Revision: 7065
          
http://languagetool.svn.sourceforge.net/languagetool/?rev=7065&view=rev
Author:   dnaber
Date:     2012-05-26 19:10:20 +0000 (Sat, 26 May 2012)
Log Message:
-----------
tiny code cleanup

Modified Paths:
--------------
    
trunk/JLanguageTool/src/java/org/languagetool/rules/spelling/hunspell/HunspellRule.java

Modified: 
trunk/JLanguageTool/src/java/org/languagetool/rules/spelling/hunspell/HunspellRule.java
===================================================================
--- 
trunk/JLanguageTool/src/java/org/languagetool/rules/spelling/hunspell/HunspellRule.java
     2012-05-26 16:02:05 UTC (rev 7064)
+++ 
trunk/JLanguageTool/src/java/org/languagetool/rules/spelling/hunspell/HunspellRule.java
     2012-05-26 19:10:20 UTC (rev 7065)
@@ -49,7 +49,7 @@
        /**
         * The dictionary file
         */
-       Hunspell.Dictionary dictionary = null;
+       private Hunspell.Dictionary dictionary = null;
 
        public HunspellRule(final ResourceBundle messages, final Language 
language)
                        throws UnsatisfiedLinkError, 
UnsupportedOperationException, IOException {
@@ -80,10 +80,10 @@
                }
        }
        
-       private final String getDictionaryPath(final String dicName, 
+       private String getDictionaryPath(final String dicName,
                        final String originalPath) throws IOException {
                
-               URL dictURL = 
JLanguageTool.getDataBroker().getFromResourceDirAsUrl(
+               final URL dictURL = 
JLanguageTool.getDataBroker().getFromResourceDirAsUrl(
                                originalPath); 
                
                String dictionaryPath = dictURL.getPath();
@@ -91,7 +91,7 @@
                //in the webstart version, we need to copy the files outside 
the jar
                //to the local temporary directory
                if ("jar".equals(dictURL.getProtocol())) {
-                       File tempDir = new 
File(System.getProperty("java.io.tmpdir"));
+                       final File tempDir = new 
File(System.getProperty("java.io.tmpdir"));
                        File temporaryFile = new File(tempDir, dicName + 
".dic");
                        JLanguageTool.addTemporaryFile(temporaryFile);
                        fileCopy(JLanguageTool.getDataBroker().
@@ -110,10 +110,10 @@
        }
        
        private void fileCopy(final InputStream in, final File targetFile) 
throws IOException {
-               OutputStream out = new FileOutputStream(targetFile);
-               byte[] buf = new byte[1024];
+               final OutputStream out = new FileOutputStream(targetFile);
+               final byte[] buf = new byte[1024];
                  int len;
-                 while ((len = in.read(buf)) > 0){
+                 while ((len = in.read(buf)) > 0) {
                          out.write(buf, 0, len);
                  }
                  in.close();
@@ -137,8 +137,9 @@
                                .getTokensWithoutWhitespace();
 
                // some languages might not have a dictionary, be silent about 
it
-               if (dictionary == null)
+               if (dictionary == null) {
                        return toRuleMatchArray(ruleMatches);
+    }
 
                // starting with the first token to skip the zero-length 
START_SENT
                for (int i = 1; i < tokens.length; i++) {
@@ -153,7 +154,7 @@
                                                tokens[i].getStartPos(), 
tokens[i].getStartPos() + word.length(),
                                                messages.getString("spelling"),
                                                
messages.getString("desc_spelling_short"));
-                               List<String> suggestions = 
dictionary.suggest(word);
+                               final List<String> suggestions = 
dictionary.suggest(word);
                                if (suggestions != null) {
                                        
ruleMatch.setSuggestedReplacements(suggestions);
                                }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Languagetool-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-cvs

Reply via email to