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 Jun 4, 2024
1 parent 44ade1d commit b275236
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, 2021, 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 @@ -202,11 +202,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 @@ -250,11 +252,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 @@ -299,12 +303,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 b275236

@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.