-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
8
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
When I try to call Configuration.getInstance, I found that the error messages on OpenJDK 8 and OpenJDK 11 are different, but both messages are reasonable.
When I call Configuration.getInstance(null, null, (String) null);, it can throw either a NullPointerException or an IllegalArgumentException. In the official documentation (https://docs.oracle.com/en/java/javase/11/docs/api/java.base/javax/security/auth/login/Configuration.html#getInstance(java.lang.String,javax.security.auth.login.Configuration.Parameters,java.lang.String), the description is as follows:
NullPointerException - if the specified type is null. IllegalArgumentException - if the specified Provider is null, or if the specified parameters are not understood by the ConfigurationSpi implementation from the specified Provider.
However, when executing with OpenJDK 8, it reports an IllegalArgumentException: missing provider, whereas when using OpenJDK 11, it reports a NullPointerException: null type name.
This indicates that the order of parameter validation is different between the two versions. We believe the OpenJDK 11 error message is better, because when processing parameters, they should be handled in input order. Therefore, we believe OpenJDK 8 should modify its implementation to ensure consistency.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Exception in thread "main" java.lang.NullPointerException: null type name
at java.base/java.util.Objects.requireNonNull(Objects.java:235)
at java.base/javax.security.auth.login.Configuration.getInstance(Configuration.java:424)
at test.main(test.java:10)
ACTUAL -
Exception in thread "main" java.lang.IllegalArgumentException: missing provider
at javax.security.auth.login.Configuration.getInstance(Configuration.java:412)
at test.main(test.java:10)
---------- BEGIN SOURCE ----------
import javax.security.auth.login.Configuration;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
public class test {
public static void main(String[] var0) throws NoSuchAlgorithmException, NoSuchProviderException {
Configuration.getInstance(null, null, (String) null);
}
}
---------- END SOURCE ----------
When I try to call Configuration.getInstance, I found that the error messages on OpenJDK 8 and OpenJDK 11 are different, but both messages are reasonable.
When I call Configuration.getInstance(null, null, (String) null);, it can throw either a NullPointerException or an IllegalArgumentException. In the official documentation (https://docs.oracle.com/en/java/javase/11/docs/api/java.base/javax/security/auth/login/Configuration.html#getInstance(java.lang.String,javax.security.auth.login.Configuration.Parameters,java.lang.String), the description is as follows:
NullPointerException - if the specified type is null. IllegalArgumentException - if the specified Provider is null, or if the specified parameters are not understood by the ConfigurationSpi implementation from the specified Provider.
However, when executing with OpenJDK 8, it reports an IllegalArgumentException: missing provider, whereas when using OpenJDK 11, it reports a NullPointerException: null type name.
This indicates that the order of parameter validation is different between the two versions. We believe the OpenJDK 11 error message is better, because when processing parameters, they should be handled in input order. Therefore, we believe OpenJDK 8 should modify its implementation to ensure consistency.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Exception in thread "main" java.lang.NullPointerException: null type name
at java.base/java.util.Objects.requireNonNull(Objects.java:235)
at java.base/javax.security.auth.login.Configuration.getInstance(Configuration.java:424)
at test.main(test.java:10)
ACTUAL -
Exception in thread "main" java.lang.IllegalArgumentException: missing provider
at javax.security.auth.login.Configuration.getInstance(Configuration.java:412)
at test.main(test.java:10)
---------- BEGIN SOURCE ----------
import javax.security.auth.login.Configuration;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
public class test {
public static void main(String[] var0) throws NoSuchAlgorithmException, NoSuchProviderException {
Configuration.getInstance(null, null, (String) null);
}
}
---------- END SOURCE ----------
- relates to
-
JDK-4985694 Incomplete spec for most of the getInstances
-
- Closed
-