< prev index next >

src/java.desktop/share/classes/sun/applet/Main.java

Print this page

        

@@ -73,11 +73,10 @@
     private static AppletMessageHandler amh = new AppletMessageHandler("appletviewer");
 
     /**
      * Member variables set according to options passed in to AppletViewer.
      */
-    private boolean debugFlag = false;
     private boolean helpFlag  = false;
     private String  encoding  = null;
     private boolean noSecurityFlag  = false;
     private static boolean cmdLineTestFlag = false;
 

@@ -134,18 +133,10 @@
         if (urlList.size() == 0) {
             System.err.println(lookup("main.err.inputfile"));
             return 1;
         }
 
-        if (debugFlag) {
-            // START A DEBUG SESSION
-            // Given the current architecture, we will end up decoding the
-            // arguments again, but at least we are guaranteed to have
-            // arguments which are valid.
-            return invokeDebugger(args);
-        }
-
         // INSTALL THE SECURITY MANAGER (if necessary)
         if (!noSecurityFlag && (System.getSecurityManager() == null))
             init();
 
         // LAUNCH APPLETVIEWER FOR EACH URL

@@ -189,13 +180,10 @@
         } else if ("-encoding".equals(arg) && (i < argc - 1)) {
             if (encoding != null)
                 throw new ParseException(lookup("main.err.dupoption", arg));
             encoding = args[++i];
             return 2;
-        } else if ("-debug".equals(arg)) {
-            debugFlag = true;
-            return 1;
         } else if ("-Xnosecurity".equals(arg)) {
             // This is an undocumented (and, in the future, unsupported)
             // flag which prevents AppletViewer from installing its own
             // SecurityManager.
 

@@ -265,72 +253,10 @@
         }
 
         return u;
     }
 
-    /**
-     * Invoke the debugger with the arguments passed in to appletviewer.
-     *
-     * @param args The arguments passed into the debugger.
-     * @return     {@code 0} if the debugger is invoked successfully,
-     *             {@code 1} otherwise.
-     */
-    private int invokeDebugger(String [] args) {
-        // CONSTRUCT THE COMMAND LINE
-        String [] newArgs = new String[args.length + 1];
-        int current = 0;
-
-        // Add a -classpath argument that prevents
-        // the debugger from launching appletviewer with the default of
-        // ".". appletviewer's classpath should never contain valid
-        // classes since they will result in security exceptions.
-        // Ideally, the classpath should be set to "", but the VM won't
-        // allow an empty classpath, so a phony directory name is used.
-        String phonyDir = System.getProperty("java.home") +
-                          File.separator + "phony";
-        newArgs[current++] = "-Djava.class.path=" + phonyDir;
-
-        // Appletviewer's main class is the debuggee
-        newArgs[current++] = "sun.applet.Main";
-
-        // Append all the of the original appletviewer arguments,
-        // leaving out the "-debug" option.
-        for (int i = 0; i < args.length; i++) {
-            if (!("-debug".equals(args[i]))) {
-                newArgs[current++] = args[i];
-            }
-        }
-
-        // LAUNCH THE DEBUGGER
-        // Reflection is used for two reasons:
-        // 1) The debugger classes are on classpath and thus must be loaded
-        // by the application class loader. (Currently, appletviewer are
-        // loaded through the boot class path out of rt.jar.)
-        // 2) Reflection removes any build dependency between appletviewer
-        // and jdb.
-        try {
-            Class<?> c = Class.forName("com.sun.tools.example.debug.tty.TTY", true,
-                                    ClassLoader.getSystemClassLoader());
-            Method m = c.getDeclaredMethod("main",
-                                           new Class<?>[] { String[].class });
-            m.invoke(null, new Object[] { newArgs });
-        } catch (ClassNotFoundException cnfe) {
-            System.err.println(lookup("main.debug.cantfinddebug"));
-            return 1;
-        } catch (NoSuchMethodException nsme) {
-            System.err.println(lookup("main.debug.cantfindmain"));
-            return 1;
-        } catch (InvocationTargetException ite) {
-            System.err.println(lookup("main.debug.exceptionindebug"));
-            return 1;
-        } catch (IllegalAccessException iae) {
-            System.err.println(lookup("main.debug.cantaccess"));
-            return 1;
-        }
-        return 0;
-    }
-
     private void init() {
         // GET APPLETVIEWER USER-SPECIFIC PROPERTIES
         Properties avProps = getAVProps();
 
         // ADD OTHER RANDOM PROPERTIES
< prev index next >