You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by si...@apache.org on 2019/06/18 21:42:25 UTC

[sling-whiteboard] branch master updated (a20fd43 -> c82ad0e)

This is an automated email from the ASF dual-hosted git repository.

simonetripodi pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git.


    from a20fd43  Increase execution timeout to make Jenkins failures less likely
     new 3b5d4e1  [feature-diff] fixed dependencies management to make the diff bundle being installable in the Feature context
     new 7cc0a3e  [r2f] fixed 'pom.properties' resource loading
     new 7a07d7d  [feature-diff] fixed OSGi imports
     new c82ad0e  Merge branch 'master' of github.com:apache/sling-whiteboard

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 feature-diff/pom.xml                               | 13 ++++
 .../feature/r2f/impl/Bundle2ArtifactMapper.java    | 74 ++++++++++++++--------
 2 files changed, 61 insertions(+), 26 deletions(-)


[sling-whiteboard] 04/04: Merge branch 'master' of github.com:apache/sling-whiteboard

Posted by si...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

simonetripodi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git

commit c82ad0e49387322604f82b83f0967f009587723c
Merge: 7a07d7d a20fd43
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Tue Jun 18 23:42:14 2019 +0200

    Merge branch 'master' of github.com:apache/sling-whiteboard

 url-connection-agent/README.md                     |  12 +-
 .../java/org/apache/sling/uca/impl/AgentIT.java    | 185 ++++++++-------------
 .../org/apache/sling/uca/impl/AgentLauncher.java   | 107 ++++++++++++
 ...vingServerControl.java => ErrorDescriptor.java} |  26 +--
 .../apache/sling/uca/impl/HttpClientLauncher.java  |  83 ++++++---
 .../sling/uca/impl/MisbehavingServerControl.java   |  14 ++
 .../sling/uca/impl/MisbehavingServerExtension.java |  39 +++--
 ...ngServerControl.java => RecordedThrowable.java} |  29 ++--
 .../org/apache/sling/uca/impl/TestTimeouts.java    |  64 +++++++
 9 files changed, 383 insertions(+), 176 deletions(-)


[sling-whiteboard] 02/04: [r2f] fixed 'pom.properties' resource loading

Posted by si...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

simonetripodi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git

commit 7cc0a3e133a744ac976115b16548130bb44c409e
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Tue Jun 18 23:40:41 2019 +0200

    [r2f] fixed 'pom.properties' resource loading
---
 .../feature/r2f/impl/Bundle2ArtifactMapper.java    | 74 ++++++++++++++--------
 1 file changed, 48 insertions(+), 26 deletions(-)

diff --git a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/Bundle2ArtifactMapper.java b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/Bundle2ArtifactMapper.java
index 6779c72..26f31ed 100644
--- a/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/Bundle2ArtifactMapper.java
+++ b/runtime2feature/src/main/java/org/apache/sling/feature/r2f/impl/Bundle2ArtifactMapper.java
@@ -16,12 +16,13 @@
  */
 package org.apache.sling.feature.r2f.impl;
 
-import java.io.IOException;
+import static org.osgi.framework.wiring.BundleWiring.LISTRESOURCES_RECURSE;
+
 import java.io.InputStream;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.net.URLConnection;
-import java.util.Enumeration;
+import java.util.Collection;
 import java.util.Properties;
 import java.util.function.Function;
 
@@ -30,12 +31,13 @@ import org.apache.sling.feature.ArtifactId;
 import org.apache.sling.feature.Feature;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.startlevel.BundleStartLevel;
+import org.osgi.framework.wiring.BundleWiring;
 
 final class Bundle2ArtifactMapper extends AbstractFeatureElementConsumer<Artifact> implements Function<Bundle, Artifact> {
 
-    private static final String POM_PROPERTIES_RESOURCE_NAME = "pom.properties";
+    private static final String MAVEN_METADATA_PATH = "/META-INF/maven";
 
-    private static final String MAVEN_METADATA_PATH = "META-INF/maven";
+    private static final String POM_PROPERTIES_RESOURCE_NAME = "pom.properties";
 
     private static final String GROUP_ID = "groupId";
 
@@ -53,28 +55,34 @@ final class Bundle2ArtifactMapper extends AbstractFeatureElementConsumer<Artifac
     public Artifact apply(Bundle bundle) {
         Properties pomProperties = new Properties();
 
-        Enumeration<URL> pomPropertiesURLs = bundle.findEntries(MAVEN_METADATA_PATH, POM_PROPERTIES_RESOURCE_NAME, true);
-        if (pomPropertiesURLs.hasMoreElements()) {
-            URL pomPropertiesURL = pomPropertiesURLs.nextElement();
-
-            try {
-                URLConnection connection = pomPropertiesURL.openConnection();
-                connection.connect();
-
-                try (InputStream inStream = connection.getInputStream()) {
-                    pomProperties.load(inStream);
-                }
-
-                if (connection instanceof HttpURLConnection) {
-                    ((HttpURLConnection) connection).disconnect();
-                }
-            } catch (IOException e) {
-                throw new RuntimeException("An error occurred while reading "
-                                           + pomPropertiesURL
-                                           + " properties file from Bundle "
-                                           + bundle.getSymbolicName()
-                                           + " does not export valid Maven metadata", e);
+        BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
+        Collection<String> pomPropertiesResources = bundleWiring.listResources(MAVEN_METADATA_PATH, POM_PROPERTIES_RESOURCE_NAME, LISTRESOURCES_RECURSE);
+
+        if (pomPropertiesResources == null || pomPropertiesResources.isEmpty()) {
+            return null;
+        }
+
+        URL pomPropertiesURL = getPomPropertiesURL(pomPropertiesResources, bundle);
+        if (pomPropertiesURL == null) {
+            return null;
+        }
+
+        try {
+            URLConnection connection = pomPropertiesURL.openConnection();
+            connection.connect();
+
+            try (InputStream inStream = connection.getInputStream()) {
+                pomProperties.load(inStream);
             }
+
+            if (connection instanceof HttpURLConnection) {
+                ((HttpURLConnection) connection).disconnect();
+            }
+        } catch (Throwable t) {
+            throw new RuntimeException("An error occurred while reading "
+                                       + pomPropertiesURL
+                                       + " properties file from Bundle "
+                                       + bundle.getSymbolicName(), t);
         }
 
         if (pomProperties.isEmpty()) {
@@ -97,9 +105,23 @@ final class Bundle2ArtifactMapper extends AbstractFeatureElementConsumer<Artifac
         return artifact;
     }
 
+    private static URL getPomPropertiesURL(Collection<String> pomPropertiesResources, Bundle bundle) {
+        for (String pomPropertiesResource : pomPropertiesResources) {
+            URL pomPropertiesURL = bundle.getEntry(pomPropertiesResource);
+
+            if (pomPropertiesURL != null) {
+                return pomPropertiesURL;
+            }
+        }
+
+        return null;
+    }
+
     @Override
     public void accept(Artifact artifact) {
-        getTargetFeature().getBundles().add(artifact);
+        if (artifact != null) {
+            getTargetFeature().getBundles().add(artifact);
+        }
     }
 
 }


[sling-whiteboard] 03/04: [feature-diff] fixed OSGi imports

Posted by si...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

simonetripodi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git

commit 7a07d7dabe66733afd6a0d648f002ee2a0653a52
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Tue Jun 18 23:41:07 2019 +0200

    [feature-diff] fixed OSGi imports
---
 feature-diff/pom.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/feature-diff/pom.xml b/feature-diff/pom.xml
index 2d34583..3c0e36d 100644
--- a/feature-diff/pom.xml
+++ b/feature-diff/pom.xml
@@ -126,6 +126,7 @@
           <instructions>
             <Export-Package>org.apache.sling.feature.diff*;version=${project.version}</Export-Package>
             <Import-Package>
+              org.apache.sling.feature*,
               org.apache.commons.collections4*,
               org.apache.commons.io*
             </Import-Package>


[sling-whiteboard] 01/04: [feature-diff] fixed dependencies management to make the diff bundle being installable in the Feature context

Posted by si...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

simonetripodi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git

commit 3b5d4e1d1f6ed981a7dbc901f813174f005215bd
Author: Simo Tripodi <st...@adobe.com>
AuthorDate: Tue Jun 18 20:09:49 2019 +0200

    [feature-diff] fixed dependencies management to make the diff bundle
    being installable in the Feature context
---
 feature-diff/pom.xml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/feature-diff/pom.xml b/feature-diff/pom.xml
index e89ae4b..2d34583 100644
--- a/feature-diff/pom.xml
+++ b/feature-diff/pom.xml
@@ -56,6 +56,12 @@
       <version>3.8.1</version>
       <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-collections4</artifactId>
+      <version>4.1</version>
+      <scope>provided</scope>
+    </dependency>
 
     <!--
      | Sling Feature Model libraries
@@ -80,6 +86,12 @@
       <artifactId>jackson-databind</artifactId>
       <version>${jackson.version}</version>
       <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.commons</groupId>
+          <artifactId>commons-collections4</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
       <groupId>com.fasterxml.jackson.core</groupId>