JDK-8277224 : sun.security.pkcs.PKCS9Attributes.toString() throws NPE
  • Type: Bug
  • Component: security-libs
  • Sub-Component: java.security
  • Affected Version: 7u331,8u321,11.0.14-oracle,18
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2021-11-16
  • Updated: 2022-04-17
  • Resolved: 2021-11-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 15 JDK 17 JDK 18 JDK 7 JDK 8 Other
11.0.14-oracleFixed 15.0.7Fixed 17.0.2Fixed 18 b25Fixed 7u331Fixed 8u321Fixed openjdk8u332Fixed
Related Reports
Relates :  
Description
Since the JDK-8242151 fix, some array elements of the PKCS9Attribute.PKCS9_OIDS array are null. 

PKCS9Attributes.toString() doesn't take this into account.

java.lang.NullPointerException: Cannot invoke "Object.hashCode()" because "key" is null
        at java.base/java.util.Hashtable.get(Hashtable.java:381)
        at java.base/sun.security.pkcs.PKCS9Attributes.getAttribute(PKCS9Attributes.java:262)
        at java.base/sun.security.pkcs.PKCS9Attributes.toString(PKCS9Attributes.java:331)
        at java.base/java.lang.StringConcatHelper.stringOf(StringConcatHelper.java:453)
        at java.base/java.lang.StringConcatHelper.simpleConcat(StringConcatHelper.java:408)
        at NonStandardNames.main(NonStandardNames.java:66)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:577)
        at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
        at java.base/java.lang.Thread.run(Thread.java:833)


Comments
verified
13-04-2022

Fix request (15u) the patch applies cleanly, relevant tests pass.
21-12-2021

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk15u-dev/pull/154 Date: 2021-12-20 15:53:21 +0000
20-12-2021

8u: Rebased to monojdk8u-dev: http://cr.openjdk.java.net/~zgu/JDK-8277224-8u/webrev.01/
03-12-2021

Fix Request (8u) Backport for parity with Oracle 8u331. The original patch does not apply cleanly. 8u patch has been reviewed by @phh
01-12-2021

8u code review: https://mail.openjdk.java.net/pipermail/jdk8u-dev/2021-December/014452.html
01-12-2021

Fix Request (11u): Should get backported for parity with 11.0.14-oracle. Applies cleanly.
23-11-2021

Changeset: 6bb04626 Author: Sean Coffey <coffeys@openjdk.org> Date: 2021-11-17 20:50:46 +0000 URL: https://git.openjdk.java.net/jdk/commit/6bb04626af6574ef1e8d4b7dad0389d4b59f5d08
17-11-2021

JDK 17u Fix request: Correct a minor regression on a jdk internal class
17-11-2021