--- lucene-java-2.0.0-434148/src/java/org/apache/lucene/queryParser/QueryParser.java 2006-07-23 04:08:36.000000000 -0700 +++ lucene-java-2.0.0-434148-patched/src/java/org/apache/lucene/queryParser/QueryParser.java 2006-08-23 15:07:01.000000000 -0700 @@ -247,7 +247,7 @@ } protected void addClause(Vector clauses, int conj, int mods, Query q) { - boolean required, prohibited; + boolean required = false, prohibited = false; // If this term is introduced by AND, make the preceding term required, // unless it's already prohibited @@ -1023,13 +1023,12 @@ final private boolean jj_2_1(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_1(); } - catch(LookaheadSuccess ls) { return true; } finally { jj_save(0, xla); } } final private boolean jj_3_1() { - if (jj_scan_token(TERM)) return true; - if (jj_scan_token(COLON)) return true; + if (jj_scan_token(TERM) || jj_ls) return !jj_ls; + if (jj_scan_token(COLON) || jj_ls) return !jj_ls; return false; } @@ -1044,9 +1043,9 @@ final private int[] jj_la1 = new int[22]; static private int[] jj_la1_0; static { - jj_la1_0(); + jj_la1_0_mth(); } - private static void jj_la1_0() { + private static void jj_la1_0_mth() { jj_la1_0 = new int[] {0x180,0x180,0xe00,0xe00,0xfb1f80,0x8000,0xfb1000,0x9a0000,0x40000,0x40000,0x8000,0xc000000,0x1000000,0xc000000,0x8000,0xc0000000,0x10000000,0xc0000000,0x8000,0x40000,0x8000,0xfb0000,}; } final private JJCalls[] jj_2_rtns = new JJCalls[1]; @@ -1113,9 +1112,9 @@ throw generateParseException(); } - static private final class LookaheadSuccess extends java.lang.Error { } - final private LookaheadSuccess jj_ls = new LookaheadSuccess(); + private boolean jj_ls = false; final private boolean jj_scan_token(int kind) { + jj_ls = false; if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { @@ -1132,7 +1131,7 @@ if (tok != null) jj_add_error_token(kind, i); } if (jj_scanpos.kind != kind) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; + if (jj_la == 0 && jj_scanpos == jj_lastpos) jj_ls = true; return false; } --- lucene-java-2.0.0-434148/src/java/org/apache/lucene/analysis/standard/StandardTokenizer.java 2005-11-12 00:33:21.000000000 -0800 +++ lucene-java-2.0.0-434148-patched/src/java/org/apache/lucene/analysis/standard/StandardTokenizer.java 2006-08-23 15:07:01.000000000 -0700 @@ -84,9 +84,9 @@ final private int[] jj_la1 = new int[1]; static private int[] jj_la1_0; static { - jj_la1_0(); + jj_la1_0_mth(); } - private static void jj_la1_0() { + private static void jj_la1_0_mth() { jj_la1_0 = new int[] {0x10ff,}; } --- lucene-java-2.0.0-434148/src/java/org/apache/lucene/index/FieldInfos.java 2006-08-16 11:31:36.000000000 -0700 +++ lucene-java-2.0.0-434148-patched/src/java/org/apache/lucene/index/FieldInfos.java 2006-08-23 15:07:01.000000000 -0700 @@ -190,14 +190,9 @@ } public int fieldNumber(String fieldName) { - try { - FieldInfo fi = fieldInfo(fieldName); - if (fi != null) - return fi.number; - } - catch (IndexOutOfBoundsException ioobe) { - return -1; - } + FieldInfo fi = fieldInfo(fieldName); + if (fi != null) + return fi.number; return -1; } @@ -213,12 +208,10 @@ * with the given number doesn't exist. */ public String fieldName(int fieldNumber) { - try { - return fieldInfo(fieldNumber).name; - } - catch (NullPointerException npe) { - return ""; - } + FieldInfo fi = fieldInfo(fieldNumber); + if (fi != null) + return fi.name; + return ""; } /** --- lucene-java-2.0.0-434148/src/java/org/apache/lucene/store/MMapDirectory.java 2006-05-13 06:29:22.000000000 -0700 +++ lucene-java-2.0.0-434148-patched/src/java/org/apache/lucene/store/MMapDirectory.java 2006-08-23 15:07:01.000000000 -0700 @@ -184,11 +184,11 @@ public void close() throws IOException {} } - private final int MAX_BBUF = Integer.MAX_VALUE; - public IndexInput openInput(String name) throws IOException { File f = new File(getFile(), name); RandomAccessFile raf = new RandomAccessFile(f, "r"); + final int MAX_BBUF = Integer.MAX_VALUE; + try { return (raf.length() <= MAX_BBUF) ? (IndexInput) new MMapIndexInput(raf) --- lucene-java-2.0.0-434148/src/java/org/apache/lucene/index/IndexFileNameFilter.java 2005-06-09 11:56:40.000000000 -0700 +++ lucene-java-2.0.0-434148-patched/src/java/org/apache/lucene/index/IndexFileNameFilter.java 2006-08-23 15:07:01.000000000 -0700 @@ -37,8 +37,9 @@ } if (name.equals(IndexFileNames.DELETABLE)) return true; else if (name.equals(IndexFileNames.SEGMENTS)) return true; - else if (name.matches(".+\\.f\\d+")) return true; + else if (matches(".+\\.f\\d+", name)) return true; return false; } + public native boolean matches(String pattern, String string); } --- lucene-java-2.0.0-434148/src/java/org/apache/lucene/document/AbstractField.java 2006-06-09 18:23:22.000000000 -0700 +++ lucene-java-2.0.0-434148-patched/src/java/org/apache/lucene/document/AbstractField.java 2006-08-23 15:07:01.000000000 -0700 @@ -15,6 +15,7 @@ * limitations under the License. */ +import java.io.Reader; /** * @@ -271,4 +272,11 @@ result.append('>'); return result.toString(); } + + /* The following abstract methods were added as a workaround for GCJ bug #15411. + * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15411 + */ + public abstract String stringValue(); + public abstract Reader readerValue(); + public abstract byte[] binaryValue(); } --- lucene-java-2.0.0-434148/src/java/org/apache/lucene/index/IndexWriter.java 2006-08-18 06:33:16.000000000 -0700 +++ lucene-java-2.0.0-434148-patched/src/java/org/apache/lucene/index/IndexWriter.java 2006-08-23 15:09:30.000000000 -0700 @@ -62,17 +62,17 @@ * Default value for the write lock timeout (1,000). * @see #setDefaultWriteLockTimeout */ - public static long WRITE_LOCK_TIMEOUT = 1000; + public static long DEFAULT_WRITE_LOCK_TIMEOUT = 1000; - private long writeLockTimeout = WRITE_LOCK_TIMEOUT; + private long writeLockTimeout = DEFAULT_WRITE_LOCK_TIMEOUT; /** * Default value for the commit lock timeout (10,000). * @see #setDefaultCommitLockTimeout */ - public static long COMMIT_LOCK_TIMEOUT = 10000; + public static long DEFAULT_COMMIT_LOCK_TIMEOUT = 10000; - private long commitLockTimeout = COMMIT_LOCK_TIMEOUT; + private long commitLockTimeout = DEFAULT_COMMIT_LOCK_TIMEOUT; public static final String WRITE_LOCK_NAME = "write.lock"; public static final String COMMIT_LOCK_NAME = "commit.lock"; @@ -391,14 +391,14 @@ * Sets the default (for any instance of IndexWriter) maximum time to wait for a commit lock (in milliseconds) */ public static void setDefaultCommitLockTimeout(long commitLockTimeout) { - IndexWriter.COMMIT_LOCK_TIMEOUT = commitLockTimeout; + IndexWriter.DEFAULT_COMMIT_LOCK_TIMEOUT = commitLockTimeout; } /** * @see #setDefaultCommitLockTimeout */ public static long getDefaultCommitLockTimeout() { - return IndexWriter.COMMIT_LOCK_TIMEOUT; + return IndexWriter.DEFAULT_COMMIT_LOCK_TIMEOUT; } /** @@ -421,14 +421,14 @@ * milliseconds). */ public static void setDefaultWriteLockTimeout(long writeLockTimeout) { - IndexWriter.WRITE_LOCK_TIMEOUT = writeLockTimeout; + IndexWriter.DEFAULT_WRITE_LOCK_TIMEOUT = writeLockTimeout; } /** * @see #setDefaultWriteLockTimeout */ public static long getDefaultWriteLockTimeout() { - return IndexWriter.WRITE_LOCK_TIMEOUT; + return IndexWriter.DEFAULT_WRITE_LOCK_TIMEOUT; } /** Flushes all changes to an index and closes all associated files. */ --- lucene-java-2.0.0-434148/src/java/org/apache/lucene/index/IndexReader.java 2006-06-09 18:23:22.000000000 -0700 +++ lucene-java-2.0.0-434148-patched/src/java/org/apache/lucene/index/IndexReader.java 2006-08-23 15:09:47.000000000 -0700 @@ -140,7 +140,7 @@ synchronized (directory) { // in- & inter-process sync return (IndexReader)new Lock.With( directory.makeLock(IndexWriter.COMMIT_LOCK_NAME), - IndexWriter.COMMIT_LOCK_TIMEOUT) { + IndexWriter.DEFAULT_COMMIT_LOCK_TIMEOUT) { public Object doBody() throws IOException { SegmentInfos infos = new SegmentInfos(); infos.read(directory); @@ -232,7 +232,7 @@ boolean locked=false; try { - locked=commitLock.obtain(IndexWriter.COMMIT_LOCK_TIMEOUT); + locked=commitLock.obtain(IndexWriter.DEFAULT_COMMIT_LOCK_TIMEOUT); return SegmentInfos.readCurrentVersion(directory); } finally { @@ -264,7 +264,7 @@ boolean locked=false; try { - locked=commitLock.obtain(IndexWriter.COMMIT_LOCK_TIMEOUT); + locked=commitLock.obtain(IndexWriter.DEFAULT_COMMIT_LOCK_TIMEOUT); return SegmentInfos.readCurrentVersion(directory) == segmentInfos.getVersion(); } finally { @@ -512,7 +512,7 @@ if (writeLock == null) { Lock writeLock = directory.makeLock(IndexWriter.WRITE_LOCK_NAME); - if (!writeLock.obtain(IndexWriter.WRITE_LOCK_TIMEOUT)) // obtain write lock + if (!writeLock.obtain(IndexWriter.DEFAULT_WRITE_LOCK_TIMEOUT)) // obtain write lock throw new IOException("Index locked for write: " + writeLock); this.writeLock = writeLock; @@ -594,7 +594,7 @@ if(directoryOwner){ synchronized (directory) { // in- & inter-process sync new Lock.With(directory.makeLock(IndexWriter.COMMIT_LOCK_NAME), - IndexWriter.COMMIT_LOCK_TIMEOUT) { + IndexWriter.DEFAULT_COMMIT_LOCK_TIMEOUT) { public Object doBody() throws IOException { doCommit(); segmentInfos.write(directory);