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

Text recommending against calling 'new SecureRandom()' should be removed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 6
    • security-libs
    • b65
    • generic
    • generic

      The JavaDoc for the SecureRandom() constructor contains the following text: "This constructor is provided for backwards compatibility. The caller is encouraged to use one of the alternative getInstance methods to obtain a SecureRandom object."

      There is no good reason for this recommendation. In fact, it is often preferable to call "new SecureRandom()" because it automatically chooses the default SecureRandom implementation for the platform. This is not possible by calling getInstance(), which requires the algorithm type to be explicitly specified.

            andreas Andreas Sterbenz
            andreas Andreas Sterbenz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: