Skip to content

Commit

Permalink
8324648: Avoid NoSuchMethodError when instantiating NativePRNG
Browse files Browse the repository at this point in the history
Backport-of: 69b2674c6861fdb7d9f9cb39e07d50515c73e33a
  • Loading branch information
olivergillespie authored and shipilev committed Mar 5, 2024
1 parent 2d62854 commit d6ad625
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/java.base/unix/classes/sun/security/provider/NativePRNG.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -203,11 +203,13 @@ static boolean isAvailable() {
}

// constructor, called by the JCA framework
public NativePRNG() {
super();
public NativePRNG(SecureRandomParameters params) {
if (INSTANCE == null) {
throw new AssertionError("NativePRNG not available");
}
if (params != null) {
throw new IllegalArgumentException("Unsupported params: " + params.getClass());
}
}

// set the seed
Expand Down Expand Up @@ -251,11 +253,13 @@ static boolean isAvailable() {
}

// constructor, called by the JCA framework
public Blocking() {
super();
public Blocking(SecureRandomParameters params) {
if (INSTANCE == null) {
throw new AssertionError("NativePRNG$Blocking not available");
}
if (params != null) {
throw new IllegalArgumentException("Unsupported params: " + params.getClass());
}
}

// set the seed
Expand Down Expand Up @@ -300,12 +304,14 @@ static boolean isAvailable() {
}

// constructor, called by the JCA framework
public NonBlocking() {
super();
public NonBlocking(SecureRandomParameters params) {
if (INSTANCE == null) {
throw new AssertionError(
"NativePRNG$NonBlocking not available");
}
if (params != null) {
throw new IllegalArgumentException("Unsupported params: " + params.getClass());
}
}

// set the seed
Expand Down

1 comment on commit d6ad625

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.