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/07/20 15:31:12 UTC

[GitHub] [netbeans] neilcsmith-net opened a new pull request, #4414: Fix #4411 - ensure moduleLocations is initialized.

neilcsmith-net opened a new pull request, #4414:
URL: https://github.com/apache/netbeans/pull/4414

   Fix #4411 - protect against NPE by ensuring moduleLocations is initialized in PatchModuleFileManager::fixLocation.


-- 
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 #4414: Fix #4411 - ensure moduleLocations is initialized.

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


##########
java/java.source.base/src/org/netbeans/modules/java/source/parsing/PatchModuleFileManager.java:
##########
@@ -296,7 +296,8 @@ public FileObject getFileForOutput(Location location, String packageName, String
 
     private Location fixLocation(Location input) throws IOException {
         if (input == StandardLocation.CLASS_OUTPUT && overrideModuleName != null) {
-            return this.moduleLocations.stream().filter(pl -> overrideModuleName.equals(pl.getModuleName())).map(pl -> (Location) pl).findAny().orElse(input);
+            return moduleLocations(StandardLocation.PATCH_MODULE_PATH)
+                    .stream().filter(pl -> overrideModuleName.equals(pl.getModuleName())).map(pl -> (Location) pl).findAny().orElse(input);

Review Comment:
   this looks good to me, I actually wanted to propose the same but you were faster this time :)
   
   The confusing part while looking through the code however was that `moduleLocations(foo)` only allows foo to be the constant `StandardLocation.PATCH_MODULE_PATH`, everything else throws an exception. So it would be more intuitive to simply make that a `getModueLocations()` without parameter.



-- 
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 #4414: Fix #4411 - ensure moduleLocations is initialized.

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


##########
java/java.source.base/src/org/netbeans/modules/java/source/parsing/PatchModuleFileManager.java:
##########
@@ -296,7 +296,8 @@ public FileObject getFileForOutput(Location location, String packageName, String
 
     private Location fixLocation(Location input) throws IOException {
         if (input == StandardLocation.CLASS_OUTPUT && overrideModuleName != null) {
-            return this.moduleLocations.stream().filter(pl -> overrideModuleName.equals(pl.getModuleName())).map(pl -> (Location) pl).findAny().orElse(input);
+            return moduleLocations(StandardLocation.PATCH_MODULE_PATH)
+                    .stream().filter(pl -> overrideModuleName.equals(pl.getModuleName())).map(pl -> (Location) pl).findAny().orElse(input);

Review Comment:
   this looks good to me, I actually wanted to propose the same but you were faster this time :)
   
   The confusing part while looking through the code however was that `moduleLocations(foo)` only allows foo to be the constant `StandardLocation.PATCH_MODULE_PATH`, everything else throws an exception. So it would be more intuitive to simply make that a `getModueLocations()` without parameter - probably also less error prone since it does what you expect it to do.



-- 
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] neilcsmith-net commented on pull request #4414: Fix #4411 - ensure moduleLocations is initialized.

Posted by GitBox <gi...@apache.org>.
neilcsmith-net commented on PR #4414:
URL: https://github.com/apache/netbeans/pull/4414#issuecomment-1191198842

   Thanks @matthiasblaesing @jlahoda - merging.
   
   @matthiasblaesing only seems to happen with explicit module projects - try adding a `module-info` to the project you shared in #4044 and you should see it blow up straight away.  Also affects loading projects with a module info.


-- 
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] neilcsmith-net commented on a diff in pull request #4414: Fix #4411 - ensure moduleLocations is initialized.

Posted by GitBox <gi...@apache.org>.
neilcsmith-net commented on code in PR #4414:
URL: https://github.com/apache/netbeans/pull/4414#discussion_r926400619


##########
java/java.source.base/src/org/netbeans/modules/java/source/parsing/PatchModuleFileManager.java:
##########
@@ -296,7 +296,8 @@ public FileObject getFileForOutput(Location location, String packageName, String
 
     private Location fixLocation(Location input) throws IOException {
         if (input == StandardLocation.CLASS_OUTPUT && overrideModuleName != null) {
-            return this.moduleLocations.stream().filter(pl -> overrideModuleName.equals(pl.getModuleName())).map(pl -> (Location) pl).findAny().orElse(input);
+            return moduleLocations(StandardLocation.PATCH_MODULE_PATH)
+                    .stream().filter(pl -> overrideModuleName.equals(pl.getModuleName())).map(pl -> (Location) pl).findAny().orElse(input);

Review Comment:
   Got to be faster than you sometime! :smile: I kept the fix minimal but had similar thoughts wondering why that method takes the location.  Mind you `moduleLocations()` would be fine - no need for `get` on everything!



-- 
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] neilcsmith-net merged pull request #4414: Fix #4411 - ensure moduleLocations is initialized.

Posted by GitBox <gi...@apache.org>.
neilcsmith-net merged PR #4414:
URL: https://github.com/apache/netbeans/pull/4414


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