aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2017-02-01 10:11:47 +0100
committerThomas Lenz <thomas.lenz@egiz.gv.at>2017-02-01 10:11:47 +0100
commit45819f5a12b1942d5c942ec909e22536b16aa56c (patch)
tree830251fbfbb286d57834fb42423f57ac51160b6b
parent22607c8b05d03e7da006e34713231f6c41ea9f1b (diff)
downloadmoa-sig-45819f5a12b1942d5c942ec909e22536b16aa56c.tar.gz
moa-sig-45819f5a12b1942d5c942ec909e22536b16aa56c.tar.bz2
moa-sig-45819f5a12b1942d5c942ec909e22536b16aa56c.zip
fix wrong result in VerifyPDFSignatureResponse
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java16
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java14
2 files changed, 25 insertions, 5 deletions
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java
index fafbc16..91dc6b9 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java
@@ -69,6 +69,22 @@ public class ResponseBuilderUtils {
private static final String XMLNS_NS_URI = Constants.XMLNS_NS_URI;
/**
+ * Add an DOM element with a specific name as child to a root element
+ *
+ * @param elementName Name of the DOM element
+ * @param response Full document with namespace information
+ * @param rootElement Root element
+ * @return new child DOM element
+ */
+ public static Element addChildElement(String elementName, Document response,
+ Element rootElement) {
+ Element childElement = response.createElementNS(MOA_NS_URI, elementName);
+ rootElement.appendChild(childElement);
+ return childElement;
+
+ }
+
+ /**
* Create a response element with all the namespaces set.
*
* @param responseName The name of the response root element.
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java
index f58b68a..98b54a3 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/VerifyPDFSignatureResponseBuilder.java
@@ -48,7 +48,7 @@ public class VerifyPDFSignatureResponseBuilder {
/** The XML document containing the response element. */
private Document responseDoc;
/** The response <code>VerifyCMSSignatureResponse</code> DOM element. */
- private Element responseElem;
+ private Element responseRootElem;
/**
* Create a new <code>VerifyCMSSignatureResponseBuilder</code>:
@@ -59,7 +59,7 @@ public class VerifyPDFSignatureResponseBuilder {
public VerifyPDFSignatureResponseBuilder() throws MOASystemException {
responseDoc =
ResponseBuilderUtils.createResponse("VerifyPDFSignatureResponse");
- responseElem = responseDoc.getDocumentElement();
+ responseRootElem = responseDoc.getDocumentElement();
}
/**
@@ -78,10 +78,13 @@ public class VerifyPDFSignatureResponseBuilder {
Iterator iter;
+
for (iter = response.getResponseElements().iterator(); iter.hasNext();) {
VerifyCMSSignatureResponseElement responseElement =
- (VerifyCMSSignatureResponseElement) iter.next();
- addResponseElement(responseElement);
+ (VerifyCMSSignatureResponseElement) iter.next();
+ Element signatureResult = ResponseBuilderUtils.addChildElement("SignatureResult", responseDoc, responseRootElem);
+ addResponseElement(responseElement, signatureResult);
+
}
return responseDoc;
@@ -91,9 +94,10 @@ public class VerifyPDFSignatureResponseBuilder {
* Add an element to the response.
*
* @param responseElement The element to add to the response.
+ * @param signatureResult
* @throws MOAApplicationException An error occurred adding the element.
*/
- private void addResponseElement(VerifyCMSSignatureResponseElement responseElement)
+ private void addResponseElement(VerifyCMSSignatureResponseElement responseElement, Element responseElem)
throws MOAApplicationException {
SignerInfo signerInfo = responseElement.getSignerInfo();