Skip to content

Apache Lucene open-source search software

SOLR-6161: Walk the entire cause chain looking for an Error

Shalin Shekhar Mangar2fbc511c3810
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 {