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

pauls 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 659a698  SLING-9884: use artifact level for warnings
659a698 is described below

commit 659a69893f7f03933f3051ce0285d0a3c36a4ede
Author: Karl Pauls <[email protected]>
AuthorDate: Mon Nov 9 11:55:16 2020 +0100

    SLING-9884: use artifact level for warnings
---
 .../analyser/task/impl/CheckRequirementsCapabilities.java  | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckRequirementsCapabilities.java
 
b/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckRequirementsCapabilities.java
index 15bc39d..3492ae3 100644
--- 
a/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckRequirementsCapabilities.java
+++ 
b/src/main/java/org/apache/sling/feature/analyser/task/impl/CheckRequirementsCapabilities.java
@@ -116,12 +116,22 @@ public class CheckRequirementsCapabilities implements 
AnalyserTask {
                                 }
                                 else
                                 {
-                                    ctx.reportWarning(String.format(format, 
info.getName(), requirement.toString(), entry.getKey(), "while the requirement 
is optional no artifact is providing a matching capability in this start 
level."));
+                                    String message = String.format(format, 
info.getName(), requirement.toString(), entry.getKey(), "while the requirement 
is optional no artifact is providing a matching capability in this start 
level.");
+                                    if (info instanceof ArtifactDescriptor) {
+                                        
ctx.reportArtifactWarning(((ArtifactDescriptor) info).getArtifact().getId(), 
message);
+                                    } else {
+                                        ctx.reportWarning(message);
+                                    }
                                 }
                             }
                             else if (candidates.size() > 1)
                             {
-                                ctx.reportWarning(String.format(format, 
info.getName(), requirement.toString(), entry.getKey(), "there is more than one 
matching capability in this start level: " + candidates));
+                                String message = String.format(format, 
info.getName(), requirement.toString(), entry.getKey(), "there is more than one 
matching capability in this start level: " + candidates);
+                                if (info instanceof ArtifactDescriptor) {
+                                    
ctx.reportArtifactWarning(((ArtifactDescriptor) info).getArtifact().getId(), 
message);
+                                } else {
+                                    ctx.reportWarning(message);
+                                }
                             }
                         }
                     }

Reply via email to