Permalink
Browse files

Fix serialization bug with writing boolean values--missing break in c…

…ase statement.
  • Loading branch information...
1 parent f177152 commit 46a5b4d7e916e3fe0a9a77659599d74709f18c2d @jkreps jkreps committed Jan 6, 2009
Showing with 5 additions and 4 deletions.
  1. +1 −1 .classpath
  2. +4 −3 src/java/voldemort/serialization/json/JsonTypeSerializer.java
View
@@ -7,7 +7,6 @@
<classpathentry kind="src" path="example/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/catalina-ant.jar"/>
- <classpathentry kind="lib" path="lib/colt.jar"/>
<classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
<classpathentry kind="lib" path="lib/commons-collections-3.1.jar"/>
<classpathentry kind="lib" path="lib/commons-dbcp-1.2.2.jar"/>
@@ -29,5 +28,6 @@
<classpathentry kind="lib" path="lib/slf4j-log4j12-1.4.3.jar"/>
<classpathentry kind="lib" path="lib/velocity-1.5.jar"/>
<classpathentry kind="lib" path="lib/xerces.jar"/>
+ <classpathentry kind="lib" path="lib/colt-1.2.0.jar"/>
<classpathentry kind="output" path="classes"/>
</classpath>
@@ -131,6 +131,7 @@ private void write(DataOutputStream output, Object object, Object type) throws I
break;
case BOOLEAN:
writeBoolean(output, (Boolean) object);
+ break;
default:
throw new SerializationException("Unknown type: " + type);
}
@@ -478,7 +479,7 @@ private void writeMap(DataOutputStream output,
if(object.size() != type.size())
throw new SerializationException("Invalid map for serialization, expected: " + type
+ " but got " + object);
- for(Map.Entry<String, Object> entry : type.entrySet()) {
+ for(Map.Entry<String, Object> entry: type.entrySet()) {
if(!object.containsKey(entry.getKey()))
throw new SerializationException("Missing property: " + entry.getKey() + " in "
+ type);
@@ -491,7 +492,7 @@ private void writeMap(DataOutputStream output,
if(stream.readByte() == -1)
return null;
Map<String, Object> m = new HashMap<String, Object>(type.size());
- for(String property : type.keySet())
+ for(String property: type.keySet())
m.put(property, read(stream, type.get(property)));
return m;
}
@@ -506,7 +507,7 @@ private void writeList(DataOutputStream output, List<Object> objects, List<Objec
output.writeShort(-1);
} else if(objects.size() < Short.MAX_VALUE) {
output.writeShort(objects.size());
- for(Object o : objects)
+ for(Object o: objects)
write(output, o, entryType);
} else {
throw new SerializationException("List has length " + objects.size()

0 comments on commit 46a5b4d

Please sign in to comment.