You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rj...@apache.org on 2015/02/02 22:22:37 UTC

svn commit: r1656582 - in /lucene/dev/branches/lucene_solr_5_0: ./ lucene/ lucene/core/ lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java

Author: rjernst
Date: Mon Feb  2 21:22:37 2015
New Revision: 1656582

URL: http://svn.apache.org/r1656582
Log:
LUCENE-6213: Bikeshed the hell out of a 1 element list

Modified:
    lucene/dev/branches/lucene_solr_5_0/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/core/   (props changed)
    lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java

Modified: lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java?rev=1656582&r1=1656581&r2=1656582&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java (original)
+++ lucene/dev/branches/lucene_solr_5_0/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java Mon Feb  2 21:22:37 2015
@@ -395,9 +395,9 @@ public final class SegmentInfos implemen
     }
   }
 
-  private static final String[] unsupportedCodecs = {
+  private static final List<String> unsupportedCodecs = Arrays.asList(
       "Lucene3x"
-  };
+  );
 
   private static Codec readCodec(DataInput input) throws IOException {
     final String name = input.readString();
@@ -405,12 +405,10 @@ public final class SegmentInfos implemen
       return Codec.forName(name);
     } catch (IllegalArgumentException e) {
       // give better error messages if we can, first check if this is a legacy codec
-      for (String codec : unsupportedCodecs) {
-        if (codec.equals(name)) {
-          IOException newExc = new IndexFormatTooOldException(input, "Codec '" + name + "' is too old");
-          newExc.initCause(e);
-          throw newExc;
-        }
+      if (unsupportedCodecs.contains(name)) {
+        IOException newExc = new IndexFormatTooOldException(input, "Codec '" + name + "' is too old");
+        newExc.initCause(e);
+        throw newExc;
       }
       // or maybe it's an old default codec that moved
       if (name.startsWith("Lucene")) {