[jsword-svn] r1958 - in trunk: bibledesktop/src/main/java/org/crosswire/bibledesktop/book jsword/src/main/java/org/crosswire/jsword/book/filter/thml jsword/src/main/java/org/crosswire/jsword/book/sword jsword/src/main/java/org/crosswire/jsword/index/lucene jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis jsword/src/main/java/org/crosswire/jsword/index/search

dmsmith at crosswire.org dmsmith at crosswire.org
Sun Oct 25 16:50:02 MST 2009


Author: dmsmith
Date: 2009-10-25 16:50:02 -0700 (Sun, 25 Oct 2009)
New Revision: 1958

Modified:
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/DivTag.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/AbstractBackend.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawBackend.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawFileBackend.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordConstants.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordUtil.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndex.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/AbstractBookAnalyzer.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/AbstractBookTokenFilter.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/ArabicLuceneAnalyzer.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/ConfigurableSnowballAnalyzer.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/CzechLuceneAnalyzer.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/PersianLuceneAnalyzer.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/SavedStreams.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/SmartChineseLuceneAnalyzer.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/StrongsNumberFilter.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/search/DefaultSearchModifier.java
Log:
Fix checkstyle and findbugs complaints.

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java	2009-10-25 12:41:16 UTC (rev 1957)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java	2009-10-25 23:50:02 UTC (rev 1958)
@@ -336,7 +336,6 @@
             {
                 modifier.setMaxResults(rankCount);
             }
-            
 
             Key results = selected[0].find(new DefaultSearchRequest(param, modifier));
             int partial = results.getCardinality();

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/DivTag.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/DivTag.java	2009-10-25 12:41:16 UTC (rev 1957)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/filter/thml/DivTag.java	2009-10-25 23:50:02 UTC (rev 1958)
@@ -36,7 +36,6 @@
 {
     /**
      * Create an div tag
-     * @param level
      */
     public DivTag()
     {

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/AbstractBackend.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/AbstractBackend.java	2009-10-25 12:41:16 UTC (rev 1957)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/AbstractBackend.java	2009-10-25 23:50:02 UTC (rev 1958)
@@ -117,10 +117,11 @@
         return null;
     }
 
-    /* (non-Javadoc)
-     * @see org.crosswire.jsword.passage.Key#contains(org.crosswire.jsword.passage.Key)
+    /**
+     * Determine whether this Book contains the key in question
+     * @param key The key whose presense is desired.
+     * @return true if the Book contains the key
      */
-    /* @Override */
     public abstract boolean contains(Key key);
 
     /**
@@ -142,10 +143,18 @@
     {
     }
 
-    public void create() throws IOException, BookException {
+    /**
+     * Create the directory to hold the Book if it does not exist.
+     * @throws IOException
+     * @throws BookException
+     */
+    public void create() throws IOException, BookException
+    {
         File dataPath = new File(getExpandedDataPath());
-        if(!dataPath.exists()) {
-            if(!dataPath.mkdirs()) {
+        if (!dataPath.exists())
+        {
+            if (!dataPath.mkdirs())
+            {
                 throw new IOException("Unable to create module data path!"); //$NON-NLS-1$
             }
         }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawBackend.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawBackend.java	2009-10-25 12:41:16 UTC (rev 1957)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawBackend.java	2009-10-25 23:50:02 UTC (rev 1958)
@@ -119,7 +119,11 @@
         }
     }
 
-    public void setRawText(Key key, String text) throws BookException, IOException {
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.sword.AbstractBackend#setRawText(org.crosswire.jsword.passage.Key, java.lang.String)
+     */
+    public void setRawText(Key key, String text) throws BookException, IOException
+    {
     }
 
     /* (non-Javadoc)
@@ -142,7 +146,11 @@
         return idxFile[SwordConstants.TESTAMENT_OLD].canRead() || idxFile[SwordConstants.TESTAMENT_NEW].canRead();
     }
 
-    public void create() throws IOException, BookException {
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.sword.AbstractBackend#create()
+     */
+    public void create() throws IOException, BookException
+    {
         super.create();
     }
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawFileBackend.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawFileBackend.java	2009-10-25 12:41:16 UTC (rev 1957)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/RawFileBackend.java	2009-10-25 23:50:02 UTC (rev 1958)
@@ -47,11 +47,6 @@
 public class RawFileBackend extends RawBackend
 {
 
-    private static final Logger log          = Logger.getLogger(RawFileBackend.class);
-
-    private File                incfile      = null;
-    private int                 incfileValue = 0;
-
     public RawFileBackend(SwordBookMetaData sbmd, int datasize)
     {
         super(sbmd, datasize);
@@ -67,22 +62,9 @@
         }
     }
 
-    private void initIncFile()
-    {
-        try
-        {
-            File tempIncfile = new File(getExpandedDataPath().getPath() + File.separator + "incfile"); //$NON-NLS-1$
-            if (tempIncfile.exists())
-            {
-                this.incfile = tempIncfile;
-            }
-        }
-        catch (BookException e)
-        {
-            log.error("Error on checking incfile: " + e.getMessage()); //$NON-NLS-1$
-        }
-    }
-
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.sword.RawBackend#getRawText(org.crosswire.jsword.passage.Key)
+     */
     public String getRawText(Key key) throws BookException
     {
         return super.getRawText(key);
@@ -159,6 +141,22 @@
         }
     }
 
+    private void initIncFile()
+    {
+        try
+        {
+            File tempIncfile = new File(getExpandedDataPath().getPath() + File.separator + INCFILE);
+            if (tempIncfile.exists())
+            {
+                this.incfile = tempIncfile;
+            }
+        }
+        catch (BookException e)
+        {
+            log.error("Error on checking incfile: " + e.getMessage()); //$NON-NLS-1$
+        }
+    }
+
     private File createDataTextFile(int index) throws BookException, IOException
     {
         String dataPath = getExpandedDataPath().getPath();
@@ -166,9 +164,9 @@
         // dataPath += File.separator + String.format("%07d", index);
         dataPath += File.separator + new DecimalFormat("0000000").format(index); //$NON-NLS-1$
         File dataFile = new File(dataPath);
-        if ( !dataFile.createNewFile())
+        if (!dataFile.exists() && !dataFile.createNewFile())
         {
-            log.info("Data file did already exist: " + dataPath); //$NON-NLS-1$
+            throw new IOException("Could not create data file."); //$NON-NLS-1$
         }
         return dataFile;
     }
@@ -222,11 +220,24 @@
         buf.append(new DecimalFormat("0000000").format(ordinal)); //$NON-NLS-1$
         buf.append("\r\n"); //$NON-NLS-1$
         String fileName = buf.toString();
-        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(txtFile[testament], true));
-        bos.write(fileName.getBytes());
-        bos.close();
+        BufferedOutputStream bos = null;
+        try
+        {
+            bos = new BufferedOutputStream(new FileOutputStream(txtFile[testament], true));
+            bos.write(fileName.getBytes());
+        }
+        finally
+        {
+            if (bos != null)
+            {
+                bos.close();
+            }
+        }
     }
 
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.sword.RawBackend#create()
+     */
     public void create() throws IOException, BookException
     {
         super.create();
@@ -240,6 +251,9 @@
         prepopulateIncfile();
     }
 
+    /* (non-Javadoc)
+     * @see org.crosswire.jsword.book.sword.RawBackend#isWritable()
+     */
     public boolean isWritable()
     {
         File otTextFile = txtFile[1];
@@ -262,56 +276,74 @@
         String path = getExpandedDataPath().getPath();
 
         File otTextFile = new File(path + File.separator + SwordConstants.FILE_OT);
-        otTextFile.createNewFile();
+        if (!otTextFile.exists() && !otTextFile.createNewFile())
+        {
+            throw new IOException("Could not create ot text file."); //$NON-NLS-1$
+        }
+
         File ntTextFile = new File(path + File.separator + SwordConstants.FILE_NT);
-        ntTextFile.createNewFile();
+        if (!ntTextFile.exists() && !ntTextFile.createNewFile())
+        {
+            throw new IOException("Could not create nt text file."); //$NON-NLS-1$
+        }
     }
 
     private void createIndexFiles() throws IOException, BookException
     {
         String path = getExpandedDataPath().getPath();
+        File otIndexFile = new File(path + File.separator + SwordConstants.FILE_OT + SwordConstants.EXTENSION_VSS);
+        if (!otIndexFile.exists() && !otIndexFile.createNewFile())
+        {
+            throw new IOException("Could not create ot index file."); //$NON-NLS-1$
+        }
 
-        File otIndexFile = new File(path + File.separator + SwordConstants.FILE_OT + SwordConstants.EXTENSION_VSS);
-        otIndexFile.createNewFile();
         File ntIndexFile = new File(path + File.separator + SwordConstants.FILE_NT + SwordConstants.EXTENSION_VSS);
-        ntIndexFile.createNewFile();
+        if (!ntIndexFile.exists() && !ntIndexFile.createNewFile())
+        {
+            throw new IOException("Could not create nt index file."); //$NON-NLS-1$
+        }
     }
 
     private void prepopulateIndexFiles() throws IOException
     {
+        File otIndexFile = idxFile[SwordConstants.TESTAMENT_OLD];
+        BufferedOutputStream otIdxBos = new BufferedOutputStream(new FileOutputStream(otIndexFile, false));
+
         try
         {
-            File ntIndexFile = idxFile[SwordConstants.TESTAMENT_NEW];
-            BufferedOutputStream ntIdxBos = new BufferedOutputStream(new FileOutputStream(ntIndexFile, false));
-
-            File otIndexFile = idxFile[SwordConstants.TESTAMENT_OLD];
-            BufferedOutputStream otIdxBos = new BufferedOutputStream(new FileOutputStream(otIndexFile, false));
-
-            for (int i = 0; i < BibleInfo.versesInBible(); i++ )
+            for (int i = 0; i < SwordConstants.ORDINAL_MAT11; i++)
             {
-                if ((i + 1) >= SwordConstants.ORDINAL_MAT11)
-                {
-                    writeInitialIndex(ntIdxBos);
-                }
-                else
-                {
-                    writeInitialIndex(otIdxBos);
-                }
+                writeInitialIndex(otIdxBos);
             }
-
-            ntIdxBos.close();
+        }
+        finally
+        {
             otIdxBos.close();
         }
-        catch (FileNotFoundException e)
+
+        File ntIndexFile = idxFile[SwordConstants.TESTAMENT_NEW];
+        BufferedOutputStream ntIdxBos = new BufferedOutputStream(new FileOutputStream(ntIndexFile, false));
+        try
         {
-            throw new IOException(e.getMessage());
+            int totVerses = BibleInfo.versesInBible();
+            for (int i = SwordConstants.ORDINAL_MAT11; i < totVerses; i++)
+            {
+                writeInitialIndex(ntIdxBos);
+            }
         }
+        finally
+        {
+            ntIdxBos.close();
+        }
     }
 
     private void createIncfile() throws IOException, BookException
     {
-        File tempIncfile = new File(getExpandedDataPath().getPath() + File.separator + "incfile"); //$NON-NLS-1$
-        tempIncfile.createNewFile();
+        File tempIncfile = new File(getExpandedDataPath().getPath() + File.separator + INCFILE);
+        if (!tempIncfile.exists() && !tempIncfile.createNewFile())
+        {
+            throw new IOException("Could not create incfile file."); //$NON-NLS-1$
+        }
         this.incfile = tempIncfile;
     }
 
@@ -349,7 +381,11 @@
             {
                 fis = new FileInputStream(this.incfile);
                 byte[] buffer = new byte[4];
-                fis.read(buffer);
+                if (fis.read(buffer) != 4)
+                {
+                    log.error("Read data is not of appropriate size of 4 bytes!"); //$NON-NLS-1$
+                    throw new IOException("Incfile is not 4 bytes long"); //$NON-NLS-1$
+                }
                 ret = SwordUtil.decodeLittleEndian32(buffer, 0);
             }
             catch (FileNotFoundException e)
@@ -359,7 +395,10 @@
             }
             finally
             {
-                fis.close();
+                if (fis != null)
+                {
+                    fis.close();
+                }
             }
         }
 
@@ -374,12 +413,17 @@
 
     private byte[] readTextDataFile(File dataFile) throws IOException
     {
+        BufferedInputStream inStream = null;
         try
         {
-            byte[] textData = new byte[(int) dataFile.length()];
-            BufferedInputStream inStream = new BufferedInputStream(new FileInputStream(dataFile));
-            inStream.read(textData);
-            inStream.close();
+            int len = (int) dataFile.length();
+            byte[] textData = new byte[len];
+            inStream = new BufferedInputStream(new FileInputStream(dataFile));
+            if (inStream.read(textData) != len)
+            {
+                log.error("Read data is not of appropriate size of " + len + " bytes!"); //$NON-NLS-1$ //$NON-NLS-2$
+                throw new IOException("data is not " + len + " bytes long"); //$NON-NLS-1$ //$NON-NLS-2$
+            }
             return textData;
         }
         catch (FileNotFoundException ex)
@@ -387,13 +431,30 @@
             log.error(ex.getMessage());
             throw new IOException("Could not read text data file, file not found: " + dataFile.getName()); //$NON-NLS-1$
         }
+        finally
+        {
+            if (inStream != null)
+            {
+                inStream.close();
+            }
+        }
     }
 
     private void writeTextDataFile(File dataFile, byte[] textData) throws IOException
     {
-        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(dataFile, false));
-        bos.write(textData);
-        bos.close();
+        BufferedOutputStream bos = null;
+        try
+        {
+            bos = new BufferedOutputStream(new FileOutputStream(dataFile, false));
+            bos.write(textData);
+        }
+        finally
+        {
+            if (bos != null)
+            {
+                bos.close();
+            }
+        }
     }
 
     private byte[] littleEndian32BitByteArrayFromInt(int val)
@@ -409,4 +470,10 @@
         SwordUtil.encodeLittleEndian16(val, buffer, 0);
         return buffer;
     }
+
+    private static final Logger log          = Logger.getLogger(RawFileBackend.class);
+    private static final String INCFILE      = "incfile"; //$NON-NLS-1$
+
+    private File                incfile;
+    private int                 incfileValue;
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordConstants.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordConstants.java	2009-10-25 12:41:16 UTC (rev 1957)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordConstants.java	2009-10-25 23:50:02 UTC (rev 1958)
@@ -156,7 +156,7 @@
      * array containing LUT of positions of initial verses per chapter.
      * This and all the cps* below were longs and then ints
      * This was an artifact of a port from C/C++ where int/long vary
-     * in size dependeing on architecture.
+     * in size depending on architecture.
      */
     private static short[][] cps;
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordUtil.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordUtil.java	2009-10-25 12:41:16 UTC (rev 1957)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordUtil.java	2009-10-25 23:50:02 UTC (rev 1958)
@@ -96,13 +96,16 @@
      * @param data data to write
      * @throws IOException on error
      */
-    protected static void writeRAF(RandomAccessFile raf, long offset, byte[] data) throws IOException {
+    protected static void writeRAF(RandomAccessFile raf, long offset, byte[] data) throws IOException
+    {
         raf.seek(offset);
         writeNextRAF(raf, data);
     }
 
-    protected static void writeNextRAF(RandomAccessFile raf, byte[] data) throws IOException {
-        if(data == null) {
+    protected static void writeNextRAF(RandomAccessFile raf, byte[] data) throws IOException
+    {
+        if (data == null)
+        {
             return;
         }
         raf.write(data);

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndex.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndex.java	2009-10-25 12:41:16 UTC (rev 1957)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndex.java	2009-10-25 23:50:02 UTC (rev 1958)
@@ -266,7 +266,8 @@
                     searcher.search(query, collector);
                     tally.setTotal(collector.getTotalHits());
                     ScoreDoc[] hits = collector.topDocs().scoreDocs;
-                    for (int i = 0; i < hits.length; i++) {
+                    for (int i = 0; i < hits.length; i++)
+                    {
                         int docId = hits[i].doc;
                         Document doc = searcher.doc(docId);
                         Key key = VerseFactory.fromString(doc.get(LuceneIndex.FIELD_KEY));

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/AbstractBookAnalyzer.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/AbstractBookAnalyzer.java	2009-10-25 12:41:16 UTC (rev 1957)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/AbstractBookAnalyzer.java	2009-10-25 23:50:02 UTC (rev 1958)
@@ -89,7 +89,7 @@
     }
 
     /**
-     * Load a stop word list as a resource. The list needs to be in a form described by {@link WordListLoader}.
+     * Load a stop word list as a resource. The list needs to be in a form described by {@link org.apache.lucene.analysis.WordListLoader}.
      * @param clazz the class that owns the resource
      * @param resourceName the name of the resource
      * @param commentChar The comment character in the stop word file.

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/AbstractBookTokenFilter.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/AbstractBookTokenFilter.java	2009-10-25 12:41:16 UTC (rev 1957)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/AbstractBookTokenFilter.java	2009-10-25 23:50:02 UTC (rev 1958)
@@ -72,5 +72,17 @@
         this.book = book;
     }
 
+    /* Define to quite FindBugs */
+    public boolean equals(Object obj)
+    {
+        return super.equals(obj);
+    }
+
+    /* Define to quite FindBugs */
+    public int hashCode()
+    {
+        return super.hashCode();
+    }
+
     private Book book;
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/ArabicLuceneAnalyzer.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/ArabicLuceneAnalyzer.java	2009-10-25 12:41:16 UTC (rev 1957)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/ArabicLuceneAnalyzer.java	2009-10-25 23:50:02 UTC (rev 1958)
@@ -81,25 +81,25 @@
         if (streams == null)
         {
             streams = new SavedStreams();
-            streams.source = new ArabicLetterTokenizer(reader);
-            streams.result = new LowerCaseFilter(streams.source);
-            streams.result = new ArabicNormalizationFilter(streams.result);
+            streams.setSource(new ArabicLetterTokenizer(reader));
+            streams.setResult(new LowerCaseFilter(streams.getSource()));
+            streams.setResult(new ArabicNormalizationFilter(streams.getResult()));
             if (doStopWords && stopSet != null)
             {
-                streams.result = new StopFilter(false, streams.result, stopSet);
+                streams.setResult(new StopFilter(false, streams.getResult(), stopSet));
             }
 
             if (doStemming)
             {
-                streams.result = new ArabicStemFilter(streams.result);
+                streams.setResult(new ArabicStemFilter(streams.getResult()));
             }
 
             setPreviousTokenStream(streams);
         }
         else
         {
-            streams.source.reset(reader);
+            streams.getSource().reset(reader);
         }
-        return streams.result;
+        return streams.getResult();
     }
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/ConfigurableSnowballAnalyzer.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/ConfigurableSnowballAnalyzer.java	2009-10-25 12:41:16 UTC (rev 1957)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/ConfigurableSnowballAnalyzer.java	2009-10-25 23:50:02 UTC (rev 1958)
@@ -114,13 +114,13 @@
         {
             // stemmer name are same as language name, in most cases
             stemmerName = book.getLanguage().getName();
-    
+
             // Check for allowed stemmers
             if (!allowedStemmers.matcher(stemmerName).matches())
             {
                 throw new IllegalArgumentException("SnowballAnalyzer configured for unavailable stemmer " + stemmerName); //$NON-NLS-1$
             }
-    
+
             // Initialize the default stop words
             if (defaultStopWordMap.containsKey(stemmerName))
             {

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/CzechLuceneAnalyzer.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/CzechLuceneAnalyzer.java	2009-10-25 12:41:16 UTC (rev 1957)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/CzechLuceneAnalyzer.java	2009-10-25 23:50:02 UTC (rev 1958)
@@ -70,20 +70,20 @@
         if (streams == null)
         {
             streams = new SavedStreams();
-            streams.source = new LowerCaseTokenizer(reader);
-            streams.result = streams.source;
+            streams.setSource(new LowerCaseTokenizer(reader));
+            streams.setResult(streams.getSource());
             if (doStopWords && stopSet != null)
             {
-                streams.result = new StopFilter(false, streams.result, stopSet);
+                streams.setResult(new StopFilter(false, streams.getResult(), stopSet));
             }
 
             setPreviousTokenStream(streams);
         }
         else
         {
-            streams.source.reset(reader);
+            streams.getSource().reset(reader);
         }
-        return streams.result;
+        return streams.getResult();
     }
 
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/PersianLuceneAnalyzer.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/PersianLuceneAnalyzer.java	2009-10-25 12:41:16 UTC (rev 1957)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/PersianLuceneAnalyzer.java	2009-10-25 23:50:02 UTC (rev 1958)
@@ -44,7 +44,7 @@
  */
 public class PersianLuceneAnalyzer extends AbstractBookAnalyzer
 {
-    public PersianLuceneAnalyzer() throws IOException 
+    public PersianLuceneAnalyzer() throws IOException
     {
         loadStopWords(PersianAnalyzer.class,
                       PersianAnalyzer.DEFAULT_STOPWORD_FILE,
@@ -87,25 +87,25 @@
           if (streams == null)
           {
               streams = new SavedStreams();
-              streams.source = new ArabicLetterTokenizer(reader);
-              streams.result = new LowerCaseFilter(streams.source);
-              streams.result = new ArabicNormalizationFilter(streams.result);
+              streams.setSource(new ArabicLetterTokenizer(reader));
+              streams.setResult(new LowerCaseFilter(streams.getSource()));
+              streams.setResult(new ArabicNormalizationFilter(streams.getResult()));
               /* additional persian-specific normalization */
-              streams.result = new PersianNormalizationFilter(streams.result);
+              streams.setResult(new PersianNormalizationFilter(streams.getResult()));
               /*
                * the order here is important: the stop set is normalized with the
                * above!
                */
               if (doStopWords && stopSet != null)
               {
-                  streams.result = new StopFilter(false, streams.result, stopSet);
+                  streams.setResult(new StopFilter(false, streams.getResult(), stopSet));
               }
               setPreviousTokenStream(streams);
           }
           else
           {
-              streams.source.reset(reader);
+              streams.getSource().reset(reader);
           }
-          return streams.result;
+          return streams.getResult();
       }
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/SavedStreams.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/SavedStreams.java	2009-10-25 12:41:16 UTC (rev 1957)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/SavedStreams.java	2009-10-25 23:50:02 UTC (rev 1958)
@@ -33,6 +33,36 @@
  */
 /* package */ class SavedStreams
 {
-    Tokenizer source;
-    TokenStream result;
+    /**
+     * @return the source
+     */
+    public Tokenizer getSource()
+    {
+        return source;
+    }
+
+    /**
+     * @param source the source to set
+     */
+    public void setSource(Tokenizer source)
+    {
+        this.source = source;
+    }
+
+    /**
+     * @return the result
+     */
+    public TokenStream getResult()
+    {
+        return result;
+    }
+    /**
+     * @param result the result to set
+     */
+    public void setResult(TokenStream result)
+    {
+        this.result = result;
+    }
+    private Tokenizer source;
+    private TokenStream result;
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/SmartChineseLuceneAnalyzer.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/SmartChineseLuceneAnalyzer.java	2009-10-25 12:41:16 UTC (rev 1957)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/SmartChineseLuceneAnalyzer.java	2009-10-25 23:50:02 UTC (rev 1958)
@@ -28,7 +28,7 @@
 
 /**
  * A simple wrapper for {@link SmartChineseAnalyzer}, which takes overlapping
- * two character tokenization approach which leads to larger index size, like {@link CJKAnalyzer}.
+ * two character tokenization approach which leads to larger index size, like {@link org.apache.lucene.analyzer.cjk.CJKAnalyzer}.
  * This analyzer's stop list is merely of punctuation. It does stemming of English.
  *  
  * @see gnu.lgpl.License for license details.<br>

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/StrongsNumberFilter.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/StrongsNumberFilter.java	2009-10-25 12:41:16 UTC (rev 1957)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/analysis/StrongsNumberFilter.java	2009-10-25 23:50:02 UTC (rev 1958)
@@ -108,6 +108,18 @@
         return true;
     }
 
+    /* Define to quite FindBugs */
+    public boolean equals(Object obj)
+    {
+        return super.equals(obj);
+    }
+
+    /* Define to quite FindBugs */
+    public int hashCode()
+    {
+        return super.hashCode();
+    }
+
     private TermAttribute termAtt;
     private StrongsNumber number;
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/search/DefaultSearchModifier.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/search/DefaultSearchModifier.java	2009-10-25 12:41:16 UTC (rev 1957)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/search/DefaultSearchModifier.java	2009-10-25 23:50:02 UTC (rev 1958)
@@ -71,7 +71,7 @@
     /**
      * The maximum number of results to provide. A value of Integer.MAX_VALUE, the default, means get all results.
      * 
-     * @param maxResults the maxResults to set
+     * @param newMaxResults the maxResults to set
      */
     public void setMaxResults(int newMaxResults)
     {




More information about the jsword-svn mailing list