From fe11385a26e576e2da716b0a120c6eee4410a575 Mon Sep 17 00:00:00 2001 From: netconomy Date: Thu, 22 Nov 2007 08:27:04 +0000 Subject: Fixed the "assume only signature blocks" typo git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@226 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../pdfas/framework/config/SettingsHelper.java | 33 ++++++++++++++++++---- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'src/main/java/at/gv/egiz/pdfas') 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; + } } -- cgit v1.2.3