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/06/17 06:54:47 UTC

[GitHub] [netbeans] errael opened a new pull request, #4236: Avoid NPE in ant module suite's "Project Properties" dialog.

errael opened a new pull request, #4236:
URL: https://github.com/apache/netbeans/pull/4236

   `ProjectNav > some-module-suite > properties > Libraries`
   when `<module-suite-dir>/nbproject/platform.properties`
   has `cluster.path=... <maven-nbm-dir>/target/nbm/clusters/extra`
   
   This fix prevents a hung dialog (cancel terminates it).
   It also makes it simpler to incorporate a maven based
   nbm into an existing module suite as an external cluster.
   
   Note that specifying a maven nbm project in cluster.path currently works for running the suite. It's just this dialog that hangs.
   
   
   
   ---
   **^Add meaningful description above**
   
   By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -
   
    - are all your own work, and you have the right to contribute them.
    - are contributed solely under the terms and conditions of the Apache License 2.0 (see section 5 of the license for more information).
   
   Please make sure (eg. `git log`) that all commits have a valid name and email address for you in the Author field.
   
   If you're a first time contributor, see the Contributing guidelines for more information.
   
   


-- 
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


[GitHub] [netbeans] errael commented on a diff in pull request #4236: Avoid NPE in ant module suite's "Project Properties" dialog.

Posted by GitBox <gi...@apache.org>.
errael commented on code in PR #4236:
URL: https://github.com/apache/netbeans/pull/4236#discussion_r900438175


##########
apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ClusterUtils.java:
##########
@@ -169,8 +169,11 @@ public static Set<ClusterInfo> evaluateClusterPath(File root, PropertyEvaluator
                     prj = _prj;
                 } else {
                     NbModuleProvider prov2 = _prj.getLookup().lookup(NbModuleProvider.class);
-                    if (prov2 != null && /* XXX is there a better way? */ cd.equals(prov2.getModuleJarLocation().getParentFile().getParentFile())) {
-                        prj = _prj;
+                    if (prov2 != null) {
+                        File fi = prov2.getModuleJarLocation();
+                        if (fi != null && /* XXX is there a better way? */ cd.equals(fi.getParentFile().getParentFile())) {

Review Comment:
   > could ... getRootDir(NbModuleProvider prov)
   
   Something to consider for a rework of this ancient code, not holding my breath :-) Seems out of scope for fixing a missing null check.



-- 
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


[GitHub] [netbeans] mbien commented on a diff in pull request #4236: Avoid NPE in ant module suite's "Project Properties" dialog.

Posted by GitBox <gi...@apache.org>.
mbien commented on code in PR #4236:
URL: https://github.com/apache/netbeans/pull/4236#discussion_r900368155


##########
apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ClusterUtils.java:
##########
@@ -169,8 +169,11 @@ public static Set<ClusterInfo> evaluateClusterPath(File root, PropertyEvaluator
                     prj = _prj;
                 } else {
                     NbModuleProvider prov2 = _prj.getLookup().lookup(NbModuleProvider.class);
-                    if (prov2 != null && /* XXX is there a better way? */ cd.equals(prov2.getModuleJarLocation().getParentFile().getParentFile())) {
-                        prj = _prj;
+                    if (prov2 != null) {
+                        File fi = prov2.getModuleJarLocation();
+                        if (fi != null && /* XXX is there a better way? */ cd.equals(fi.getParentFile().getParentFile())) {

Review Comment:
   `getParentFile().getParentFile()`
   sounds like a second potential NPE ;)



-- 
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


[GitHub] [netbeans] mbien commented on a diff in pull request #4236: Avoid NPE in ant module suite's "Project Properties" dialog.

Posted by GitBox <gi...@apache.org>.
mbien commented on code in PR #4236:
URL: https://github.com/apache/netbeans/pull/4236#discussion_r900441709


##########
apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ClusterUtils.java:
##########
@@ -169,8 +169,11 @@ public static Set<ClusterInfo> evaluateClusterPath(File root, PropertyEvaluator
                     prj = _prj;
                 } else {
                     NbModuleProvider prov2 = _prj.getLookup().lookup(NbModuleProvider.class);
-                    if (prov2 != null && /* XXX is there a better way? */ cd.equals(prov2.getModuleJarLocation().getParentFile().getParentFile())) {
-                        prj = _prj;
+                    if (prov2 != null) {
+                        File fi = prov2.getModuleJarLocation();
+                        if (fi != null && /* XXX is there a better way? */ cd.equals(fi.getParentFile().getParentFile())) {

Review Comment:
   if you want you can add another commit. first fixes the bug, second extracts the two occurrences into a utility method. This keeps bugfix and code improvement separate (but tbh I don't think its necessary, its small enough to be one commit).
   
   There is no need to wait with small cleanups like this.



-- 
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


[GitHub] [netbeans] mbien commented on a diff in pull request #4236: Avoid NPE in ant module suite's "Project Properties" dialog.

Posted by GitBox <gi...@apache.org>.
mbien commented on code in PR #4236:
URL: https://github.com/apache/netbeans/pull/4236#discussion_r900411275


##########
apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ClusterUtils.java:
##########
@@ -169,8 +169,11 @@ public static Set<ClusterInfo> evaluateClusterPath(File root, PropertyEvaluator
                     prj = _prj;
                 } else {
                     NbModuleProvider prov2 = _prj.getLookup().lookup(NbModuleProvider.class);
-                    if (prov2 != null && /* XXX is there a better way? */ cd.equals(prov2.getModuleJarLocation().getParentFile().getParentFile())) {
-                        prj = _prj;
+                    if (prov2 != null) {
+                        File fi = prov2.getModuleJarLocation();
+                        if (fi != null && /* XXX is there a better way? */ cd.equals(fi.getParentFile().getParentFile())) {

Review Comment:
   could be put into a private utility method `getRootDir(NbModuleProvider prov)`. Would be self explanatory (+DRY) and could do the null check there.



-- 
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


[GitHub] [netbeans] mbien merged pull request #4236: Avoid NPE in ant module suite's "Project Properties" dialog.

Posted by GitBox <gi...@apache.org>.
mbien merged PR #4236:
URL: https://github.com/apache/netbeans/pull/4236


-- 
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


[GitHub] [netbeans] mbien commented on a diff in pull request #4236: Avoid NPE in ant module suite's "Project Properties" dialog.

Posted by GitBox <gi...@apache.org>.
mbien commented on code in PR #4236:
URL: https://github.com/apache/netbeans/pull/4236#discussion_r900411275


##########
apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ClusterUtils.java:
##########
@@ -169,8 +169,11 @@ public static Set<ClusterInfo> evaluateClusterPath(File root, PropertyEvaluator
                     prj = _prj;
                 } else {
                     NbModuleProvider prov2 = _prj.getLookup().lookup(NbModuleProvider.class);
-                    if (prov2 != null && /* XXX is there a better way? */ cd.equals(prov2.getModuleJarLocation().getParentFile().getParentFile())) {
-                        prj = _prj;
+                    if (prov2 != null) {
+                        File fi = prov2.getModuleJarLocation();
+                        if (fi != null && /* XXX is there a better way? */ cd.equals(fi.getParentFile().getParentFile())) {

Review Comment:
   could be put into a utility method `getRootDir(NbModuleProvider prov)`. Would be self explanatory (+DRY) and could do the null check there.



-- 
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


[GitHub] [netbeans] errael commented on a diff in pull request #4236: Avoid NPE in ant module suite's "Project Properties" dialog.

Posted by GitBox <gi...@apache.org>.
errael commented on code in PR #4236:
URL: https://github.com/apache/netbeans/pull/4236#discussion_r900403943


##########
apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ClusterUtils.java:
##########
@@ -169,8 +169,11 @@ public static Set<ClusterInfo> evaluateClusterPath(File root, PropertyEvaluator
                     prj = _prj;
                 } else {
                     NbModuleProvider prov2 = _prj.getLookup().lookup(NbModuleProvider.class);
-                    if (prov2 != null && /* XXX is there a better way? */ cd.equals(prov2.getModuleJarLocation().getParentFile().getParentFile())) {
-                        prj = _prj;
+                    if (prov2 != null) {
+                        File fi = prov2.getModuleJarLocation();
+                        if (fi != null && /* XXX is there a better way? */ cd.equals(fi.getParentFile().getParentFile())) {

Review Comment:
   Technically yes; but no, not really. The contract is that a returned File is somewhere inside a project, it's parent can't be null.
   
   For example, elsewhere in `ClusterUtils` there's
   ```
               File jar = nbmp.getModuleJarLocation();
               if (jar != null) {
                   return jar.getParentFile().getParentFile();
               }
   ```
   There are other examples scattered through other files.



-- 
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


[GitHub] [netbeans] mbien commented on a diff in pull request #4236: Avoid NPE in ant module suite's "Project Properties" dialog.

Posted by GitBox <gi...@apache.org>.
mbien commented on code in PR #4236:
URL: https://github.com/apache/netbeans/pull/4236#discussion_r900411275


##########
apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ClusterUtils.java:
##########
@@ -169,8 +169,11 @@ public static Set<ClusterInfo> evaluateClusterPath(File root, PropertyEvaluator
                     prj = _prj;
                 } else {
                     NbModuleProvider prov2 = _prj.getLookup().lookup(NbModuleProvider.class);
-                    if (prov2 != null && /* XXX is there a better way? */ cd.equals(prov2.getModuleJarLocation().getParentFile().getParentFile())) {
-                        prj = _prj;
+                    if (prov2 != null) {
+                        File fi = prov2.getModuleJarLocation();
+                        if (fi != null && /* XXX is there a better way? */ cd.equals(fi.getParentFile().getParentFile())) {

Review Comment:
   could be put into a utility method `getRootDir(NbModuleProvider prov)`. Would be self explanatory and could do the null check there.



-- 
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


[GitHub] [netbeans] mbien commented on a diff in pull request #4236: Avoid NPE in ant module suite's "Project Properties" dialog.

Posted by GitBox <gi...@apache.org>.
mbien commented on code in PR #4236:
URL: https://github.com/apache/netbeans/pull/4236#discussion_r900441709


##########
apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ClusterUtils.java:
##########
@@ -169,8 +169,11 @@ public static Set<ClusterInfo> evaluateClusterPath(File root, PropertyEvaluator
                     prj = _prj;
                 } else {
                     NbModuleProvider prov2 = _prj.getLookup().lookup(NbModuleProvider.class);
-                    if (prov2 != null && /* XXX is there a better way? */ cd.equals(prov2.getModuleJarLocation().getParentFile().getParentFile())) {
-                        prj = _prj;
+                    if (prov2 != null) {
+                        File fi = prov2.getModuleJarLocation();
+                        if (fi != null && /* XXX is there a better way? */ cd.equals(fi.getParentFile().getParentFile())) {

Review Comment:
   if you want you can add another commit. first fixes the bug, second extracts the two occurrences into a utility method. This keeps bugfix and code improvement separate.
   
   There is no need to wait with small cleanups like this.



-- 
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


[GitHub] [netbeans] errael commented on a diff in pull request #4236: Avoid NPE in ant module suite's "Project Properties" dialog.

Posted by GitBox <gi...@apache.org>.
errael commented on code in PR #4236:
URL: https://github.com/apache/netbeans/pull/4236#discussion_r900410373


##########
apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/universe/ClusterUtils.java:
##########
@@ -169,8 +169,11 @@ public static Set<ClusterInfo> evaluateClusterPath(File root, PropertyEvaluator
                     prj = _prj;
                 } else {
                     NbModuleProvider prov2 = _prj.getLookup().lookup(NbModuleProvider.class);
-                    if (prov2 != null && /* XXX is there a better way? */ cd.equals(prov2.getModuleJarLocation().getParentFile().getParentFile())) {
-                        prj = _prj;
+                    if (prov2 != null) {
+                        File fi = prov2.getModuleJarLocation();
+                        if (fi != null && /* XXX is there a better way? */ cd.equals(fi.getParentFile().getParentFile())) {

Review Comment:
   I hadn't seen this before
   ```
       /**
        * Returns location of built module JAR (file need not to exist).
        *
        * Currently (6.7) used only for suite-chaining. May return <tt>null</tt>,
        * module project cannot be chained into another suite in such case.
        * @return location of built module JAR
        */
       @CheckForNull File getModuleJarLocation();
   ```



-- 
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


[GitHub] [netbeans] errael commented on pull request #4236: Avoid NPE in ant module suite's "Project Properties" dialog.

Posted by GitBox <gi...@apache.org>.
errael commented on PR #4236:
URL: https://github.com/apache/netbeans/pull/4236#issuecomment-1159579903

   Turns out `ClusterUtils` already has `getClusterDirectory(Project prj)`. The only difference is whether suite or standalone is checked first.


-- 
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