diff --git a/solr/core/src/java/org/apache/solr/response/SortingResponseWriter.java b/solr/core/src/java/org/apache/solr/response/SortingResponseWriter.java index ec53da500ac..99bf252576c 100644 --- a/solr/core/src/java/org/apache/solr/response/SortingResponseWriter.java +++ b/solr/core/src/java/org/apache/solr/response/SortingResponseWriter.java @@ -72,7 +72,9 @@ public class SortingResponseWriter implements QueryResponseWriter { public void write(Writer writer, SolrQueryRequest req, SolrQueryResponse res) throws IOException { Exception e1 = res.getException(); if(e1 != null) { - e1.printStackTrace(new PrintWriter(writer)); + if(!(e1 instanceof IgnoreException)) { + e1.printStackTrace(new PrintWriter(writer)); + } return; } SolrRequestInfo info = SolrRequestInfo.getRequestInfo(); @@ -175,8 +177,7 @@ public class SortingResponseWriter implements QueryResponseWriter { while(ex != null) { String m = ex.getMessage(); if(m != null && m.contains("Broken pipe")) { - logger.info("Early client disconnect during export"); - return; + throw new IgnoreException(); } ex = ex.getCause(); } @@ -194,7 +195,16 @@ public class SortingResponseWriter implements QueryResponseWriter { writer.flush(); } + public static class IgnoreException extends IOException { + public void printStackTrace(PrintWriter pw) { + pw.print("Early Client Disconnect"); + } + + public String getMessage() { + return "Early Client Disconnect"; + } + } protected void writeDoc(SortDoc sortDoc,