OpenJDK / jdk / jdk
changeset 48416:08144d9cbdaa
8193435: Remove pre-1.2 SecurityManager text from java.awt.Toolkit
Reviewed-by: serb, mullan
author | dmarkov |
---|---|
date | Fri, 22 Dec 2017 18:49:41 +0000 |
parents | bae005a497a2 |
children | 044979e94c4e |
files | src/java.desktop/share/classes/java/awt/Toolkit.java src/java.desktop/share/classes/sun/awt/SunToolkit.java src/java.desktop/share/classes/sun/awt/image/URLImageSource.java |
diffstat | 3 files changed, 4 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/src/java.desktop/share/classes/java/awt/Toolkit.java Wed Dec 20 08:38:20 2017 -0800 +++ b/src/java.desktop/share/classes/java/awt/Toolkit.java Fri Dec 22 18:49:41 2017 +0000 @@ -678,11 +678,6 @@ * If the connection to the specified URL requires * either {@code URLPermission} or {@code SocketPermission}, * then {@code URLPermission} is used for security checks. - * For compatibility with pre-1.2 security managers, if the access - * is denied with {@code FilePermission} or {@code SocketPermission}, - * the method throws the {@code SecurityException} - * if the corresponding 1.1-style SecurityManager.checkXXX method - * also denies permission. * @param url the URL to use in fetching the pixel data. * @return an image which gets its pixel data from * the specified URL. @@ -724,11 +719,6 @@ * If the connection to the specified URL requires * either {@code URLPermission} or {@code SocketPermission}, * then {@code URLPermission} is used for security checks. - * For compatibility with pre-1.2 security managers, if the access - * is denied with {@code FilePermission} or {@code SocketPermission}, - * the method throws {@code SecurityException} - * if the corresponding 1.1-style SecurityManager.checkXXX method - * also denies permission. * @param url the URL to use in fetching the pixel data. * @return an image which gets its pixel data from * the specified URL.
--- a/src/java.desktop/share/classes/sun/awt/SunToolkit.java Wed Dec 20 08:38:20 2017 -0800 +++ b/src/java.desktop/share/classes/sun/awt/SunToolkit.java Fri Dec 22 18:49:41 2017 +0000 @@ -868,25 +868,10 @@ java.security.Permission perm = URLUtil.getConnectPermission(url); if (perm != null) { - try { - sm.checkPermission(perm); - } catch (SecurityException se) { - // fallback to checkRead/checkConnect for pre 1.2 - // security managers - if ((perm instanceof java.io.FilePermission) && - perm.getActions().indexOf("read") != -1) { - sm.checkRead(perm.getName()); - } else if ((perm instanceof - java.net.SocketPermission) && - perm.getActions().indexOf("connect") != -1) { - sm.checkConnect(url.getHost(), url.getPort()); - } else { - throw se; - } - } + sm.checkPermission(perm); } } catch (java.io.IOException ioe) { - sm.checkConnect(url.getHost(), url.getPort()); + sm.checkConnect(url.getHost(), url.getPort()); } } }
--- a/src/java.desktop/share/classes/sun/awt/image/URLImageSource.java Wed Dec 20 08:38:20 2017 -0800 +++ b/src/java.desktop/share/classes/sun/awt/image/URLImageSource.java Fri Dec 22 18:49:41 2017 +0000 @@ -46,25 +46,10 @@ java.security.Permission perm = URLUtil.getConnectPermission(u); if (perm != null) { - try { - sm.checkPermission(perm); - } catch (SecurityException se) { - // fallback to checkRead/checkConnect for pre 1.2 - // security managers - if ((perm instanceof java.io.FilePermission) && - perm.getActions().indexOf("read") != -1) { - sm.checkRead(perm.getName()); - } else if ((perm instanceof - java.net.SocketPermission) && - perm.getActions().indexOf("connect") != -1) { - sm.checkConnect(u.getHost(), u.getPort()); - } else { - throw se; - } - } + sm.checkPermission(perm); } } catch (java.io.IOException ioe) { - sm.checkConnect(u.getHost(), u.getPort()); + sm.checkConnect(u.getHost(), u.getPort()); } } this.url = u;