8193435: Remove pre-1.2 SecurityManager text from java.awt.Toolkit
Reviewed-by: serb, mullan
This commit is contained in:
parent
2a8c7a915a
commit
384238b493
src/java.desktop/share/classes
@ -678,11 +678,6 @@ public abstract class Toolkit {
|
||||
* 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 @@ public abstract class Toolkit {
|
||||
* 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.
|
||||
|
@ -868,25 +868,10 @@ public abstract class SunToolkit extends Toolkit
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,25 +46,10 @@ public class URLImageSource extends InputStreamImageSource {
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user