This commit is contained in:
Jan Bartel 2017-07-28 11:55:57 +02:00 committed by Joakim Erdfelt
parent dfd9e43b2d
commit 7c4f7b13f7
1 changed files with 4 additions and 4 deletions

View File

@ -100,7 +100,7 @@ public class DefaultFileLocatorHelper implements BundleFileLocatorHelper
// some osgi frameworks do use the file protocol directly in some // some osgi frameworks do use the file protocol directly in some
// situations. Do use the FileResource to transform the URL into a // situations. Do use the FileResource to transform the URL into a
// File: URL#toURI is broken // File: URL#toURI is broken
return new PathResource(url).getFile().getParentFile().getParentFile(); return new PathResource(url).getFile().getParentFile().getParentFile().getCanonicalFile();
} }
else if (url.getProtocol().equals("bundleentry")) else if (url.getProtocol().equals("bundleentry"))
{ {
@ -131,7 +131,7 @@ public class DefaultFileLocatorHelper implements BundleFileLocatorHelper
FILE_FIELD.setAccessible(true); FILE_FIELD.setAccessible(true);
} }
File f = (File) FILE_FIELD.get(bundleEntry); File f = (File) FILE_FIELD.get(bundleEntry);
return f.getParentFile().getParentFile(); return f.getParentFile().getParentFile().getCanonicalFile();
} }
else if (match(bundleEntry.getClass().getName(), ZIP_BUNDLE_ENTRY_CLASSES)) else if (match(bundleEntry.getClass().getName(), ZIP_BUNDLE_ENTRY_CLASSES))
{ {
@ -173,7 +173,7 @@ public class DefaultFileLocatorHelper implements BundleFileLocatorHelper
if (location.startsWith("file:/")) if (location.startsWith("file:/"))
{ {
URI uri = new URI(URIUtil.encodePath(location)); URI uri = new URI(URIUtil.encodePath(location));
return new File(uri); return new File(uri).getCanonicalFile();
} }
else if (location.startsWith("file:")) else if (location.startsWith("file:"))
{ {
@ -199,7 +199,7 @@ public class DefaultFileLocatorHelper implements BundleFileLocatorHelper
else if (location.startsWith("reference:file:")) else if (location.startsWith("reference:file:"))
{ {
location = URLDecoder.decode(location.substring("reference:".length()), "UTF-8"); location = URLDecoder.decode(location.substring("reference:".length()), "UTF-8");
File file = new File(location.substring("file:".length())); File file = new File(location.substring("file:".length())).getCanonicalFile();
return file; return file;
} }
} }