Revision: 7768
          
http://languagetool.svn.sourceforge.net/languagetool/?rev=7768&view=rev
Author:   dnaber
Date:     2012-07-28 12:24:18 +0000 (Sat, 28 Jul 2012)
Log Message:
-----------
don't fail silently if there is no index dir

Modified Paths:
--------------
    
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleEditorController.groovy

Added Paths:
-----------
    trunk/ltcommunity/src/java/org/languagetool/NoDataForLanguageException.java

Modified: 
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleEditorController.groovy
===================================================================
--- 
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleEditorController.groovy
       2012-07-28 08:48:09 UTC (rev 7767)
+++ 
trunk/ltcommunity/grails-app/controllers/org/languagetool/RuleEditorController.groovy
       2012-07-28 12:24:18 UTC (rev 7768)
@@ -113,8 +113,9 @@
               indexSearcher.close()
             }
             return searcherResult
+        } else {
+            throw new NoDataForLanguageException(language, indexDir)
         }
-        return null
     }
 
     private void checkExampleSentences(PatternRule patternRule, Language 
language, List problems, List shortProblems) {

Added: 
trunk/ltcommunity/src/java/org/languagetool/NoDataForLanguageException.java
===================================================================
--- trunk/ltcommunity/src/java/org/languagetool/NoDataForLanguageException.java 
                        (rev 0)
+++ trunk/ltcommunity/src/java/org/languagetool/NoDataForLanguageException.java 
2012-07-28 12:24:18 UTC (rev 7768)
@@ -0,0 +1,19 @@
+package org.languagetool;
+
+import java.io.File;
+
+public class NoDataForLanguageException extends RuntimeException {
+
+    private final Language language;
+    private final File indexLocation;
+
+    public NoDataForLanguageException(Language language, File indexLocation) {
+        this.language = language;
+        this.indexLocation = indexLocation;
+    }
+
+    @Override
+    public String getMessage() {
+        return "No index data found for " + language.getName() + " at " + 
indexLocation;
+    }
+}

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
Languagetool-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/languagetool-cvs

Reply via email to