mirror of https://github.com/apache/lucene.git
avoid ArrayIndexOutOfBoundsException when startet without index parameter and print usage instead.
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@351472 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fa24e67d6d
commit
530484379e
|
@ -26,7 +26,11 @@ import java.rmi.server.UnicastRemoteObject;
|
|||
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 @@ public class RemoteSearchable
|
|||
/** 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"
|
||||
|
|
Loading…
Reference in New Issue