}\r
\r
public void load() {\r
- try {\r
- ExtendedProperties configuration = new ExtendedProperties();\r
-\r
+ synchronized (filterRules) {\r
try {\r
- configuration = new ExtendedProperties(configFile);\r
- }\r
- catch (FileNotFoundException e) {\r
- }\r
+ ExtendedProperties configuration = new ExtendedProperties();\r
+\r
+ try {\r
+ configuration = new ExtendedProperties(configFile);\r
+ }\r
+ catch (FileNotFoundException e) {\r
+ }\r
\r
- getFilterConfig(filterRules, "abuse.filter", configuration);\r
+ getFilterConfig(filterRules, "abuse.filter", configuration);\r
\r
- setOpenPostingDisabled(configuration.getString("abuse.openPostingDisabled", "0").equals("1"));\r
- setOpenPostingPassword(configuration.getString("abuse.openPostingPassword", "0").equals("1"));\r
- setCookieOnBlock(configuration.getString("abuse.cookieOnBlock", "0").equals("1"));\r
- setLogEnabled(configuration.getString("abuse.logEnabled", "0").equals("1"));\r
- setLogSize(configuration.getInt("abuse.logSize", 10));\r
- setArticleBlockAction(configuration.getString("abuse.articleBlockAction", ""));\r
- setCommentBlockAction(configuration.getString("abuse.commentBlockAction", ""));\r
- }\r
- catch (Throwable t) {\r
- throw new RuntimeException(t.toString());\r
+ setOpenPostingDisabled(configuration.getString("abuse.openPostingDisabled", "0").equals("1"));\r
+ setOpenPostingPassword(configuration.getString("abuse.openPostingPassword", "0").equals("1"));\r
+ setCookieOnBlock(configuration.getString("abuse.cookieOnBlock", "0").equals("1"));\r
+ setLogEnabled(configuration.getString("abuse.logEnabled", "0").equals("1"));\r
+ setLogSize(configuration.getInt("abuse.logSize", 10));\r
+ setArticleBlockAction(configuration.getString("abuse.articleBlockAction", ""));\r
+ setCommentBlockAction(configuration.getString("abuse.commentBlockAction", ""));\r
+ }\r
+ catch (Throwable t) {\r
+ throw new RuntimeException(t.toString());\r
+ }\r
}\r
}\r
+\r
public void save() {\r
- try {\r
- ExtendedProperties configuration = new ExtendedProperties();\r
+ synchronized (filterRules) {\r
+ try {\r
+ ExtendedProperties configuration = new ExtendedProperties();\r
\r
- setFilterConfig(filterRules, "abuse.filter", configuration);\r
+ setFilterConfig(filterRules, "abuse.filter", configuration);\r
\r
- configuration.addProperty("abuse.openPostingDisabled", getOpenPostingDisabled()?"1":"0");\r
- configuration.addProperty("abuse.openPostingPassword", getOpenPostingPassword()?"1":"0");\r
- configuration.addProperty("abuse.cookieOnBlock", getCookieOnBlock()?"1":"0");\r
- configuration.addProperty("abuse.logEnabled", getLogEnabled()?"1":"0");\r
- configuration.addProperty("abuse.logSize", Integer.toString(getLogSize()));\r
- configuration.addProperty("abuse.articleBlockAction", getArticleBlockAction());\r
- configuration.addProperty("abuse.commentBlockAction", getCommentBlockAction());\r
+ configuration.addProperty("abuse.openPostingDisabled", getOpenPostingDisabled() ? "1" : "0");\r
+ configuration.addProperty("abuse.openPostingPassword", getOpenPostingPassword() ? "1" : "0");\r
+ configuration.addProperty("abuse.cookieOnBlock", getCookieOnBlock() ? "1" : "0");\r
+ configuration.addProperty("abuse.logEnabled", getLogEnabled() ? "1" : "0");\r
+ configuration.addProperty("abuse.logSize", Integer.toString(getLogSize()));\r
+ configuration.addProperty("abuse.articleBlockAction", getArticleBlockAction());\r
+ configuration.addProperty("abuse.commentBlockAction", getCommentBlockAction());\r
\r
- configuration.save(new FileOutputStream(new File(configFile)), "Anti abuse configuration");\r
- }\r
- catch (Throwable t) {\r
- throw new RuntimeException(t.toString());\r
+ configuration.save(new FileOutputStream(new File(configFile)), "Anti abuse configuration");\r
+ }\r
+ catch (Throwable t) {\r
+ throw new RuntimeException(t.toString());\r
+ }\r
}\r
}\r
\r