From 7b883e536a32606dd9d940479634a8d0055d1e57 Mon Sep 17 00:00:00 2001 From: tknall Date: Mon, 12 Nov 2007 15:40:19 +0000 Subject: fatal bug fixed (parsing for signed-data-object-ids) git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@223 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../wag/egov/egiz/sig/connectors/bku/BKUHelper.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/main/java/at/knowcenter') diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java index 5e3033e..8f0b79e 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java @@ -341,14 +341,21 @@ public final class BKUHelper private static String extractId(String text, String name) { String id = null; - int start_idx = text.indexOf(name) + name.length(); + // fatal bug; fixed by tknall (start) + int startOfName = text.indexOf(name); + if (startOfName == -1) { + log.debug("No id for name \"" + name + "\" extracted. Probably detached signature. Returning empty id: \"\""); //$NON-NLS-1$ + return ""; + } + // stop + + int start_idx = startOfName + name.length(); int end_idx = text.indexOf("\"", start_idx); //$NON-NLS-1$ final int quot_end_idx = end_idx; final int squot_end_idx = text.indexOf("'", start_idx); //$NON-NLS-1$ end_idx = Math.min(quot_end_idx, squot_end_idx); id = text.substring(start_idx, end_idx); - log.info("extract id:" + name + id); //$NON-NLS-1$ if (log.isDebugEnabled()) { log.debug("extract id:" + name + id); //$NON-NLS-1$ -- cgit v1.2.3