From f25f28f27730a5cfe0cf70d5749acec8116b49a0 Mon Sep 17 00:00:00 2001 From: Denis Lila Date: Thu, 31 Mar 2011 14:01:04 -0400 Subject: Make PluginDebug a bit lazier. --- .../sun/applet/AppletSecurityContextManager.java | 2 +- .../sun/applet/GetMemberPluginCallRequest.java | 4 +- .../sun/applet/GetWindowPluginCallRequest.java | 2 +- .../sun/applet/PluginAppletSecurityContext.java | 50 +++++++-------- .../java/sun/applet/PluginAppletViewer.java | 74 +++++++++++----------- .../java/sun/applet/PluginCookieInfoRequest.java | 2 +- plugin/icedteanp/java/sun/applet/PluginDebug.java | 9 ++- .../java/sun/applet/PluginMessageConsumer.java | 10 +-- .../sun/applet/PluginMessageHandlerWorker.java | 10 +-- .../java/sun/applet/PluginObjectStore.java | 2 +- .../java/sun/applet/PluginProxyInfoRequest.java | 2 +- .../java/sun/applet/PluginProxySelector.java | 6 +- .../java/sun/applet/PluginStreamHandler.java | 12 ++-- plugin/icedteanp/java/sun/applet/RequestQueue.java | 2 +- .../java/sun/applet/VoidPluginCallRequest.java | 2 +- 15 files changed, 96 insertions(+), 93 deletions(-) (limited to 'plugin') diff --git a/plugin/icedteanp/java/sun/applet/AppletSecurityContextManager.java b/plugin/icedteanp/java/sun/applet/AppletSecurityContextManager.java index 14a839f..7c9e504 100644 --- a/plugin/icedteanp/java/sun/applet/AppletSecurityContextManager.java +++ b/plugin/icedteanp/java/sun/applet/AppletSecurityContextManager.java @@ -59,7 +59,7 @@ public class AppletSecurityContextManager { } public static void handleMessage(int identifier, int reference, String src, String[] privileges, String message) { - PluginDebug.debug(identifier + " -- " + src + " -- " + reference + " -- " + message + " CONTEXT= " + contexts.get(identifier)); + PluginDebug.debug(identifier, " -- ", src, " -- ", reference, " -- ", message, " CONTEXT= ", contexts.get(identifier)); AccessControlContext callContext = null; privileges = privileges != null ? privileges : new String[0]; diff --git a/plugin/icedteanp/java/sun/applet/GetMemberPluginCallRequest.java b/plugin/icedteanp/java/sun/applet/GetMemberPluginCallRequest.java index 5d143a6..2cea3da 100644 --- a/plugin/icedteanp/java/sun/applet/GetMemberPluginCallRequest.java +++ b/plugin/icedteanp/java/sun/applet/GetMemberPluginCallRequest.java @@ -42,11 +42,11 @@ public class GetMemberPluginCallRequest extends PluginCallRequest { public GetMemberPluginCallRequest(String message, Long reference) { super(message, reference); - PluginDebug.debug("GetMemberPluginCall " + message); + PluginDebug.debug("GetMemberPluginCall ", message); } public void parseReturn(String message) { - PluginDebug.debug("GetMemberParseReturn GOT: " + message); + PluginDebug.debug("GetMemberParseReturn GOT: ", message); String[] args = message.split(" "); // FIXME: Is it even possible to distinguish between null and void // here? diff --git a/plugin/icedteanp/java/sun/applet/GetWindowPluginCallRequest.java b/plugin/icedteanp/java/sun/applet/GetWindowPluginCallRequest.java index d7134da..8c0ffea 100644 --- a/plugin/icedteanp/java/sun/applet/GetWindowPluginCallRequest.java +++ b/plugin/icedteanp/java/sun/applet/GetWindowPluginCallRequest.java @@ -46,7 +46,7 @@ public class GetWindowPluginCallRequest extends PluginCallRequest { } public void parseReturn(String message) { - PluginDebug.debug("GetWindowParseReturn GOT: " + message); + PluginDebug.debug("GetWindowParseReturn GOT: ", message); String[] args = message.split(" "); // FIXME: add thread ID to messages to support multiple // threads using the netscape.javascript package. diff --git a/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java b/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java index 0bab269..41e5954 100644 --- a/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java +++ b/plugin/icedteanp/java/sun/applet/PluginAppletSecurityContext.java @@ -181,7 +181,7 @@ class Signature { c = Class.forName(name); } catch (ClassNotFoundException cnfe) { - PluginDebug.debug("Class " + name + " not found in primordial loader. Looking in " + cl); + PluginDebug.debug("Class ", name, " not found in primordial loader. Looking in ", cl); try { c = cl.loadClass(name); } catch (ClassNotFoundException e) { @@ -294,12 +294,12 @@ public class PluginAppletSecurityContext { } public void associateSrc(ClassLoader cl, URL src) { - PluginDebug.debug("Associating " + cl + " with " + src); + PluginDebug.debug("Associating ", cl, " with ", src); this.classLoaders.put(cl, src); } public void associateInstance(Integer i, ClassLoader cl) { - PluginDebug.debug("Associating " + cl + " with instance " + i); + PluginDebug.debug("Associating ", cl, " with instance ", i); this.instanceClassLoaders.put(i, cl); } @@ -329,7 +329,7 @@ public class PluginAppletSecurityContext { String[] args = message.split(" "); Integer instance = new Integer(args[1]); String className = args[2].replace('/', '.'); - PluginDebug.debug("Searching for class " + className + " in " + cl); + PluginDebug.debug("Searching for class ", className, " in ", cl); try { c = cl.loadClass(className); @@ -338,7 +338,7 @@ public class PluginAppletSecurityContext { } catch (ClassNotFoundException cnfe) { cl = this.instanceClassLoaders.get(instance); - PluginDebug.debug("Not found. Looking in " + cl); + PluginDebug.debug("Not found. Looking in ", cl); if (instance != 0 && cl != null) { try { @@ -381,7 +381,7 @@ public class PluginAppletSecurityContext { o = m = c.getMethod(methodName, signature.getClassArray()); store.reference(m); } - PluginDebug.debug(o + " has id " + store.getIdentifier(o)); + PluginDebug.debug(o, " has id ", store.getIdentifier(o)); write(reference, args[0] + " " + store.getIdentifier(o)); } else if (message.startsWith("GetStaticFieldID") || message.startsWith("GetFieldID")) { @@ -392,7 +392,7 @@ public class PluginAppletSecurityContext { Class c = (Class) store.getObject(classID); - PluginDebug.debug("GetStaticFieldID/GetFieldID got class=" + c.getName()); + PluginDebug.debug("GetStaticFieldID/GetFieldID got class=", c.getName()); Field f = null; f = c.getField(fieldName); @@ -631,7 +631,7 @@ public class PluginAppletSecurityContext { arguments[1] = methodName; for (int i = 0; i < args.length - 3; i++) { arguments[i + 2] = store.getObject(parseCall(args[3 + i], null, Integer.class)); - PluginDebug.debug("GOT ARG: " + arguments[i + 2]); + PluginDebug.debug("GOT ARG: ", arguments[i + 2]); } Object[] matchingMethodAndArgs = MethodOverloadResolver.getMatchingMethod(arguments); @@ -652,8 +652,8 @@ public class PluginAppletSecurityContext { collapsedArgs += " " + arg; } - PluginDebug.debug("Calling method " + m + " on object " + o - + " (" + c + ") with " + collapsedArgs); + PluginDebug.debug("Calling method ", m, " on object ", o + , " (", c, ") with ", collapsedArgs); AccessControlContext acc = callContext != null ? callContext : getClosedAccessControlContext(); checkPermission(src, c, acc); @@ -683,9 +683,9 @@ public class PluginAppletSecurityContext { retO = m.getReturnType().toString(); } - PluginDebug.debug("Calling " + m + " on " + o + " with " - + collapsedArgs + " and that returned: " + ret - + " of type " + retO); + PluginDebug.debug("Calling ", m, " on ", o, " with " + , collapsedArgs, " and that returned: ", ret + , " of type ", retO); if (m.getReturnType().equals(java.lang.Void.class) || m.getReturnType().equals(java.lang.Void.TYPE)) { @@ -799,8 +799,8 @@ public class PluginAppletSecurityContext { + Integer .toString(((int) b[i]) & 0x0ff, 16)); - PluginDebug.debug("Java: GetStringChars: " + o); - PluginDebug.debug(" String BYTES: " + buf); + PluginDebug.debug("Java: GetStringChars: ", o); + PluginDebug.debug(" String BYTES: ", buf); write(reference, "GetStringChars " + buf); } else if (message.startsWith("GetToStringValue")) { String[] args = message.split(" "); @@ -965,7 +965,7 @@ public class PluginAppletSecurityContext { for (int i = 0; i < args.length - 2; i++) { arguments[i + 1] = store.getObject(parseCall(args[2 + i], null, Integer.class)); - PluginDebug.debug("GOT ARG: " + arguments[i + 1]); + PluginDebug.debug("GOT ARG: ", arguments[i + 1]); } Object[] matchingConstructorAndArgs = MethodOverloadResolver @@ -990,8 +990,8 @@ public class PluginAppletSecurityContext { collapsedArgs += " " + arg.toString(); } - PluginDebug.debug("Calling constructor on class " + c + - " with " + collapsedArgs); + PluginDebug.debug("Calling constructor on class ", c, + " with ", collapsedArgs); AccessControlContext acc = callContext != null ? callContext : getClosedAccessControlContext(); checkPermission(src, c, acc); @@ -1014,7 +1014,7 @@ public class PluginAppletSecurityContext { write(reference, "NewObject " + store.getIdentifier(ret)); } else if (message.startsWith("NewStringUTF")) { - PluginDebug.debug("MESSAGE: " + message); + PluginDebug.debug("MESSAGE: ", message); String[] args = message.split(" "); int length = new Integer(args[1]); byte[] byteArray = new byte[length]; @@ -1028,12 +1028,12 @@ public class PluginAppletSecurityContext { } ret = new String(byteArray, "UTF-8"); - PluginDebug.debug("NEWSTRINGUTF: " + ret); + PluginDebug.debug("NEWSTRINGUTF: ", ret); store.reference(ret); write(reference, "NewStringUTF " + store.getIdentifier(ret)); } else if (message.startsWith("NewString")) { - PluginDebug.debug("MESSAGE: " + message); + PluginDebug.debug("MESSAGE: ", message); String[] args = message.split(" "); Integer strlength = parseCall(args[1], null, Integer.class); int bytelength = 2 * strlength; @@ -1041,20 +1041,20 @@ public class PluginAppletSecurityContext { String ret = null; for (int i = 0; i < strlength; i++) { int c = parseCall(args[2 + i], null, Integer.class); - PluginDebug.debug("char " + i + " " + c); + PluginDebug.debug("char ", i, " ", c); // Low. byteArray[2 * i] = (byte) (c & 0x0ff); // High. byteArray[2 * i + 1] = (byte) ((c >> 8) & 0x0ff); } ret = new String(byteArray, 0, bytelength, "UTF-16LE"); - PluginDebug.debug("NEWSTRING: " + ret); + PluginDebug.debug("NEWSTRING: ", ret); store.reference(ret); write(reference, "NewString " + store.getIdentifier(ret)); } else if (message.startsWith("ExceptionOccurred")) { - PluginDebug.debug("EXCEPTION: " + throwable); + PluginDebug.debug("EXCEPTION: ", throwable); if (throwable != null) store.reference(throwable); write(reference, "ExceptionOccurred " @@ -1132,7 +1132,7 @@ public class PluginAppletSecurityContext { } private void write(int reference, String message) { - PluginDebug.debug("appletviewer writing " + message); + PluginDebug.debug("appletviewer writing ", message); streamhandler.write("context " + identifier + " reference " + reference + " " + message); } diff --git a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java index d863f16..df29e3f 100644 --- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java +++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java @@ -189,7 +189,7 @@ class PluginAppletPanelFactory { return null; } - PluginDebug.debug("Applet " + a.getClass() + " initialized"); + PluginDebug.debug("Applet ", a.getClass(), " initialized"); streamhandler.write("instance " + identifier + " reference 0 initialized"); AppletSecurityContextManager.getSecurityContext(0).associateSrc(((NetxPanel) panel).getAppletClassLoader(), doc); @@ -232,7 +232,7 @@ class PluginAppletPanelFactory { String[] events = splitSeparator(",", eventList); for (int i = 0; i < events.length; i++) { - PluginDebug.debug("Adding event to queue: " + events[i]); + PluginDebug.debug("Adding event to queue: ", events[i]); if (events[i].equals("dispose")) panel.sendEvent(AppletPanel.APPLET_DISPOSE); else if (events[i].equals("load")) @@ -251,7 +251,7 @@ class PluginAppletPanelFactory { panel.sendEvent(AppletPanel.APPLET_ERROR); else // non-fatal error if we get an unrecognized event - PluginDebug.debug("Unrecognized event name: " + events[i]); + PluginDebug.debug("Unrecognized event name: ", events[i]); } while (!panel.emptyEventQueue()) @@ -371,7 +371,7 @@ public class PluginAppletViewer extends XEmbeddedFrame public static void framePanel(int identifier, PrintStream statusMsgStream, long handle, AppletViewerPanel panel) { - PluginDebug.debug("Framing " + panel); + PluginDebug.debug("Framing ", panel); // SecurityManager MUST be set, and only privileged code may call reFrame() System.getSecurityManager().checkPermission(new AllPermission()); @@ -386,7 +386,7 @@ public class PluginAppletViewer extends XEmbeddedFrame applets.put(identifier, appletFrame); - PluginDebug.debug(panel + " framed"); + PluginDebug.debug(panel, " framed"); } /** @@ -486,7 +486,7 @@ public class PluginAppletViewer extends XEmbeddedFrame */ public static void handleMessage(int identifier, int reference, String message) { - PluginDebug.debug("PAV handling: " + message); + PluginDebug.debug("PAV handling: ", message); try { if (message.startsWith("handle")) { @@ -515,11 +515,11 @@ public class PluginAppletViewer extends XEmbeddedFrame UrlUtil.decode(message.substring("tag".length() + 1, spaceLocation)); String tag = message.substring(spaceLocation + 1); - PluginDebug.debug("Handle = " + handle + "\n" + - "Width = " + width + "\n" + - "Height = " + height + "\n" + - "DocumentBase = " + documentBase + "\n" + - "Tag = " + tag); + PluginDebug.debug("Handle = ", handle, "\n", + "Width = ", width, "\n", + "Height = ", height, "\n", + "DocumentBase = ", documentBase, "\n", + "Tag = ", tag); PluginAppletViewer.parse (identifier, handle, width, height, @@ -561,7 +561,7 @@ public class PluginAppletViewer extends XEmbeddedFrame // Set it inactive, and try to do cleanup is applicable PAV_INIT_STATUS previousStatus = updateStatus(identifier, PAV_INIT_STATUS.INACTIVE); - PluginDebug.debug("Destroy status set for " + identifier); + PluginDebug.debug("Destroy status set for ", identifier); if (previousStatus != null && previousStatus.equals(PAV_INIT_STATUS.REFRAME_COMPLETE)) { @@ -569,7 +569,7 @@ public class PluginAppletViewer extends XEmbeddedFrame } } else { - PluginDebug.debug("Handling message: " + message + " instance " + identifier + " " + Thread.currentThread()); + PluginDebug.debug("Handling message: ", message, " instance ", identifier, " ", Thread.currentThread()); // Wait till initialization finishes while (!applets.containsKey(identifier) && @@ -643,17 +643,17 @@ public class PluginAppletViewer extends XEmbeddedFrame private static synchronized void destroyApplet(int identifier) { - PluginDebug.debug("DestroyApplet called for " + identifier); + PluginDebug.debug("DestroyApplet called for ", identifier); PAV_INIT_STATUS prev = updateStatus(identifier, PAV_INIT_STATUS.DESTROYED); // If already destroyed, return if (prev.equals(PAV_INIT_STATUS.DESTROYED)) { - PluginDebug.debug(identifier + " already destroyed. Returning."); + PluginDebug.debug(identifier, " already destroyed. Returning."); return; } - PluginDebug.debug("Attempting to destroy frame " + identifier); + PluginDebug.debug("Attempting to destroy frame ", identifier); // Try to dispose the panel right away if (applets.containsKey(identifier)) @@ -661,11 +661,11 @@ public class PluginAppletViewer extends XEmbeddedFrame // If panel is already disposed, return if (applets.get(identifier).panel.applet == null) { - PluginDebug.debug(identifier + " panel inactive. Returning."); + PluginDebug.debug(identifier, " panel inactive. Returning."); return; } - PluginDebug.debug("Attempting to destroy panel " + identifier); + PluginDebug.debug("Attempting to destroy panel ", identifier); final int fIdentifier = identifier; SwingUtilities.invokeLater(new Runnable() { @@ -674,7 +674,7 @@ public class PluginAppletViewer extends XEmbeddedFrame } }); - PluginDebug.debug(identifier + " destroyed"); + PluginDebug.debug(identifier, " destroyed"); } /** @@ -692,7 +692,7 @@ public class PluginAppletViewer extends XEmbeddedFrame waitTime < APPLET_TIMEOUT) { try { if (waitTime % 500 == 0) - PluginDebug.debug("Waiting for applet panel " + panel + " to initialize..."); + PluginDebug.debug("Waiting for applet panel ", panel, " to initialize..."); Thread.sleep(waitTime += 50); } catch (InterruptedException ie) { @@ -700,7 +700,7 @@ public class PluginAppletViewer extends XEmbeddedFrame } } - PluginDebug.debug("Applet panel " + panel + " initialized"); + PluginDebug.debug("Applet panel ", panel, " initialized"); } public void handleMessage(int reference, String message) { @@ -783,7 +783,7 @@ public class PluginAppletViewer extends XEmbeddedFrame // (happens in a separate thread) waitForAppletInit((NetxPanel) panel); - PluginDebug.debug(panel + " -- " + panel.getApplet() + " -- " + ((NetxPanel) panel).isAlive()); + PluginDebug.debug(panel, " -- ", panel.getApplet(), " -- ", ((NetxPanel) panel).isAlive()); // Still null? if (panel.getApplet() == null) { @@ -792,10 +792,10 @@ public class PluginAppletViewer extends XEmbeddedFrame } o = panel.getApplet(); - PluginDebug.debug("Looking for object " + o + " panel is " + panel); + PluginDebug.debug("Looking for object ", o, " panel is ", panel); AppletSecurityContextManager.getSecurityContext(0).store(o); - PluginDebug.debug("WRITING 1: " + "context 0 reference " + reference + " GetJavaObject " - + AppletSecurityContextManager.getSecurityContext(0).getIdentifier(o)); + PluginDebug.debug("WRITING 1: ", "context 0 reference ", reference, " GetJavaObject " + , AppletSecurityContextManager.getSecurityContext(0).getIdentifier(o)); streamhandler.write("context 0 reference " + reference + " GetJavaObject " + AppletSecurityContextManager.getSecurityContext(0).getIdentifier(o)); PluginDebug.debug("WRITING 1 DONE"); @@ -844,7 +844,7 @@ public class PluginAppletViewer extends XEmbeddedFrame * Get an image ref. */ private synchronized Ref getCachedImageRef(URL url) { - PluginDebug.debug("getCachedImageRef() searching for " + url); + PluginDebug.debug("getCachedImageRef() searching for ", url); try { @@ -853,8 +853,8 @@ public class PluginAppletViewer extends XEmbeddedFrame if (originalURL.startsWith(codeBase)) { - PluginDebug.debug("getCachedImageRef() got URL = " + url); - PluginDebug.debug("getCachedImageRef() plugin codebase = " + codeBase); + PluginDebug.debug("getCachedImageRef() got URL = ", url); + PluginDebug.debug("getCachedImageRef() plugin codebase = ", codeBase); // try to fetch it locally if (panel instanceof NetxPanel) { @@ -871,7 +871,7 @@ public class PluginAppletViewer extends XEmbeddedFrame } } - PluginDebug.debug("getCachedImageRef() getting img from URL = " + url); + PluginDebug.debug("getCachedImageRef() getting img from URL = ", url); synchronized (imageRefs) { AppletImageRef ref = imageRefs.get(url); @@ -1049,7 +1049,7 @@ public class PluginAppletViewer extends XEmbeddedFrame PluginDebug.debug("wait getMEM request 2"); while (request.isDone() == false) request.wait(); - PluginDebug.debug("wait getMEM request 3 GOT: " + request.getObject().getClass()); + PluginDebug.debug("wait getMEM request 3 GOT: ", request.getObject().getClass()); } } catch (InterruptedException e) { throw new RuntimeException("Interrupted waiting for call request.", @@ -1101,7 +1101,7 @@ public class PluginAppletViewer extends XEmbeddedFrame streamhandler.postCallRequest(request); streamhandler.write(request.getMessage()); try { - PluginDebug.debug("wait setMem request: " + request.getMessage()); + PluginDebug.debug("wait setMem request: ", request.getMessage()); PluginDebug.debug("wait setMem request 1"); synchronized (request) { PluginDebug.debug("wait setMem request 2"); @@ -1342,7 +1342,7 @@ public class PluginAppletViewer extends XEmbeddedFrame requestURI = UrlUtil.encode(scheme + "://" + uri.getHost() + port + "/" + uri.getPath(), "UTF-8"); } catch (Exception e) { - PluginDebug.debug("Cannot construct URL from " + uri.toString() + " ... falling back to DIRECT proxy"); + PluginDebug.debug("Cannot construct URL from ", uri.toString(), " ... falling back to DIRECT proxy"); e.printStackTrace(); return null; } @@ -1424,7 +1424,7 @@ public class PluginAppletViewer extends XEmbeddedFrame // FIXME: make this private and access it from JSObject using // reflection. private void write(String message) throws IOException { - PluginDebug.debug("WRITING 2: " + "instance " + identifier + " " + message); + PluginDebug.debug("WRITING 2: ", "instance ", identifier, " " + message); streamhandler.write("instance " + identifier + " " + message); PluginDebug.debug("WRITING 2 DONE"); } @@ -1741,7 +1741,7 @@ public class PluginAppletViewer extends XEmbeddedFrame if ((c[0] = in.read()) == '>') { buf.append((char) c[0]); - PluginDebug.debug("Comment skipped: " + buf.toString()); + PluginDebug.debug("Comment skipped: ", buf.toString()); // comment skipped. return; @@ -1753,7 +1753,7 @@ public class PluginAppletViewer extends XEmbeddedFrame } else if (commentHeaderPassed == false) { buf.append((char) c[0]); - PluginDebug.debug("Warning: Attempted to skip comment, but this tag does not appear to be a comment: " + buf.toString()); + PluginDebug.debug("Warning: Attempted to skip comment, but this tag does not appear to be a comment: ", buf.toString()); return; } @@ -1795,7 +1795,7 @@ public class PluginAppletViewer extends XEmbeddedFrame val = decodeString(buf.toString()); } - PluginDebug.debug("PUT " + att + " = '" + val + "'"); + PluginDebug.debug("PUT ", att, " = '", val, "'"); atts.put(att.toLowerCase(java.util.Locale.ENGLISH), val); while (true) { @@ -1958,7 +1958,7 @@ public class PluginAppletViewer extends XEmbeddedFrame if (val == null) { statusMsgStream.println(requiresNameWarning); } else { - PluginDebug.debug("PUT " + att + " = " + val); + PluginDebug.debug("PUT ", att, " = ", val); atts.put(att.toLowerCase(), val); } } diff --git a/plugin/icedteanp/java/sun/applet/PluginCookieInfoRequest.java b/plugin/icedteanp/java/sun/applet/PluginCookieInfoRequest.java index 7671c40..d2dfce8 100644 --- a/plugin/icedteanp/java/sun/applet/PluginCookieInfoRequest.java +++ b/plugin/icedteanp/java/sun/applet/PluginCookieInfoRequest.java @@ -54,7 +54,7 @@ public class PluginCookieInfoRequest extends PluginCallRequest { // try to parse the proxy information. If things go wrong, do nothing .. // this will keep internal = null which forces a direct connection - PluginDebug.debug("PluginCookieInfoRequest GOT: " + cookieInfo); + PluginDebug.debug("PluginCookieInfoRequest GOT: ", cookieInfo); // skip 'plugin' marker cookieInfo = cookieInfo.substring(cookieInfo.indexOf(' ') + 1); diff --git a/plugin/icedteanp/java/sun/applet/PluginDebug.java b/plugin/icedteanp/java/sun/applet/PluginDebug.java index 29c7c1c..4cbbe53 100644 --- a/plugin/icedteanp/java/sun/applet/PluginDebug.java +++ b/plugin/icedteanp/java/sun/applet/PluginDebug.java @@ -41,8 +41,11 @@ public class PluginDebug { static final boolean DEBUG = System.getenv().containsKey("ICEDTEAPLUGIN_DEBUG"); - public static void debug(String message) { - if (DEBUG) - System.err.println(message); + public static void debug(Object... messageChunks) { + if (DEBUG) { + for (Object chunk : messageChunks) { + System.err.println(chunk.toString()); + } + } } } diff --git a/plugin/icedteanp/java/sun/applet/PluginMessageConsumer.java b/plugin/icedteanp/java/sun/applet/PluginMessageConsumer.java index bb9f94c..e6968b5 100644 --- a/plugin/icedteanp/java/sun/applet/PluginMessageConsumer.java +++ b/plugin/icedteanp/java/sun/applet/PluginMessageConsumer.java @@ -69,7 +69,7 @@ class PluginMessageConsumer { * @param reference The reference to give priority to */ public static void registerPriorityWait(Long reference) { - PluginDebug.debug("Registering priority for reference " + reference); + PluginDebug.debug("Registering priority for reference ", reference); registerPriorityWait("reference " + reference.toString()); } @@ -79,7 +79,7 @@ class PluginMessageConsumer { * @param searchString the string to look for in a response */ private static void registerPriorityWait(String searchString) { - PluginDebug.debug("Registering priority for string " + searchString); + PluginDebug.debug("Registering priority for string ", searchString); synchronized (priorityWaitQueue) { if (!priorityWaitQueue.contains(searchString)) { priorityWaitQueue.add(searchString); @@ -206,7 +206,7 @@ class PluginMessageConsumer { for (PluginMessageHandlerWorker worker : workers) { if (worker.isFree(prioritized)) { - PluginDebug.debug("Found free worker (" + worker.isPriority() + ") with id " + worker.getWorkerId()); + PluginDebug.debug("Found free worker (", worker.isPriority(), ") with id ", worker.getWorkerId()); // mark it busy before returning worker.busy(); return worker; @@ -218,10 +218,10 @@ class PluginMessageConsumer { PluginMessageHandlerWorker worker = null; if (workers.size() < (MAX_WORKERS - PRIORITY_WORKERS)) { - PluginDebug.debug("Cannot find free worker, creating worker " + workers.size()); + PluginDebug.debug("Cannot find free worker, creating worker ", workers.size()); worker = new PluginMessageHandlerWorker(this, streamHandler, workers.size(), false); } else if (prioritized) { - PluginDebug.debug("Cannot find free worker, creating priority worker " + workers.size()); + PluginDebug.debug("Cannot find free worker, creating priority worker ", workers.size()); worker = new PluginMessageHandlerWorker(this, streamHandler, workers.size(), true); } else { return null; diff --git a/plugin/icedteanp/java/sun/applet/PluginMessageHandlerWorker.java b/plugin/icedteanp/java/sun/applet/PluginMessageHandlerWorker.java index 26ab3cc..50941ab 100644 --- a/plugin/icedteanp/java/sun/applet/PluginMessageHandlerWorker.java +++ b/plugin/icedteanp/java/sun/applet/PluginMessageHandlerWorker.java @@ -56,7 +56,7 @@ class PluginMessageHandlerWorker extends Thread { this.isPriorityWorker = isPriorityWorker; this.consumer = consumer; - PluginDebug.debug("Worker " + this.id + " (priority=" + isPriorityWorker + ") created."); + PluginDebug.debug("Worker ", this.id, " (priority=", isPriorityWorker, ") created."); } public void setmessage(String message) { @@ -68,7 +68,7 @@ class PluginMessageHandlerWorker extends Thread { if (message != null) { - PluginDebug.debug("Consumer (priority=" + isPriorityWorker + ") thread " + id + " consuming " + message); + PluginDebug.debug("Consumer (priority=", isPriorityWorker, ") thread ", id, " consuming ", message); // ideally, whoever returns this object should mark it // busy first, but just in case.. @@ -86,7 +86,7 @@ class PluginMessageHandlerWorker extends Thread { this.message = null; - PluginDebug.debug("Consumption (priority=" + isPriorityWorker + ") completed by consumer thread " + id); + PluginDebug.debug("Consumption (priority=", isPriorityWorker, ") completed by consumer thread ", id); // mark ourselves free again free(); @@ -96,9 +96,9 @@ class PluginMessageHandlerWorker extends Thread { // Sleep when there is nothing to do try { Thread.sleep(Integer.MAX_VALUE); - PluginDebug.debug("Consumer thread " + id + " sleeping..."); + PluginDebug.debug("Consumer thread ", id, " sleeping..."); } catch (InterruptedException ie) { - PluginDebug.debug("Consumer thread " + id + " woken..."); + PluginDebug.debug("Consumer thread ", id, " woken..."); // nothing.. someone woke us up, see if there // is work to do } diff --git a/plugin/icedteanp/java/sun/applet/PluginObjectStore.java b/plugin/icedteanp/java/sun/applet/PluginObjectStore.java index 1f7114d..a80e327 100644 --- a/plugin/icedteanp/java/sun/applet/PluginObjectStore.java +++ b/plugin/icedteanp/java/sun/applet/PluginObjectStore.java @@ -127,7 +127,7 @@ public class PluginObjectStore { synchronized(lock) { if (PluginDebug.DEBUG) { for (Map.Entry e : objects.entrySet()) { - PluginDebug.debug(e.getKey() + "::" + e.getValue()); + PluginDebug.debug(e.getKey(), "::", e.getValue()); } } } diff --git a/plugin/icedteanp/java/sun/applet/PluginProxyInfoRequest.java b/plugin/icedteanp/java/sun/applet/PluginProxyInfoRequest.java index 9e46d2c..8631f41 100644 --- a/plugin/icedteanp/java/sun/applet/PluginProxyInfoRequest.java +++ b/plugin/icedteanp/java/sun/applet/PluginProxyInfoRequest.java @@ -56,7 +56,7 @@ public class PluginProxyInfoRequest extends PluginCallRequest { // try to parse the proxy information. If things go wrong, do nothing .. // this will keep internal = null which forces a direct connection - PluginDebug.debug("PluginProxyInfoRequest GOT: " + proxyInfo); + PluginDebug.debug("PluginProxyInfoRequest GOT: ", proxyInfo); String[] messageComponents = proxyInfo.split(" "); try { diff --git a/plugin/icedteanp/java/sun/applet/PluginProxySelector.java b/plugin/icedteanp/java/sun/applet/PluginProxySelector.java index 735c918..32360fe 100644 --- a/plugin/icedteanp/java/sun/applet/PluginProxySelector.java +++ b/plugin/icedteanp/java/sun/applet/PluginProxySelector.java @@ -84,7 +84,7 @@ public class PluginProxySelector extends JNLPProxySelector { // If the browser returned anything, try to parse it. If anything in the try block fails, the fallback is direct connection try { if (o != null) { - PluginDebug.debug("Proxy URI = " + o); + PluginDebug.debug("Proxy URI = ", o); URI proxyURI = (URI) o; // If origin uri is http/ftp, we're good. If origin uri is not that, the proxy _must_ be socks, else we fallback to direct @@ -98,7 +98,7 @@ public class PluginProxySelector extends JNLPProxySelector { String uriKey = uri.getScheme() + "://" + uri.getHost(); proxyCache.put(uriKey, proxy); } else { - PluginDebug.debug("Proxy " + proxyURI + " cannot be used for " + uri + ". Falling back to DIRECT"); + PluginDebug.debug("Proxy ", proxyURI, " cannot be used for ", uri, ". Falling back to DIRECT"); } } } catch (Exception e) { @@ -107,7 +107,7 @@ public class PluginProxySelector extends JNLPProxySelector { proxyList.add(proxy); - PluginDebug.debug("Proxy for " + uri.toString() + " is " + proxy); + PluginDebug.debug("Proxy for ", uri.toString(), " is ", proxy); return proxyList; } diff --git a/plugin/icedteanp/java/sun/applet/PluginStreamHandler.java b/plugin/icedteanp/java/sun/applet/PluginStreamHandler.java index d68e8e4..04e093e 100644 --- a/plugin/icedteanp/java/sun/applet/PluginStreamHandler.java +++ b/plugin/icedteanp/java/sun/applet/PluginStreamHandler.java @@ -65,7 +65,7 @@ public class PluginStreamHandler { public PluginStreamHandler(InputStream inputstream, OutputStream outputstream) throws MalformedURLException, IOException { - PluginDebug.debug("Current context CL=" + Thread.currentThread().getContextClassLoader()); + PluginDebug.debug("Current context CL=", Thread.currentThread().getContextClassLoader()); PluginDebug.debug("Creating consumer..."); consumer = new PluginMessageConsumer(this); @@ -168,7 +168,7 @@ public class PluginStreamHandler { try { - PluginDebug.debug("Breakdown -- type: " + type + " identifier: " + identifier + " reference: " + reference + " src: " + src + " privileges: " + privileges + " rest: \"" + rest + "\""); + PluginDebug.debug("Breakdown -- type: ", type, " identifier: ", identifier, " reference: ", reference, " src: ", src, " privileges: ", privileges, " rest: \"", rest, "\""); if (rest.contains("JavaScriptGetWindow") || rest.contains("JavaScriptGetMember") @@ -191,7 +191,7 @@ public class PluginStreamHandler { if (type.equals("instance")) { PluginAppletViewer.handleMessage(identifier, freference, frest); } else if (type.equals("context")) { - PluginDebug.debug("Sending to PASC: " + identifier + "/" + reference + " and " + rest); + PluginDebug.debug("Sending to PASC: ", identifier, "/", reference, " and ", rest); AppletSecurityContextManager.handleMessage(identifier, reference, src, privileges, rest); } } catch (Exception e) { @@ -234,7 +234,7 @@ public class PluginStreamHandler { while (!request.serviceable(message)) { - PluginDebug.debug(request + " cannot service " + message); + PluginDebug.debug(request, " cannot service ", message); // something is very wrong.. we have a message to // process, but no one to service it @@ -279,7 +279,7 @@ public class PluginStreamHandler { try { message = pluginInputReader.readLine(); - PluginDebug.debug(" PIPE: appletviewer read: " + message); + PluginDebug.debug(" PIPE: appletviewer read: ", message); if (message == null || message.equals("shutdown")) { synchronized (shuttingDown) { @@ -313,7 +313,7 @@ public class PluginStreamHandler { */ public void write(String message) { - PluginDebug.debug(" PIPE: appletviewer wrote: " + message); + PluginDebug.debug(" PIPE: appletviewer wrote: ", message); synchronized (pluginOutputWriter) { try { pluginOutputWriter.write(message + "\n", 0, message.length()); diff --git a/plugin/icedteanp/java/sun/applet/RequestQueue.java b/plugin/icedteanp/java/sun/applet/RequestQueue.java index 17df673..1610ffc 100644 --- a/plugin/icedteanp/java/sun/applet/RequestQueue.java +++ b/plugin/icedteanp/java/sun/applet/RequestQueue.java @@ -43,7 +43,7 @@ public class RequestQueue { private int size = 0; public void post(PluginCallRequest request) { - PluginDebug.debug("Securitymanager=" + System.getSecurityManager()); + PluginDebug.debug("Securitymanager=", System.getSecurityManager()); if (head == null) { head = tail = request; tail.setNext(null); diff --git a/plugin/icedteanp/java/sun/applet/VoidPluginCallRequest.java b/plugin/icedteanp/java/sun/applet/VoidPluginCallRequest.java index 71687d2..d367add 100644 --- a/plugin/icedteanp/java/sun/applet/VoidPluginCallRequest.java +++ b/plugin/icedteanp/java/sun/applet/VoidPluginCallRequest.java @@ -40,7 +40,7 @@ package sun.applet; public class VoidPluginCallRequest extends PluginCallRequest { public VoidPluginCallRequest(String message, Long reference) { super(message, reference); - PluginDebug.debug("VoidPluginCall " + message); + PluginDebug.debug("VoidPluginCall ", message); } public void parseReturn(String message) { -- cgit v1.2.3