You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Jean-Baptiste Onofré (JIRA)" <ji...@apache.org> on 2015/05/14 03:36:59 UTC

[jira] [Created] (KARAF-3727) Cave generate the repository.xml with "bad" path on Windows

Jean-Baptiste Onofré created KARAF-3727:
-------------------------------------------

             Summary: Cave generate the repository.xml with "bad" path on Windows
                 Key: KARAF-3727
                 URL: https://issues.apache.org/jira/browse/KARAF-3727
             Project: Karaf
          Issue Type: Bug
          Components: cave-repository
    Affects Versions: cave-3.0.0, cave-2.3.0
            Reporter: Jean-Baptiste Onofré
             Fix For: cave-2.3.1, cave-3.0.1, cave-4.0.0


On Windows, when using cave:repository-update nice-repo, the generated repository.xml contains bad paths:

{code}
<repository name="test-repo" lastmodified="20150512044028.680">
<resource id="org.apache.felix.ipojo/1.8.0" 
symbolicname="org.apache.felix.ipojo" 
presentationname="Apache Felix iPOJO"     
uri="file:/C:/foo/bar/apache-karaf-3.0.2/foo/bundle_repo/test-repo/org/apache/felix/org.apache.felix.ipojo/1.8.0/org.apache.felix.ipojo-1.8.0.jar" 
version="1.8.0">
{code}

Especially, the slashes are not good on Windows.

The issue is that, in the CaveRepositoryImpl, we do:

{code}
private void useResourceRelativeUri(ResourceImpl resource) throws Exception {
    String resourceURI = resource.getURI();
    String locationURI = "file:" + this.getLocation();
    LOGGER.debug("Converting resource URI {} relatively to repository URI {}", resourceURI, locationURI);
    if (resourceURI.startsWith(locationURI)) {
        resourceURI = resourceURI.substring(locationURI.length() + 1);
        LOGGER.debug("Resource URI converted to " + resourceURI);
        resource.put(Resource.URI, resourceURI);
    }
}
{code}

The problem is that, if the resourceURI looks good (using back slashes), the locationURI uses forward slashes. So the method doesn't trim the URI for the repository.xml and it ends with the full path (instead of the relative one).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)