diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java | 11 |
1 files changed, 9 insertions, 2 deletions
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$
|