lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r832571 - in /lucene/java/trunk/src/java/org/apache/lucene: index/SegmentInfo.java index/SegmentInfos.java messages/MessageImpl.java
Date Tue, 03 Nov 2009 21:38:31 GMT
Author: uschindler
Date: Tue Nov  3 21:38:28 2009
New Revision: 832571

URL: http://svn.apache.org/viewvc?rev=832571&view=rev
Log:
Fix some strange things on ApacheCon

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfo.java
    lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfos.java
    lucene/java/trunk/src/java/org/apache/lucene/messages/MessageImpl.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfo.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfo.java?rev=832571&r1=832570&r2=832571&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfo.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfo.java Tue Nov  3 21:38:28
2009
@@ -152,12 +152,10 @@
     delCount = src.delCount;
   }
 
-  // must be Map<String, String>
   void setDiagnostics(Map<String, String> diagnostics) {
     this.diagnostics = diagnostics;
   }
 
-  // returns Map<String, String>
   public Map<String, String> getDiagnostics() {
     return diagnostics;
   }
@@ -714,13 +712,13 @@
    *  has the same dir and same name. */
   @Override
   public boolean equals(Object obj) {
-    SegmentInfo other;
-    try {
-      other = (SegmentInfo) obj;
-    } catch (ClassCastException cce) {
+    if (this == obj) return true;
+    if (obj instanceof SegmentInfo) {
+      final SegmentInfo other = (SegmentInfo) obj;
+      return other.dir == dir && other.name.equals(name);
+    } else {
       return false;
     }
-    return other.dir == dir && other.name.equals(name);
   }
 
   @Override

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfos.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfos.java?rev=832571&r1=832570&r2=832571&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfos.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfos.java Tue Nov  3 21:38:28
2009
@@ -28,6 +28,7 @@
 import java.io.IOException;
 import java.io.PrintStream;
 import java.util.Vector;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
@@ -648,14 +649,7 @@
           
           if (gen == -1) {
             // Neither approach found a generation
-            String s;
-            if (files != null) {
-              s = "";
-              for(int i=0;i<files.length;i++)
-                s += " " + files[i];
-            } else
-              s = " null";
-            throw new FileNotFoundException("no segments* file found in " + directory + ":
files:" + s);
+            throw new FileNotFoundException("no segments* file found in " + directory + ":
files: " + Arrays.toString(files));
           }
         }
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/messages/MessageImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/messages/MessageImpl.java?rev=832571&r1=832570&r2=832571&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/messages/MessageImpl.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/messages/MessageImpl.java Tue Nov  3 21:38:28
2009
@@ -60,13 +60,13 @@
   @Override
   public String toString() {
     Object[] args = getArguments();
-    String argsString = "";
+    StringBuilder sb = new StringBuilder(getKey());
     if (args != null) {
       for (int i = 0; i < args.length; i++) {
-        argsString += args[i] + (i < args.length ? "" : ", ");
+        sb.append(i == 0 ? " " : ", ").append(args[i]);
       }
     }
-    return getKey() + " " + argsString;
+    return sb.toString();
   }
 
 }



Mime
View raw message