Skip to content

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

fixed NPE problems doing a shutdown from command-line

orbiterf97971b63b51
diff --git a/source/de/anomic/http/HttpFactory.java b/source/de/anomic/http/HttpFactory.java
index 69e6935c9..05ebdeb44 100644
--- a/source/de/anomic/http/HttpFactory.java
+++ b/source/de/anomic/http/HttpFactory.java
@@ -55,9 +55,7 @@ public class HttpFactory {
* @return
*/
public static HttpClient newClient(httpHeader header, int timeout) {
- HttpClient client = new JakartaCommonsHttpClient();
- client.setTimeout(timeout);
- client.setHeader(header);
+ HttpClient client = new JakartaCommonsHttpClient(timeout, header, null);
return client;
}
diff --git a/source/de/anomic/http/JakartaCommonsHttpClient.java b/source/de/anomic/http/JakartaCommonsHttpClient.java
index 7ac6a7c4f..284abb827 100644
--- a/source/de/anomic/http/JakartaCommonsHttpClient.java
+++ b/source/de/anomic/http/JakartaCommonsHttpClient.java
@@ -51,7 +51,6 @@ import org.apache.commons.httpclient.methods.multipart.FilePart;
import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
import org.apache.commons.httpclient.methods.multipart.Part;
import org.apache.commons.httpclient.methods.multipart.StringPart;
-import org.apache.commons.httpclient.params.HttpClientParams;
import org.apache.commons.httpclient.params.HttpMethodParams;
import org.apache.commons.httpclient.protocol.Protocol;
import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
@@ -78,8 +77,9 @@ public class JakartaCommonsHttpClient extends de.anomic.http.HttpClient {
static {
// set user-agent
+ yacyVersion thisversion = yacyVersion.thisVersion();
apacheHttpClient.getParams().setParameter(HttpMethodParams.USER_AGENT,
- "yacy/" + yacyVersion.thisVersion().releaseNr +
+ "yacy/" + ((thisversion == null) ? "0.0" : thisversion.releaseNr) +
" (www.yacy.net; " +
de.anomic.http.HttpClient.getSystemOST() + ") " +
getCurrentUserAgent().replace(';', ':')); // last ; must be before location (this is parsed)
diff --git a/source/de/anomic/http/httpdProxyHandler.java b/source/de/anomic/http/httpdProxyHandler.java
index 4290e7e42..8067ce274 100644
--- a/source/de/anomic/http/httpdProxyHandler.java
+++ b/source/de/anomic/http/httpdProxyHandler.java
@@ -188,7 +188,7 @@ public final class httpdProxyHandler {
}
switchboard = plasmaSwitchboard.getSwitchboard();
-
+ if (switchboard != null) {
// creating a logger
theLogger = new serverLog("PROXY");
@@ -226,6 +226,7 @@ public final class httpdProxyHandler {
System.out.println("redirector not Found");
}
}
+ }
}
/**
diff --git a/source/de/anomic/server/serverCore.java b/source/de/anomic/server/serverCore.java
index 29816b4be..4ecee876b 100644
--- a/source/de/anomic/server/serverCore.java
+++ b/source/de/anomic/server/serverCore.java
@@ -481,7 +481,6 @@ public final class serverCore extends serverAbstractBusyThread implements server
// shut down all busySessions
for (Session session: this.busySessions) {
- try {session.notifyAll();} catch (IllegalMonitorStateException e) {e.printStackTrace();}
try {session.interrupt();} catch (SecurityException e ) {e.printStackTrace();}
}
diff --git a/source/de/anomic/yacy/yacyVersion.java b/source/de/anomic/yacy/yacyVersion.java
index 0b0a0e178..f834bd3ac 100644
--- a/source/de/anomic/yacy/yacyVersion.java
+++ b/source/de/anomic/yacy/yacyVersion.java
@@ -171,6 +171,7 @@ public final class yacyVersion implements Comparator<yacyVersion>, Comparable<ya
// construct a virtual release name for this release
if (thisVersion == null) {
plasmaSwitchboard sb = plasmaSwitchboard.getSwitchboard();
+ if (sb == null) return null;
boolean full = new File(sb.getRootPath(), "libx").exists();
thisVersion = new yacyVersion(
"yacy" + ((full) ? "" : "_emb") +
@@ -328,7 +329,7 @@ public final class yacyVersion implements Comparator<yacyVersion>, Comparable<ya
File storagePath = plasmaSwitchboard.getSwitchboard().releasePath;
// load file
File download = new File(storagePath, release.url.getFileName());
- HttpClient client = HttpFactory.newClient(null, 300000);
+ HttpClient client = HttpFactory.newClient(null, 120000);
HttpResponse res = null;
try {
res = client.GET(release.url.toString());