LuciferYang commented on code in PR #258:
URL: https://github.com/apache/commons-crypto/pull/258#discussion_r1367880514
##########
src/test/java/org/apache/commons/crypto/random/CryptoRandomFactoryTest.java:
##########
@@ -141,4 +141,14 @@ public void testNull() {
assertThrows(NullPointerException.class, () ->
CryptoRandomFactory.getCryptoRandom(null));
}
+ @Test
+ public void testExceptionInInitializerErrorRandom() throws
GeneralSecurityException, IOException {
Review Comment:
If there are no chagnes to `CryptoRandomFactory.java`, the new test
case will fail:
```
java.lang.ExceptionInInitializerError
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:534)
at java.base/java.lang.Class.forName(Class.java:513)
at
org.apache.commons.crypto.utils.ReflectionUtils.getClassByNameOrNull(ReflectionUtils.java:93)
at
org.apache.commons.crypto.utils.ReflectionUtils.getClassByName(ReflectionUtils.java:64)
at
org.apache.commons.crypto.random.CryptoRandomFactory.getCryptoRandom(CryptoRandomFactory.java:189)
at
org.apache.commons.crypto.random.CryptoRandomFactoryTest.testExceptionInInitializerErrorRandom(CryptoRandomFactoryTest.java:150)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: java.lang.IllegalStateException:
java.security.GeneralSecurityException: ExceptionInInitializerErrorRandom init
failed
at
org.apache.commons.crypto.random.ExceptionInInitializerErrorRandom.<clinit>(ExceptionInInitializerErrorRandom.java:28)
... 10 more
Caused by: java.security.GeneralSecurityException:
ExceptionInInitializerErrorRandom init failed
at
org.apache.commons.crypto.random.ExceptionInInitializerErrorRandom.check(ExceptionInInitializerErrorRandom.java:33)
at
org.apache.commons.crypto.random.ExceptionInInitializerErrorRandom.<clinit>(ExceptionInInitializerErrorRandom.java:26)
... 10 more
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]