[
https://issues.apache.org/jira/browse/NETBEANS-1785?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
John Brice updated NETBEANS-1785:
---------------------------------
Description:
Pasting code into JavaFX start method of a Java application, NetBeans offers to
resolve imports. Clicking OK results in a Null Pointer Exception. Cancel the
dialog, then Ctrl+Shift+I imports correct classes.
Steps to reproduce:
Create new Java application.
Add OpenJFX jars to classpath and modulepath.
Add --module-path %PATH_TO_FX% and --add-modules javafx.controls,javafx.fxml
to VM options.
Make main class extend Application, implement all abstract methods, change
main method body to:
{code:java}
public static void main(String[] args) {
launch(args);
}{code}
Paste this code into start method:
{code:java}
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("FTGui.fxml"));
stage.setTitle("Hello World");
stage.setScene(new Scene(root, 300, 275));
stage.show();
}{code}
Netbeans dialog pops up offering to resolve imports for pasted code.
Click OK, get NPE.
{noformat}
java.lang.NullPointerException
at
org.netbeans.modules.debugger.jpda.jdi.ReferenceTypeWrapper.fieldByName(ReferenceTypeWrapper.java:1033)
[catch] at
org.netbeans.modules.debugger.jpda.visual.VisualDebuggerListener.setFxDebug(VisualDebuggerListener.java:463)
at
org.netbeans.modules.debugger.jpda.visual.VisualDebuggerListener.initDebuggerRemoteService(VisualDebuggerListener.java:273)
at
org.netbeans.modules.debugger.jpda.visual.VisualDebuggerListener.access$100(VisualDebuggerListener.java:94)
at
org.netbeans.modules.debugger.jpda.visual.VisualDebuggerListener$3.breakpointReached(VisualDebuggerListener.java:184)
at
org.netbeans.api.debugger.jpda.JPDABreakpoint.fireJPDABreakpointChange(JPDABreakpoint.java:275)
at
org.netbeans.api.debugger.jpda.JPDADebugger.fireBreakpointEvent(JPDADebugger.java:466)
at
org.netbeans.modules.debugger.jpda.JPDADebuggerImpl.fireBreakpointEvent(JPDADebuggerImpl.java:641)
at
org.netbeans.modules.debugger.jpda.breakpoints.BreakpointImpl.perform(BreakpointImpl.java:535)
at
org.netbeans.modules.debugger.jpda.breakpoints.MethodBreakpointImpl.exec(MethodBreakpointImpl.java:253)
at
org.netbeans.modules.debugger.jpda.util.Operator.processEvents(Operator.java:500)
at
org.netbeans.modules.debugger.jpda.util.Operator.access$800(Operator.java:94)
at org.netbeans.modules.debugger.jpda.util.Operator$1.run(Operator.java:225)
at
org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
at org.netbeans.modules.debugger.jpda.util.Operator$2.run(Operator.java:257)
at java.base/java.lang.Thread.run(Thread.java:834){noformat}
Cancel import dialog, press Ctrl+Shift+I and correct classes are imported.
Run or debug and the app runs successfully.
Crash report attached.
was:
Pasting code into JavaFX start method of a Java application, NetBeans offers to
resolve imports. Clicking OK results in a Null Pointer Exception. Cancel the
dialog, then Ctrl+Shift+I imports correct classes.
Steps to reproduce:
Create new Java application.
Add OpenJFX jars to classpath and modulepath.
Add --module-path %PATH_TO_FX% and --add-modules javafx.controls,javafx.fxml to
VM options.
Make main class extend Application, implement all abstract methods, change main
method body to:
{code:java}
public static void main(String[] args) {
launch(args);
}{code}
Paste this code into start method:
{code:java}
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("FTGui.fxml"));
stage.setTitle("Hello World");
stage.setScene(new Scene(root, 300, 275));
stage.show();
}{code}
Netbeans dialog pops up offering to resolve imports for pasted code.
Click OK, get NPE.
Cancel import dialog, press Ctrl+Shift+I and correct classes are imported.
Run or debug and the app runs successfully.
Crash report attached.
> NPE when resolving imports for pasted code
> ------------------------------------------
>
> Key: NETBEANS-1785
> URL: https://issues.apache.org/jira/browse/NETBEANS-1785
> Project: NetBeans
> Issue Type: Bug
> Affects Versions: 10.0
> Environment: Windows 10 1803 (64-bit)
> Netbeans 10vc4
> AdoptOpenJDK 11.0.1
> OpenJFX 11.0.1
> Reporter: John Brice
> Priority: Major
> Attachments: pasted-code-npe.zip
>
>
> Pasting code into JavaFX start method of a Java application, NetBeans offers
> to resolve imports. Clicking OK results in a Null Pointer Exception. Cancel
> the dialog, then Ctrl+Shift+I imports correct classes.
>
> Steps to reproduce:
> Create new Java application.
> Add OpenJFX jars to classpath and modulepath.
> Add --module-path %PATH_TO_FX% and --add-modules javafx.controls,javafx.fxml
> to VM options.
> Make main class extend Application, implement all abstract methods, change
> main method body to:
> {code:java}
> public static void main(String[] args) {
> launch(args);
> }{code}
> Paste this code into start method:
> {code:java}
> @Override
> public void start(Stage stage) throws Exception {
> Parent root = FXMLLoader.load(getClass().getResource("FTGui.fxml"));
> stage.setTitle("Hello World");
> stage.setScene(new Scene(root, 300, 275));
> stage.show();
> }{code}
> Netbeans dialog pops up offering to resolve imports for pasted code.
> Click OK, get NPE.
> {noformat}
> java.lang.NullPointerException
> at
> org.netbeans.modules.debugger.jpda.jdi.ReferenceTypeWrapper.fieldByName(ReferenceTypeWrapper.java:1033)
> [catch] at
> org.netbeans.modules.debugger.jpda.visual.VisualDebuggerListener.setFxDebug(VisualDebuggerListener.java:463)
> at
> org.netbeans.modules.debugger.jpda.visual.VisualDebuggerListener.initDebuggerRemoteService(VisualDebuggerListener.java:273)
> at
> org.netbeans.modules.debugger.jpda.visual.VisualDebuggerListener.access$100(VisualDebuggerListener.java:94)
> at
> org.netbeans.modules.debugger.jpda.visual.VisualDebuggerListener$3.breakpointReached(VisualDebuggerListener.java:184)
> at
> org.netbeans.api.debugger.jpda.JPDABreakpoint.fireJPDABreakpointChange(JPDABreakpoint.java:275)
> at
> org.netbeans.api.debugger.jpda.JPDADebugger.fireBreakpointEvent(JPDADebugger.java:466)
> at
> org.netbeans.modules.debugger.jpda.JPDADebuggerImpl.fireBreakpointEvent(JPDADebuggerImpl.java:641)
> at
> org.netbeans.modules.debugger.jpda.breakpoints.BreakpointImpl.perform(BreakpointImpl.java:535)
> at
> org.netbeans.modules.debugger.jpda.breakpoints.MethodBreakpointImpl.exec(MethodBreakpointImpl.java:253)
> at
> org.netbeans.modules.debugger.jpda.util.Operator.processEvents(Operator.java:500)
> at
> org.netbeans.modules.debugger.jpda.util.Operator.access$800(Operator.java:94)
> at
> org.netbeans.modules.debugger.jpda.util.Operator$1.run(Operator.java:225)
> at
> org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
> at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
> at
> org.netbeans.modules.debugger.jpda.util.Operator$2.run(Operator.java:257)
> at java.base/java.lang.Thread.run(Thread.java:834){noformat}
> Cancel import dialog, press Ctrl+Shift+I and correct classes are imported.
> Run or debug and the app runs successfully.
> Crash report attached.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists