mirror of https://github.com/apache/lucene.git
improve some exception messages and init the cause of exceptions
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@405870 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cb5f472525
commit
07587e8d15
|
@ -159,7 +159,9 @@ final class FieldsReader {
|
||||||
}
|
}
|
||||||
catch (DataFormatException e) {
|
catch (DataFormatException e) {
|
||||||
// this will happen if the field is not compressed
|
// 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -332,7 +332,8 @@ final class SegmentMerger {
|
||||||
doc += base; // convert to merged space
|
doc += base; // convert to merged space
|
||||||
|
|
||||||
if (doc < lastDoc)
|
if (doc < lastDoc)
|
||||||
throw new IllegalStateException("docs out of order");
|
throw new IllegalStateException("docs out of order (" + doc +
|
||||||
|
" < " + lastDoc + " )");
|
||||||
|
|
||||||
df++;
|
df++;
|
||||||
|
|
||||||
|
|
|
@ -94,12 +94,12 @@ class SegmentReader extends IndexReader {
|
||||||
SegmentReader.class.getName());
|
SegmentReader.class.getName());
|
||||||
IMPL = Class.forName(name);
|
IMPL = Class.forName(name);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new RuntimeException("cannot load SegmentReader class: " + e);
|
throw new RuntimeException("cannot load SegmentReader class: " + e, e);
|
||||||
} catch (SecurityException se) {
|
} catch (SecurityException se) {
|
||||||
try {
|
try {
|
||||||
IMPL = Class.forName(SegmentReader.class.getName());
|
IMPL = Class.forName(SegmentReader.class.getName());
|
||||||
} catch (ClassNotFoundException e) {
|
} 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 {
|
try {
|
||||||
instance = (SegmentReader)IMPL.newInstance();
|
instance = (SegmentReader)IMPL.newInstance();
|
||||||
} catch (Exception e) {
|
} 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.init(dir, sis, closeDir, ownDir);
|
||||||
instance.initialize(si);
|
instance.initialize(si);
|
||||||
|
|
|
@ -92,11 +92,14 @@ final class TermInfosWriter {
|
||||||
final void add(Term term, TermInfo ti)
|
final void add(Term term, TermInfo ti)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
if (!isIndex && term.compareTo(lastTerm) <= 0)
|
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)
|
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)
|
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)
|
if (!isIndex && size % indexInterval == 0)
|
||||||
other.add(lastTerm, lastTi); // add an index term
|
other.add(lastTerm, lastTi); // add an index term
|
||||||
|
|
Loading…
Reference in New Issue