Author: jcompagner
Date: Mon Dec 14 19:12:44 2009
New Revision: 890446
URL: http://svn.apache.org/viewvc?rev=890446&view=rev
Log:
partly reverted 2534 , fixed 2613
Issue: WICKET-2613
Modified:
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/util/io/Connections.java
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/util/resource/UrlResourceStream.java
Modified:
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/util/io/Connections.java
URL:
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/util/io/Connections.java?rev=890446&r1=890445&r2=890446&view=diff
==============================================================================
---
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/util/io/Connections.java
(original)
+++
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/util/io/Connections.java
Mon Dec 14 19:12:44 2009
@@ -16,11 +16,9 @@
*/
package org.apache.wicket.util.io;
-import java.io.File;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.JarURLConnection;
-import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
@@ -77,46 +75,6 @@
}
/**
- * Tries to find a file on the harddisk that the url points to
- *
- * @param url
- * @return file file pointing to the connection
- * @throws Exception
- * if file could not be located
- */
- public static File findFile(final URL url) throws Exception
- {
- File file = null;
- URL fileUrl = url;
- URLConnection connection = null;
-
- try
- {
- connection = url.openConnection();
-
- // if this is a connection to a file inside a jar we
point the file to the jar
- // itself
- if (connection instanceof JarURLConnection)
- {
- fileUrl =
((JarURLConnection)connection).getJarFileURL();
- }
-
- file = new File(new URI(fileUrl.toExternalForm()));
-
- if (file != null && !file.exists())
- {
- file = null;
- }
-
- return file;
- }
- finally
- {
- close(connection);
- }
- }
-
- /**
* Closes a connection, ignoring any exceptions if they occur
*
* @param connection
Modified:
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/util/resource/UrlResourceStream.java
URL:
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/util/resource/UrlResourceStream.java?rev=890446&r1=890445&r2=890446&view=diff
==============================================================================
---
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/util/resource/UrlResourceStream.java
(original)
+++
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/util/resource/UrlResourceStream.java
Mon Dec 14 19:12:44 2009
@@ -19,6 +19,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
@@ -95,7 +96,12 @@
try
{
- file = Connections.findFile(url);
+ file = new File(new URI(url.toExternalForm()));
+
+ if (file != null && !file.exists())
+ {
+ file = null;
+ }
}
catch (Exception e)
{