[ 
https://issues.apache.org/jira/browse/KARAF-5422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16483792#comment-16483792
 ] 

ASF GitHub Bot commented on KARAF-5422:
---------------------------------------

gnodet closed pull request #510: [KARAF-5422] Add properties for karaf URI
URL: https://github.com/apache/karaf/pull/510
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/assemblies/features/base/src/main/resources/resources/etc/org.ops4j.pax.url.mvn.cfg
 
b/assemblies/features/base/src/main/resources/resources/etc/org.ops4j.pax.url.mvn.cfg
index 1837f4096f..8f8ddeb777 100644
--- 
a/assemblies/features/base/src/main/resources/resources/etc/org.ops4j.pax.url.mvn.cfg
+++ 
b/assemblies/features/base/src/main/resources/resources/etc/org.ops4j.pax.url.mvn.cfg
@@ -80,9 +80,9 @@ org.ops4j.pax.url.mvn.useFallbackRepositories=false
 # The following property value will add the system folder as a repo.
 #
 org.ops4j.pax.url.mvn.defaultRepositories=\
-    
file:${karaf.home}/${karaf.default.repository}@id=system.repository@snapshots, \
-    file:${karaf.data}/kar@id=kar.repository@multi@snapshots, \
-    
file:${karaf.base}/${karaf.default.repository}@id=child.system.repository@snapshots
+    
${karaf.home.uri}${karaf.default.repository}@id=system.repository@snapshots, \
+    ${karaf.data.uri}kar@id=kar.repository@multi@snapshots, \
+    
${karaf.base.uri}${karaf.default.repository}@id=child.system.repository@snapshots
 
 #
 # if "defaultLocalRepoAsRemote" is set to *any* value, localRepository will be
diff --git a/itests/test/src/test/resources/etc/org.ops4j.pax.url.mvn.cfg 
b/itests/test/src/test/resources/etc/org.ops4j.pax.url.mvn.cfg
index 0fccfb5701..5dd583e6df 100644
--- a/itests/test/src/test/resources/etc/org.ops4j.pax.url.mvn.cfg
+++ b/itests/test/src/test/resources/etc/org.ops4j.pax.url.mvn.cfg
@@ -77,12 +77,12 @@ org.ops4j.pax.url.mvn.useFallbackRepositories=false
 # The following property value will add the system folder as a repo.
 #
 #org.ops4j.pax.url.mvn.defaultRepositories=\
-#    
file:${karaf.home}/${karaf.default.repository}@id=system.repository@snapshots, \
-#    file:\${user.home}/.m2/repository@snapshots@id=local, \
-#    file:${karaf.data}/kar@id=kar.repository@multi@snapshots, \
-#    
file:${karaf.base}/${karaf.default.repository}@id=child.system.repository@snapshots
+#    
${karaf.home.uri}${karaf.default.repository}@id=system.repository@snapshots, \
+#    file:${user.home}/.m2/repository@snapshots@id=local, \
+#    ${karaf.data.uri}kar@id=kar.repository@multi@snapshots, \
+#    
${karaf.base.uri}${karaf.default.repository}@id=child.system.repository@snapshots
 org.ops4j.pax.url.mvn.defaultRepositories=\
-    
file:${karaf.home}/${karaf.default.repository}@id=system.repository@snapshots, \
+    
${karaf.home.uri}${karaf.default.repository}@id=system.repository@snapshots, \
     file:${user.home}/.m2/repository@snapshots@id=local
 
 #
diff --git a/main/src/main/java/org/apache/karaf/main/ConfigProperties.java 
b/main/src/main/java/org/apache/karaf/main/ConfigProperties.java
index e2f083c152..d3084dc659 100644
--- a/main/src/main/java/org/apache/karaf/main/ConfigProperties.java
+++ b/main/src/main/java/org/apache/karaf/main/ConfigProperties.java
@@ -41,6 +41,8 @@
      * hold the binary install of Karaf.
      */
     public static final String PROP_KARAF_HOME = "karaf.home";
+
+    public static final String PROP_KARAF_HOME_URI = "karaf.home.uri";
     /**
      * The environment variable for specifying the Karaf home directory.  The 
home directory
      * hold the binary install of Karaf.
@@ -51,6 +53,8 @@
      * holds the configuration and data for a Karaf instance.
      */
     public static final String PROP_KARAF_BASE = "karaf.base";
+
+    public static final String PROP_KARAF_BASE_URI = "karaf.base.uri";
     /**
      * The environment variable for specifying the Karaf base directory.  The 
base directory
      * holds the configuration and data for a Karaf instance.
@@ -61,6 +65,8 @@
      * holds the bundles data and cache for a Karaf instance.
      */
     public static final String PROP_KARAF_DATA = "karaf.data";
+
+    public static final String PROP_KARAF_DATA_URI = "karaf.data.uri";
     /**
      * The environment variable for specifying the Karaf data directory. The 
data directory
      * holds the bundles data and cache for a Karaf instance.
@@ -71,6 +77,8 @@
      * holds the configuration for a Karaf instance.
      */
     public static final String PROP_KARAF_ETC = "karaf.etc";
+
+    public static final String PROP_KARAF_ETC_URI = "karaf.etc.uri";
     /**
      * The environment variable for specifying the Karaf etc directory. The 
etc directory
      * holds the configuration for a Karaf instance.
@@ -81,6 +89,8 @@
      * holds the bundles data and cache for a Karaf instance.
      */
     public static final String PROP_KARAF_INSTANCES = "karaf.instances";
+
+    public static final String PROP_KARAF_INSTANCES_URI = 
"karaf.instances.uri";
     /**
      * The system property for specifying the Karaf data directory. The data 
directory
      * holds the bundles data and cache for a Karaf instance.
@@ -201,6 +211,12 @@ public ConfigProperties() throws Exception {
         System.setProperty(PROP_KARAF_ETC, karafEtc.getPath());
         System.setProperty(PROP_KARAF_INSTANCES, karafInstances.getPath());
 
+        System.setProperty(PROP_KARAF_HOME_URI, 
karafHome.toURI().toASCIIString());
+        System.setProperty(PROP_KARAF_BASE_URI, 
karafBase.toURI().toASCIIString());
+        System.setProperty(PROP_KARAF_DATA_URI, 
karafData.toURI().toASCIIString());
+        System.setProperty(PROP_KARAF_ETC_URI, 
karafEtc.toURI().toASCIIString());
+        System.setProperty(PROP_KARAF_INSTANCES_URI, 
karafInstances.toURI().toASCIIString());
+
         if (!karafEtc.exists()) {
             throw new FileNotFoundException("Karaf etc folder not found: " + 
karafEtc.getAbsolutePath());
         }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Feature Repository with Spaces in Path
> --------------------------------------
>
>                 Key: KARAF-5422
>                 URL: https://issues.apache.org/jira/browse/KARAF-5422
>             Project: Karaf
>          Issue Type: Bug
>    Affects Versions: 4.0.6, 4.2.0, 4.1.5
>         Environment: OS:
> * OSX 10.12.6
> * CentOS 6
>            Reporter: Stephen Kahmann
>            Assignee: Guillaume Nodet
>            Priority: Major
>
> We are generating a custom distribution with boot features using Maven. This 
> creates a features repo xml file (ff74b32b-4c34-43fc-9775-8a83173c4d65.xml) 
> in the $KARAF_HOME/etc directory. The feature is also listed in the 
> org.apache.karaf.features.cfg file:
> {code}
> #
> # Comma separated list of features repositories to register by default
> #
> featuresRepositories = 
> file:${karaf.home}/etc/ff74b32b-4c34-43fc-9775-8a83173c4d65.xml
> {code}
> This works great except for when the distribution is unzipped into a 
> directory with spaces somewhere in the path. This causes a URISyntaxException:
> {code}
> 2017-10-12 17:11:38,669 | ERROR | pool-7-thread-1  | BootFeaturesInstaller    
>         | 8 - org.apache.karaf.features.core - 4.0.6 | Error installing boot 
> feature repository file:/Users/stephen/workspace/dirname with 
> spaces/distribution-1.9.30-SNAPSHOT/etc/ff74b32b-4c34-43fc-9775-8a83173c4d65.xml
> java.lang.IllegalArgumentException: Illegal character in path at index 33: 
> file:/Users/stephen/workspace/dirname with 
> spaces/distribution-1.9.30-SNAPSHOT/etc/ff74b32b-4c34-43fc-9775-8a83173c4d65.xml
>     at java.net.URI.create(URI.java:852)[:1.8.0_131]
>     at 
> org.apache.karaf.features.internal.service.BootFeaturesInstaller.installBootFeatures(BootFeaturesInstaller.java:104)[8:org.apache.karaf.features.core:4.0.6]
>     at 
> org.apache.karaf.features.internal.service.BootFeaturesInstaller.start(BootFeaturesInstaller.java:93)[8:org.apache.karaf.features.core:4.0.6]
>     at 
> org.apache.karaf.features.internal.osgi.Activator.doStart(Activator.java:260)[8:org.apache.karaf.features.core:4.0.6]
>     at 
> org.apache.karaf.util.tracker.BaseActivator.run(BaseActivator.java:236)[8:org.apache.karaf.features.core:4.0.6]
>     at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_131]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_131]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_131]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_131]
>     at java.lang.Thread.run(Thread.java:748)[:1.8.0_131]
> Caused by: java.net.URISyntaxException: Illegal character in path at index 
> 33: file:/Users/stephen/workspace/dirname with 
> spaces/distribution-1.9.30-SNAPSHOT/etc/ff74b32b-4c34-43fc-9775-8a83173c4d65.xml
>     at java.net.URI$Parser.fail(URI.java:2848)[:1.8.0_131]
>     at java.net.URI$Parser.checkChars(URI.java:3021)[:1.8.0_131]
>     at java.net.URI$Parser.parseHierarchical(URI.java:3105)[:1.8.0_131]
>     at java.net.URI$Parser.parse(URI.java:3053)[:1.8.0_131]
>     at java.net.URI.<init>(URI.java:588)[:1.8.0_131]
>     at java.net.URI.create(URI.java:850)[:1.8.0_131]
>     ... 9 more
> {code}
> Can anyone help with this?
> Thanks



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

Reply via email to