felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r892846 - in /felix/trunk/dependencymanager: core/src/main/java/org/apache/felix/dm/resources/BundleResourceRepository.java test/pom.xml
Date Mon, 21 Dec 2009 15:08:32 GMT
Author: marrs
Date: Mon Dec 21 15:08:31 2009
New Revision: 892846

URL: http://svn.apache.org/viewvc?rev=892846&view=rev
Log:
fixed an issue with the EntryResource in BundleResourceRepository, path + name calculation
where wrong

Modified:
    felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/resources/BundleResourceRepository.java
    felix/trunk/dependencymanager/test/pom.xml

Modified: felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/resources/BundleResourceRepository.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/resources/BundleResourceRepository.java?rev=892846&r1=892845&r2=892846&view=diff
==============================================================================
--- felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/resources/BundleResourceRepository.java
(original)
+++ felix/trunk/dependencymanager/core/src/main/java/org/apache/felix/dm/resources/BundleResourceRepository.java
Mon Dec 21 15:08:31 2009
@@ -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() {

Modified: felix/trunk/dependencymanager/test/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/test/pom.xml?rev=892846&r1=892845&r2=892846&view=diff
==============================================================================
--- felix/trunk/dependencymanager/test/pom.xml (original)
+++ felix/trunk/dependencymanager/test/pom.xml Mon Dec 21 15:08:31 2009
@@ -76,7 +76,6 @@
          <compilerArgument>-g</compilerArgument>
           <compilerVersion>1.5</compilerVersion>
         </configuration> 
-
         <executions>
           <execution>
             <id>default-testCompile</id>



Mime
View raw message