Skip to content

Commit

Permalink
Fix AnnotatedCompositeSerializer BufferOverflowException
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-eyeviewdigital committed Mar 4, 2013
1 parent ef5975b commit dda568b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ public ByteBuffer toByteBuffer(T obj) {
}

if (cb.limit() + 3 > bb.remaining()) {
ByteBuffer temp = ByteBuffer.allocate(bb.limit() * 2);
int exponent = (int) Math.ceil(Math.log((double) (cb.limit() + 3) / (double) bb.limit()));
int newBufferSize = bb.limit() * (int) Math.pow(2, exponent);
ByteBuffer temp = ByteBuffer.allocate(newBufferSize);
bb.flip();
temp.put(bb);
bb = temp;
Expand Down

0 comments on commit dda568b

Please sign in to comment.