Permalink
Browse files

added a try/catch around the write() call in method JsonTypeSerialize…

…r.writeMap, to show the name of the property field in the stack trace when a property fail to write
  • Loading branch information...
1 parent 970796e commit eb04276f906fc9eeae512bdc65056b5f2954de84 Shannon Zhang committed Apr 7, 2009
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/java/voldemort/serialization/json/JsonTypeSerializer.java
@@ -37,8 +37,8 @@
* A serializer that goes from a simple JSON like object definition + an object
* instance to serialized bytes and back again.
*
- * Official motto of this class:
- * "I fought the static type system, and the type system won."
+ * Official motto of this class: "I fought the static type system, and the type
+ * system won."
*
* @author jay
*
@@ -499,7 +499,11 @@ private void writeMap(DataOutputStream output,
if(!object.containsKey(entry.getKey()))
throw new SerializationException("Missing property: " + entry.getKey() + " in "
+ type);
- write(output, object.get(entry.getKey()), entry.getValue());
+ try {
+ write(output, object.get(entry.getKey()), entry.getValue());
+ } catch(SerializationException e) {
+ throw new SerializationException("Fail to write property: " + entry.getKey(), e);
+ }
}
}
}

0 comments on commit eb04276

Please sign in to comment.