From e0dc1dcebf5cb2c23b90e6736c844e317de5b017 Mon Sep 17 00:00:00 2001 From: Silenio Quarti Date: Mon, 15 Jul 2013 18:18:39 -0400 Subject: Bug 412067 - isLoadable(); returns False due URL parse error - comment#4 --- .../common_j2se/org/eclipse/swt/internal/Library.java | 18 +++++++----------- 1 file 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; -- cgit