You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2015/01/24 14:08:25 UTC

karaf git commit: [KARAF-3472] Refactore the system directory loading in InstallKars MOJO to properly work on Windows and path with spaces

Repository: karaf
Updated Branches:
  refs/heads/karaf-3.0.x 23f0def0f -> 52b0effcb


[KARAF-3472] Refactore the system directory loading in InstallKars MOJO to properly work on Windows and path with spaces


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/52b0effc
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/52b0effc
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/52b0effc

Branch: refs/heads/karaf-3.0.x
Commit: 52b0effcb9b60a7b4b9c986ed5fdebd548f5bb93
Parents: 23f0def
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Sat Jan 24 14:07:42 2015 +0100
Committer: Jean-Baptiste Onofré <jb...@apache.org>
Committed: Sat Jan 24 14:07:42 2015 +0100

----------------------------------------------------------------------
 .../karaf/tooling/features/InstallKarsMojo.java       | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/52b0effc/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
index 6d5b548..bde0483 100644
--- a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
+++ b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/InstallKarsMojo.java
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URI;
+import java.net.URLEncoder;
 import java.util.*;
 
 import org.apache.felix.utils.properties.Properties;
@@ -115,7 +116,6 @@ public class InstallKarsMojo extends MojoSupport {
      */
     protected boolean ignoreDependencyFlag;
 
-    private URI system;
     private Properties startupProperties = new Properties();
 
     // an access layer for available Aether implementation
@@ -132,7 +132,6 @@ public class InstallKarsMojo extends MojoSupport {
         // creating system directory
         getLog().info("Creating system directory");
         systemDirectory.mkdirs();
-        system = systemDirectory.toURI();
 
         if (startupPropertiesFile.exists()) {
             getLog().info("Loading startup.properties");
@@ -169,7 +168,7 @@ public class InstallKarsMojo extends MojoSupport {
                     getLog().info("Extracting " + artifact.toString() + " kar");
                     try {
                         Kar kar = new Kar(karFile.toURI());
-                        kar.extract(new File(system.getPath()), new File(workDirectory));
+                        kar.extract(systemDirectory, new File(workDirectory));
                         for (URI repositoryUri : kar.getFeatureRepos()) {
                             resolveRepository(repositoryUri.getPath(), repositories, features, false, addToStartup);
                         }
@@ -281,7 +280,7 @@ public class InstallKarsMojo extends MojoSupport {
         Set<?> startupBundles = startupProperties.keySet();
         for (Object startupBundle : startupBundles) {
             String bundlePath = this.dependencyHelper.pathFromMaven((String) startupBundle);
-            File bundleFile = new File(system.resolve(bundlePath));
+            File bundleFile = new File(systemDirectory, bundlePath);
             if (!bundleFile.exists()) {
                 File bundleSource = this.dependencyHelper.resolveById((String) startupBundle, getLog());
                 bundleFile.getParentFile().mkdirs();
@@ -383,7 +382,8 @@ public class InstallKarsMojo extends MojoSupport {
             repositoryFile = new File(repository);
         }
         // copy the repository file in system folder
-        File repositoryFileInSystemFolder = new File(new File(system), repository);
+
+        File repositoryFileInSystemFolder = new File(systemDirectory, repository);
         if (!repositoryFileInSystemFolder.exists()) {
             repositoryFileInSystemFolder.getParentFile().mkdirs();
             copy(repositoryFile, repositoryFileInSystemFolder);
@@ -509,7 +509,7 @@ public class InstallKarsMojo extends MojoSupport {
             } else {
                 bundleFile = new File(new URI(bundleLocation));
             }
-            File bundleSystemFile = new File(system.resolve(bundleLocation));
+            File bundleSystemFile = new File(systemDirectory, bundleLocation);
             copy(bundleFile, bundleSystemFile);
             // add metadata for snapshot
             if (bundleLocation.startsWith("mvn")) {
@@ -537,7 +537,7 @@ public class InstallKarsMojo extends MojoSupport {
         } else {
             configFileFile = new File(new URI(configFileLocation));
         }
-        File configFileSystemFile = new File(system.resolve(configFileLocation));
+        File configFileSystemFile = new File(systemDirectory, configFileLocation);
         copy(configFileFile, configFileSystemFile);
         // add metadata for snapshot
         if (configFileLocation.startsWith("mvn")) {