You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/08/17 13:20:45 UTC

[GitHub] [netbeans] ppisl commented on a diff in pull request #4499: Initial implementation of (experimental) Dependency API in Gradle

ppisl commented on code in PR #4499:
URL: https://github.com/apache/netbeans/pull/4499#discussion_r947890895


##########
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/adm/VulnerabilityWorker.java:
##########
@@ -161,7 +166,7 @@ public Map<String, Dependency> getDependencyMap() {
         
         private void buildDependecyMap(Dependency dependency, Map<String, Dependency> result) {
             String gav = createGAV(dependency.getArtifact());
-            result.put(gav, dependency);
+            result.putIfAbsent(gav, dependency);
             dependency.getChildren().forEach((childDependency) -> {

Review Comment:
   So the line above expect that there could be allredy pair gav : dependency in the result. In this case the dependency is not put again in the result but the children are recountned anyway. 



##########
extide/gradle/src/org/netbeans/modules/gradle/api/GradleBaseProject.java:
##########
@@ -206,6 +213,29 @@ public String getLicense() {
     public Map<String, File> getSubProjects() {
         return subProjects;
     }
+    
+    /**
+     * Finds a GAV for the given project. Returns {@code null} if the project path
+     * is not known (it is not referenced anywhere by this project), or has no known
+     * GAV. The project's own GAV should be always present, if defined by the project 
+     * file(s).
+     * 
+     * @param projectPath Gradle project path
+     * @return GAV coordinates, or {@code null}
+     * @since 2.27
+     */
+    public String findProjectGav(@NonNull String projectPath) {
+        if ("".equals(projectPath) || getPath().equals(projectPath)) {
+            String n = getName();
+            String g = getGroup();
+            String v = getVersion();
+            if (n == null || "".equals(n) || g == null || "".equals(g) || v == null || "".equals(v) || "unspecified".equals(v)) {  // NOI18N

Review Comment:
   Just minor. Using n.isEmpty(), q.isEmtpy() and v.isEmpty would be better here than the equals approach. The null check is done in the condition anyway. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists