Please review the small diff below - see the bug for details. This change will 
cause OutputViewer to misbehave if init() is called more than once. But since 
this is an internal class in jconsole, that restriction is not a problem

bug: https://bugs.openjdk.java.net/browse/JDK-8159155 
<https://bugs.openjdk.java.net/browse/JDK-8159155>

Thanks,
/Staffan


diff --git 
a/src/jdk.jconsole/share/classes/sun/tools/jconsole/OutputViewer.java 
b/src/jdk.jconsole/share/classes/sun/tools/jconsole/OutputViewer.java
--- a/src/jdk.jconsole/share/classes/sun/tools/jconsole/OutputViewer.java
+++ b/src/jdk.jconsole/share/classes/sun/tools/jconsole/OutputViewer.java
@@ -42,14 +42,11 @@
     private static JFrame frame;
     private static JTextArea ta;

-    static {
+    public static void init() {
         System.setOut(PipeListener.create("System.out"));
         System.setErr(PipeListener.create("System.err"));
     }

-    // Dummy to cause class to be loaded
-    public static void init() { }
-
     private static void append(String s) {
         if (frame == null) {
             // FIXME: The frame title should be a localized string.

Reply via email to