diff --git a/htroot/solr/select.java b/htroot/solr/select.java index 906629967..a753c60e7 100644 --- a/htroot/solr/select.java +++ b/htroot/solr/select.java @@ -23,6 +23,7 @@ import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.Writer; import java.util.HashMap; +import java.util.LinkedHashSet; import java.util.Map; import javax.servlet.ServletException; @@ -101,10 +102,10 @@ public class select { * @return */ public static String mime(final RequestHeader header, final serverObjects post, final serverSwitch env) { - String wt = post.get(CommonParams.WT, "xml"); + String wt = post == null ? "xml" : post.get(CommonParams.WT, "xml"); if (wt == null || wt.length() == 0 || "xml".equals(wt) || "exml".equals(wt)) return "text/xml"; if ("xslt".equals(wt)) { - String tr = post.get("tr",""); + String tr = post == null ? "" : post.get("tr",""); if (tr.indexOf("json") >= 0) return "application/json"; } if ("rss".equals(wt)) return "application/rss+xml"; @@ -131,7 +132,7 @@ public class select { * @param out * @return */ - public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env, final OutputStream out) { + public static serverObjects respond(final RequestHeader header, serverObjects post, final serverSwitch env, final OutputStream out) { // this uses the methods in the jetty servlet environment and can be removed if jetty in implemented Switchboard sb = (Switchboard) env; @@ -147,7 +148,7 @@ public class select { if (!searchAllowed) return null; // check post - if (post == null) return null; + if (post == null) {post = new serverObjects(); post.put(CommonParams.Q, ""); post.put(CommonParams.ROWS, "0");} if (post.size() > 100) { Log.logWarning("select", "rejected bad-formed search request with " + post.size() + " properties from " + header.refererHost()); return null; // prevent the worst hacks here... diff --git a/source/net/yacy/peers/Protocol.java b/source/net/yacy/peers/Protocol.java index f9e40fd96..2ef361307 100644 --- a/source/net/yacy/peers/Protocol.java +++ b/source/net/yacy/peers/Protocol.java @@ -123,7 +123,6 @@ import org.apache.solr.client.solrj.response.FacetField.Count; import org.apache.solr.common.SolrDocument; import org.apache.solr.common.SolrDocumentList; import org.apache.solr.common.SolrInputDocument; -import org.apache.solr.common.params.FacetParams; public final class Protocol { diff --git a/source/net/yacy/server/serverObjects.java b/source/net/yacy/server/serverObjects.java index a148e323f..f4a0507c1 100644 --- a/source/net/yacy/server/serverObjects.java +++ b/source/net/yacy/server/serverObjects.java @@ -195,7 +195,7 @@ public class serverObjects implements Serializable, Cloneable { return; } for (int i = 0; i < a.length; i++) { - if (a[i].equals(value)) return; + if (a[i].equals(value)) return; // double-check } String[] aa = new String[a.length + 1]; System.arraycopy(a, 0, aa, 0, a.length);