diff options
12 files changed, 43 insertions, 284 deletions
@@ -1,3 +1,45 @@ +2011-01-20 Andrew Su <[email protected]> + + Removing dead/commented/unused code. + * plugin/icedteanp/java/sun/applet/GetWindowPluginCallRequest.java: + Removed unused imports. + * plugin/icedteanp/java/sun/applet/MethodOverloadResolver.java: + (getMatchingMethod): Removed unused variable. + (getMatchingConstructor): Removed unused variable. + * plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java: + Removed unused imports. + (Signature): Removed commented code. + (handleMessage): Removed commented code. + (getAccessControlContext): Remove commented code. + * plugin/icedteanp/java/sun/applet/PluginAppletViewer.java: + (getCachedImage): Removed commented code. + (makeReader): Removed unused method. + (parse): Removed unused variables. Removed dead code. + * plugin/icedteanp/java/sun/applet/PluginCallRequest.java: Removed + unused imports. + * plugin/icedteanp/java/sun/applet/PluginDebug.java: Removed unused + imports. + * plugin/icedteanp/java/sun/applet/PluginMessageConsumer.java: Removed + unused imports. + (getReference): Removed unused method. + (isInInit): Removed unused method. + (dumpWorkerStatus): Removed unused method. + * plugin/icedteanp/java/sun/applet/PluginMessageHandlerWorker.java: + Removed unused variable. + (PluginMessageHandlerWorker): Removed unused variable. + (plugin/icedteanp/java/sun/applet/PluginObjectStore.java): Removed + unused imports. + (reference): Removed commented code. + (unreference): Removed commented code. + * plugin/icedteanp/java/sun/applet/PluginProxyInfoRequest.java: + Removed unused import. + * plugin/icedteanp/java/sun/applet/PluginStreamHandler.java: Removed + unused imports. Removed unused variable. + (PluginStreamHandler): Removed unnecessary comments. Removed commented + code. + (startProcessing): Removed unused variables. Removed commented code. + (write): Removed commented code. + 2011-01-20 Deepak Bhole <[email protected]> PR619: Improper finalization by the plugin can crash the browser diff --git a/plugin/icedteanp/java/sun/applet/GetWindowPluginCallRequest.java b/plugin/icedteanp/java/sun/applet/GetWindowPluginCallRequest.java index aa46a86..d7134da 100644 --- a/plugin/icedteanp/java/sun/applet/GetWindowPluginCallRequest.java +++ b/plugin/icedteanp/java/sun/applet/GetWindowPluginCallRequest.java @@ -37,9 +37,6 @@ exception statement from your version. */ package sun.applet; -import java.security.AccessControlContext; -import java.security.ProtectionDomain; - public class GetWindowPluginCallRequest extends PluginCallRequest { // FIXME: look into int vs long JavaScript internal values. long internal; diff --git a/plugin/icedteanp/java/sun/applet/MethodOverloadResolver.java b/plugin/icedteanp/java/sun/applet/MethodOverloadResolver.java index cd1801a..f4e6850 100644 --- a/plugin/icedteanp/java/sun/applet/MethodOverloadResolver.java +++ b/plugin/icedteanp/java/sun/applet/MethodOverloadResolver.java @@ -175,8 +175,6 @@ public class MethodOverloadResolver { int lowestCost = Integer.MAX_VALUE; - ArrayList<Object> paramList = new ArrayList<Object>(); - for (Method matchingMethod : matchingMethods) { int methodCost = 0; @@ -240,8 +238,6 @@ public class MethodOverloadResolver { int lowestCost = Integer.MAX_VALUE; - ArrayList<Object> paramList = new ArrayList<Object>(); - for (Constructor matchingConstructor : matchingConstructors) { int constructorCost = 0; diff --git a/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java b/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java index ead88c3..4858dc4 100644 --- a/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java +++ b/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java @@ -37,7 +37,6 @@ exception statement from your version. */ package sun.applet; -import java.io.File; import java.lang.reflect.Array; import java.lang.reflect.Constructor; import java.lang.reflect.Field; @@ -53,14 +52,11 @@ import java.security.CodeSource; import java.security.Permissions; import java.security.PrivilegedAction; import java.security.ProtectionDomain; -import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Hashtable; import java.util.List; import java.util.Map; -import javax.swing.text.html.HTMLDocument.HTMLReader.IsindexAction; - import net.sourceforge.jnlp.runtime.JNLPRuntime; import netscape.javascript.JSObjectCreatePermission; @@ -144,32 +140,25 @@ class Signature { if (elem == null) // end of signature continue; - // System.out.println ("NEXT TYPE: " + elem); Class primitive = primitiveNameToType(elem); if (primitive != null) typeList.add(primitive); else { - // System.out.println ("HERE1"); int dimsize = 0; int n = elem.indexOf('['); if (n != -1) { - // System.out.println ("HERE2"); String arrayType = elem.substring(0, n); dimsize++; n = elem.indexOf('[', n + 1); - // System.out.println ("HERE2.5"); while (n != -1) { dimsize++; n = elem.indexOf('[', n + 1); - // System.out.println ("HERE2.8"); } int[] dims = new int[dimsize]; primitive = primitiveNameToType(arrayType); - // System.out.println ("HERE3"); if (primitive != null) { typeList.add(Array.newInstance(primitive, dims) .getClass()); - // System.out.println ("HERE4"); } else typeList.add(Array.newInstance( getClass(arrayType, cl), dims).getClass()); @@ -557,11 +546,6 @@ public class PluginAppletSecurityContext { // Cast the object to appropriate type before insertion value = MethodOverloadResolver.getCostAndCastedObject(value, store.getObject(arrayID).getClass().getComponentType())[1]; - //if (value == null && - // store.getObject(arrayID).getClass().getComponentType().isPrimitive()) { - // value = 0; - //} - Array.set(store.getObject(arrayID), index, value); write(reference, "SetObjectArrayElement"); @@ -569,13 +553,10 @@ public class PluginAppletSecurityContext { String[] args = message.split(" "); Integer arrayID = parseCall(args[1], null, Integer.class); - //System.out.println("ARRAYID: " + arrayID); Object o = store.getObject(arrayID); int len = 0; len = Array.getLength(o); - // System.out.println ("Returning array length: " + len); - // System.out.println ("array length: " + o + " " + len); write(reference, "GetArrayLength " + Array.getLength(o)); } else if (message.startsWith("GetField")) { String[] args = message.split(" "); @@ -624,10 +605,7 @@ public class PluginAppletSecurityContext { } else if (message.startsWith("GetObjectClass")) { int oid = Integer.parseInt(message.substring("GetObjectClass" .length() + 1)); - // System.out.println ("GETTING CLASS FOR: " + oid); Class<?> c = store.getObject(oid).getClass(); - // System.out.println (" OBJ: " + store.getObject(oid)); - // System.out.println (" CLS: " + c); store.reference(c); write(reference, "GetObjectClass " + store.getIdentifier(c)); @@ -773,8 +751,6 @@ public class PluginAppletSecurityContext { byte[] b = null; o = (String) store.getObject(stringID); b = o.getBytes("UTF-8"); - // System.out.println ("STRING UTF-8 LENGTH: " + o + " " + - // b.length); write(reference, "GetStringUTFLength " + o.length()); } else if (message.startsWith("GetStringLength")) { @@ -785,10 +761,7 @@ public class PluginAppletSecurityContext { byte[] b = null; o = (String) store.getObject(stringID); b = o.getBytes("UTF-16LE"); - // System.out.println ("STRING UTF-16 LENGTH: " + o + " " + - // b.length); - // System.out.println ("Java: GetStringLength " + b.length); write(reference, "GetStringLength " + o.length()); } else if (message.startsWith("GetStringUTFChars")) { String[] args = message.split(" "); @@ -807,8 +780,6 @@ public class PluginAppletSecurityContext { + Integer .toString(((int) b[i]) & 0x0ff, 16)); - // System.out.println ("Java: GetStringUTFChars: " + o); - // //System.out.println ("String UTF BYTES: " + buf); write(reference, "GetStringUTFChars " + buf); } else if (message.startsWith("GetStringChars")) { String[] args = message.split(" "); @@ -854,10 +825,6 @@ public class PluginAppletSecurityContext { String type = parseCall(args[1], null, String.class); Integer length = parseCall(args[2], null, Integer.class); - // System.out.println ("CALLING: NewArray: " + type + " " + - // length + " " - // + Signature.primitiveNameToType(type)); - Object newArray = null; Class c; @@ -939,10 +906,6 @@ public class PluginAppletSecurityContext { Integer classID = parseCall(args[2], null, Integer.class); Integer objectID = parseCall(args[3], null, Integer.class); - // System.out.println ("CALLING: NewObjectArray: " + - // classID + " " + length + " " - // + objectID); - Object newArray = null; newArray = Array.newInstance((Class) store.getObject(classID), length); @@ -962,12 +925,9 @@ public class PluginAppletSecurityContext { final Constructor m = (Constructor) store.getObject(methodID); Class[] argTypes = m.getParameterTypes(); - // System.out.println ("NEWOBJ: HERE1"); Object[] arguments = new Object[argTypes.length]; - // System.out.println ("NEWOBJ: HERE2"); for (int i = 0; i < argTypes.length; i++) { arguments[i] = parseArgs(args[3 + i], argTypes[i]); - // System.out.println ("NEWOBJ: GOT ARG: " + arguments[i]); } final Object[] fArguments = arguments; @@ -1090,9 +1050,6 @@ public class PluginAppletSecurityContext { ret = new String(byteArray, 0, bytelength, "UTF-16LE"); PluginDebug.debug("NEWSTRING: " + ret); - // System.out.println ("NEWOBJ: CALLED: " + ret); - // System.out.println ("NEWOBJ: CALLED: " + - // store.getObject(ret)); store.reference(ret); write(reference, "NewString " + store.getIdentifier(ret)); @@ -1336,106 +1293,6 @@ public class PluginAppletSecurityContext { public AccessControlContext getAccessControlContext(String[] nsPrivilegeList, String src) { - /* - for (int i=0; i < nsPrivilegeList.length; i++) { - String privilege = nsPrivilegeList[i]; - - if (privilege.equals("UniversalAccept")) { - SocketPermission sp = new SocketPermission("*", "accept,resolve"); - grantedPermissions.add(sp); - } else if (privilege.equals("UniversalAwtEventQueueAccess")) { - AWTPermission awtp = new AWTPermission("accessEventQueue"); - grantedPermissions.add(awtp); - } else if (privilege.equals("UniversalConnect")) { - SocketPermission sp = new SocketPermission("*", "connect,resolve"); - grantedPermissions.add(sp); - } else if (privilege.equals("UniversalListen")) { - SocketPermission sp = new SocketPermission("*", "listen,resolve"); - grantedPermissions.add(sp); - } else if (privilege.equals("UniversalExecAccess")) { - FilePermission fp = new FilePermission("<<ALL FILES>>", "execute"); - RuntimePermission rtp = new RuntimePermission("setIO"); - grantedPermissions.add(fp); - grantedPermissions.add(rtp); - } else if (privilege.equals("UniversalExitAccess")) { - // Doesn't matter what the permissions are. Do not allow VM to exit.. we - // use a single VM for the entire browser lifecycle once invoked, we - // cannot let it exit - - //RuntimePermission rtp = new RuntimePermission("exitVM.*"); - //grantedPermissions.add(rtp); - } else if (privilege.equals("UniversalFileDelete")) { - FilePermission fp = new FilePermission("<<ALL FILES>>", "delete"); - grantedPermissions.add(fp); - } else if (privilege.equals("UniversalFileRead")) { - FilePermission fp = new FilePermission("<<ALL FILES>>", "read"); - grantedPermissions.add(fp); - } else if (privilege.equals("UniversalFileWrite")) { - FilePermission fp = new FilePermission("<<ALL FILES>>", "write"); - grantedPermissions.add(fp); - } else if (privilege.equals("UniversalFdRead")) { - RuntimePermission rtp = new RuntimePermission("readFileDescriptor"); - grantedPermissions.add(rtp); - } else if (privilege.equals("UniversalFdWrite")) { - RuntimePermission rtp = new RuntimePermission("writeFileDescriptor"); - grantedPermissions.add(rtp); - } else if (privilege.equals("UniversalLinkAccess")) { - RuntimePermission rtp = new RuntimePermission("loadLibrary.*"); - grantedPermissions.add(rtp); - } else if (privilege.equals("UniversalListen")) { - SocketPermission sp = new SocketPermission("*", "listen"); - grantedPermissions.add(sp); - } else if (privilege.equals("UniversalMulticast")) { - SocketPermission sp = new SocketPermission("*", "accept,connect,resolve"); - grantedPermissions.add(sp); - } else if (privilege.equals("UniversalPackageAccess")) { - RuntimePermission rtp = new RuntimePermission("defineClassInPackage.*"); - grantedPermissions.add(rtp); - } else if (privilege.equals("UniversalPackageDefinition")) { - RuntimePermission rtp = new RuntimePermission("accessClassInPackage.*"); - grantedPermissions.add(rtp); - } else if (privilege.equals("UniversalPrintJobAccess")) { - RuntimePermission rtp = new RuntimePermission("queuePrintJob"); - grantedPermissions.add(rtp); - } else if (privilege.equals("UniversalPropertyRead")) { - PropertyPermission pp = new PropertyPermission("*", "read"); - grantedPermissions.add(pp); - } else if (privilege.equals("UniversalPropertyWrite")) { - PropertyPermission pp = new PropertyPermission("*", "write"); - grantedPermissions.add(pp); - } else if (privilege.equals("UniversalSetFactory")) { - RuntimePermission rtp = new RuntimePermission("setFactory"); - grantedPermissions.add(rtp); - } else if (privilege.equals("UniversalSystemClipboardAccess")) { - AWTPermission awtp = new AWTPermission("accessClipboard"); - grantedPermissions.add(awtp); - } else if (privilege.equals("UniversalThreadAccess")) { - RuntimePermission rtp1 = new RuntimePermission("modifyThread"); - RuntimePermission rtp2 = new RuntimePermission("stopThread"); - grantedPermissions.add(rtp1); - grantedPermissions.add(rtp2); - } else if (privilege.equals("UniversalThreadGroupAccess")) { - RuntimePermission rtp1 = new RuntimePermission("modifyThreadGroup"); - RuntimePermission rtp2 = new RuntimePermission("modifyThread"); - RuntimePermission rtp3 = new RuntimePermission("stopThread"); - grantedPermissions.add(rtp1); - grantedPermissions.add(rtp2); - grantedPermissions.add(rtp3); - } else if (privilege.equals("UniversalTopLevelWindow")) { - AWTPermission awtp = new AWTPermission("topLevelWindow"); - grantedPermissions.add(awtp); - } else if (privilege.equals("UniversalBrowserRead")) { - BrowserReadPermission bp = new BrowserReadPermission(); - grantedPermissions.add(bp); - } else if (privilege.equals("UniversalJavaPermissions")) { - AllPermission ap = new AllPermission(); - grantedPermissions.add(ap); - } - } - - // what to do with these is unknown: UniversalConnectWithRedirect, UniversalDialogModality, UniversalSendMail, LimitedInstall, FullInstall, SilentInstall - */ - Permissions grantedPermissions = new Permissions(); for (int i = 0; i < nsPrivilegeList.length; i++) { diff --git a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java index 2b9b0c3..38b8b96 100644 --- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java +++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java @@ -836,7 +836,6 @@ public class PluginAppletViewer extends XEmbeddedFrame } private Image getCachedImage(URL url) { - // System.getSecurityManager().checkConnection(url.getHost(), url.getPort()); return (Image) getCachedImageRef(url).get(); } @@ -1825,18 +1824,6 @@ public class PluginAppletViewer extends XEmbeddedFrame static String encoding = null; - static private Reader makeReader(InputStream is) { - if (encoding != null) { - try { - return new BufferedReader(new InputStreamReader(is, encoding)); - } catch (IOException x) { - } - } - InputStreamReader r = new InputStreamReader(is); - encoding = r.getEncoding(); - return new BufferedReader(r); - } - /** * Scan an html file for <applet> tags */ @@ -1869,10 +1856,7 @@ public class PluginAppletViewer extends XEmbeddedFrame PrintStream statusMsgStream, PluginAppletPanelFactory factory) throws IOException { - // <OBJECT> <EMBED> tag flags - boolean isAppletTag = false; boolean isObjectTag = false; - boolean isEmbedTag = false; boolean objectTagAlreadyParsed = false; // The current character @@ -1948,9 +1932,7 @@ public class PluginAppletViewer extends XEmbeddedFrame } } atts = null; - isAppletTag = false; isObjectTag = false; - isEmbedTag = false; } } else { String nm = scanIdentifier(c, in); @@ -1967,15 +1949,12 @@ public class PluginAppletViewer extends XEmbeddedFrame String val = t.get("value"); if (val == null) { statusMsgStream.println(requiresNameWarning); - } else if (atts != null) { + } else { PluginDebug.debug("PUT " + att + " = " + val); atts.put(att.toLowerCase(), val); - } else { - statusMsgStream.println(paramOutsideWarning); } } } else if (nm.equalsIgnoreCase("applet")) { - isAppletTag = true; atts = scanTag(c, in); // If there is a classid and no code tag present, transform it to code tag @@ -2055,7 +2034,6 @@ public class PluginAppletViewer extends XEmbeddedFrame atts.put("height", height); } } else if (nm.equalsIgnoreCase("embed")) { - isEmbedTag = true; atts = scanTag(c, in); // If there is a classid and no code tag present, transform it to code tag diff --git a/plugin/icedteanp/java/sun/applet/PluginCallRequest.java b/plugin/icedteanp/java/sun/applet/PluginCallRequest.java index b32ff8b..17aa84c 100644 --- a/plugin/icedteanp/java/sun/applet/PluginCallRequest.java +++ b/plugin/icedteanp/java/sun/applet/PluginCallRequest.java @@ -37,9 +37,6 @@ exception statement from your version. */ package sun.applet; -import java.security.AccessControlContext; -import java.security.ProtectionDomain; - // FIXME: for each type of request extend a new (anonymous?) // PluginCallRequest. public abstract class PluginCallRequest { diff --git a/plugin/icedteanp/java/sun/applet/PluginDebug.java b/plugin/icedteanp/java/sun/applet/PluginDebug.java index d96314c..29c7c1c 100644 --- a/plugin/icedteanp/java/sun/applet/PluginDebug.java +++ b/plugin/icedteanp/java/sun/applet/PluginDebug.java @@ -37,8 +37,6 @@ exception statement from your version. */ package sun.applet; -import java.io.*; - public class PluginDebug { static final boolean DEBUG = System.getenv().containsKey("ICEDTEAPLUGIN_DEBUG"); diff --git a/plugin/icedteanp/java/sun/applet/PluginMessageConsumer.java b/plugin/icedteanp/java/sun/applet/PluginMessageConsumer.java index c30cdcb..189f381 100644 --- a/plugin/icedteanp/java/sun/applet/PluginMessageConsumer.java +++ b/plugin/icedteanp/java/sun/applet/PluginMessageConsumer.java @@ -41,7 +41,6 @@ import java.util.ArrayList; import java.util.Hashtable; import java.util.Iterator; import java.util.LinkedList; -import java.util.Set; class PluginMessageConsumer { @@ -107,17 +106,6 @@ class PluginMessageConsumer { } } - /** - * Returns the reference for this message. This method assumes that - * the message has a reference number. - * - * @param The message - * @return the reference number - */ - private Long getReference(String[] msgParts) { - return Long.parseLong(msgParts[3]); - } - public PluginMessageConsumer(PluginStreamHandler streamHandler) { as = new AppletSecurity(); @@ -144,10 +132,6 @@ class PluginMessageConsumer { return null; } - private boolean isInInit(Integer instanceNum) { - return initWorkers.containsKey(instanceNum); - } - private void addToInitWorkers(Integer instanceNum, PluginMessageHandlerWorker worker) { synchronized (initWorkers) { initWorkers.put(instanceNum, worker); @@ -291,10 +275,4 @@ class PluginMessageConsumer { // No workers available. Better luck next time! return null; } - - private void dumpWorkerStatus() { - for (PluginMessageHandlerWorker worker : workers) { - PluginDebug.debug(worker.toString()); - } - } } diff --git a/plugin/icedteanp/java/sun/applet/PluginMessageHandlerWorker.java b/plugin/icedteanp/java/sun/applet/PluginMessageHandlerWorker.java index 91e3746..17e7a39 100644 --- a/plugin/icedteanp/java/sun/applet/PluginMessageHandlerWorker.java +++ b/plugin/icedteanp/java/sun/applet/PluginMessageHandlerWorker.java @@ -43,7 +43,6 @@ class PluginMessageHandlerWorker extends Thread { private boolean isPriorityWorker = false; private int id; private String message = null; - private SecurityManager sm; PluginStreamHandler streamHandler = null; PluginMessageConsumer consumer = null; @@ -54,7 +53,6 @@ class PluginMessageHandlerWorker extends Thread { this.id = id; this.streamHandler = streamHandler; - this.sm = sm; this.isPriorityWorker = isPriorityWorker; this.consumer = consumer; diff --git a/plugin/icedteanp/java/sun/applet/PluginObjectStore.java b/plugin/icedteanp/java/sun/applet/PluginObjectStore.java index a0c6f6e..a39b6d1 100644 --- a/plugin/icedteanp/java/sun/applet/PluginObjectStore.java +++ b/plugin/icedteanp/java/sun/applet/PluginObjectStore.java @@ -38,8 +38,6 @@ exception statement from your version. */ package sun.applet; import java.util.*; -import java.lang.reflect.*; -import java.io.*; public class PluginObjectStore { private static HashMap<Integer, Object> objects = new HashMap<Integer, Object>(); @@ -87,36 +85,24 @@ public class PluginObjectStore { objects.put(nextUniqueIdentifier, object); counts.put(nextUniqueIdentifier, 1); identifiers.put(object, nextUniqueIdentifier); - //System.out.println("JAVA ADDED: " + nextUniqueIdentifier); - //System.out.println("JAVA REFERENCED: " + nextUniqueIdentifier - // + " to: 1"); nextUniqueIdentifier++; } else { counts.put(identifier, counts.get(identifier) + 1); - //System.out.println("JAVA REFERENCED: " + identifier + - // " to: " + counts.get(identifier)); } } public void unreference(int identifier) { Integer currentCount = counts.get(identifier); if (currentCount == null) { - //System.out.println("ERROR UNREFERENCING: " + identifier); return; } if (currentCount == 1) { - //System.out.println("JAVA DEREFERENCED: " + identifier - // + " to: 0"); Object object = objects.get(identifier); objects.remove(identifier); counts.remove(identifier); identifiers.remove(object); - //System.out.println("JAVA REMOVED: " + identifier); } else { counts.put(identifier, currentCount - 1); - //System.out.println("JAVA DEREFERENCED: " + - // identifier + " to: " + - // counts.get(identifier)); } } diff --git a/plugin/icedteanp/java/sun/applet/PluginProxyInfoRequest.java b/plugin/icedteanp/java/sun/applet/PluginProxyInfoRequest.java index b6e12d4..9e46d2c 100644 --- a/plugin/icedteanp/java/sun/applet/PluginProxyInfoRequest.java +++ b/plugin/icedteanp/java/sun/applet/PluginProxyInfoRequest.java @@ -37,7 +37,6 @@ exception statement from your version. */ package sun.applet; -import java.net.MalformedURLException; import java.net.URI; /** diff --git a/plugin/icedteanp/java/sun/applet/PluginStreamHandler.java b/plugin/icedteanp/java/sun/applet/PluginStreamHandler.java index bd95493..4eff8dd 100644 --- a/plugin/icedteanp/java/sun/applet/PluginStreamHandler.java +++ b/plugin/icedteanp/java/sun/applet/PluginStreamHandler.java @@ -39,13 +39,11 @@ package sun.applet; import java.io.BufferedReader; import java.io.BufferedWriter; -import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; -import java.io.StreamTokenizer; import java.net.MalformedURLException; import java.nio.charset.Charset; import java.util.Date; @@ -56,7 +54,6 @@ import javax.swing.SwingUtilities; public class PluginStreamHandler { private BufferedReader pluginInputReader; - private StreamTokenizer pluginInputTokenizer; private BufferedWriter pluginOutputWriter; private RequestQueue queue = new RequestQueue(); @@ -70,10 +67,6 @@ public class PluginStreamHandler { PluginAppletViewer pav; - static Date d = new Date(); - static long startTime = d.getTime(); - static long totalWait = 0; - public PluginStreamHandler(InputStream inputstream, OutputStream outputstream) throws MalformedURLException, IOException { @@ -82,13 +75,10 @@ public class PluginStreamHandler { pav = (PluginAppletViewer) ClassLoader.getSystemClassLoader().loadClass("sun.applet.PluginAppletViewer").newInstance(); PluginDebug.debug("Loaded: " + pav + " CL=" + pav.getClass().getClassLoader()); } catch (InstantiationException e) { - // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { - // TODO Auto-generated catch block e.printStackTrace(); } catch (ClassNotFoundException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -99,23 +89,9 @@ public class PluginStreamHandler { pluginInputReader = new BufferedReader(new InputStreamReader(inputstream, Charset.forName("UTF-8"))); - /*pluginInputTokenizer = new StreamTokenizer(pluginInputReader); - pluginInputTokenizer.resetSyntax(); - pluginInputTokenizer.whitespaceChars('\u0000', '\u0000'); - pluginInputTokenizer.wordChars('\u0001', '\u00FF');*/ pluginOutputWriter = new BufferedWriter(new OutputStreamWriter (outputstream, Charset.forName("UTF-8"))); - - /* - while(true) { - String message = read(); - PluginDebug.debug(message); - handleMessage(message); - // TODO: - // write(queue.peek()); - } - */ } public void startProcessing() { @@ -128,15 +104,8 @@ public class PluginStreamHandler { PluginDebug.debug("Waiting for data..."); - long b4 = new Date().getTime(); - String s = read(); - long after = new Date().getTime(); - - totalWait += (after - b4); - //System.err.println("Total wait time: " + totalWait); - if (s != null) { consumer.queue(s); } else { @@ -152,35 +121,6 @@ public class PluginStreamHandler { PluginDebug.debug("APPLETVIEWER: exiting appletviewer"); System.exit(0); } - - /* - int readChar = -1; - // blocking read, discard first character - try { - readChar = pluginInputReader.read(); - } catch (IOException ioe) { - // plugin may have detached - } - - // if not disconnected - if (readChar != -1) { - String s = read(); - PluginDebug.debug("Got data, consuming " + s); - consumer.consume(s); - } else { - try { - // Close input/output channels to plugin. - pluginInputReader.close(); - pluginOutputWriter.close(); - } catch (IOException exception) { - // Deliberately ignore IOException caused by broken - // pipe since plugin may have already detached. - } - AppletSecurityContextManager.dumpStore(0); - PluginDebug.debug("APPLETVIEWER: exiting appletviewer"); - System.exit(0); - } - */ } } }; @@ -411,13 +351,6 @@ public class PluginStreamHandler { } return; - /* - synchronized(writeQueue) { - writeQueue.add(message); - PluginDebug.debug(" PIPE: appletviewer wrote: " + message); - } - */ - } public boolean messageAvailable() { |