[ https://issues.apache.org/jira/browse/NETBEANS-194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16275610#comment-16275610 ]
ASF GitHub Bot commented on NETBEANS-194: ----------------------------------------- matthiasblaesing opened a new pull request #313: [NETBEANS-194] Don't return NULL from ShellProjectUtils#launchVMOptions and compilerPathOptions URL: https://github.com/apache/incubator-netbeans/pull/313 The two methods ShellProjectUtils#launchVMOptions and compilerPathOptions both return NULL if the project the JShell integration is invoked in is not a modular project or does not export any modules. The callers interate directly on the return value and for this case this leads to a NullPointerException. The other methods of ShellProjectUtils return an empty Collection and not NULL, this adjusts the behaviour of the two methods launchVMOptions and compilerPathOptions to also return an empty collection instead of NULL. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > JShell integration causes NULL Pointer exception on JDK9 > -------------------------------------------------------- > > Key: NETBEANS-194 > URL: https://issues.apache.org/jira/browse/NETBEANS-194 > Project: NetBeans > Issue Type: Bug > Components: java - JShell > Affects Versions: 9.0 > Reporter: Matthias Bläsing > Assignee: Matthias Bläsing > Labels: pull-request-available > > I ran netbeans with JDK 9.0.1 and tested the JShell integration. While > running it, I received two NullPointerExceptions: > *Steps to reproduce:* > - run netbeans with JDK 9.0.1: {{ant -Dnbjdk.home=<JDK9> tryme}} > - Create a "Java Application" project. > - Choose "Execute Java Shell" > - Observe the output in the console > *Result 1: Exception instead of JShell:* > {noformat} > [exec] java.lang.NullPointerException > [exec] at > org.netbeans.modules.jshell.support.ShellSession.customizeBuilderOnJDK9(ShellSession.java:787) > [exec] at > org.netbeans.modules.jshell.support.ShellSession.customizeBuilder(ShellSession.java:743) > [exec] at > org.netbeans.modules.jshell.support.ShellSession.access$700(ShellSession.java:148) > [exec] at > org.netbeans.modules.jshell.support.ShellSession$Launcher.makeBuilder(ShellSession.java:623) > [exec] at > org.netbeans.modules.jshell.tool.JShellLauncher.createJShellInstance(JShellLauncher.java:250) > [exec] at > org.netbeans.modules.jshell.support.ShellSession$Launcher.createJShellInstance(ShellSession.java:628) > [exec] at > org.netbeans.modules.jshell.tool.JShellTool.resetState(JShellTool.java:745) > [exec] at > org.netbeans.modules.jshell.tool.JShellLauncher.resetState(JShellLauncher.java:207) > [exec] at > org.netbeans.modules.jshell.tool.JShellLauncher.ensureLive(JShellLauncher.java:195) > [exec] at > org.netbeans.modules.jshell.tool.JShellLauncher.getJShell(JShellLauncher.java:201) > [exec] at > org.netbeans.modules.jshell.support.ShellSession.initJShell(ShellSession.java:830) > [exec] at > org.netbeans.modules.jshell.support.ShellSession.getJShell(ShellSession.java:314) > [exec] [catch] at > org.netbeans.modules.jshell.support.ShellSession.lambda$null$2(ShellSession.java:519) > [exec] at > org.netbeans.modules.jshell.model.ConsoleModel$ModelAccImpl.execute(ConsoleModel.java:1104) > [exec] at > org.netbeans.modules.jshell.support.ShellSession.lambda$start$3(ShellSession.java:515) > [exec] at > org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418) > [exec] at > org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45) > [exec] at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278) > [exec] at > org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033) > {noformat} > *After fix (return empty list instead of NULL):* > {noformat} > [exec] java.lang.NullPointerException > [exec] at > org.netbeans.modules.jshell.env.JShellEnvironment.customizeJShell(JShellEnvironment.java:270) > [exec] at > org.netbeans.modules.jshell.support.ShellSession.customizeBuilder(ShellSession.java:745) > [exec] at > org.netbeans.modules.jshell.support.ShellSession.access$700(ShellSession.java:148) > [exec] at > org.netbeans.modules.jshell.support.ShellSession$Launcher.makeBuilder(ShellSession.java:623) > [exec] at > org.netbeans.modules.jshell.tool.JShellLauncher.createJShellInstance(JShellLauncher.java:250) > [exec] at > org.netbeans.modules.jshell.support.ShellSession$Launcher.createJShellInstance(ShellSession.java:628) > [exec] at > org.netbeans.modules.jshell.tool.JShellTool.resetState(JShellTool.java:745) > [exec] at > org.netbeans.modules.jshell.tool.JShellLauncher.resetState(JShellLauncher.java:207) > [exec] at > org.netbeans.modules.jshell.tool.JShellLauncher.ensureLive(JShellLauncher.java:195) > [exec] at > org.netbeans.modules.jshell.tool.JShellLauncher.getJShell(JShellLauncher.java:201) > [exec] at > org.netbeans.modules.jshell.support.ShellSession.initJShell(ShellSession.java:830) > [exec] at > org.netbeans.modules.jshell.support.ShellSession.getJShell(ShellSession.java:314) > [exec] [catch] at > org.netbeans.modules.jshell.support.ShellSession.lambda$null$2(ShellSession.java:519) > [exec] at > org.netbeans.modules.jshell.model.ConsoleModel$ModelAccImpl.execute(ConsoleModel.java:1104) > [exec] at > org.netbeans.modules.jshell.support.ShellSession.lambda$start$3(ShellSession.java:515) > [exec] at > org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418) > [exec] at > org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45) > [exec] at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278) > [exec] at > org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033) > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)