lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bmes...@apache.org
Subject svn commit: r351472 - /lucene/java/trunk/src/java/org/apache/lucene/search/RemoteSearchable.java
Date Thu, 01 Dec 2005 21:15:59 GMT
Author: bmesser
Date: Thu Dec  1 13:15:53 2005
New Revision: 351472

URL: http://svn.apache.org/viewcvs?rev=351472&view=rev
Log:
avoid ArrayIndexOutOfBoundsException when startet without index parameter and print usage
instead.

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/search/RemoteSearchable.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/RemoteSearchable.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/search/RemoteSearchable.java?rev=351472&r1=351471&r2=351472&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/RemoteSearchable.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/RemoteSearchable.java Thu Dec  1 13:15:53
2005
@@ -26,7 +26,11 @@
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.Term;
 
-/** A remote searchable implementation. */
+/**
+ * A remote searchable implementation.
+ *
+ * @version $Id$
+ */
 public class RemoteSearchable
   extends UnicastRemoteObject
   implements Searchable {
@@ -111,12 +115,22 @@
   /** Exports a searcher for the index in args[0] named
    * "//localhost/Searchable". */
   public static void main(String args[]) throws Exception {
+    String indexName = null;
+    
+    if (args != null && args.length == 1)
+      indexName = args[0];
+    
+    if (indexName == null) {
+      System.out.println("Usage: org.apache.lucene.search.RemoteSearchable <index>");
+      return;
+    }
+    
     // create and install a security manager
     if (System.getSecurityManager() == null) {
       System.setSecurityManager(new RMISecurityManager());
     }
     
-    Searchable local = new IndexSearcher(args[0]);
+    Searchable local = new IndexSearcher(indexName);
     RemoteSearchable impl = new RemoteSearchable(local);
       
     // bind the implementation to "Searchable"



Mime
View raw message