You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2011/02/09 15:59:58 UTC
svn commit: r1068923 -
/felix/trunk/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java
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