Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

*) Avoiding NullpointerException while testing exception test

theli0405de763503
diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.java
index 9a750fcf2..c3070e0f1 100644
--- a/source/de/anomic/http/httpdFileHandler.java
+++ b/source/de/anomic/http/httpdFileHandler.java
@@ -487,14 +487,15 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
conProp.put(httpd.CONNECTION_PROP_PERSISTENT,"close");
}
} else {
- if (e.getMessage().startsWith("Broken pipe") || e.getMessage().startsWith("Connection reset by peer")) {
+ String errorMsg = e.getMessage();
+ if ((errorMsg != null) && (errorMsg.startsWith("Broken pipe") || errorMsg.startsWith("Connection reset by peer"))) {
// client closed the connection, so we just end silently
- this.theLogger.logInfo("Client unexpectedly closed connection while processing query: " + path + "; '" + e.toString() + ":" + e.getMessage() + "'");
+ this.theLogger.logInfo("Client unexpectedly closed connection while processing query: " + path + "; '" + e.toString() + ":" + errorMsg + "'");
conProp.put(httpd.CONNECTION_PROP_PERSISTENT,"close");
} else {
- this.theLogger.logError("ERROR: Exception with query: " + path + "; '" + e.toString() + ":" + e.getMessage() + "'");
+ this.theLogger.logError("ERROR: Exception with query: " + path + "; '" + e.toString() + ":" + ((errorMsg ==null)?"":e.getMessage()) + "'");
if (!conProp.containsKey(httpd.CONNECTION_PROP_PROXY_RESPOND_HEADER)) {
- httpd.sendRespondError(conProp,out, 4, 503, null, "Exception with query: " + path + "; '" + e.toString() + ":" + e.getMessage() + "'",e);
+ httpd.sendRespondError(conProp,out, 4, 503, null, "Exception with query: " + path + "; '" + e.toString() + ":" + ((errorMsg ==null)?"":e.getMessage()) + "'",e);
} else {
conProp.put(httpd.CONNECTION_PROP_PERSISTENT,"close");
}