lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rjer...@apache.org
Subject svn commit: r1656581 - /lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
Date Mon, 02 Feb 2015 21:21:51 GMT
Author: rjernst
Date: Mon Feb  2 21:21:50 2015
New Revision: 1656581

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

Modified:
    lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java

Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java?rev=1656581&r1=1656580&r2=1656581&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
Mon Feb  2 21:21:50 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")) {



Mime
View raw message