Hi,

I added a message to gappletviewer to warn users that it currently runs without a security manager. The warning is displayed in standalone mode; for plugin mode, the warning is left to the plugin itself.

Tom

2006-09-08  Thomas Fitzsimmons  <[EMAIL PROTECTED]>

        * tools/gnu/classpath/tools/appletviewer/Main.java: Warn about
        missing security manager when run in standalone mode.
Index: tools/gnu/classpath/tools/appletviewer/Main.java
===================================================================
RCS file: /sources/classpath/classpath/tools/gnu/classpath/tools/appletviewer/Main.java,v
retrieving revision 1.4
diff -u -r1.4 Main.java
--- tools/gnu/classpath/tools/appletviewer/Main.java	11 May 2006 08:33:05 -0000	1.4
+++ tools/gnu/classpath/tools/appletviewer/Main.java	8 Sep 2006 18:20:32 -0000
@@ -44,10 +44,12 @@
 import gnu.classpath.tools.getopt.Parser;
 import java.applet.Applet;
 import java.awt.Dimension;
+import java.io.BufferedReader;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.net.URL;
 import java.util.ArrayList;
@@ -249,6 +251,7 @@
 
     if (pluginMode)
       {
+        // Plugin will warn user about missing security manager.
 	InputStream in;
 	OutputStream out;
 
@@ -259,6 +262,33 @@
       }
     else
       {
+        // Warn user about missing security manager.
+        System.err.println("WARNING: CURRENTLY GAPPLETVIEWER RUNS WITH NO SECURITY MANAGER.\n\n"
+                           + "THIS MEANS THAT APPLETS YOU LOAD CAN DO ANYTHING A JAVA APPLICATION\n"
+                           + "THAT YOU DOWNLOAD AND RUN CAN DO.  BE *VERY* CAREFUL WHICH APPLETS YOU RUN.\n"
+                           + "DO NOT USE GAPPLETVIEWER ON YOUR SYSTEM IF YOUR SYSTEM STORES IMPORTANT DATA.\n"
+                           + "THIS DATA CAN BE DESTROYED OR STOLEN IF YOU LOAD A MALICIOUS APPLET.\n");
+
+        System.err.println("[press 'c' or 'C' to continue or anything else to quit]");
+
+        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+        String response = null;
+
+        try
+          {
+            response = stdin.readLine();
+          }
+        catch (IOException e)
+          {
+            System.err.println("failed to read response to warning message: " + e);
+            System.exit(1);
+          }
+
+        if (!(response.equals("c") || response.equals("C")))
+          {
+            System.exit(0);
+          }
+
         if (code == null)
           {
             // The --code option wasn't given and there are no URL

Reply via email to