URL xUrl = getxURL(url, zoom);
if (xUrl == null)
return null;
- return getFilePath(xUrl); // can be null!
+ return getFilePath(xUrl, zoom == 100); // can be null!
}
}
private static InputStream getStream(URL url) {
try {
- URL platformURL = FileLocator.find(url);
- if (platformURL != null) {
- url = platformURL;
+ if (InternalPolicy.OSGI_AVAILABLE) {
+ URL platformURL = FileLocator.find(url);
+ if (platformURL != null) {
+ url = platformURL;
+ }
}
return new BufferedInputStream(url.openStream());
} catch (IOException e) {
*
* @return {@link String} or <code>null</code> if the file cannot be found
*/
- private static String getFilePath(URL url) {
+ private static String getFilePath(URL url, boolean logIOException) {
try {
if (!InternalPolicy.OSGI_AVAILABLE) {
return null;
}
+ URL platformURL = FileLocator.find(url);
+ if (platformURL != null) {
+ url = platformURL;
+ }
URL locatedURL = FileLocator.toFileURL(url);
if (FILE_PROTOCOL.equalsIgnoreCase(locatedURL.getProtocol()))
return new Path(locatedURL.getPath()).toOSString();
return null;
} catch (IOException e) {
- Policy.logException(e);
+ if (logIOException) {
+ Policy.logException(e);
+ }
return null;
}
}
try {
if (InternalPolicy.DEBUG_LOAD_URL_IMAGE_DESCRIPTOR_2x) {
- if (InternalPolicy.DEBUG_LOAD_URL_IMAGE_DESCRIPTOR_DIRECTLY) {
+ if (!InternalPolicy.DEBUG_LOAD_URL_IMAGE_DESCRIPTOR_DIRECTLY) {
try {
return new Image(device, new URLImageFileNameProvider(url));
} catch (SWTException exception) {
}
// Try to see if we can optimize using SWTs file based image support.
- String path = getFilePath(url);
+ String path = getFilePath(url, true);
if (path != null) {
try {
return new Image(device, path);