From e0d280a78d86f32866d80a2a7e97db4d5a6292fd Mon Sep 17 00:00:00 2001 From: tknall Date: Mon, 28 Jan 2013 17:29:47 +0000 Subject: Minor issues (e.g. source code encoding issues) fixed. Cleanup tasks... git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/pdf-as/trunk@929 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../at/gv/egiz/pdfas/exceptions/ErrorCode.java | 3 +- .../gv/egiz/pdfas/exceptions/ErrorCodeHelper.java | 2 +- .../placeholder/SignaturePlaceholderExtractor.java | 1 - .../java/at/gv/egiz/pdfas/utils/PDFASUtils.java | 2 +- .../java/at/knowcenter/wag/egov/egiz/PdfAS.java | 33 +++++++---------- .../wag/egov/egiz/cfg/SettingsReader.java | 2 +- .../egov/egiz/framework/VerificationFilter.java | 2 +- .../wag/egov/egiz/pdf/AdobeSignatureHelper.java | 3 +- .../wag/egov/egiz/pdf/ObjectExtractor.java | 2 +- .../at/knowcenter/wag/egov/egiz/pdf/PDFPage.java | 31 ++++++---------- .../wag/egov/egiz/pdf/PDFSignatureObjectIText.java | 8 ++-- .../knowcenter/wag/egov/egiz/pdf/PDFUtilities.java | 22 +++++------ .../knowcenter/wag/egov/egiz/pdf/Placeholder.java | 2 - .../wag/egov/egiz/pdf/PositioningInstruction.java | 43 ++++++++++++++++++++++ .../wag/egov/egiz/pdf/StructContentHelper.java | 2 +- .../wag/egov/egiz/sig/SignatureObject.java | 16 ++++---- .../wag/egov/egiz/sig/SignatureResponse.java | 2 +- .../egov/egiz/sig/connectors/bku/BKUHelper.java | 2 +- .../sig/connectors/bku/SignSignatureObject.java | 2 +- .../egiz/sig/connectors/moa/MOASoapConnection.java | 9 ++--- 20 files changed, 107 insertions(+), 82 deletions(-) (limited to 'pdf-as-lib/src/main/java') diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java index df321df..e0ddbf2 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java @@ -57,7 +57,8 @@ public final class ErrorCode public static final int SIGNATURE_PLACEHOLDER_EXTRACTION_FAILED = 233; public static final int INVALID_SIGNATURE_POSITION = 224; - + public static final int NO_TEXTUAL_CONTENT = 251; + public static final int SIGNATURE_COULDNT_BE_CREATED = 300; public static final int SIGNED_TEXT_EMPTY = 301; public static final int PROFILE_NOT_DEFINED = 302; diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCodeHelper.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCodeHelper.java index 25644cd..c67e860 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCodeHelper.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCodeHelper.java @@ -102,7 +102,7 @@ public class ErrorCodeHelper cnfe = (CaptionNotFoundException)e.getCause(); } - message += " Die Überschrift (Caption/Label) \"" + cnfe.getCaption() + "\" wurde nicht wiedergefunden."; + message += " Die \u00DCberschrift (Caption/Label) \"" + cnfe.getCaption() + "\" wurde nicht wiedergefunden."; } message += " " + ErrorCodeHelper.getMessageForErrorCode(e.getErrorCode()); diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java index 8abe516..8b8c22e 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java @@ -327,7 +327,6 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine { } } } catch (ReaderException re) { - re.printStackTrace(); if (log.isDebugEnabled()) { log.debug("Could not decode - not a placeholder. needed: " + (System.currentTimeMillis() - before)); diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/utils/PDFASUtils.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/utils/PDFASUtils.java index 4cd3bd5..7f09dfc 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/utils/PDFASUtils.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/utils/PDFASUtils.java @@ -42,7 +42,7 @@ import com.lowagie.text.pdf.PdfReader; */ public class PDFASUtils { //23.11.2010 changed by exthex - added checkDocumentPermissions(PDDocument doc) - + private PDFASUtils() { } diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java index c222259..fa9d4c1 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java @@ -115,7 +115,7 @@ public abstract class PdfAS * The current version of the pdf-as library. This version string is logged on every invocation * of the api or the web application. */ - public static final String PDFAS_VERSION = "3.2"; + public static final String PDFAS_VERSION = "3.3-SNAPSHOT"; /** * The key of the strict mode setting. @@ -123,14 +123,14 @@ public abstract class PdfAS public static final String STRICT_MODE_KEY = "strict_mode"; /** - * The left/right border. + * The left/right margin. */ - public static final float SIGNATURE_BORDER = 100f; + public static final float SIGNATURE_MARGIN_HORIZONTAL = 50f; /** - * The top/bottom border. + * The top/bottom margin. */ - public static final float SIGNATURE_MARGIN = 20f; + public static final float SIGNATURE_MARGIN_VERTICAL = 20f; /** * The Mime Type of a PDF document. @@ -1333,19 +1333,11 @@ public abstract class PdfAS Rectangle psize = reader.getPageSizeWithRotation(page); int page_rotation = reader.getPageRotation(page); -// [tknall] for iText 1.x.x: -// float page_width = psize.width(); -// float page_height = psize.height(); - -// [tknall] for iText 2.x.x: -// float page_width = psize.getWidth(); -// float page_height = psize.getHeight(); - float page_width = psize.getWidth(); float page_height = psize.getHeight(); // now we can calculate x-position - float pre_pos_x = SIGNATURE_BORDER / 2; + float pre_pos_x = SIGNATURE_MARGIN_HORIZONTAL; if (!pos.isXauto()) { // we do have absolute x @@ -1353,7 +1345,7 @@ public abstract class PdfAS } // calculate width // center - float pre_width = page_width - pre_pos_x - pre_pos_x; + float pre_width = page_width - 2*pre_pos_x; if (!pos.isWauto()) { // we do have absolute width @@ -1368,6 +1360,7 @@ public abstract class PdfAS // Signatur table dimensions are complete pdf_table.setTotalWidth(width); pdf_table.setLockedWidth(true); + final float table_height = pdf_table.getTotalHeight(); // now check pos_y float pos_y = pos.getPosY(); @@ -1385,7 +1378,7 @@ public abstract class PdfAS { // ignore footer in new page page++; - pos_y = page_height - SIGNATURE_BORDER / 2; + pos_y = page_height - SIGNATURE_MARGIN_VERTICAL; return new PositioningInstruction(make_new_page, page, pos_x, pos_y); } // up to here no checks have to be made if Tablesize and Pagesize are fit @@ -1397,7 +1390,7 @@ public abstract class PdfAS // we do have an empty page or nothing in area above footerline pre_page_length = page_height; // no text --> SIGNATURE_BORDER - pos_y = page_height - SIGNATURE_BORDER / 2; + pos_y = page_height - SIGNATURE_MARGIN_VERTICAL; if (pos_y - footer_line <= table_height) { make_new_page = true; @@ -1408,13 +1401,13 @@ public abstract class PdfAS } page++; // no text --> SIGNATURE_BORDER - pos_y = page_height - SIGNATURE_BORDER / 2; + pos_y = page_height - SIGNATURE_MARGIN_VERTICAL; } return new PositioningInstruction(make_new_page, page, pos_x, pos_y); } final float page_length = pre_page_length; // we do have text take SIGNATURE_MARGIN - pos_y = page_height - page_length - SIGNATURE_MARGIN; + pos_y = page_height - page_length - SIGNATURE_MARGIN_VERTICAL; if (pos_y - footer_line <= table_height) { make_new_page = true; @@ -1426,7 +1419,7 @@ public abstract class PdfAS } page++; // no text --> SIGNATURE_BORDER - pos_y = page_height - SIGNATURE_BORDER / 2; + pos_y = page_height - SIGNATURE_MARGIN_VERTICAL; } return new PositioningInstruction(make_new_page, page, pos_x, pos_y); } diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java index 6bc1c99..352c594 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/cfg/SettingsReader.java @@ -77,7 +77,7 @@ import at.knowcenter.wag.egov.egiz.tools.FileHelper; * error.code.200=Das Dokument konnte nicht geladen werden * * #SignatureException - * error.code.300=Die Signatur ist ungültig + * error.code.300=Die Signatur ist ungültig * * #NormalizeException * error.code.400=Die angegebene Version ist nicht bekannt diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java index 0bab96f..d50792b 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java @@ -259,7 +259,7 @@ public class VerificationFilter if (signature_block_detected && !current_block_contains_signature) { if (!supressException) { - throw new PDFDocumentException(ErrorCode.MODIFIED_AFTER_SIGNATION, "Das Dokument wurde nach erfolgter Signierung verändert."); + throw new PDFDocumentException(ErrorCode.MODIFIED_AFTER_SIGNATION, "Das Dokument wurde nach erfolgter Signierung ver\u00E4ndert."); } } diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java index e337e71..a67f789 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/AdobeSignatureHelper.java @@ -123,6 +123,7 @@ public class AdobeSignatureHelper { // the following line marks the sig block as adobe sig // sap.setVisibleSignature(createRectangleFromTablePos(iui.actualTablePos), // iui.actualTablePos.page, "PDF-AS-Signatur"); + // zero size rectangle -> signature block not shown as adobe visible signature sap.setVisibleSignature(new Rectangle(0, 0, 0, 0), atp.page, finalFieldName); String subfilter = "unknown"; if (so != null && so.getKZ() != null) { @@ -207,7 +208,7 @@ public class AdobeSignatureHelper { } private static String getAdobeReasonName(String sigProfile) { - return getDefaultableConfigProperty(sigProfile, ADOBE_SIGN_REASONNAME_KEY, "Informationen zur Prüfung finden Sie unter http://www.signaturpruefung.gv.at"); + return getDefaultableConfigProperty(sigProfile, ADOBE_SIGN_REASONNAME_KEY, "Informationen zur Pr\u00FCfung finden Sie unter http://www.signaturpruefung.gv.at"); } private static String getVerifyUrl(String sigProfile) { diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/ObjectExtractor.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/ObjectExtractor.java index eb7377a..09f6d38 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/ObjectExtractor.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/ObjectExtractor.java @@ -158,7 +158,7 @@ public class ObjectExtractor { objInfo.setHeight(image.getHeight()); objInfo.setWidth(image.getWidth()); - objInfo.setName(key + image.getSuffix()); + objInfo.setName(key + "." + image.getSuffix()); objInfo.setObjectType(NonTextObjectInfo.TYPE_IMAGE); objInfo.setPageNr(pageNr); objectInfos.add(objInfo); diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java index a0311da..7de89d2 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java @@ -74,22 +74,22 @@ public class PDFPage extends PDFTextStripper protected float max_image_ypos = Float.NEGATIVE_INFINITY; /** - * The y coordinate of the footer line. PDF elements below this footer line will not be regarded. + * The effective page height. */ - protected float footer_line = 0.0f; + protected float effectivePageHeight; /** * Constructor. * - * @param footer_line The y coordinate of the footer line. PDF elements below this footer line will not be regarded. + * @param effectivePageHeight The height of the page to be evaluated. PDF elements outside this height will not be considered. * * @throws IOException */ - public PDFPage(float footer_line) throws IOException + public PDFPage(float effectivePageHeight) throws IOException { super(); - this.footer_line = footer_line; + this.effectivePageHeight = effectivePageHeight; OperatorProcessor newInvoke = new MyInvoke(); newInvoke.setContext(this); @@ -140,9 +140,8 @@ public class PDFPage extends PDFTextStripper float page_height = page.findMediaBox().getHeight(); current_y = page_height - text.getX(); } - - - if (current_y > this.footer_line) + + if (current_y > this.effectivePageHeight) { //logger_.debug("character is below footer_line. footer_line = " + this.footer_line + ", text.character=" + character + ", y=" + current_y); return; @@ -152,12 +151,8 @@ public class PDFPage extends PDFTextStripper if (!character.equals(" ") && current_y > this.max_character_ypos) { this.max_character_ypos = current_y; - //logger_.debug("text.character=" + character + ", y=" + current_y); - // System.err.println(character + "|" + current_y); } - //logger_.error("text.character=" + character + ", y=" + current_y + " max_c=" + this.max_character_ypos); - // System.err.println(character + "|" + current_y); } // use this funtion getting an unsorted text output @@ -182,7 +177,7 @@ public class PDFPage extends PDFTextStripper { max_ypos = this.max_image_ypos; } - //logger_.error("max len=" + max_ypos); + return max_ypos; } @@ -192,7 +187,6 @@ public class PDFPage extends PDFTextStripper public void process(PDFOperator operator, List arguments) throws IOException { COSName name = (COSName) arguments.get(0); - //logger_.error(""); // PDResources res = context.getResources(); @@ -203,13 +197,12 @@ public class PDFPage extends PDFTextStripper COSStream cos_stream = stream.getStream(); COSName subtype = (COSName) cos_stream.getDictionaryObject(COSName.SUBTYPE); - //logger_.error(""); if (subtype.equals(COSName.IMAGE)) { - //logger_.error("XObject Image"); + logger_.debug("XObject Image"); Matrix ctm = context.getGraphicsState().getCurrentTransformationMatrix(); - //logger_.debug("ctm = " + ctm); + logger_.debug("ctm = " + ctm); Pos [] coordinates = new Pos [] { new Pos(0, 0, 1), @@ -275,9 +268,9 @@ public class PDFPage extends PDFTextStripper logger_.debug("actual_lowest_point = " + actual_lowest_point); - if (actual_lowest_point > PDFPage.this.footer_line && actual_starting_point > PDFPage.this.footer_line) + if (actual_lowest_point > PDFPage.this.effectivePageHeight && actual_starting_point > PDFPage.this.effectivePageHeight) { - logger_.debug("image is below footer_line. footer_line = " + PDFPage.this.footer_line); + logger_.debug("image is below footer_line"); return; } diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFSignatureObjectIText.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFSignatureObjectIText.java index 1145619..a8a150e 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFSignatureObjectIText.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFSignatureObjectIText.java @@ -418,7 +418,7 @@ public class PDFSignatureObjectIText implements PDFSignatureObject logger_.debug("Image file declaration is relative. Prepending path of resources directory."); img_file = new File(SettingsReader.relocateFile(img_ref)); } else { - logger_.debug("Image file declaration is absolute. Skipping file relocation."); + logger_.debug("Image file declaration is absolute. Skipping file relocation."); } // String img_location = SettingsReader.relocateFile(img_ref); // File img_file = new File (img_location); @@ -447,7 +447,7 @@ public class PDFSignatureObjectIText implements PDFSignatureObject { logger_.error("BadElementException:" + e.getMessage()); } - PDFDocumentException pde = new PDFDocumentException(220, "PDF table can not created"); + PDFDocumentException pde = new PDFDocumentException(220, "Unable to create PDF table."); throw pde; } catch (MalformedURLException e) @@ -456,7 +456,7 @@ public class PDFSignatureObjectIText implements PDFSignatureObject { logger_.error("MalformedURLException:" + e.getMessage()); } - PDFDocumentException pde = new PDFDocumentException(221, "PDF table can not created"); + PDFDocumentException pde = new PDFDocumentException(221, "Unable to create PDF table."); throw pde; } catch (IOException e) @@ -465,7 +465,7 @@ public class PDFSignatureObjectIText implements PDFSignatureObject { logger_.error("Error Code: 222, IOException:" + e.getMessage()); } - PDFDocumentException pde = new PDFDocumentException(222, "PDF table can not created: Image can not loaded"); + PDFDocumentException pde = new PDFDocumentException(222, "Unable to create PDF table, unable to load image."); throw pde; } break; diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFUtilities.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFUtilities.java index e2a3d06..bdc1078 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFUtilities.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFUtilities.java @@ -50,7 +50,7 @@ import com.lowagie.text.DocumentException; */ public abstract class PDFUtilities { - public static float calculatePageLength(final PdfDataSource pdfDataSource,int page ,float footer_line, int pagerotation) throws PDFDocumentException + public static float calculatePageLength(final PdfDataSource pdfDataSource, int page, float effectivePageHeight, int pagerotation) throws PDFDocumentException { try { @@ -67,7 +67,7 @@ public abstract class PDFUtilities parser.parse(); PDDocument pdfDocument_ = parser.getPDDocument(); - float page_length = calculatePageLength(pdfDocument_,page , footer_line, pagerotation); + float page_length = calculatePageLength(pdfDocument_, page, effectivePageHeight, pagerotation); pdfDocument_.close(); return page_length; } @@ -80,23 +80,23 @@ public abstract class PDFUtilities throw new PDFDocumentException(201, e); } } - public static float calculatePageLength(PDDocument document,int page ,float footer_line, int pagerotation) throws IOException + public static float calculatePageLength(PDDocument document, int page, float effectivePageHeight, int pagerotation) throws IOException { //int last_page_id = document.getNumberOfPages(); List allPages = document.getDocumentCatalog().getAllPages(); PDPage pdpage = (PDPage) allPages.get(page); pdpage.setRotation(pagerotation); - return calculatePageLength(pdpage, footer_line); + return calculatePageLength(pdpage, effectivePageHeight); } /** * @deprecated * @param pdf - * @param footer_line + * @param effectivePageHeight * @return * @throws PDFDocumentException */ - public static float calculateLastPageLength(final byte[] pdf, float footer_line) throws PDFDocumentException + public static float calculateLastPageLength(final byte[] pdf, float effectivePageHeight) throws PDFDocumentException { try { @@ -112,7 +112,7 @@ public abstract class PDFUtilities parser.parse(); PDDocument pdfDocument_ = parser.getPDDocument(); - float last_page_length = calculateLastPageLength(pdfDocument_, footer_line); + float last_page_length = calculateLastPageLength(pdfDocument_, effectivePageHeight); pdfDocument_.close(); return last_page_length; @@ -127,20 +127,20 @@ public abstract class PDFUtilities } } - public static float calculateLastPageLength(PDDocument document, float footer_line) throws IOException + public static float calculateLastPageLength(PDDocument document, float effectivePageHeight) throws IOException { int last_page_id = document.getNumberOfPages(); List allPages = document.getDocumentCatalog().getAllPages(); PDPage last_page = (PDPage) allPages.get(last_page_id - 1); - return calculatePageLength(last_page, footer_line); + return calculatePageLength(last_page, effectivePageHeight); } - public static float calculatePageLength(PDPage page, float footer_line) throws IOException + public static float calculatePageLength(PDPage page, float effectivePageHeight) throws IOException { // logger_.debug("Last Page id:" + last_page_id); // PDPage last_page = (PDPage) allPages.get(0); - PDFPage my_page = new PDFPage(footer_line); + PDFPage my_page = new PDFPage(effectivePageHeight); my_page.processStream(page, page.findResources(), page.getContents().getStream()); return my_page.getMaxPageLength(); } diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java index 9249985..101a2b0 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/Placeholder.java @@ -32,8 +32,6 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import javax.sound.midi.SysexMessage; - import org.apache.commons.codec.net.URLCodec; import org.apache.log4j.Logger; diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PositioningInstruction.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PositioningInstruction.java index 7af4ce7..0fe399c 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PositioningInstruction.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PositioningInstruction.java @@ -136,4 +136,47 @@ public class PositioningInstruction return this.y; } + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + (make_new_page ? 1231 : 1237); + result = prime * result + page; + result = prime * result + Float.floatToIntBits(x); + result = prime * result + Float.floatToIntBits(y); + return result; + } + + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof PositioningInstruction)) + return false; + PositioningInstruction other = (PositioningInstruction) obj; + if (make_new_page != other.make_new_page) + return false; + if (page != other.page) + return false; + if (Float.floatToIntBits(x) != Float.floatToIntBits(other.x)) + return false; + if (Float.floatToIntBits(y) != Float.floatToIntBits(other.y)) + return false; + return true; + } + + public String toString() { + StringBuffer buffer = new StringBuffer(); + buffer.append("PositioningInstruction [page="); + buffer.append(page); + buffer.append(", make_new_page="); + buffer.append(make_new_page); + buffer.append(", x="); + buffer.append(x); + buffer.append(", y="); + buffer.append(y); + buffer.append("]"); + return buffer.toString(); + } + } diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java index 7ca5a0a..a9c1c54 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java @@ -167,7 +167,7 @@ public class StructContentHelper implements StructContentWriter { this.structTreeRootKids = obtainStructTreeRootKids(structTreeRoot); - if(this.structTreeRootKids == null) + if (this.structTreeRootKids == null) { this.structTreeRootKids = this.createStructTreeRootKids(structTreeRoot); } diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java index 8855b86..9e28213 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureObject.java @@ -597,9 +597,9 @@ public class SignatureObject implements Serializable * correction this will result in broken signatures.
* e.g this * invalid IssuerName (note the space before the second RND CN): - * serialNumber=863532247989, CN=BMUKK - Amtssignatur Schulen,OU=Abt. IT/2,O=Bundesministerium für Unterricht, Kunst und Kultur,C=AT + * serialNumber=863532247989, CN=BMUKK - Amtssignatur Schulen,OU=Abt. IT/2,O=Bundesministerium für Unterricht, Kunst und Kultur,C=AT * will be normalized to: - * serialNumber=863532247989,CN=BMUKK - Amtssignatur Schulen,OU=Abt. IT/2,O=Bundesministerium für Unterricht, Kunst und Kultur,C=AT + * serialNumber=863532247989,CN=BMUKK - Amtssignatur Schulen,OU=Abt. IT/2,O=Bundesministerium für Unterricht, Kunst und Kultur,C=AT * @param The invalid RFC2253 name as string. * @return The normalized RFC2253 name without spaces prior to RDNs. */ @@ -805,13 +805,13 @@ public class SignatureObject implements Serializable */ private static String resolveRDN(String certString, String value, String extractedRDN) { - if(!certString.contains(value)) { + if (!certString.contains(value)) { // given value cannot be found in certificate string return extractedRDN; } - if(certString.indexOf(value) != certString.lastIndexOf(value)) { + if (certString.indexOf(value) != certString.lastIndexOf(value)) { // given value is ambiguous - cannot resolve RDN from certificate string return extractedRDN; @@ -820,15 +820,15 @@ public class SignatureObject implements Serializable String[] parts = certString.split(",|;"); String val = value.trim(); - for(int i=0; i"); //$NON-NLS-1$ Pattern erm_p_e = Pattern.compile(""); //$NON-NLS-1$ diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/SignSignatureObject.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/SignSignatureObject.java index 72f181e..1aca88f 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/SignSignatureObject.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/SignSignatureObject.java @@ -211,7 +211,7 @@ public class SignSignatureObject implements Serializable, MandatorySignatureInfo //rpiazzi workaround //the problem with atrust encoding special characters (Sonderzeichen) wrong //led to this workaround. As special characters are of the form e.g. "&#xxx;" - //Example: for "Georg Müller" atrust returns "Georg Müller" + //Example: for "Georg Müller" atrust returns "Georg Müller" //By calling this.getX509Certificate().getSubjectDN().getName() you get "Georg Mü\;ller", //After that the down called method fillDNMap replaces the "\" with a "+" //Because of this the workaround in at.gv.egiz.pdfas.impl.signator.binary.BinarySignator_1_0_0.fillReplacesWithValues() diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOASoapConnection.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOASoapConnection.java index 7aa3d7b..05ff92f 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOASoapConnection.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOASoapConnection.java @@ -42,11 +42,8 @@ import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.methods.PostMethod; -import org.apache.commons.httpclient.methods.multipart.FilePart; -import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity; import org.apache.commons.httpclient.methods.multipart.Part; import org.apache.commons.httpclient.methods.multipart.PartSource; -import org.apache.commons.httpclient.methods.multipart.StringPart; import org.apache.commons.httpclient.params.HttpMethodParams; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -114,10 +111,10 @@ public final class MOASoapConnection ByteArrayInputStream bais = new ByteArrayInputStream(requestString.getBytes("UTF-8")); //$NON-NLS-1$ Document xmlRequest = builder.parse(bais); - // Call öffnen + // Call oeffnen Call call = null; - // Neues BodyElement anlegen und mit dem DOM-Baum füllen + // Neues BodyElement anlegen und mit dem DOM-Baum fuellen SOAPBodyElement body = new SOAPBodyElement(xmlRequest.getDocumentElement()); SOAPBodyElement[] params = new SOAPBodyElement[] { body }; @@ -126,7 +123,7 @@ public final class MOASoapConnection call = service.createCall(); call.setTargetEndpointAddress(endpointURL); - // Call auslösen und die Antworten speichern + // Call ausloesen und die Antworten speichern log.debug("Calling MOA: " + endpointURL); //$NON-NLS-1$ Vector responses = (Vector) call.invoke(params); -- cgit v1.2.3