Panu Bloigu created KARAF-5918:
----------------------------------

             Summary: karaf-maven-plugin / features-add-to-repository fails 
with spaces in transitive feature repository urls
                 Key: KARAF-5918
                 URL: https://issues.apache.org/jira/browse/KARAF-5918
             Project: Karaf
          Issue Type: Bug
          Components: karaf
            Reporter: Panu Bloigu


Hello,

In Karaf 4.0.8, when using karaf-maven-plugin:features-add-to-repository to 
generate an in-place Karaf distribution, the execution fails, if 
 * includeTransitiveDependency == true
 * and features.xml of any of the transitive features has spaces within a 
<repository> tag.

The stacktrace is as follows: 
{noformat}
Caused by: java.net.MalformedURLException: no protocol:
%20%20%20%20%20%20%20%20mvn:org.ops4j.pax.transx/pax-transx-features/0.3.0/xml/features
%20%20%20%20
    at java.net.URL.<init> (URL.java:593)
    at java.net.URL.<init> (URL.java:490)
    at java.net.URL.<init> (URL.java:439)
    at 
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity 
(XMLEntityManager.java:620)
    at 
com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion 
(XMLVersionDetector.java:148)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse 
(XML11Configuration.java:806)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse 
(XML11Configuration.java:771)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse 
(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse 
(DOMParser.java:243)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse 
(DocumentBuilderImpl.java:339)
    at javax.xml.parsers.DocumentBuilder.parse (DocumentBuilder.java:177)
    at org.apache.karaf.util.XmlUtils.parse (XmlUtils.java:51)
    at org.apache.karaf.features.internal.model.JaxbUtil.unmarshalValidate 
(JaxbUtil.java:116)
    at org.apache.karaf.features.internal.model.JaxbUtil.unmarshal 
(JaxbUtil.java:101)
    at org.apache.karaf.features.internal.model.JaxbUtil.unmarshal 
(JaxbUtil.java:95)
    at 
org.apache.karaf.tooling.features.AbstractFeatureMojo.retrieveDescriptorsRecursively
 (AbstractFeatureMojo.java:125)
    at 
org.apache.karaf.tooling.features.AbstractFeatureMojo.retrieveDescriptorsRecursively
 (AbstractFeatureMojo.java:131)
    at 
org.apache.karaf.tooling.features.AbstractFeatureMojo.retrieveDescriptorsRecursively
 (AbstractFeatureMojo.java:131)
    at org.apache.karaf.tooling.features.AbstractFeatureMojo.resolveFeatures 
(AbstractFeatureMojo.java:236)
    at org.apache.karaf.tooling.features.AddToRepositoryMojo.execute 
(AddToRepositoryMojo.java:58)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo 
(DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
(MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute 
(MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject 
(LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject 
(LifecycleModuleBuilder.java:81)
    at 
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
 (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute 
(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke 
(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced 
(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch 
(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode 
(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main 
(Launcher.java:356)
{noformat}
The features.xml in this case is the one from the PAX JDBC project: 
[https://github.com/ops4j/org.ops4j.pax.jdbc/blob/jdbc-1.3.0/pax-jdbc-features/src/main/resources/features.xml]
 and it contains a <repository> definition which is causing the failure:
{noformat}
    <repository>
        mvn:org.ops4j.pax.transx/pax-transx-features/0.3.0/xml/features
    </repository>
{noformat}

This fails with Karaf 4.0.8, but I would suspect it fails also with the 
currently latest 4.2.1, as XmlUtils doesn't seem to have changed much between 
4.0.8 and 4.2.1. Unfortunately I currently can not test this with any other 
version, though. 

I would suspect that calling setIgnoringElementContentWhitespace(true) on the 
DocumentParser instance might get around this.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to