Gonzalo Herreros created FLUME-2719:
---------------------------------------
Summary: NullPointerException not handled in JSONHandler
Key: FLUME-2719
URL: https://issues.apache.org/jira/browse/FLUME-2719
Project: Flume
Issue Type: Bug
Components: Sinks+Sources
Affects Versions: v1.5.1
Reporter: Gonzalo Herreros
Priority: Minor
When using an http source with JSONHandler, invalid json is handled correctly
and a 400 error is returned.
However an empty body provokes and unhandled NPE in JSONHandler which returns a
500.
If should either ignore the request or complain the request is invalid.
try {
eventList = gson.fromJson(reader, listType);
} catch (JsonSyntaxException ex) {
throw new HTTPBadRequestException("Request has invalid JSON Syntax.", ex);
}
for (Event e : eventList) {
((JSONEvent) e).setCharset(charset);
}
The GSON API describes that fromJson returns null when the imput is EOF (which
is arguable but documented).
Flume should check for eventList being null before trying to loop
Always reproduced in all version
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)