[
https://issues.apache.org/jira/browse/CAMEL-12181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16348226#comment-16348226
]
ASF GitHub Bot commented on CAMEL-12181:
davsclaus closed pull request #2203: CAMEL-12181: XML Signature: '#' missing in
ObjectReference attribute
URL: https://github.com/apache/camel/pull/2203
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/XAdESSignatureProperties.java
b/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/XAdESSignatureProperties.java
index 06ef1c7c9e3..da263dd9847 100644
---
a/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/XAdESSignatureProperties.java
+++
b/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/XAdESSignatureProperties.java
@@ -740,7 +740,7 @@ protected String addDataObjectFormat(Element
signedDataObjectProperties, Documen
Element dataObjectFormat = createElement("DataObjectFormat", doc,
input);
signedDataObjectProperties.appendChild(dataObjectFormat);
String contentReferenceId = "_" + UUID.randomUUID().toString();
-setAttribute(dataObjectFormat, "ObjectReference", contentReferenceId);
+setAttribute(dataObjectFormat, "ObjectReference", "#" +
contentReferenceId);
if (getDataObjectFormatDescription() != null &&
!getDataObjectFormatDescription().isEmpty()) {
Element description = createElement("Description", doc, input);
diff --git
a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java
b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java
index 5a75256c0b0..eb64c1afd3c 100644
---
a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java
+++
b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java
@@ -223,6 +223,7 @@ public void envelopingAllParameters() throws Exception {
//DataObjectFormat
checkXpath(doc, pathToDataObjectProperties +
"etsi:DataObjectFormat/etsi:Description/text()", prefix2Namespace, "invoice");
checkXpath(doc, pathToDataObjectProperties +
"etsi:DataObjectFormat/etsi:MimeType/text()", prefix2Namespace, "text/xml");
+checkXpath(doc, pathToDataObjectProperties +
"etsi:DataObjectFormat/@ObjectReference", prefix2Namespace, "#", true);
checkXpath(doc, pathToDataObjectProperties +
"etsi:DataObjectFormat/etsi:ObjectIdentifier/etsi:Identifier/text()",
prefix2Namespace, "1.2.840.113549.1.9.16.6.2");
checkXpath(doc, pathToDataObjectProperties +
"etsi:DataObjectFormat/etsi:ObjectIdentifier/etsi:Identifier/@Qualifier",
@@ -834,11 +835,18 @@ private void validateAgainstSchema(Document doc) throws
Exception {
static void checkXpath(Document doc, String xpathString, final Map prefix2Namespace, String expectedResult)
throws XPathExpressionException {
+checkXpath(doc, xpathString, prefix2Namespace, expectedResult, false);
+}
+
+ static void checkXpath(Document doc, String xpathString, final Map prefix2Namespace, String expectedResult, boolean startsWith)
+throws XPathExpressionException {
XPathExpression expr = getXpath(xpathString, prefix2Namespace);
String result = (String) expr.evaluate(doc, XPathConstants.STRING);
assertNotNull("The xpath " + xpathString + " returned a null value",
result);
-if (NOT_EMPTY.equals(expectedResult)) {
+if (startsWith) {
+assertTrue(result.startsWith(expectedResult));
+} else if (NOT_EMPTY.equals(expectedResult)) {
assertTrue("Not empty result for xpath " + xpathString + "
expected", !result.isEmpty());
} else {
assertEquals(expectedResult, result);
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org
> XML Signature: '#' missing in ObjectReference attribute of XADES element
> DataObjectFormat
> -
>
> Key: CAMEL-12181
> URL: