You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/10/29 22:28:40 UTC

svn commit: r1195020 - /lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/SegmentInfo.java

Author: rmuir
Date: Sat Oct 29 20:28:39 2011
New Revision: 1195020

URL: http://svn.apache.org/viewvc?rev=1195020&view=rev
Log:
LUCENE-3490: add check if codec is not found

Modified:
    lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/SegmentInfo.java

Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/SegmentInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/SegmentInfo.java?rev=1195020&r1=1195019&r2=1195020&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/SegmentInfo.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/SegmentInfo.java Sat Oct 29 20:28:39 2011
@@ -223,7 +223,11 @@ public final class SegmentInfo implement
 
     // System.out.println(Thread.currentThread().getName() + ": si.read hasProx=" + hasProx + " seg=" + name);
     if (format <= DefaultSegmentInfosWriter.FORMAT_4_0) {
-      codec = codecs.lookup(input.readString());
+      String codecName = input.readString();
+      codec = codecs.lookup(codecName);
+      if (codec == null) {
+        throw new IllegalArgumentException("Required codec '" + codec + "' not found!");
+      }
     } else {
       // TODO what todo if preflex is not available in the provider? register it or fail?
       codec = codecs.lookup("Lucene3x");