@@ -272,7 +272,7 @@ public IRubyObject initialize(final ThreadContext context, final IRubyObject[] a
272
272
}
273
273
// TODO: ugly NoClassDefFoundError catching for no BC env. How can we remove this?
274
274
boolean noClassDef = false ;
275
- if ( key == null && ! noClassDef ) { // PEM_read_bio_DSAPrivateKey
275
+ if ( key == null && ! noClassDef ) {
276
276
try {
277
277
key = readPrivateKey (strJava , passwd );
278
278
}
@@ -304,8 +304,7 @@ public IRubyObject initialize(final ThreadContext context, final IRubyObject[] a
304
304
key = readECPrivateKey (ecdsaFactory , str .getBytes ());
305
305
}
306
306
catch (NoClassDefFoundError e ) { noClassDef = true ; debugStackTrace (runtime , e ); }
307
- catch (InvalidKeySpecException e ) { debug (runtime , "PKeyEC could not read private key" , e ); }
308
- catch (IOException e ) { debugStackTrace (runtime , "PKeyEC could not read private key" , e ); }
307
+ catch (InvalidKeySpecException |IOException e ) { debug (runtime , "PKeyEC could not read private key" , e ); }
309
308
catch (RuntimeException e ) {
310
309
if ( isKeyGenerationFailure (e ) ) debug (runtime , "PKeyEC could not read private key" , e );
311
310
else debugStackTrace (runtime , e );
@@ -331,8 +330,6 @@ public IRubyObject initialize(final ThreadContext context, final IRubyObject[] a
331
330
if ( key == null ) key = tryPKCS8EncodedKey (runtime , ecdsaFactory , str .getBytes ());
332
331
if ( key == null ) key = tryX509EncodedKey (runtime , ecdsaFactory , str .getBytes ());
333
332
334
- if ( key == null ) throw newECError (runtime , "Neither PUB key nor PRIV key:" );
335
-
336
333
if ( key instanceof KeyPair ) {
337
334
final PublicKey pubKey = ((KeyPair ) key ).getPublic ();
338
335
final PrivateKey privKey = ((KeyPair ) key ).getPrivate ();
@@ -353,7 +350,7 @@ else if ( key instanceof ECPublicKey ) {
353
350
this .privateKey = null ;
354
351
}
355
352
else {
356
- throw newECError (runtime , "Neither PUB key nor PRIV key: " + key . getClass (). getName () );
353
+ throw newECError (runtime , "Neither PUB key nor PRIV key: " );
357
354
}
358
355
359
356
if ( curveName == null && publicKey != null ) {
0 commit comments