commit | 0aacad3983ec62aa031d9e235157913f277b4bb8 | [log] [tgz] |
---|---|---|
author | Richard S. Hall <rickhall@apache.org> | Wed Feb 09 14:59:57 2011 +0000 |
committer | Richard S. Hall <rickhall@apache.org> | Wed Feb 09 14:59:57 2011 +0000 |
tree | ac8849f2dcd0381ef9c976b433dadc9728ceb42c | |
parent | d10f7c723dde1b7ab4ace8a94d6fddff572d7e45 [diff] |
Throw exception if anyone attempts to open "/" bundle resource. (FELIX-2832) git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1068923 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java b/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java index 5a3df7b..f5bddb8 100644 --- a/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java +++ b/framework/src/main/java/org/apache/felix/framework/URLHandlersBundleURLConnection.java
@@ -47,6 +47,17 @@ 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