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

null SecureRandom algorithm throws NullPointerException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.5.1, 2.0, 3.0, 4.0, 5.0, 6, 7, 8, 9
    • security-libs

      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.

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

              Created:
              Updated:
              Resolved: