From 6009309445cbab4de8042c8c62184892683b5898 Mon Sep 17 00:00:00 2001 From: netconomy Date: Fri, 7 Dec 2007 10:47:04 +0000 Subject: neu: CaptionNotFoundException 701 in BinarySignature wenn zuwinig Platz, verbessertes Ex Handling git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@235 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/main/java/at/knowcenter/wag') diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java index 7a5af6b..44a13a4 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/BinarySignature.java @@ -37,6 +37,7 @@ import java.util.Iterator; import java.util.List; import at.gv.egiz.pdfas.exceptions.ErrorCode; +import at.gv.egiz.pdfas.exceptions.pdf.CaptionNotFoundException; import at.gv.egiz.pdfas.exceptions.pdf.KZSettingNotFoundException; import at.gv.egiz.pdfas.framework.input.PdfDataSource; import at.gv.egiz.pdfas.framework.output.DataSink; @@ -829,9 +830,10 @@ public abstract class BinarySignature * The field definitions. * @throws IOException * @throws SettingNotFoundException + * @throws CaptionNotFoundException */ protected static void createEgizDict(PdfStamper stamper, PdfTemplate table_template, IncrementalUpdateInformation iui, List variable_field_definitions, List all_field_definitions) - throws IOException, SettingNotFoundException + throws IOException, SettingNotFoundException, CaptionNotFoundException { // iui.temp_ir = table_template.getIndirectReference(); iui.temp_ir_number = table_template.getIndirectReference().getNumber(); @@ -1314,8 +1316,9 @@ public abstract class BinarySignature * where varaible strings are. * @return Returns the list of ReplaceInfo objects specifying the variable * areas. + * @throws CaptionNotFoundException */ - protected static List determineReplacesInContentStream(final byte[] pdf, int begin, int end, List field_definitions) + protected static List determineReplacesInContentStream(final byte[] pdf, int begin, int end, List field_definitions) throws CaptionNotFoundException { List replaces = new ArrayList(); try @@ -1336,6 +1339,10 @@ public abstract class BinarySignature byte[] caption = sfd.caption.getBytes("ISO-8859-1"); int caption_index = findIndex(strings, caption); + if (caption_index < 0) + { + throw new CaptionNotFoundException(sfd.caption); + } int start_index = skipStrings(strings, caption_index, caption); int next_index = findFirstNotPlaceholder(strings, start_index); -- cgit v1.2.3