diff --git a/htroot/yacy/hello.java b/htroot/yacy/hello.java index 254e8255e..4649a68fa 100644 --- a/htroot/yacy/hello.java +++ b/htroot/yacy/hello.java @@ -62,18 +62,18 @@ import de.anomic.yacy.yacyVersion; public final class hello { public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) { - if (post == null || ss == null || yacyCore.seedDB == null || yacyCore.seedDB.mySeed == null) { return new serverObjects(); } + if (post == null || ss == null || yacyCore.seedDB == null || yacyCore.seedDB.mySeed == null) { return null; } // return variable that accumulates replacements final serverObjects prop = new serverObjects(); - if (prop == null) { return new serverObjects(); } + if (prop == null) { return null; } // final String iam = (String) post.get("iam", ""); // complete seed of the requesting peer // final String pattern = (String) post.get("pattern", ""); // -// final String mytime = (String) post.get(STR_MYTIME, ""); // - final String key = (String) post.get("key", ""); // transmission key for response - final String seed = (String) post.get(yacySeed.STR_SEED, ""); // - final String countStr = (String) post.get("count", "0"); // +// final String mytime = (String) post.get(STR_MYTIME, ""); // + final String key = (String) post.get("key", ""); // transmission key for response + final String seed = (String) post.get(yacySeed.STR_SEED, ""); + final String countStr = (String) post.get("count", "0"); int i; int count = 0; try {count = (countStr == null) ? 0 : Integer.parseInt(countStr);} catch (NumberFormatException e) {count = 0;} @@ -81,7 +81,7 @@ public final class hello { final yacySeed remoteSeed = yacySeed.genRemoteSeed(seed, key); // System.out.println("YACYHELLO: REMOTESEED=" + ((remoteSeed == null) ? "NULL" : remoteSeed.toString())); - if (remoteSeed == null) { return new serverObjects(); } + if (remoteSeed == null) { return null; } // we easily know the caller's IP: final String clientip = (String) header.get("CLIENTIP", ""); // read an artificial header addendum diff --git a/htroot/yacy/list.java b/htroot/yacy/list.java index 18c0f337c..85bd7c14c 100644 --- a/htroot/yacy/list.java +++ b/htroot/yacy/list.java @@ -57,18 +57,21 @@ import de.anomic.server.serverSwitch; public final class list { - public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) { + public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) { + if (post == null || ss == null ) { return null; } + // return variable that accumulates replacements final serverObjects prop = new serverObjects(); + if (prop == null) { return null; } + final String col = (String) post.get("col", ""); - - final File listsPath = new File(env.getRootPath(),env.getConfig("listsPath", "DATA/LISTS")); + final File listsPath = new File(ss.getRootPath(),ss.getConfig("listsPath", "DATA/LISTS")); if (col.equals("black")) { String filename = ""; final StringBuffer out = new StringBuffer(); - final String filenames=env.getConfig("proxyBlackListsShared", ""); + final String filenames=ss.getConfig("proxyBlackListsShared", ""); final String[] filenamesarray = filenames.split(","); if(filenamesarray.length >0){ @@ -76,7 +79,7 @@ public final class list { filename = filenamesarray[i]; out.append(listManager.getListString(new File(listsPath,filename).toString(), false)).append(serverCore.crlfString); } - } // if filenamesarray.length >0 + } // if filenamesarray.length > 0 prop.put("list",out); } else { diff --git a/htroot/yacy/message.java b/htroot/yacy/message.java index 5f991e387..7fb502cd8 100644 --- a/htroot/yacy/message.java +++ b/htroot/yacy/message.java @@ -69,12 +69,12 @@ public final class message { } public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) { - if (post == null || ss == null) { return new serverObjects(); } + if (post == null || ss == null) { return null; } // return variable that accumulates replacements plasmaSwitchboard sb = (plasmaSwitchboard) ss; serverObjects prop = new serverObjects(); - if (prop == null || sb == null) { return new serverObjects(); } + if (prop == null || sb == null) { return null; } // System.out.println("yacy/message:post=" + post.toString()); diff --git a/htroot/yacy/profile.java b/htroot/yacy/profile.java index 356514848..0df4bb764 100644 --- a/htroot/yacy/profile.java +++ b/htroot/yacy/profile.java @@ -64,7 +64,7 @@ public final class profile { public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) { // return variable that accumulates replacements serverObjects prop = new serverObjects(); - if (prop == null) { return new serverObjects(); } + if (prop == null) { return null; } Properties profile = new Properties(); int count=0; diff --git a/htroot/yacy/query.java b/htroot/yacy/query.java index 5a0925946..074e13385 100644 --- a/htroot/yacy/query.java +++ b/htroot/yacy/query.java @@ -57,12 +57,12 @@ import de.anomic.yacy.yacyCore; public final class query { public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) { - if (post == null || ss == null) { return new serverObjects(); } + if (post == null || ss == null) { return null; } // return variable that accumulates replacements - final serverObjects prop = new serverObjects(); final plasmaSwitchboard sb = (plasmaSwitchboard) ss; - if (prop == null || sb == null) { return new serverObjects(); } + final serverObjects prop = new serverObjects(); + if (prop == null || sb == null) { return null; } // System.out.println("YACYQUERY: RECEIVED POST = " + ((post == null) ? "NULL" : post.toString())); diff --git a/htroot/yacy/search.java b/htroot/yacy/search.java index 105f50f1f..dd0ad6763 100644 --- a/htroot/yacy/search.java +++ b/htroot/yacy/search.java @@ -59,12 +59,12 @@ import de.anomic.yacy.yacySeed; public final class search { public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) { - if (post == null || ss == null) { return new serverObjects(); } + if (post == null || ss == null) { return null; } // return variable that accumulates replacements final plasmaSwitchboard sb = (plasmaSwitchboard) ss; serverObjects prop = new serverObjects(); - if (prop == null || sb == null) { return new serverObjects(); } + if (prop == null || sb == null) { return null; } //System.out.println("yacy: search received request = " + post.toString()); @@ -75,9 +75,9 @@ public final class search { // final String fwdep = (String) post.get("fwdep", ""); // forward depth. if "0" then peer may NOT ask another peer for more results // final String fwden = (String) post.get("fwden", ""); // forward deny, a list of seed hashes. They may NOT be target of forward hopping final long duetime= Long.parseLong((String) post.get("duetime", "3000")); - final int count = Integer.parseInt((String) post.get("count", "10")); // maximum number of wanted results + final int count = Integer.parseInt((String) post.get("count", "10")); // maximum number of wanted results final boolean global = ((String) post.get("resource", "global")).equals("global"); // if true, then result may consist of answers from other peers -// Date remoteTime = yacyCore.parseUniversalDate((String) post.get("mytime")); // read remote time +// Date remoteTime = yacyCore.parseUniversalDate((String) post.get("mytime")); // read remote time if (yacyCore.seedDB == null) { yacyCore.log.logSevere("yacy.search: seed cache not initialized"); } else { @@ -95,7 +95,7 @@ public final class search { final int links = Integer.parseInt(prop.get("linkcount","0")); yacyCore.seedDB.mySeed.incSI(links); yacyCore.seedDB.mySeed.incSU(links); - return prop; + return prop; } } \ No newline at end of file diff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.java index 9898dfe2b..a9f5e2350 100644 --- a/htroot/yacy/transferRWI.java +++ b/htroot/yacy/transferRWI.java @@ -62,16 +62,16 @@ import de.anomic.yacy.yacyDHTAction; public final class transferRWI { public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) { - if (post == null || ss == null) { return new serverObjects(); } + if (post == null || ss == null) { return null; } long start = System.currentTimeMillis(); - - // return variable that accumulates replacements - final serverObjects prop = new serverObjects(); + + // return variable that accumulates replacements final plasmaSwitchboard sb = (plasmaSwitchboard) ss; - if (prop == null || sb == null) { return new serverObjects(); } - - // request values + final serverObjects prop = new serverObjects(); + if (prop == null || sb == null) { return null; } + + // request values final String iam = (String) post.get("iam", ""); // seed hash of requester // final String youare = (String) post.get("youare", ""); // seed hash of the target peer, needed for network stability // final String key = (String) post.get("key", ""); // transmission key @@ -79,11 +79,11 @@ public final class transferRWI { final int entryc = Integer.parseInt((String) post.get("entryc", "")); // number of entries in indexes final byte[] indexes = ((String) post.get("indexes", "")).getBytes(); // the indexes, as list of word entries final boolean granted = sb.getConfig("allowReceiveIndex", "false").equals("true"); - + // response values String result = ""; StringBuffer unknownURLs = new StringBuffer(); - + final yacySeed otherPeer = yacyCore.seedDB.get(iam); final String otherPeerName = iam + ":" + ((otherPeer == null) ? "NULL" : (otherPeer.getName() + "/" + otherPeer.getVersion())); @@ -91,7 +91,7 @@ public final class transferRWI { // log value status (currently added to find outOfMemory error sb.getLog().logFine("Processing " + indexes.length + " bytes / " + wordc + " words / " + entryc + " entries from " + otherPeerName); final long startProcess = System.currentTimeMillis(); - + // decode request ArrayList v = new ArrayList(); int s = 0; @@ -103,7 +103,7 @@ public final class transferRWI { } // the value-vector should now have the same length as entryc if (v.size() != entryc) sb.getLog().logSevere("ERROR WITH ENTRY COUNTER: v=" + v.size() + ", entryc=" + entryc); - + // now parse the Strings in the value-vector and write index entries String estring; int p; @@ -130,7 +130,7 @@ public final class transferRWI { } } yacyCore.seedDB.mySeed.incRI(received); - + // finally compose the unknownURL hash list final Iterator it = unknownURL.iterator(); while (it.hasNext()) { @@ -148,12 +148,12 @@ public final class transferRWI { sb.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". Not granted."); result = "error_not_granted"; } - + prop.put("unknownURL", unknownURLs.toString()); prop.put("result", result); - - // return rewrite properties - return prop; + + // return rewrite properties + return prop; } -} +} \ No newline at end of file diff --git a/htroot/yacy/transferURL.java b/htroot/yacy/transferURL.java index 59726ea35..c344e99cc 100644 --- a/htroot/yacy/transferURL.java +++ b/htroot/yacy/transferURL.java @@ -56,13 +56,14 @@ import de.anomic.yacy.yacySeed; public final class transferURL { public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch ss) { - if (post == null || ss == null) { return new serverObjects(); } + if (post == null || ss == null) { return null; } + long start = System.currentTimeMillis(); // return variable that accumulates replacements final plasmaSwitchboard sb = (plasmaSwitchboard) ss; final serverObjects prop = new serverObjects(); - if (prop == null || sb == null) { return new serverObjects(); } + if (prop == null || sb == null) { return null; } // request values final String iam = (String) post.get("iam", ""); // seed hash of requester