mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
prevent NPE on jboss
This commit is contained in:
@@ -68,14 +68,7 @@ public class JSONMessageBodyReaderWriter implements MessageBodyWriter<Object>,
|
|||||||
httpHeaders.putSingle(HttpHeaders.CONTENT_TYPE, mediaType.toString()
|
httpHeaders.putSingle(HttpHeaders.CONTENT_TYPE, mediaType.toString()
|
||||||
+ ";charset=UTF-8");
|
+ ";charset=UTF-8");
|
||||||
OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8);
|
OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8);
|
||||||
|
getGson().toJson(t, type, writer);
|
||||||
Type jsonType;
|
|
||||||
if (type.equals(genericType)) {
|
|
||||||
jsonType = type;
|
|
||||||
} else {
|
|
||||||
jsonType = genericType;
|
|
||||||
}
|
|
||||||
getGson().toJson(t, jsonType, writer);
|
|
||||||
writer.flush();
|
writer.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,13 +79,7 @@ public class JSONMessageBodyReaderWriter implements MessageBodyWriter<Object>,
|
|||||||
throws IOException, WebApplicationException {
|
throws IOException, WebApplicationException {
|
||||||
InputStreamReader reader = new InputStreamReader(
|
InputStreamReader reader = new InputStreamReader(
|
||||||
new BufferedInputStream(entityStream), UTF_8);
|
new BufferedInputStream(entityStream), UTF_8);
|
||||||
Type jsonType;
|
return getGson().fromJson(reader, type);
|
||||||
if (type.equals(genericType)) {
|
|
||||||
jsonType = type;
|
|
||||||
} else {
|
|
||||||
jsonType = genericType;
|
|
||||||
}
|
|
||||||
return getGson().fromJson(reader, jsonType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Gson getGson() {
|
private Gson getGson() {
|
||||||
|
|||||||
Reference in New Issue
Block a user