diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index b97d5aa526b..a9805a96fd7 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -48,6 +48,10 @@ Optimizations faster IndexWriter.deleteAll in that case (Robert Muir, Adrien Grand, Mike McCandless) +Bug Fixes + +* LUCENE-6378: Fix all RuntimeExceptions to throw the underlying root cause. + (Varun Thacker, Adrien Grand, Mike McCandless) ======================= Lucene 5.1.0 ======================= New Features diff --git a/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java b/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java index 1057e4ffff0..28ce0d7eb58 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java @@ -172,7 +172,7 @@ public class TestFieldsReader extends LuceneTestCase { try { i.seek(getFilePointer()); } catch (IOException e) { - throw new RuntimeException(); + throw new RuntimeException(e); } return i; } diff --git a/lucene/facet/src/java/org/apache/lucene/facet/RandomSamplingFacetsCollector.java b/lucene/facet/src/java/org/apache/lucene/facet/RandomSamplingFacetsCollector.java index a7e3519087e..dcc366a43c3 100644 --- a/lucene/facet/src/java/org/apache/lucene/facet/RandomSamplingFacetsCollector.java +++ b/lucene/facet/src/java/org/apache/lucene/facet/RandomSamplingFacetsCollector.java @@ -215,7 +215,7 @@ public class RandomSamplingFacetsCollector extends FacetsCollector { return new MatchingDocs(docs.context, new BitDocIdSet(sampleDocs), docs.totalHits, null); } catch (IOException e) { - throw new RuntimeException(); + throw new RuntimeException(e); } } diff --git a/lucene/misc/src/java/org/apache/lucene/uninverting/DocTermOrds.java b/lucene/misc/src/java/org/apache/lucene/uninverting/DocTermOrds.java index d29260cf1b0..afd5a85be33 100644 --- a/lucene/misc/src/java/org/apache/lucene/uninverting/DocTermOrds.java +++ b/lucene/misc/src/java/org/apache/lucene/uninverting/DocTermOrds.java @@ -895,7 +895,7 @@ public class DocTermOrds implements Accountable { try { return getOrdTermsEnum(reader); } catch (IOException e) { - throw new RuntimeException(); + throw new RuntimeException(e); } } } diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/DocumentValueSourceDictionary.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/DocumentValueSourceDictionary.java index 9eedbc6562c..fbdfaa869b4 100644 --- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/DocumentValueSourceDictionary.java +++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/DocumentValueSourceDictionary.java @@ -145,7 +145,7 @@ public class DocumentValueSourceDictionary extends DocumentDictionary { try { currentWeightValues = weightsValueSource.getValues(new HashMap(), leaves.get(currentLeafIndex)); } catch (IOException e) { - throw new RuntimeException(); + throw new RuntimeException(e); } } return currentWeightValues.longVal(docId - starts[subIndex]); diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/FileDictionary.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/FileDictionary.java index 3ee0efe0ee1..0b7cfeccc76 100644 --- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/FileDictionary.java +++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/FileDictionary.java @@ -113,7 +113,7 @@ public class FileDictionary implements Dictionary { try { return new FileIterator(); } catch (IOException e) { - throw new RuntimeException(); + throw new RuntimeException(e); } } diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java index ca0a0a2a944..5353ff2f466 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java +++ b/lucene/test-framework/src/java/org/apache/lucene/index/BaseDocValuesFormatTestCase.java @@ -2681,7 +2681,7 @@ public abstract class BaseDocValuesFormatTestCase extends BaseIndexFileFormatTes } } } catch (Throwable e) { - throw new RuntimeException(); + throw new RuntimeException(e); } } }; diff --git a/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/RegexRulesPasswordProvider.java b/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/RegexRulesPasswordProvider.java index 8e30d1a880e..e67efadbf49 100644 --- a/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/RegexRulesPasswordProvider.java +++ b/solr/contrib/extraction/src/java/org/apache/solr/handler/extraction/RegexRulesPasswordProvider.java @@ -103,7 +103,7 @@ public class RegexRulesPasswordProvider implements PasswordProvider { } is.close(); } catch (IOException e) { - throw new RuntimeException(); + throw new RuntimeException(e); } return rules; } diff --git a/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java b/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java index 75d550ed97c..2f0c372ff28 100644 --- a/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java +++ b/solr/core/src/java/org/apache/solr/search/ExtendedDismaxQParser.java @@ -1494,7 +1494,7 @@ public class ExtendedDismaxQParser extends QParser { try { queryFields = DisMaxQParser.parseQueryFields(req.getSchema(), solrParams); // req.getSearcher() here causes searcher refcount imbalance } catch (SyntaxError e) { - throw new RuntimeException(); + throw new RuntimeException(e); } // Phrase slop array int pslop[] = new int[4]; diff --git a/solr/core/src/java/org/apache/solr/spelling/suggest/DocumentExpressionDictionaryFactory.java b/solr/core/src/java/org/apache/solr/spelling/suggest/DocumentExpressionDictionaryFactory.java index d5f9cedcd08..5782ab850ce 100644 --- a/solr/core/src/java/org/apache/solr/spelling/suggest/DocumentExpressionDictionaryFactory.java +++ b/solr/core/src/java/org/apache/solr/spelling/suggest/DocumentExpressionDictionaryFactory.java @@ -99,7 +99,7 @@ public class DocumentExpressionDictionaryFactory extends DictionaryFactory { try { expression = JavascriptCompiler.compile(weightExpression); } catch (ParseException e) { - throw new RuntimeException(); + throw new RuntimeException(e); } SimpleBindings bindings = new SimpleBindings(); for (SortField sortField : sortFields) { diff --git a/solr/core/src/java/org/apache/solr/spelling/suggest/FileDictionaryFactory.java b/solr/core/src/java/org/apache/solr/spelling/suggest/FileDictionaryFactory.java index 07ecb4334c2..14333475f07 100644 --- a/solr/core/src/java/org/apache/solr/spelling/suggest/FileDictionaryFactory.java +++ b/solr/core/src/java/org/apache/solr/spelling/suggest/FileDictionaryFactory.java @@ -55,7 +55,7 @@ public class FileDictionaryFactory extends DictionaryFactory { return new FileDictionary(new InputStreamReader( core.getResourceLoader().openResource(sourceLocation), StandardCharsets.UTF_8), fieldDelimiter); } catch (IOException e) { - throw new RuntimeException(); + throw new RuntimeException(e); } } diff --git a/solr/core/src/java/org/apache/solr/spelling/suggest/fst/AnalyzingInfixLookupFactory.java b/solr/core/src/java/org/apache/solr/spelling/suggest/fst/AnalyzingInfixLookupFactory.java index c37219b79d3..49edb6068fd 100644 --- a/solr/core/src/java/org/apache/solr/spelling/suggest/fst/AnalyzingInfixLookupFactory.java +++ b/solr/core/src/java/org/apache/solr/spelling/suggest/fst/AnalyzingInfixLookupFactory.java @@ -135,7 +135,7 @@ public class AnalyzingInfixLookupFactory extends LookupFactory { } }; } catch (IOException e) { - throw new RuntimeException(); + throw new RuntimeException(e); } } diff --git a/solr/core/src/java/org/apache/solr/util/SimplePostTool.java b/solr/core/src/java/org/apache/solr/util/SimplePostTool.java index 84ce8b2c543..73c5e7ea04c 100644 --- a/solr/core/src/java/org/apache/solr/util/SimplePostTool.java +++ b/solr/core/src/java/org/apache/solr/util/SimplePostTool.java @@ -518,7 +518,7 @@ public class SimplePostTool { Thread.sleep(delay * 1000); filesPosted++; } catch (InterruptedException e) { - throw new RuntimeException(); + throw new RuntimeException(e); } } return filesPosted; @@ -610,7 +610,7 @@ public class SimplePostTool { } catch (IOException e) { warn("Caught exception when trying to open connection to "+u+": "+e.getMessage()); } catch (InterruptedException e) { - throw new RuntimeException(); + throw new RuntimeException(e); } } if(!subStack.isEmpty()) { @@ -1209,7 +1209,7 @@ public class SimplePostTool { } catch (IOException e) { warn("IOException opening URL "+url+": "+e.getMessage()); } catch (Exception e) { - throw new RuntimeException(); + throw new RuntimeException(e); } return l; }