aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib/src/main/java/at/gv/egiz/pdfas
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-lib/src/main/java/at/gv/egiz/pdfas')
-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() {