diff options
Diffstat (limited to 'src/main/java/at/knowcenter')
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/pdf/NoSignatureHolder.java | 61 | ||||
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java | 17 |
2 files changed, 76 insertions, 2 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/NoSignatureHolder.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/NoSignatureHolder.java new file mode 100644 index 0000000..08e48bb --- /dev/null +++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/NoSignatureHolder.java @@ -0,0 +1,61 @@ +package at.knowcenter.wag.egov.egiz.pdf;
+
+import java.io.Serializable;
+
+import at.gv.egiz.pdfas.framework.input.DataSource;
+import at.knowcenter.wag.egov.egiz.sig.SignatureObject;
+
+public class NoSignatureHolder implements Serializable, SignatureHolder {
+
+ private static final long serialVersionUID = 1L;
+
+ // # sigs before modification
+ private int position;
+
+ public NoSignatureHolder(int pos) {
+ this.position = pos;
+ }
+
+ public DataSource getDataSource() {
+ return null;
+ }
+
+ public SignatureObject getSignatureObject() {
+ return null;
+ }
+
+ public int getPosition() {
+ return this.position;
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + this.position;
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj == null) {
+ return false;
+ }
+
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+
+ final NoSignatureHolder other = (NoSignatureHolder) obj;
+
+ if (this.position != other.position) {
+ return false;
+ }
+
+ return true;
+ }
+
+}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java index 7b935de..eb07828 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/web/servlets/VerifyServlet.java @@ -20,6 +20,7 @@ package at.knowcenter.wag.egov.egiz.web.servlets; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -50,6 +51,8 @@ import at.knowcenter.wag.egov.egiz.cfg.SettingsReader; import at.knowcenter.wag.egov.egiz.exceptions.PDFDocumentException;
import at.knowcenter.wag.egov.egiz.exceptions.PresentableException;
import at.knowcenter.wag.egov.egiz.exceptions.SettingNotFoundException;
+import at.knowcenter.wag.egov.egiz.pdf.NoSignatureHolder;
+import at.knowcenter.wag.egov.egiz.pdf.SignatureHolder;
import at.knowcenter.wag.egov.egiz.sig.ConnectorFactory;
import at.knowcenter.wag.egov.egiz.sig.SignatureResponse;
import at.knowcenter.wag.egov.egiz.web.FormFields;
@@ -324,12 +327,22 @@ public class VerifyServlet extends HttpServlet ExtractionStage es = new ExtractionStage();
List signature_holders = es.extractSignatureHolders(dataSource, parameters);
- if (signature_holders.size() == 0)
+ // filter out NoSignatureHolders that are possibly present due to the direct call method extractSignatureHolders()
+ List filtered_signature_holders = new ArrayList();
+ Iterator it = signature_holders.iterator();
+ while(it.hasNext()) {
+ SignatureHolder current = (SignatureHolder) it.next();
+ if(!(current instanceof NoSignatureHolder)) {
+ filtered_signature_holders.add(current);
+ }
+ }
+
+ if (filtered_signature_holders.size() == 0)
{
throw new PDFDocumentException(206, "PDF document not signed."); //$NON-NLS-1$
}
- return signature_holders;
+ return filtered_signature_holders;
}
// TODO obsolete method - remove
|