You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2021/06/22 16:24:13 UTC

[sling-org-apache-sling-feature-analyser] branch master updated: SLING-10501 : The analyser scanner should pass the artifact url to the resource builder

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0919856  SLING-10501 : The analyser scanner should pass the artifact url to the resource builder
0919856 is described below

commit 0919856abc41ff10ff1809a7494e0ad50447dc46
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Jun 22 18:24:04 2021 +0200

    SLING-10501 : The analyser scanner should pass the artifact url to the resource builder
---
 .../sling/feature/scanner/impl/BundleDescriptorImpl.java       | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/apache/sling/feature/scanner/impl/BundleDescriptorImpl.java b/src/main/java/org/apache/sling/feature/scanner/impl/BundleDescriptorImpl.java
index 71a03f1..fec6d41 100644
--- a/src/main/java/org/apache/sling/feature/scanner/impl/BundleDescriptorImpl.java
+++ b/src/main/java/org/apache/sling/feature/scanner/impl/BundleDescriptorImpl.java
@@ -71,7 +71,7 @@ public class BundleDescriptorImpl
     private final Manifest manifest;
 
     /** The physical file for analyzing. */
-    private final URL artifactFile;
+    private URL artifactFile;
 
 
     /** The corresponding artifact from the feature. */
@@ -184,16 +184,15 @@ public class BundleDescriptorImpl
 
     @Override
     public URL getArtifactFile() {
-        URL result = null;
         if (artifactFile == null && artifactProvider != null) {
             try {
-                result = artifactProvider.provide(artifact.getId());
+                artifactFile = artifactProvider.provide(artifact.getId());
             } catch (Exception ex) {
                 // Ignore, we assume this is a best effort and callers can handle a null.
                 logger.debug("Unable to get artifact file for: " + artifact.getId(), ex);
             }
         }
-        return result;
+        return artifactFile;
     }
 
     @Override
@@ -224,7 +223,8 @@ public class BundleDescriptorImpl
             this.getImportedPackages().addAll(extractImportedPackages(this.manifest));
             this.getDynamicImportedPackages().addAll(extractDynamicImportedPackages(this.manifest));
             try {
-                ResourceImpl resource = ResourceBuilder.build(null, this.manifest.getMainAttributes().entrySet().stream()
+                final URL url = this.getArtifactFile();
+                ResourceImpl resource = ResourceBuilder.build(url == null ? null : url.toURI().toString(), this.manifest.getMainAttributes().entrySet().stream()
                     .collect(Collectors.toMap(entry -> entry.getKey().toString(), entry -> entry.getValue().toString())));
                 this.getCapabilities().addAll(resource.getCapabilities(null));
                 this.getRequirements().addAll(resource.getRequirements(null).stream()