aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/gv/egiz/pdfas/framework/config/SettingsHelper.java33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/framework/config/SettingsHelper.java b/src/main/java/at/gv/egiz/pdfas/framework/config/SettingsHelper.java
index abe4378..bb00ea1 100644
--- a/src/main/java/at/gv/egiz/pdfas/framework/config/SettingsHelper.java
+++ b/src/main/java/at/gv/egiz/pdfas/framework/config/SettingsHelper.java
@@ -3,6 +3,9 @@
*/
package at.gv.egiz.pdfas.framework.config;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import at.gv.egiz.pdfas.framework.vfilter.VerificationFilterParameters;
import at.gv.egiz.pdfas.impl.vfilter.VerificationFilterParametersImpl;
import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
@@ -10,22 +13,27 @@ import at.knowcenter.wag.egov.egiz.exceptions.SettingsException;
/**
* Contains helpful Settings functions.
+ *
* @author wprinz
*/
public final class SettingsHelper
{
+ /**
+ * The log.
+ */
+ private static final Log log = LogFactory.getLog(SettingsHelper.class);
+
public static VerificationFilterParameters readVerificationFilterParametersFromSettings() throws SettingsException
- {
+ {
boolean binaryOnly = getFlag("binary_only");
- // TODO: tknall: typo should be fixed (including entry within config.properties)
- boolean assumeOnlySB = getFlag("assume_only_signauture_blocks");
+ boolean assumeOnlySB = getAssumeSB();
boolean checkOld = getFlag("check_old_textual_sigs");
-
+
VerificationFilterParameters vfp = new VerificationFilterParametersImpl(binaryOnly, assumeOnlySB, checkOld);
return vfp;
}
- protected static boolean getFlag (String settingsKey) throws SettingsException
+ protected static boolean getFlag(String settingsKey) throws SettingsException
{
String flag = SettingsReader.getInstance().getSetting(settingsKey, "false");
boolean b = true;
@@ -35,4 +43,19 @@ public final class SettingsHelper
}
return b;
}
+
+ protected static boolean getAssumeSB() throws SettingsException
+ {
+ // backward compatibility for typo
+ String setting_with_typo = SettingsReader.getInstance().getSetting("assume_only_signauture_blocks", null);
+ if (setting_with_typo != null)
+ {
+ log.warn("You still have the typo in your configuration file. Please change 'assume_only_signauture_blocks' to 'assume_only_signature_blocks'. Thanks.");
+ boolean assumeOnlySB_typo = getFlag("assume_only_signauture_blocks");
+ return assumeOnlySB_typo;
+ }
+
+ boolean assumeOnlySB = getFlag("assume_only_signature_blocks");
+ return assumeOnlySB;
+ }
}