From 99da8df4fbd6420632adec989e3fb13a641be591 Mon Sep 17 00:00:00 2001 From: pdanner Date: Mon, 29 Nov 2010 14:26:36 +0000 Subject: fixed some wprinz stuff git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@635 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../knowcenter/wag/egov/egiz/commandline/Main.java | 37 ++++++++++++---------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java b/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java index a746612..919201f 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java @@ -26,6 +26,7 @@ import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -34,6 +35,7 @@ import at.gv.egiz.pdfas.commandline.CommandlineConnectorChooser; import at.gv.egiz.pdfas.exceptions.ErrorCode; import at.gv.egiz.pdfas.exceptions.ErrorCodeHelper; import at.gv.egiz.pdfas.exceptions.external.ExternalErrorException; +import at.gv.egiz.pdfas.framework.DataSourceHolder; import at.gv.egiz.pdfas.framework.config.SettingsHelper; import at.gv.egiz.pdfas.framework.input.DataSource; import at.gv.egiz.pdfas.framework.input.ExtractionStage; @@ -569,7 +571,7 @@ public abstract class Main throw new PDFDocumentException(ErrorCode.DOCUMENT_CANNOT_BE_READ, e); } - List results = processVerify(dataSource, connector, verify_which); + List results = processVerify(new DataSourceHolder(dataSource), connector, verify_which); messageOutput.println("Verification results:"); formatVerifyResults(results, messageOutput); @@ -630,12 +632,12 @@ public abstract class Main String connectorId = CommandlineConnectorChooser.chooseCommandlineConnectorForSign(connector); - PdfAS.signCommandline(pdfDataSource, dataSink, signatorId, connectorId, signature_type, null, pos, null); + PdfAS.signCommandline(pdfDataSource, dataSink, signatorId, connectorId, signature_type, null, pos, null, null); // PdfAS.sign(algorithm, pdfDataSource, dataSink, signature_type, connector, pos); } - public static List processVerify(DataSource dataSource, String connector, int verify_which) throws PresentableException + public static List processVerify(DataSourceHolder dataSource, String connector, int verify_which) throws PresentableException { VerificationFilterParameters parameters = SettingsHelper.readVerificationFilterParametersFromSettings(); ExtractionStage es = new ExtractionStage(); @@ -883,7 +885,7 @@ public abstract class Main writer.print(" " + PARAMETER_SIGNATURE_TYPE + " <"); SignatureTypes sig_types = SignatureTypes.getInstance(); SettingsReader settings = SettingsReader.getInstance(); - List types_array = sig_types.getSignatureTypes(); + Set types_array = sig_types.getSignatureTypes(); Iterator it = types_array.iterator(); while (it.hasNext()) { @@ -982,18 +984,21 @@ public abstract class Main */ protected static boolean checkSignatureType(String signature_type) throws SignatureTypesException { - SignatureTypes sig_types = SignatureTypes.getInstance(); - List types_array = sig_types.getSignatureTypes(); - Iterator it = types_array.iterator(); - while (it.hasNext()) - { - String type = (String) it.next(); - if (type.equals(signature_type)) - { - return true; - } - } - return false; + return SignatureTypes.getInstance().getSignatureTypes().contains(signature_type); + + // exthex: uuuaaaahhhhh WHY??? wprinz again?, dont do that. Use List.contains(o), please + // take a java course and read: http://www.amazon.de/Java-f%C3%BCr-Dummies-Barry-Burd/dp/382662999X +// List types_array = sig_types.getSignatureTypes(); +// Iterator it = types_array.iterator(); +// while (it.hasNext()) +// { +// String type = (String) it.next(); +// if (type.equals(signature_type)) +// { +// return true; +// } +// } +// return false; } /** -- cgit v1.2.3