8198321: javax/swing/JEditorPane/5076514/bug5076514.java fails

Reviewed-by: psadhukhan
This commit is contained in:
Sergey Bylokhov 2018-11-10 18:41:43 -08:00
parent bd9a9d591b
commit cc3756b342
2 changed files with 10 additions and 4 deletions

View File

@ -742,7 +742,6 @@ javax/swing/JComboBox/8032878/bug8032878.java 8196092 windows-all,macosx-all
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

View File

@ -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 class bug5076514 {
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"