fixed an issue with the EntryResource in BundleResourceRepository, path + name calculation where wrong
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@892846 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/resources/BundleResourceRepository.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/resources/BundleResourceRepository.java
index 82b1036..e4d03c5 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/resources/BundleResourceRepository.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/resources/BundleResourceRepository.java
@@ -32,9 +32,9 @@
public class BundleResourceRepository {
private final Bundle m_bundle;
-
+
public BundleResourceRepository(Bundle bundle) {
- this.m_bundle = bundle;
+ m_bundle = bundle;
}
public synchronized void addHandler(ServiceReference ref, ResourceHandler handler) {
@@ -89,8 +89,22 @@
// TODO is this unique? can we have the same url in more than one repository?
m_id = m_entry.toString();
m_repository = bundle.getSymbolicName() + "_" + bundle.getHeaders().get("Bundle-Version");
- m_path = entry.getPath();
- m_name = entry.getFile();
+ String path = entry.getPath();
+ int i = path.lastIndexOf('/');
+ if (i == -1) {
+ m_path = "/";
+ m_name = path;
+ }
+ else {
+ if (path.length() > (i + 1)) {
+ m_path = path.substring(0, i);
+ m_name = path.substring(i + 1);
+ }
+ else {
+ m_path = path;
+ m_name = "";
+ }
+ }
}
public final String getID() {
diff --git a/dependencymanager/test/pom.xml b/dependencymanager/test/pom.xml
index 1ff6e5f..1520a9f 100644
--- a/dependencymanager/test/pom.xml
+++ b/dependencymanager/test/pom.xml
@@ -76,7 +76,6 @@
<compilerArgument>-g</compilerArgument>
<compilerVersion>1.5</compilerVersion>
</configuration>
-
<executions>
<execution>
<id>default-testCompile</id>