private static ORB initAppletORB ( Object applet , Properties orbProp ) { try { Class < ? > appletClass = Class . forName ( "java.applet.Applet" , true , null ) ; if ( ! appletClass . isInstance ( applet ) ) { throw new ClassCastException ( applet . getClass ( ) . getName ( ) ) ; } // invoke the static method ORB.init(applet, orbProp); Method method = ORB . class . getMethod ( "init" , appletClass , Properties . class ) ; return ( ORB ) method . invoke ( null , applet , orbProp ) ; } catch ( ClassNotFoundException e ) { // java.applet.Applet doesn't exist and the applet parameter is // non-null; so throw CCE throw new ClassCastException ( applet . getClass ( ) . getName ( ) ) ; } catch ( NoSuchMethodException e ) { throw new AssertionError ( e ) ; } catch ( InvocationTargetException e ) { Throwable cause = e . getCause ( ) ; if ( cause instanceof RuntimeException ) { throw ( RuntimeException ) cause ; } else if ( cause instanceof Error ) { throw ( Error ) cause ; } throw new AssertionError ( e ) ; } catch ( IllegalAccessException iae ) { throw new AssertionError ( iae ) ; } }
This method returns a new ORB instance for the given applet without creating a static dependency on java . applet .