Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid reflection #120

Merged
merged 1 commit into from
Jan 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion core/src/main/java/net/tomp2p/storage/Data.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.security.SignatureException;
import java.util.BitSet;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import net.tomp2p.connection.DSASignatureFactory;
Expand Down Expand Up @@ -816,7 +817,8 @@ public byte[] toBytes() {
* @return The ByteBuffers that is the payload. We do not make a copy here
*/
public ByteBuffer[] toByteBuffers() {
return buffer.bufferList().toArray(new ByteBuffer[0]);
List<ByteBuffer> byteBuffers = buffer.bufferList();
return byteBuffers.toArray(new ByteBuffer[byteBuffers.size()]);
}

public PublicKey publicKey() {
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/net/tomp2p/storage/DataBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public ByteBuf toByteBuf() {
} else {
final DataBuffer copy = shallowCopyIntern();
//wrap does a slice, so a derived buffer, not increasing ref count
return Unpooled.wrappedBuffer(copy.buffers.toArray(new ByteBuf[0]));
return Unpooled.wrappedBuffer(copy.buffers.toArray(new ByteBuf[copy.buffers.size()]));
}
}

Expand Down