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

Fernando Guallini fguallini at openjdk.org
Tue Oct 1 14:37:45 UTC 2024


The test **sun/security/tools/jarsigner/PreserveRawManifestEntryAndDigest.java** may 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]


The failure occurs due to a mismatch in the expected timestamp format, this happens because jarsigner uses the system's current timezone for output timestamps when signing. The current regular expression expects a timestamp length of 28 or 29 characters, which works if the test is run from a timezone like PST or CEST. However, it fails for longer timezone formats, such as 'GMT+07:00'.

This PR updates the regular expression ensuring that the test can handle a wider range of timezone strings. Also, removed a couple of unused params from a method.

-------------

Commit messages:
 - Merge branch 'master' into 8340116
 - broader timestamp regex

Changes: https://git.openjdk.org/jdk/pull/21280/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21280&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8340116
  Stats: 3 lines in 1 file changed: 0 ins; 2 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/21280.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21280/head:pull/21280

PR: https://git.openjdk.org/jdk/pull/21280


More information about the security-dev mailing list