You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by mc...@apache.org on 2011/06/24 21:19:35 UTC

svn commit: r1139413 - /felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java

Author: mcculls
Date: Fri Jun 24 19:19:35 2011
New Revision: 1139413

URL: http://svn.apache.org/viewvc?rev=1139413&view=rev
Log:
FELIX-2346: compute correct path when detecting missing resources

Modified:
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java?rev=1139413&r1=1139412&r2=1139413&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java (original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java Fri Jun 24 19:19:35 2011
@@ -137,6 +137,7 @@ public class ObrCleanRepo extends Abstra
     private Element cleanDocument( Element elem )
     {
         String localRepoPath = localRepository.getBasedir();
+        URI baseURI = new File( localRepoPath + '/' ).toURI();
         NodeList nodes = elem.getElementsByTagName( "resource" );
         List toRemove = new ArrayList();
 
@@ -146,8 +147,18 @@ public class ObrCleanRepo extends Abstra
             Element n = ( Element ) nodes.item( i );
             String value = n.getAttribute( "uri" );
 
-            File file = new File( localRepoPath, value );
-            if ( !file.exists() )
+            URI resource;
+            try
+            {
+                resource = baseURI.resolve( value );
+            }
+            catch ( IllegalArgumentException e )
+            {
+                getLog().error( "Malformed URL when creating the resource absolute URI : " + e.getMessage() );
+                return null;
+            }
+
+            if ( "file".equals( resource.getScheme() ) && !new File( resource ).exists() )
             {
                 getLog().info(
                     "The bundle " + n.getAttribute( "presentationname" ) + " - " + n.getAttribute( "version" )