mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
fixed NPE problems doing a shutdown from command-line
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4671 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
7a35126e91
commit
f97971b63b
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -188,7 +188,7 @@ public final class httpdProxyHandler {
|
|||
}
|
||||
|
||||
switchboard = plasmaSwitchboard.getSwitchboard();
|
||||
|
||||
if (switchboard != null) {
|
||||
// creating a logger
|
||||
theLogger = new serverLog("PROXY");
|
||||
|
||||
|
@ -227,6 +227,7 @@ public final class httpdProxyHandler {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Special logger instance for proxy access logging much similar
|
||||
|
|
|
@ -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();}
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue
Block a user