You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2016/12/06 23:19:54 UTC

svn commit: r1772997 - /sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java

Author: sseifert
Date: Tue Dec  6 23:19:54 2016
New Revision: 1772997

URL: http://svn.apache.org/viewvc?rev=1772997&view=rev
Log:
SLING-6364 support both provider.root and provider.roots properties for fsresource config

Modified:
    sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java

Modified: sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java?rev=1772997&r1=1772996&r2=1772997&view=diff
==============================================================================
--- sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java (original)
+++ sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java Tue Dec  6 23:19:54 2016
@@ -680,8 +680,10 @@ abstract class AbstractBundleInstallMojo
         post.addParameter("factoryPid", FS_FACTORY);
         post.addParameter("pid", "[Temporary PID replaced by real PID upon save]");
         post.addParameter("provider.file", dir);
+        // save property value to both "provider.roots" and "provider.root" because the name has changed since fsresource 1.1.6
+        post.addParameter("provider.root", path);
         post.addParameter("provider.roots", path);
-        post.addParameter("propertylist", "provider.roots,provider.file");
+        post.addParameter("propertylist", "provider.root,provider.roots,provider.file");
         try {
             final int status = client.executeMethod(post);
             // we get a moved temporarily back from the configMgr plugin
@@ -737,9 +739,15 @@ abstract class AbstractBundleInstallMojo
                         final JSONObject obj = array.getJSONObject(i);
                         final String pid = obj.getString("pid");
                         final JSONObject properties = obj.getJSONObject("properties");
-                        final String path = properties.getJSONObject("provider.file").getString("value");
-                        final String roots = properties.getJSONObject("provider.roots").getString("value");
-                        if ( path != null && path.startsWith(this.project.getBasedir().getAbsolutePath()) ) {
+                        final String path = properties.getJSONObject("provider.file").optString("value");
+                        final String roots;
+                        if (properties.has("provider.roots")) {
+                            roots = properties.getJSONObject("provider.roots").optString("value");
+                        }
+                        else {
+                            roots = properties.getJSONObject("provider.root").optString("value");
+                        }
+                        if ( path != null && path.startsWith(this.project.getBasedir().getAbsolutePath()) && roots != null ) {
                             getLog().debug("Found configuration with pid: " + pid + ", path: " + path + ", roots: " + roots);
                             result.put(pid, new String[] {path, roots});
                         }