diff --git a/src/java/org/apache/lucene/index/FieldsReader.java b/src/java/org/apache/lucene/index/FieldsReader.java index c3efe455bb7..ecb9f2986a2 100644 --- a/src/java/org/apache/lucene/index/FieldsReader.java +++ b/src/java/org/apache/lucene/index/FieldsReader.java @@ -159,7 +159,9 @@ final class FieldsReader { } catch (DataFormatException e) { // this will happen if the field is not compressed - throw new IOException ("field data are in wrong format: " + e.toString()); + IOException newException = new IOException("field data are in wrong format: " + e.toString()); + newException.initCause(e); + throw newException; } } diff --git a/src/java/org/apache/lucene/index/SegmentMerger.java b/src/java/org/apache/lucene/index/SegmentMerger.java index 534b857d699..d4fd203db69 100644 --- a/src/java/org/apache/lucene/index/SegmentMerger.java +++ b/src/java/org/apache/lucene/index/SegmentMerger.java @@ -332,7 +332,8 @@ final class SegmentMerger { doc += base; // convert to merged space if (doc < lastDoc) - throw new IllegalStateException("docs out of order"); + throw new IllegalStateException("docs out of order (" + doc + + " < " + lastDoc + " )"); df++; diff --git a/src/java/org/apache/lucene/index/SegmentReader.java b/src/java/org/apache/lucene/index/SegmentReader.java index 4ed421a03c3..520e4a6bab3 100644 --- a/src/java/org/apache/lucene/index/SegmentReader.java +++ b/src/java/org/apache/lucene/index/SegmentReader.java @@ -94,12 +94,12 @@ class SegmentReader extends IndexReader { SegmentReader.class.getName()); IMPL = Class.forName(name); } catch (ClassNotFoundException e) { - throw new RuntimeException("cannot load SegmentReader class: " + e); + throw new RuntimeException("cannot load SegmentReader class: " + e, e); } catch (SecurityException se) { try { IMPL = Class.forName(SegmentReader.class.getName()); } catch (ClassNotFoundException e) { - throw new RuntimeException("cannot load default SegmentReader class: " + e); + throw new RuntimeException("cannot load default SegmentReader class: " + e, e); } } } @@ -123,7 +123,7 @@ class SegmentReader extends IndexReader { try { instance = (SegmentReader)IMPL.newInstance(); } catch (Exception e) { - throw new RuntimeException("cannot load SegmentReader class: " + e); + throw new RuntimeException("cannot load SegmentReader class: " + e, e); } instance.init(dir, sis, closeDir, ownDir); instance.initialize(si); diff --git a/src/java/org/apache/lucene/index/TermInfosWriter.java b/src/java/org/apache/lucene/index/TermInfosWriter.java index 5e78487a939..4dc138bb0de 100644 --- a/src/java/org/apache/lucene/index/TermInfosWriter.java +++ b/src/java/org/apache/lucene/index/TermInfosWriter.java @@ -92,11 +92,14 @@ final class TermInfosWriter { final void add(Term term, TermInfo ti) throws IOException { if (!isIndex && term.compareTo(lastTerm) <= 0) - throw new IOException("term out of order"); + throw new IOException("term out of order (\"" + term + + "\".compareTo(\"" + lastTerm + "\") <= 0)"); if (ti.freqPointer < lastTi.freqPointer) - throw new IOException("freqPointer out of order"); + throw new IOException("freqPointer out of order (" + ti.freqPointer + + " < " + lastTi.freqPointer + ")"); if (ti.proxPointer < lastTi.proxPointer) - throw new IOException("proxPointer out of order"); + throw new IOException("proxPointer out of order (" + ti.proxPointer + + " < " + lastTi.proxPointer + ")"); if (!isIndex && size % indexInterval == 0) other.add(lastTerm, lastTi); // add an index term