aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-10-02 10:31:50 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-10-02 10:31:50 +0200
commit1483d928d358f1073e58510f3e12b1cf4984f269 (patch)
treec084b148168250d3583ee5ac56ede343bc24d2e2 /pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib
parent0876981fd70fdab07f7c3e1666cf77071b5fe03d (diff)
downloadpdf-as-4-1483d928d358f1073e58510f3e12b1cf4984f269.tar.gz
pdf-as-4-1483d928d358f1073e58510f3e12b1cf4984f269.tar.bz2
pdf-as-4-1483d928d358f1073e58510f3e12b1cf4984f269.zip
Verification results handed out ot application
Diffstat (limited to 'pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAs.java2
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java22
2 files changed, 9 insertions, 15 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAs.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAs.java
index 4b491064..92b2001a 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAs.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/api/PdfAs.java
@@ -28,7 +28,7 @@ public interface PdfAs {
* @param parameter The verification parameter
* @return A list of verification Results
*/
- public List<VerifyResult> verify(VerifyParameter parameter);
+ public List<VerifyResult> verify(VerifyParameter parameter) throws PdfAsException;
/**
* Gets a copy of the PDF-AS configuration, to allow the application to
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
index a8cee107..d2a21518 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
@@ -12,6 +12,7 @@ import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.security.SignatureException;
+import java.util.ArrayList;
import java.util.List;
import org.apache.pdfbox.cos.COSArray;
@@ -192,8 +193,9 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
}
}
- public List<VerifyResult> verify(VerifyParameter parameter) {
+ public List<VerifyResult> verify(VerifyParameter parameter) throws PdfAsException {
try {
+ List<VerifyResult> result = new ArrayList<VerifyResult>();
ISettings settings = (ISettings) parameter.getConfiguration();
VerifierDispatcher verifier = new VerifierDispatcher(settings);
PDDocument doc = PDDocument.load(new ByteArrayInputStream(parameter
@@ -251,20 +253,12 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
IVerifyFilter verifyFilter =
verifier.getVerifier(dict.getNameAsString("Filter"), dict.getNameAsString("SubFilter"));
- verifyFilter.verify(contentData.toByteArray(), content.getBytes());
+ List<VerifyResult> results =
+ verifyFilter.verify(contentData.toByteArray(), content.getBytes());
- /*
- * Iterator<Map.Entry<COSName, COSBase>> iterator =
- * dict.entrySet().iterator();
- *
- * while(iterator.hasNext()) { Map.Entry<COSName, COSBase>
- * entry = iterator.next(); System.out.println("Key: "
- * +entry.getKey().toString());
- *
- * }
- */
-
+ result.addAll(results);
}
+ return result;
}
} catch (IOException e) {
e.printStackTrace();
@@ -272,7 +266,7 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
// TODO Auto-generated catch block
e.printStackTrace();
}
- return null;
+ throw new PdfAsException();
}
public Configuration getConfiguration() {