lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dna...@apache.org
Subject svn commit: r405870 - in /lucene/java/trunk/src/java/org/apache/lucene/index: FieldsReader.java SegmentMerger.java SegmentReader.java TermInfosWriter.java
Date Fri, 12 May 2006 21:04:00 GMT
Author: dnaber
Date: Fri May 12 14:04:00 2006
New Revision: 405870

URL: http://svn.apache.org/viewcvs?rev=405870&view=rev
Log:
improve some exception messages and init the cause of exceptions

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/index/FieldsReader.java
    lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java
    lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java
    lucene/java/trunk/src/java/org/apache/lucene/index/TermInfosWriter.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/FieldsReader.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/index/FieldsReader.java?rev=405870&r1=405869&r2=405870&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/FieldsReader.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/FieldsReader.java Fri May 12 14:04:00
2006
@@ -159,7 +159,9 @@
       }
       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;
       }
     }
   

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java?rev=405870&r1=405869&r2=405870&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java Fri May 12 14:04:00
2006
@@ -332,7 +332,8 @@
         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++;
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java?rev=405870&r1=405869&r2=405870&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java Fri May 12 14:04:00
2006
@@ -94,12 +94,12 @@
                            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 @@
     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);

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/TermInfosWriter.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/index/TermInfosWriter.java?rev=405870&r1=405869&r2=405870&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/TermInfosWriter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/TermInfosWriter.java Fri May 12 14:04:00
2006
@@ -92,11 +92,14 @@
   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



Mime
View raw message