Skip to content

Commit

Permalink
fixed NPE problems doing a shutdown from command-line
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4671 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Apr 9, 2008
1 parent 7a35126 commit f97971b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
4 changes: 1 addition & 3 deletions source/de/anomic/http/HttpFactory.java
Expand Up @@ -55,9 +55,7 @@ public static HttpClient newClient() {
* @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;
}

Expand Down
4 changes: 2 additions & 2 deletions source/de/anomic/http/JakartaCommonsHttpClient.java
Expand Up @@ -51,7 +51,6 @@
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;
Expand All @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion source/de/anomic/http/httpdProxyHandler.java
Expand Up @@ -188,7 +188,7 @@ public final class httpdProxyHandler {
}

switchboard = plasmaSwitchboard.getSwitchboard();

if (switchboard != null) {
// creating a logger
theLogger = new serverLog("PROXY");

Expand Down Expand Up @@ -226,6 +226,7 @@ public final class httpdProxyHandler {
System.out.println("redirector not Found");
}
}
}
}

/**
Expand Down
1 change: 0 additions & 1 deletion source/de/anomic/server/serverCore.java
Expand Up @@ -481,7 +481,6 @@ public synchronized void close() {

// 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();}
}

Expand Down
3 changes: 2 additions & 1 deletion source/de/anomic/yacy/yacyVersion.java
Expand Up @@ -171,6 +171,7 @@ public static final yacyVersion thisVersion() {
// 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") +
Expand Down Expand Up @@ -328,7 +329,7 @@ public static boolean downloadRelease(yacyVersion release) {
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());
Expand Down

0 comments on commit f97971b

Please sign in to comment.