harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r953409 - in /harmony/enhanced/java/trunk/classlib/modules/luni/src: main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/ test/api/common/org/apache/harmony/luni/tests/java/net/ test/resources/org/apache/harmony/luni/tests/java/...
Date Thu, 10 Jun 2010 17:42:58 GMT
Author: tellison
Date: Thu Jun 10 17:42:58 2010
New Revision: 953409

URL: http://svn.apache.org/viewvc?rev=953409&view=rev
Log:
Apply slightly modified patch for HARMONY-6537 ([classlib][luni] JarFile can not accept entry
name contains special url format)

Added:
    harmony/enhanced/java/trunk/classlib/modules/luni/src/test/resources/org/apache/harmony/luni/tests/java/net/url-test.jar
  (with props)
Modified:
    harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/JarURLConnectionImpl.java
    harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/JarURLConnectionTest.java

Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/JarURLConnectionImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/JarURLConnectionImpl.java?rev=953409&r1=953408&r2=953409&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/JarURLConnectionImpl.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/jar/JarURLConnectionImpl.java
Thu Jun 10 17:42:58 2010
@@ -28,6 +28,7 @@ import java.net.ContentHandlerFactory;
 import java.net.JarURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.net.URLDecoder;
 import java.security.AccessController;
 import java.security.Permission;
 import java.security.PrivilegedAction;
@@ -207,12 +208,14 @@ public class JarURLConnectionImpl extend
      * URLConnection}.
      */
     private void findJarEntry() throws IOException {
-        if (getEntryName() == null) {
+        String entryName = getEntryName();
+        if (entryName == null) {
             return;
         }
-        jarEntry = jarFile.getJarEntry(getEntryName());
+        String decodedName = URLDecoder.decode(entryName, "UTF-8"); //$NON-NLS-1$
+        jarEntry = jarFile.getJarEntry(decodedName);
         if (jarEntry == null) {
-            throw new FileNotFoundException(getEntryName());
+            throw new FileNotFoundException(entryName);
         }
     }
 

Modified: harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/JarURLConnectionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/JarURLConnectionTest.java?rev=953409&r1=953408&r2=953409&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/JarURLConnectionTest.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/JarURLConnectionTest.java
Thu Jun 10 17:42:58 2010
@@ -305,6 +305,17 @@ public class JarURLConnectionTest extend
                 "content/unknown", u.openConnection().getContentType());
     }
 
+    public void test_getURLEncodedEntry() throws IOException {
+        String base = "file:resources/org/apache/harmony/luni/tests/java/net/url-test.jar";
+        URL url = new URL("jar:" + base + "!/test%20folder%20for%20url%20test/test");
+
+        if (url != null) {
+            // Force existence check
+            InputStream is = url.openStream();
+            is.close();
+        }
+    }
+
 	protected void setUp() {
 	}
 

Added: harmony/enhanced/java/trunk/classlib/modules/luni/src/test/resources/org/apache/harmony/luni/tests/java/net/url-test.jar
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/luni/src/test/resources/org/apache/harmony/luni/tests/java/net/url-test.jar?rev=953409&view=auto
==============================================================================
Binary file - no diff available.

Propchange: harmony/enhanced/java/trunk/classlib/modules/luni/src/test/resources/org/apache/harmony/luni/tests/java/net/url-test.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message