Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

handle reason nullpointer exception

  • Loading branch information...
commit 1359011e41fbc05c026d0ce1af6aa9414b6e51a1 1 parent 6f18208
@hofmeister authored
View
11 src/main/java/com/github/rnewson/couchdb/lucene/JSONErrorHandler.java
@@ -41,12 +41,17 @@ public void handle(String target, HttpServletRequest request, HttpServletRespons
connection.getRequest().setHandled(true);
final String reason = connection.getResponse().getReason();
try {
- if (reason.startsWith("{")) {
+ if (reason != null && reason.startsWith("{")) {
ServletUtils.sendJsonError(request, response, connection.getResponse().getStatus(),
new JSONObject(reason));
} else {
- ServletUtils.sendJsonError(request, response, connection.getResponse().getStatus(),
- reason);
+ if (reason != null)
+ ServletUtils.sendJsonError(request, response, connection.getResponse().getStatus(),
+ reason);
+ else
+ ServletUtils.sendJsonError(request, response, connection.getResponse().getStatus(),
+ "Unknown");
+
}
} catch (final JSONException e) {
response.sendError(500);
Please sign in to comment.
Something went wrong with that request. Please try again.