[java-metadata-aggregator] branch maint-0.9 updated: MDA-216 - remove CRs from signatures made under Java 11

Ian Young ian at iay.org.uk
Thu Oct 17 11:34:15 EDT 2019


This is an automated email from the git hooks/post-receive script.

iay pushed a commit to branch maint-0.9
in repository java-metadata-aggregator.

View the commit online:
http://git.shibboleth.net/view/?p=java-metadata-aggregator.git;a=commit;h=d541e071595255c97164055044457283aeec923e

The following commit(s) were added to refs/heads/maint-0.9 by this push:
       new  d541e07   MDA-216 - remove CRs from signatures made under Java 11
d541e07 is described below

commit d541e071595255c97164055044457283aeec923e
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Thu Oct 17 16:34:01 2019 +0100

    MDA-216 - remove CRs from signatures made under Java 11
    
    Relaxed the canary in this test so as to handle the fact that in Oracle Java 8u231 (but not in equivalent OpenJDKs, etc.) the same change has been back-ported.
    
    Now, all we can really check for is that IF there's a difference when we turn off the option, some CRs have appeared.
---
 .../metadata/dom/XMLSignatureSigningStageTest.java   | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/XMLSignatureSigningStageTest.java b/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/XMLSignatureSigningStageTest.java
index d59b354..f6813ec 100644
--- a/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/XMLSignatureSigningStageTest.java
+++ b/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/XMLSignatureSigningStageTest.java
@@ -38,7 +38,6 @@ import org.xmlunit.input.NormalizedSource;
 import net.shibboleth.metadata.AssertSupport;
 import net.shibboleth.metadata.Item;
 import net.shibboleth.utilities.java.support.logic.ConstraintViolationException;
-import net.shibboleth.utilities.java.support.testing.TestSupport;
 import net.shibboleth.utilities.java.support.xml.SerializeSupport;
 import net.shibboleth.utilities.java.support.xml.XMLParserException;
 
@@ -75,7 +74,7 @@ public class XMLSignatureSigningStageTest extends BaseDOMTest {
      */
     private boolean containsCRs(@Nonnull final Element element) {
         final String string = SerializeSupport.nodeToString(element);
-        return string.contains("
");
+        return string.contains("
") || string.contains("&#xd");
     }
 
     /** Test signing with and verifying the result against a known good. */
@@ -203,6 +202,9 @@ public class XMLSignatureSigningStageTest extends BaseDOMTest {
 
         /*
          * The second result disables CR stripping.
+         *
+         * Whether this results in CRs depends on the version of Java: anything Java 11 onwards
+         * will, but so will Oracle Java 8u231.
          */
         final List<Item<Element>> mdCol2 = getInput("input.xml");
 
@@ -231,17 +233,11 @@ public class XMLSignatureSigningStageTest extends BaseDOMTest {
                 .build();
 
         /*
-         * Under Java 11 or later, with the latest Santuario, we expect the two results to be
-         * different. Under previous versions of Java, we expect them to be the same.
-         *
-         * We ascertained in other tests that they are both valid.
+         * If there are differences, the second result should be the one with CRs in it.
          */
-        if (TestSupport.isJavaV11OrLater()) {
-            Assert.assertTrue(containsCRs(result2.unwrap()), "expected CRs in result");
-            Assert.assertTrue(diff.hasDifferences(), "results were same, expected different");
-        } else {
-            Assert.assertFalse(containsCRs(result2.unwrap()), "did not expect CRs in result");
-            Assert.assertFalse(diff.hasDifferences(), "results were different, expected same");
+        if (diff.hasDifferences()) {
+            Assert.assertFalse(containsCRs(result1.unwrap())); // already tested above
+            Assert.assertTrue(containsCRs(result2.unwrap()));
         }
     }
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list