From 015dbf6dcdc56893bc97a062a905e90b1c2ea529 Mon Sep 17 00:00:00 2001 From: tknall Date: Fri, 11 Sep 2009 07:11:57 +0000 Subject: Bugfixes git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@339 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../java/at/gv/egiz/pdfas/exceptions/ErrorCode.java | 1 + .../verificator/binary/BinaryVerificator_1_0_0.java | 4 +++- .../helper/VerificationFilterBinaryHelper.java | 20 ++++++++++++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-) (limited to 'src/main/java/at/gv/egiz') diff --git a/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java b/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java index c51d10a..d903c9b 100644 --- a/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java +++ b/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java @@ -59,6 +59,7 @@ public final class ErrorCode public static final int PLACEHOLDER_EXCEPTION = 700; public static final int CAPTION_NOT_FOUND_EXCEPTION = 701; + public static final int UNABLE_TO_PARSE_ID = 800; public static final int CORRECTOR_EXCEPTION = 801; public static final int EXTERNAL_CORRECTOR_TIMEOUT_REACHED = 802; diff --git a/src/main/java/at/gv/egiz/pdfas/impl/verificator/binary/BinaryVerificator_1_0_0.java b/src/main/java/at/gv/egiz/pdfas/impl/verificator/binary/BinaryVerificator_1_0_0.java index c2ec8ff..3107368 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/verificator/binary/BinaryVerificator_1_0_0.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/verificator/binary/BinaryVerificator_1_0_0.java @@ -29,6 +29,7 @@ import at.gv.egiz.pdfas.framework.input.PdfDataSource; import at.gv.egiz.pdfas.framework.verificator.Verificator; import at.gv.egiz.pdfas.impl.input.CompoundPdfDataSourceImpl; import at.gv.egiz.pdfas.impl.input.DelimitedPdfDataSource; +import at.gv.egiz.pdfas.impl.vfilter.helper.VerificationFilterBinaryHelper; import at.knowcenter.wag.egov.egiz.PdfASID; import at.knowcenter.wag.egov.egiz.cfg.ConfigLogger; import at.knowcenter.wag.egov.egiz.cfg.SettingsReader; @@ -150,7 +151,8 @@ public class BinaryVerificator_1_0_0 implements Verificator ArrayParseResult kz_apr = (ArrayParseResult) getRequiredValueOfKey(pdf, egiz_dict, EGIZ_KZ_NAME); PdfASID kz = null; - String kz_string = VerificationFilter.restoreKZ(pdf, kz_apr); +// String kz_string = VerificationFilter.restoreKZ(pdf, kz_apr); + String kz_string = VerificationFilterBinaryHelper.restoreKZ(pdf, kz_apr); kz = new PdfASID(kz_string); if (!kz_string.equals(getMyId().toString())) { diff --git a/src/main/java/at/gv/egiz/pdfas/impl/vfilter/helper/VerificationFilterBinaryHelper.java b/src/main/java/at/gv/egiz/pdfas/impl/vfilter/helper/VerificationFilterBinaryHelper.java index b7f36d1..3ee5da0 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/vfilter/helper/VerificationFilterBinaryHelper.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/vfilter/helper/VerificationFilterBinaryHelper.java @@ -7,8 +7,10 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import at.gv.egiz.pdfas.exceptions.ErrorCode; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import at.gv.egiz.pdfas.exceptions.ErrorCode; import at.knowcenter.wag.egov.egiz.PdfASID; import at.knowcenter.wag.egov.egiz.exceptions.InvalidIDException; import at.knowcenter.wag.egov.egiz.exceptions.PDFDocumentException; @@ -41,6 +43,11 @@ public final class VerificationFilterBinaryHelper */ public static final byte[] EGIZ_KZ_NAME = { 'I', 'D' }; + /** + * The log. + */ + private static final Log log = LogFactory.getLog(VerificationFilterBinaryHelper.class); + /** * Tells, if the given incremental update block contains a binary signature. * @@ -128,7 +135,13 @@ public final class VerificationFilterBinaryHelper { List partition = new ArrayList(); - for (int i = 0; i < kz_apr.elements.size() / 2; i++) + int linesToProcess = (kz_apr.elements.size() / 2); + log.trace("Lines to process for KZ: " + linesToProcess); + if (linesToProcess > 1) { + log.debug("HOTFIX: forcing single line to process"); + linesToProcess = 1; + } + for (int i = 0; i < linesToProcess; i++) { NumberParseResult start_npr = (NumberParseResult) kz_apr.elements.get(i * 2); NumberParseResult length_npr = (NumberParseResult) kz_apr.elements.get(i * 2 + 1); @@ -136,7 +149,10 @@ public final class VerificationFilterBinaryHelper StringInfo si = new StringInfo(); si.string_start = start_npr.number; si.string_length = length_npr.number; + si.pdf = pdf; + log.trace("Adding KZ: " + si.toString()); + partition.add(si); } -- cgit v1.2.3