Revision: 9394
          
http://languagetool.svn.sourceforge.net/languagetool/?rev=9394&view=rev
Author:   dnaber
Date:     2013-02-16 19:02:17 +0000 (Sat, 16 Feb 2013)
Log Message:
-----------
another try to fix the ConcurrentModificationException with the config dialog

Modified Paths:
--------------
    
trunk/languagetool/languagetool-office-extension/src/main/java/org/languagetool/openoffice/Main.java

Modified: 
trunk/languagetool/languagetool-office-extension/src/main/java/org/languagetool/openoffice/Main.java
===================================================================
--- 
trunk/languagetool/languagetool-office-extension/src/main/java/org/languagetool/openoffice/Main.java
        2013-02-16 18:03:02 UTC (rev 9393)
+++ 
trunk/languagetool/languagetool-office-extension/src/main/java/org/languagetool/openoffice/Main.java
        2013-02-16 19:02:17 UTC (rev 9394)
@@ -272,25 +272,29 @@
           initLanguageTool();
         }
 
-        synchronized (config) {
-          final Set<String> disabledRuleIds = config.getDisabledRuleIds();
-          if (disabledRuleIds != null) {
-            for (final String id : disabledRuleIds) {
-              langTool.disableRule(id);
-            }
+        final Set<String> disabledRuleIds = config.getDisabledRuleIds();
+        if (disabledRuleIds != null) {
+          // copy as the config thread may access this as well
+          final ArrayList<String> list = new 
ArrayList<String>(disabledRuleIds);
+          for (final String id : list) {
+            langTool.disableRule(id);
           }
-          final Set<String> disabledCategories = 
config.getDisabledCategoryNames();
-          if (disabledCategories != null) {
-            for (final String categoryName : disabledCategories) {
-              langTool.disableCategory(categoryName);
-            }
+        }
+        final Set<String> disabledCategories = 
config.getDisabledCategoryNames();
+        if (disabledCategories != null) {
+          // copy as the config thread may access this as well
+          final ArrayList<String> list = new 
ArrayList<String>(disabledCategories);
+          for (final String categoryName : list) {
+            langTool.disableCategory(categoryName);
           }
-          final Set<String> enabledRuleIds = config.getEnabledRuleIds();
-          if (enabledRuleIds != null) {
-            for (String ruleName : enabledRuleIds) {
-              langTool.enableDefaultOffRule(ruleName);
-              langTool.enableRule(ruleName);
-            }
+        }
+        final Set<String> enabledRuleIds = config.getEnabledRuleIds();
+        if (enabledRuleIds != null) {
+          // copy as the config thread may access this as well
+          final ArrayList<String> list = new ArrayList<String>(enabledRuleIds);
+          for (String ruleName : list) {
+            langTool.enableDefaultOffRule(ruleName);
+            langTool.enableRule(ruleName);
           }
         }
         try {

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


------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, 
is your hub for all things parallel software development, from weekly thought 
leadership blogs to news, videos, case studies, tutorials, tech docs, 
whitepapers, evaluation guides, and opinion stories. Check out the most 
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Languagetool-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-commits

Reply via email to