summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio_quarti@ca.ibm.com>2013-07-15 18:18:39 -0400
committerSilenio Quarti <silenio_quarti@ca.ibm.com>2013-07-15 18:18:39 -0400
commite0dc1dcebf5cb2c23b90e6736c844e317de5b017 (patch)
treeaa6f4c2b003ce9dc91a32c23ffdc74d12963e7cf
parent01c8ee61afe5a2a55fed1839db4f28acfab46b3e (diff)
downloadeclipse.platform.swt-e0dc1dcebf5cb2c23b90e6736c844e317de5b017.tar.gz
eclipse.platform.swt-e0dc1dcebf5cb2c23b90e6736c844e317de5b017.tar.xz
eclipse.platform.swt-e0dc1dcebf5cb2c23b90e6736c844e317de5b017.zip
Bug 412067 - isLoadable(); returns False due URL parse error - comment#4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java18
1 files changed, 7 insertions, 11 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java b/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java
index a6d8935a4e..bf1de817f7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/common_j2se/org/eclipse/swt/internal/Library.java
@@ -171,19 +171,15 @@ static boolean isLoadable () {
return true;
}
- try {
- url = new URL (url.getPath ());
- } catch (MalformedURLException e) {
- /* should never happen since url's initial path value must be valid */
- }
-
Attributes attributes = null;
try {
- String path = URLDecoder.decode(url.getPath (), "UTF-8");
- int index = path.indexOf ('!');
- File file = new File (path.substring (0, index));
- JarFile jar = new JarFile (file);
- attributes = jar.getManifest ().getMainAttributes ();
+ URLConnection connection = url.openConnection();
+ if (!(connection instanceof JarURLConnection)) {
+ /* should never happen for a "jar:" url */
+ return false;
+ }
+ JarURLConnection jc = (JarURLConnection) connection;
+ attributes = jc.getMainAttributes();
} catch (IOException e) {
/* should never happen for a valid SWT jar with the expected manifest values */
return false;