Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8340116

test/jdk/sun/security/tools/jarsigner/PreserveRawManifestEntryAndDigest.java can fail due to regex

XMLWordPrintable

        The following test:
        test/jdk/sun/security/tools/jarsigner/PreserveRawManifestEntryAndDigest.java

        could fail with the following exception:

        test PreserveRawManifestEntryAndDigest.testNameImmediatelyContinued(): failure
        java.lang.AssertionError: "s k 300 Tue Jun 25 10:20:16 GMT+07:00 2024 META-INF/MANIFEST.MF" should have matched "s k *\\d+ .{28,29} META-INF/MANIFEST[.]MF" expected [true] but found [false]
        at org.testng.Assert.fail(Assert.java:99)
        at org.testng.Assert.failNotEquals(Assert.java:1037)
        at org.testng.Assert.assertTrue(Assert.java:45)
        at PreserveRawManifestEntryAndDigest.assertMatchByLines(PreserveRawManifestEntryAndDigest.java:268)


        The reason is that the regex expects a certain timestamp length {28,29}, and it works fine for certain timezones such as PST or CEST, but it fails if the timezone string is longer such as 'GMT+07:00'.

              fguallini Fernando Guallini
              fguallini Fernando Guallini
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: