Permalink
Browse files

Improve empty result

  • Loading branch information...
1 parent 88f98e8 commit 2efb9d23bbc062dbb02440b7d6631f8a03adaade Damian committed Mar 19, 2012
@@ -58,6 +58,10 @@
private final BiMap<Property, String> propertyToKey;
private final List<String> asArrays;
+ // '{"item":[]}' in bytes
+ private static final byte[] EMPTY_JSON_RESULT =
+ new byte[]{ 123, 34, 105, 116, 101, 109, 34, 58, 91, 93, 125 };
+
/**
* Create a provider (no array mapping)
*
@@ -165,7 +169,7 @@ public void writeTo(Object t, Class<?> type, Type type1, Annotation[] antns,
// Special case that I can't persuade the JSON writer to deal with
// (it writes [""])
if (resources.isEmpty() && mt.equals(MediaType.APPLICATION_JSON_TYPE)) {
- out.write('['); out.write(']');
+ out.write(EMPTY_JSON_RESULT);
return;
}

0 comments on commit 2efb9d2

Please sign in to comment.