From 591c7ec8451ea28dafec03b5d37276b943e444da Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Tue, 17 Dec 2013 11:09:11 +0100 Subject: Fix Value resolver bug for SIG_DATE --- .../pdfas/lib/impl/stamping/ValueResolver.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'pdf-as-lib/src/main') diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java index 38fead85..88051cf0 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java @@ -25,7 +25,7 @@ public class ValueResolver implements IProfileConstants, IResolver { public static final String PatternRegex = "\\$(\\{[^\\$]*\\})"; - private static final String defaultDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; + public static final String defaultDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; public static final String EXP_START = "${"; public static final String EXP_END = "}"; @@ -36,6 +36,16 @@ public class ValueResolver implements IProfileConstants, IResolver { logger.debug("Resolving value for key: " + key); logger.debug("Resolving value with value: " + value); + if (key.equals(SIG_DATE)) { + if (value == null) { + value = defaultDateFormat; + } + // Value holds the date format! + SimpleDateFormat formater = new SimpleDateFormat(value); + Calendar cal = Calendar.getInstance(); + return formater.format(cal.getTime()); + } + if (value != null) { Pattern pattern = Pattern.compile(PatternRegex); @@ -59,16 +69,6 @@ public class ValueResolver implements IProfileConstants, IResolver { return result; } - if (key.equals(SIG_DATE)) { - if (value == null) { - value = defaultDateFormat; - } - // Value holds the date format! - SimpleDateFormat formater = new SimpleDateFormat(value); - Calendar cal = Calendar.getInstance(); - return formater.format(cal.getTime()); - } - return value; } -- cgit v1.2.3