Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix max sequence length constant to reflect the maximum value storabl…

…e in 30 bits.
  • Loading branch information...
commit 34d0c0d8a2185c0bca43e02e5c6bd9bad275bf5a 1 parent 310912e
jkreps jkreps authored
Showing with 2 additions and 3 deletions.
  1. +2 −3 src/java/voldemort/serialization/json/JsonTypeSerializer.java
5 src/java/voldemort/serialization/json/JsonTypeSerializer.java
View
@@ -45,8 +45,7 @@
*/
public class JsonTypeSerializer implements Serializer<Object> {
- // TODO: not correct, should be less than this
- private static final int MAX_SEQ_LENGTH = Integer.MAX_VALUE;
+ private static final int MAX_SEQ_LENGTH = 0x3FFFFFFF;
private final boolean hasVersion;
private final SortedMap<Integer, JsonTypeDefinition> typeDefVersions;
@@ -551,7 +550,7 @@ private void writeList(DataOutputStream output, List<Object> objects, List<Objec
private void writeLength(DataOutputStream stream, int size) throws IOException {
if(size < Short.MAX_VALUE) {
stream.writeShort(size);
- } else if(size < MAX_SEQ_LENGTH) {
+ } else if(size <= MAX_SEQ_LENGTH) {
stream.writeInt(size | 0xC0000000);
} else {
throw new SerializationException("Invalid length: maximum is " + MAX_SEQ_LENGTH);
Please sign in to comment.
Something went wrong with that request. Please try again.