felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r1068923 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java
Date Wed, 09 Feb 2011 14:59:58 GMT
Author: rickhall
Date: Wed Feb  9 14:59:57 2011
New Revision: 1068923

URL: http://svn.apache.org/viewvc?rev=1068923&view=rev
Log:
Throw exception if anyone attempts to open "/" bundle resource. (FELIX-2832)

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java?rev=1068923&r1=1068922&r2=1068923&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java
Wed Feb  9 14:59:57 2011
@@ -47,6 +47,17 @@ class URLHandlersBundleURLConnection ext
         throws IOException
     {
         super(url);
+
+        // If this is an attempt to create a connection to the root of
+        // the bundle, then throw an exception since this isn't possible.
+        // We only allow "/" as a valid URL so it can be used as context
+        // for creating other URLs.
+        String path = url.getPath();
+        if ((path == null) || (path.length() == 0) || path.equals("/"))
+        {
+            throw new IOException("Resource does not exist: " + url);
+        }
+
         m_framework = framework;
 
         // If we don't have a framework instance, try to find



Mime
View raw message