We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bafe6c9 commit 888c30cCopy full SHA for 888c30c
src/main/java/org/jruby/ext/openssl/PKey.java
@@ -269,6 +269,9 @@ public Object toJava(final Class target) {
269
if (target.isAssignableFrom(PublicKey.class) || Key.class.isAssignableFrom(target)) {
270
// default is public key, also want to_java() as well as to_java(java.lang.Object) to end up here
271
final PublicKey key = getPublicKey();
272
+ if (key == null) {
273
+ throw getRuntime().newRuntimeError("public key not available, to convert to " + target);
274
+ }
275
if (target.isInstance(key)) return key;
276
throw getRuntime().newTypeError("cannot convert public key of type " + key.getClass() + " to " + target);
277
}
0 commit comments