Commit 8ed41e3a authored by Petri Hintukainen's avatar Petri Hintukainen

JSM: fix handling of relative parths

parent 3ca309f6
......@@ -126,7 +126,7 @@ public abstract class BDFileSystem extends FileSystem {
return fs.prefixLength(pathname);
}
private boolean isAbsolutePath(String path) {
public static boolean isAbsolutePath(String path) {
return path.startsWith("/") || path.indexOf(":\\") == 1 ||
path.startsWith("\\");
}
......
......@@ -241,8 +241,18 @@ final class BDJSecurityManager extends SecurityManager {
throw new SecurityException("write access denied");
}
private String getCanonPath(final String path)
private String getCanonPath(String origPath)
{
if (!java.io.BDFileSystem.isAbsolutePath(origPath)) {
String home = BDJXletContext.getCurrentXletHome();
if (home == null) {
logger.error("Relative path " + origPath + " outside Xlet context\n" + Logger.dumpStack());
return origPath;
}
origPath = home + origPath;
}
final String path = origPath;
String cpath = (String)AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment