Skip to content
Merged
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
6 changes: 3 additions & 3 deletions src/main/java/net/spy/memcached/v2/vo/BKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ private BKey(byte[] data) {
throw new IllegalArgumentException("BKey byte array cannot be null.");
}

if (data.length > 31) {
if (data.length < 1 || data.length > 31) {
throw new IllegalArgumentException(
"BKey byte array size must be between 0 and 31. Given size: " + data.length);
"BKey byte array size must be between 1 and 31. Given size: " + data.length);
}

this.type = BKeyType.BYTE_ARRAY;
Expand Down Expand Up @@ -62,7 +62,7 @@ public BKeyObject toBKeyObject() {
if (this.type == BKeyType.LONG) {
return new BKeyObject((Long) this.data);
}
return new BKeyObject((byte[]) this.data);
return new BKeyObject(Arrays.copyOf((byte[]) this.data, ((byte[]) this.data).length));
}

public static BKey of(BKeyObject bkeyObject) {
Expand Down
Loading