use of org.apache.naming.JndiPermission in project Payara by payara.
the class WebappClassLoader method addPermission.
/**
* If there is a Java SecurityManager create a read FilePermission
* or JndiPermission for the file directory path.
*
* @param path file directory path
*/
public void addPermission(String path) {
if (path == null) {
return;
}
if (securityManager != null) {
securityManager.checkSecurityAccess(DDPermissionsLoader.SET_EE_POLICY);
Permission permission = null;
if (path.startsWith("jndi:") || path.startsWith("jar:jndi:")) {
if (!path.endsWith("/")) {
path = path + "/";
}
permission = new JndiPermission(path + "*");
permissionList.add(permission);
} else {
if (!path.endsWith(File.separator)) {
permission = new FilePermission(path, "read");
permissionList.add(permission);
path = path + File.separator;
}
permission = new FilePermission(path + "-", "read");
permissionList.add(permission);
}
}
}
use of org.apache.naming.JndiPermission in project tomcat70 by apache.
the class WebappClassLoaderBase method addPermission.
/**
* If there is a Java SecurityManager create a read FilePermission
* or JndiPermission for the file directory path.
*
* @param filepath file directory path
*/
public void addPermission(String filepath) {
if (filepath == null) {
return;
}
String path = filepath;
if (securityManager != null) {
Permission permission = null;
if (path.startsWith("jndi:") || path.startsWith("jar:jndi:")) {
if (!path.endsWith("/")) {
path = path + "/";
}
permission = new JndiPermission(path + "*");
addPermission(permission);
} else {
if (!path.endsWith(File.separator)) {
permission = new FilePermission(path, "read");
addPermission(permission);
path = path + File.separator;
}
permission = new FilePermission(path + "-", "read");
addPermission(permission);
}
}
}
Aggregations