changeset 52548:472f10d8a501

8198321: javax/swing/JEditorPane/5076514/bug5076514.java fails Reviewed-by: psadhukhan
author serb
date Sat, 10 Nov 2018 18:41:43 -0800
parents 55f835bdb9e0
children 50de7d1f6b64
files test/jdk/ProblemList.txt test/jdk/javax/swing/JEditorPane/5076514/bug5076514.java
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/test/jdk/ProblemList.txt	Sat Nov 10 09:52:59 2018 -0800
+++ b/test/jdk/ProblemList.txt	Sat Nov 10 18:41:43 2018 -0800
@@ -742,7 +742,6 @@
 javax/swing/JComboBox/8057893/bug8057893.java 8169953 windows-all,macosx-all
 javax/swing/JComboBox/8072767/bug8072767.java 8196093 windows-all,macosx-all
 javax/swing/JComponent/4337267/bug4337267.java 8146451 windows-all
-javax/swing/JEditorPane/5076514/bug5076514.java 8198321 generic-all
 javax/swing/JFileChooser/4524490/bug4524490.java 8042380 generic-all
 javax/swing/JFileChooser/8002077/bug8002077.java 8196094 windows-all
 javax/swing/JFileChooser/DeserializedJFileChooser/DeserializedJFileChooserTest.java 8196095 generic-all
--- a/test/jdk/javax/swing/JEditorPane/5076514/bug5076514.java	Sat Nov 10 09:52:59 2018 -0800
+++ b/test/jdk/javax/swing/JEditorPane/5076514/bug5076514.java	Sat Nov 10 18:41:43 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,13 +22,16 @@
  */
 
 /* @test
-   @bug 5076514 8025430
+   @bug 5076514 8025430 8198321
    @summary Tests if SecurityManager.checkPermission()
                   used for clipboard access with permission 'accessClipboard'
    @run main bug5076514
+   @run main/othervm -Djava.awt.headless=true bug5076514
 */
 
+import java.awt.GraphicsEnvironment;
 import java.security.Permission;
+
 import javax.swing.JEditorPane;
 
 public class bug5076514 {
@@ -37,9 +40,13 @@
 
     public static void main(String[] args) {
         System.setSecurityManager(new MySecurityManager());
+
+        // no system clipboard in the headless mode
+        boolean expected  = !GraphicsEnvironment.isHeadless();
+
         JEditorPane editor = new JEditorPane();
         editor.copy();
-        if (!isCheckPermissionCalled) {
+        if (isCheckPermissionCalled != expected) {
             throw new RuntimeException("JEditorPane's clipboard operations "
                     + "didn't call SecurityManager.checkPermission() with "
                     + "permission 'accessClipboard' when there is a security"