changeset 9949:022372f3db57

8043572: demo/jvmti/mtrace/TraceJFrame.java fails with AWTError: Can't connect to X11 window server using '$DISPLAY_SITE' as the value of the DISPLAY variable Reviewed-by: sla
author jbachorik
date Fri, 23 May 2014 15:07:22 +0200
parents 1dc8226a83ed
children 7eac6175f210
files test/demo/jvmti/mtrace/JFrameCreateTime.java test/demo/jvmti/mtrace/TraceJFrame.java
diffstat 2 files changed, 15 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/test/demo/jvmti/mtrace/JFrameCreateTime.java	Fri May 23 07:07:33 2014 +0400
+++ b/test/demo/jvmti/mtrace/JFrameCreateTime.java	Fri May 23 15:07:22 2014 +0200
@@ -32,24 +32,28 @@
  *   was very slow (VisualMust debugger people reported this).
  */
 
+import java.awt.GraphicsEnvironment;
 import javax.swing.*;
 
 public class JFrameCreateTime {
     public static void main(String[] args) {
         JFrame f;
         long start, end;
+        if (GraphicsEnvironment.isHeadless()) {
+            System.out.println("JFrameCreateTime test was skipped due to headless mode");
+        } else {
+            start = System.currentTimeMillis();
+            f = new JFrame("JFrame");
+            end = System.currentTimeMillis();
 
-        start = System.currentTimeMillis();
-        f = new JFrame("JFrame");
-        end = System.currentTimeMillis();
+            System.out.println("JFrame first creation took " + (end - start) + " ms");
 
-        System.out.println("JFrame first creation took " + (end - start) + " ms");
+            start = System.currentTimeMillis();
+            f = new JFrame("JFrame");
+            end = System.currentTimeMillis();
 
-        start = System.currentTimeMillis();
-        f = new JFrame("JFrame");
-        end = System.currentTimeMillis();
-
-        System.out.println("JFrame second creation took " + (end - start) + " ms");
-        System.exit(0);
+            System.out.println("JFrame second creation took " + (end - start) + " ms");
+            System.exit(0);
+        }
     }
 }
--- a/test/demo/jvmti/mtrace/TraceJFrame.java	Fri May 23 07:07:33 2014 +0400
+++ b/test/demo/jvmti/mtrace/TraceJFrame.java	Fri May 23 15:07:22 2014 +0200
@@ -37,7 +37,7 @@
 public class TraceJFrame {
     public static void main(String args[]) throws Exception {
         if (GraphicsEnvironment.isHeadless()) {
-            System.out.println("JFrame test was skipped due to headless mode");
+            System.out.println("TraceJFrame test was skipped due to headless mode");
         } else {
             DemoRun demo;