From 2d7427dd0787a7947b955a1816604667057ad32e Mon Sep 17 00:00:00 2001 From: Joel Bernstein Date: Fri, 22 Aug 2014 12:40:39 +0000 Subject: [PATCH] SOLR-5244: Exporting Full Sorted Result Sets git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1619783 13f79535-47bb-0310-9956-ffa450edef68 --- .../solr/response/SortingResponseWriter.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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,