Index: IndexWriter.java =================================================================== --- IndexWriter.java (revision 165147) +++ IndexWriter.java (working copy) @@ -51,68 +51,113 @@ public class IndexWriter { - /** + /** * Default value is 1000. Use org.apache.lucene.writeLockTimeout - * system property to override. + * system property to override. If a failure to get the system property occurs, perhaps + * because Lucene is being used in an unsigned applet, use the default. */ - public static long WRITE_LOCK_TIMEOUT = - Integer.parseInt(System.getProperty("org.apache.lucene.writeLockTimeout", - "1000")); + public static long WRITE_LOCK_TIMEOUT; + static { + try { + WRITE_LOCK_TIMEOUT = Integer.parseInt(System.getProperty("org.apache.lucene.writeLockTimeout", "1000")); + } catch ( Exception se ) { + WRITE_LOCK_TIMEOUT = 1000; + } + } /** * Default value is 10000. Use org.apache.lucene.commitLockTimeout - * system property to override. + * system property to override. If a failure to get the system property occurs, perhaps + * because Lucene is being used in an unsigned applet, use the default. */ - public static long COMMIT_LOCK_TIMEOUT = - Integer.parseInt(System.getProperty("org.apache.lucene.commitLockTimeout", - "10000")); + public static long COMMIT_LOCK_TIMEOUT; + static { + try { + COMMIT_LOCK_TIMEOUT = Integer.parseInt(System.getProperty("org.apache.lucene.commitLockTimeout", "10000")); + } catch ( Exception se ) { + COMMIT_LOCK_TIMEOUT = 10000; + } + } public static final String WRITE_LOCK_NAME = "write.lock"; public static final String COMMIT_LOCK_NAME = "commit.lock"; /** * Default value is 10. Use org.apache.lucene.mergeFactor - * system property to override. + * system property to override. If a failure to get the system property occurs, perhaps + * because Lucene is being used in an unsigned applet, use the default. */ - public static final int DEFAULT_MERGE_FACTOR = - Integer.parseInt(System.getProperty("org.apache.lucene.mergeFactor", - "10")); + public static int DEFAULT_MERGE_FACTOR; + static { + try { + DEFAULT_MERGE_FACTOR = Integer.parseInt(System.getProperty("org.apache.lucene.mergeFactor", "10")); + } catch ( Exception e ) { + DEFAULT_MERGE_FACTOR = 10; + } + } /** * Default value is 10. Use org.apache.lucene.minMergeDocs - * system property to override. + * system property to override. If a failure to get the system property occurs, perhaps + * because Lucene is being used in an unsigned applet, use the default. */ - public static final int DEFAULT_MIN_MERGE_DOCS = - Integer.parseInt(System.getProperty("org.apache.lucene.minMergeDocs", - "10")); + public static int DEFAULT_MIN_MERGE_DOCS; + static { + try { + DEFAULT_MIN_MERGE_DOCS = Integer.parseInt(System.getProperty("org.apache.lucene.minMergeDocs", "10")); + } catch ( Exception e ) { + DEFAULT_MIN_MERGE_DOCS = 10; + } + } /** * Default value is {@link Integer#MAX_VALUE}. * Use org.apache.lucene.maxMergeDocs system property to override. + * If a failure to get the system property occurs, perhaps + * because Lucene is being used in an unsigned applet, use the default. */ - public static final int DEFAULT_MAX_MERGE_DOCS = - Integer.parseInt(System.getProperty("org.apache.lucene.maxMergeDocs", - String.valueOf(Integer.MAX_VALUE))); + public static int DEFAULT_MAX_MERGE_DOCS; + static { + try { + DEFAULT_MAX_MERGE_DOCS = Integer.parseInt(System.getProperty("org.apache.lucene.maxMergeDocs", + String.valueOf(Integer.MAX_VALUE))); + } catch ( Exception e ) { + DEFAULT_MAX_MERGE_DOCS = Integer.MAX_VALUE; + } + } /** * Default value is 10000. Use org.apache.lucene.maxFieldLength - * system property to override. + * system property to override. If a failure to get the system property occurs, perhaps + * because Lucene is being used in an unsigned applet, use the default. */ - public static final int DEFAULT_MAX_FIELD_LENGTH = - Integer.parseInt(System.getProperty("org.apache.lucene.maxFieldLength", + public static int DEFAULT_MAX_FIELD_LENGTH; + static { + try { + DEFAULT_MAX_FIELD_LENGTH = Integer.parseInt(System.getProperty("org.apache.lucene.maxFieldLength", "10000")); + } catch ( Exception e ) { + DEFAULT_MAX_FIELD_LENGTH = 10000; + } + } /** The default value for {@link #getTermIndexInterval()}. This is * determined by the org.apache.lucene.termIndexInterval system - * property. The default is 128. + * property. The default is 128. If a failure to get the system property occurs, perhaps + * because Lucene is being used in an unsigned applet, use the default. */ - public static final int DEFAULT_TERM_INDEX_INTERVAL = - Integer.parseInt(System.getProperty("org.apache.lucene.termIndexInterval", + public static int DEFAULT_TERM_INDEX_INTERVAL; + static { + try { + DEFAULT_TERM_INDEX_INTERVAL = Integer.parseInt(System.getProperty("org.apache.lucene.termIndexInterval", "128")); + } catch ( Exception e ) { + DEFAULT_TERM_INDEX_INTERVAL = 128; + } + } - private Directory directory; // where this index resides private Analyzer analyzer; // how to analyze text