You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Alexander Osterwald (JIRA)" <ji...@apache.org> on 2016/01/06 14:08:39 UTC

[jira] [Created] (KARAF-4251) karaf-maven-plugin register its own URLStreamHandlerFactory for mvn

Alexander Osterwald created KARAF-4251:
------------------------------------------

             Summary: karaf-maven-plugin register its own URLStreamHandlerFactory for mvn
                 Key: KARAF-4251
                 URL: https://issues.apache.org/jira/browse/KARAF-4251
             Project: Karaf
          Issue Type: Question
          Components: karaf-tooling
    Affects Versions: 3.0.5
            Reporter: Alexander Osterwald


The karaf-maven-plugin registers its own URLStreamHandlerFactory for the protocol _mvn_ [see here|https://github.com/apache/karaf/blob/karaf-3.0.x/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java#L56].

{code:title=InstallKarsMojo.java|borderStyle=solid}
static {
        URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory() {
            public URLStreamHandler createURLStreamHandler(String protocol) {
                if ("wrap".equals(protocol)) {
                    return new org.ops4j.pax.url.wrap.Handler();
                }
                if ("mvn".equals(protocol)) {
                    return new org.ops4j.pax.url.mvn.Handler();
                }
                return null;
            }
        });
    }
{code} 

1. Why is this necessary? 
2. Why not using the system property _java.protocol.handler.pkgs_?

I tried to set the URLStreamHandlerFactory in a project where I use the karaf-maven-plugin which leads to the exception 'factory already set....'
3. Is it possible to implement a check whether the protocol _mvn_ is already? 



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