URLUtils.exists(URL url) doesn't properly handle missing files, eats exceptions and doesn't pass the causing exception
----------------------------------------------------------------------------------------------------------------------
Key: WOL-1077
URL: http://issues.objectstyle.org/jira/browse/WOL-1077
Project: WOProject/WOLips
Issue Type: Improvement
Components: wolips
Affects Versions: WOLips 3.3.* Next Stable Build
Environment: OSX 10.5.7, java 1.5, Eclipse 3.4.2, WOLips top of tree.
Reporter: Mark Ritchie
Here's the patch to fix the problems:
Index: wolips/base/plugins/org.objectstyle.wolips.baseforplugins/java/org/objectstyle/wolips/baseforplugins/util/URLUtils.java
===================================================================
--- wolips/base/plugins/org.objectstyle.wolips.baseforplugins/java/org/objectstyle/wolips/baseforplugins/util/URLUtils.java (revision 5973)
+++ wolips/base/plugins/org.objectstyle.wolips.baseforplugins/java/org/objectstyle/wolips/baseforplugins/util/URLUtils.java (working copy)
..-1,6 +1,7 @@
package org.objectstyle.wolips.baseforplugins.util;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.JarURLConnection;
import java.net.MalformedURLException;
..-214,8 +215,10 @@
JarURLConnection conn = (JarURLConnection) url.openConnection();
conn.getJarEntry();
exists = true;
+ } catch (FileNotFoundException e) {
+ exists = false;
} catch (IOException e) {
- //throw new IllegalArgumentException(url + " is not a File.");
+ throw new IllegalArgumentException(url + " is not a File.", e);
}
} else if ("file".equals(protocol) || "bundleresource".equals(protocol)) {
File file = cheatAndTurnIntoFile(url);
-- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.objectstyle.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
This archive was generated by hypermail 2.0.0 : Wed Sep 09 2009 - 00:13:00 EDT