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
--- a/jdk/test/demo/jvmti/mtrace/JFrameCreateTime.java Fri May 23 07:07:33 2014 +0400
+++ b/jdk/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;
-
- start = System.currentTimeMillis();
- f = new JFrame("JFrame");
- end = System.currentTimeMillis();
-
- System.out.println("JFrame first creation took " + (end - start) + " ms");
+ 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 second creation took " + (end - start) + " ms");
- System.exit(0);
+ start = System.currentTimeMillis();
+ f = new JFrame("JFrame");
+ end = System.currentTimeMillis();
+
+ System.out.println("JFrame second creation took " + (end - start) + " ms");
+ System.exit(0);
+ }
}
}
--- a/jdk/test/demo/jvmti/mtrace/TraceJFrame.java Fri May 23 07:07:33 2014 +0400
+++ b/jdk/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;