< prev index next >

src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SunPKCS11.java

Print this page




1429 
1430                             // ok
1431                             if (debug != null) {
1432                                 debug.println("no default handler set");
1433                             }
1434                             return null;
1435                         }
1436 
1437                         Class<?> c = Class.forName
1438                                    (defaultHandler,
1439                                    true,
1440                                    Thread.currentThread().getContextClassLoader());
1441                         if (!javax.security.auth.callback.CallbackHandler.class.isAssignableFrom(c)) {
1442                             // not the right subtype
1443                             if (debug != null) {
1444                                 debug.println("default handler " + defaultHandler +
1445                                               " is not a CallbackHandler");
1446                             }
1447                             return null;
1448                         }
1449                         return (CallbackHandler)c.newInstance();


1450                     }
1451                 });
1452                 // save it
1453                 pHandler = myHandler;
1454                 return myHandler;
1455 
1456             } catch (PrivilegedActionException pae) {
1457                 // ok
1458                 if (debug != null) {
1459                     debug.println("Unable to load default callback handler");
1460                     pae.printStackTrace();
1461                 }
1462             }
1463         }
1464         return null;
1465     }
1466 
1467     private Object writeReplace() throws ObjectStreamException {
1468         return new SunPKCS11Rep(this);
1469     }




1429 
1430                             // ok
1431                             if (debug != null) {
1432                                 debug.println("no default handler set");
1433                             }
1434                             return null;
1435                         }
1436 
1437                         Class<?> c = Class.forName
1438                                    (defaultHandler,
1439                                    true,
1440                                    Thread.currentThread().getContextClassLoader());
1441                         if (!javax.security.auth.callback.CallbackHandler.class.isAssignableFrom(c)) {
1442                             // not the right subtype
1443                             if (debug != null) {
1444                                 debug.println("default handler " + defaultHandler +
1445                                               " is not a CallbackHandler");
1446                             }
1447                             return null;
1448                         }
1449                         @SuppressWarnings("deprecation")
1450                         Object result = c.newInstance();
1451                         return (CallbackHandler)result;
1452                     }
1453                 });
1454                 // save it
1455                 pHandler = myHandler;
1456                 return myHandler;
1457 
1458             } catch (PrivilegedActionException pae) {
1459                 // ok
1460                 if (debug != null) {
1461                     debug.println("Unable to load default callback handler");
1462                     pae.printStackTrace();
1463                 }
1464             }
1465         }
1466         return null;
1467     }
1468 
1469     private Object writeReplace() throws ObjectStreamException {
1470         return new SunPKCS11Rep(this);
1471     }


< prev index next >