7170427: setGlobalCurrentFocusCycleRoot unexpectedly throws SecurityException
Reviewed-by: art
This commit is contained in:
parent
1d1ed3ddb3
commit
33648efb4c
jdk/src/share/classes/java/awt
@ -7947,32 +7947,21 @@ public abstract class Component implements ImageObserver, MenuContainer,
|
||||
if (rootAncestor != null) {
|
||||
Container rootAncestorRootAncestor =
|
||||
rootAncestor.getFocusCycleRootAncestor();
|
||||
|
||||
final Container fcr = (rootAncestorRootAncestor != null) ?
|
||||
Container fcr = (rootAncestorRootAncestor != null) ?
|
||||
rootAncestorRootAncestor : rootAncestor;
|
||||
|
||||
AccessController.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
KeyboardFocusManager.getCurrentKeyboardFocusManager().
|
||||
setGlobalCurrentFocusCycleRoot(fcr);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
KeyboardFocusManager.getCurrentKeyboardFocusManager().
|
||||
setGlobalCurrentFocusCycleRootPriv(fcr);
|
||||
rootAncestor.requestFocus(CausedFocusEvent.Cause.TRAVERSAL_UP);
|
||||
} else {
|
||||
final Window window = getContainingWindow();
|
||||
Window window = getContainingWindow();
|
||||
|
||||
if (window != null) {
|
||||
Component toFocus = window.getFocusTraversalPolicy().
|
||||
getDefaultComponent(window);
|
||||
if (toFocus != null) {
|
||||
AccessController.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
KeyboardFocusManager.getCurrentKeyboardFocusManager().
|
||||
setGlobalCurrentFocusCycleRoot(window);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
KeyboardFocusManager.getCurrentKeyboardFocusManager().
|
||||
setGlobalCurrentFocusCycleRootPriv(window);
|
||||
toFocus.requestFocus(CausedFocusEvent.Cause.TRAVERSAL_UP);
|
||||
}
|
||||
}
|
||||
|
@ -3245,7 +3245,7 @@ public class Container extends Component {
|
||||
|
||||
if (root != currentFocusCycleRoot) {
|
||||
KeyboardFocusManager.getCurrentKeyboardFocusManager().
|
||||
setGlobalCurrentFocusCycleRoot(root);
|
||||
setGlobalCurrentFocusCycleRootPriv(root);
|
||||
}
|
||||
return root;
|
||||
}
|
||||
@ -3302,7 +3302,7 @@ public class Container extends Component {
|
||||
Container cont = kfm.getCurrentFocusCycleRoot();
|
||||
|
||||
if (cont == this || isParentOf(cont)) {
|
||||
kfm.setGlobalCurrentFocusCycleRoot(null);
|
||||
kfm.setGlobalCurrentFocusCycleRootPriv(null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3506,7 +3506,7 @@ public class Container extends Component {
|
||||
public void transferFocusDownCycle() {
|
||||
if (isFocusCycleRoot()) {
|
||||
KeyboardFocusManager.getCurrentKeyboardFocusManager().
|
||||
setGlobalCurrentFocusCycleRoot(this);
|
||||
setGlobalCurrentFocusCycleRootPriv(this);
|
||||
Component toFocus = getFocusTraversalPolicy().
|
||||
getDefaultComponent(this);
|
||||
if (toFocus != null) {
|
||||
|
@ -637,8 +637,8 @@ public abstract class KeyboardFocusManager
|
||||
}
|
||||
|
||||
void clearGlobalFocusOwnerPriv() {
|
||||
AccessController.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
clearGlobalFocusOwner();
|
||||
return null;
|
||||
}
|
||||
@ -1287,6 +1287,15 @@ public abstract class KeyboardFocusManager
|
||||
newFocusCycleRoot);
|
||||
}
|
||||
|
||||
void setGlobalCurrentFocusCycleRootPriv(final Container newFocusCycleRoot) {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
setGlobalCurrentFocusCycleRoot(newFocusCycleRoot);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a PropertyChangeListener to the listener list. The listener is
|
||||
* registered for all bound properties of this class, including the
|
||||
|
Loading…
x
Reference in New Issue
Block a user