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

null SecureRandom algorithm throws NullPointerException

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.5.1, 2.0, 3.0, 4.0, 5.0, 6, 7, 8, 9
    • Fix Version/s: None
    • Component/s: security-libs

      Description

      When null is passed to SecureRandom algorithm in getInstance factory, then NPE is thrown.
      However spec (see in comments) is silent about this behavior.

      SecureRandom.getInstance(null) -> throws NPE
      SecureRandom.getInstance(null, DrbgParameters.instantiation(-1, DrbgParameters.Capability.NONE,null)); -> throws NPE.

      The getInstance variant which has only String parameter throws NPE for older java version up to 1.5 (i believe) as the stack trace gives info that it is originating from java.security.Provider#getService which is introduced in 1.5

      The tests under development, attached the test case.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                wetmore Bradford Wetmore
                Reporter:
                bnallakaluva Bharath Nallakaluva (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: