FELIX-2346: compute correct path when detecting missing resources
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1139413 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java b/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java
index 881f03a..3c09d55 100644
--- a/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java
+++ b/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java
@@ -137,6 +137,7 @@
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 @@
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" )