From 2fbc511c3810afc228647741693d2d0b954719b8 Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Thu, 19 Jun 2014 04:32:50 +0000 Subject: [PATCH] SOLR-6161: Walk the entire cause chain looking for an Error git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1603708 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/solr/servlet/SolrDispatchFilter.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java index 0969bb4fc31..13c890387e6 100644 --- a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java +++ b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java @@ -434,12 +434,16 @@ public class SolrDispatchFilter extends BaseSolrFilter { } catch (Throwable ex) { sendError( core, solrReq, request, (HttpServletResponse)response, ex ); - if (ex instanceof Error) { - throw (Error) ex; - } - if (ex.getCause() != null && ex.getCause() instanceof Error) { - log.error("An Error was wrapped in another exception - please report complete stacktrace on SOLR-6161", ex); - throw (Error) ex.getCause(); + // walk the the entire cause chain to search for an Error + Throwable t = ex; + while (t != null) { + if (t instanceof Error) { + if (t != ex) { + log.error("An Error was wrapped in another exception - please report complete stacktrace on SOLR-6161", ex); + } + throw (Error) t; + } + t = t.getCause(); } return; } finally {