Skip to content

Conversation

@bob0bob
Copy link
Contributor

@bob0bob bob0bob commented Dec 3, 2021

When run from the test chooser, TestIssue1120 in jme3-examples crashes:

The application's test field is null because it wasn't initialized. The initialization was placed in main(), which the test chooser never executes.

bob0bob and others added 19 commits November 21, 2021 23:33
… in AppSettings. ‘CenterWindow’, ‘WindowXPosition’ and ‘WindowYPosition’ variables. This way these variable will be saved in the profile when the profile is saved, and be reloaded. I added ‘CenterWindow’ to be added with a ‘true’ value for the default value so it will run just like it did before.

But if you set ‘CenterWindow’ to ‘false’ then inside LwjglWindow.java (lwjgl3 code) it will look at these new values, it will determine to center the window or use the position values to place the window back at the location the user last moved it to.

Of course, these values are only updated if the “program” updates this value. So if you want to save screen position, you can save them on closing to and on restart put the window back into the same location.
LWJGL3-JME library would block the current thread when executing LWJGL3.    Instead of calling run() that is blocking,  made it work like LWJGL2-JME library when they start it as a thread so run gets called. I commented out the run() function and replaced it with Thread.start().
LWJGL3-JME projects was doing a call that is blocking the current thread.  I changed it to match how LWJGL2-JME project launches the Context Window.
LWJGL3-JME projects was doing a call that is blocking the current thread.  I changed it to match how LWJGL2-JME project launches the Context Window.
Nov 28, 2021 1:10:12 AM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,6,main]
java.lang.NullPointerException
 at jme3test.bullet.TestIssue1120.simpleInitApp(TestIssue1120.java:142)
 at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:240)
 at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:139)
 at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:221)
 at java.lang.Thread.run(Thread.java:748)

The application's test field is null because it wasn't initialized. The initialization was placed in main(), which the test chooser never executes.
@stephengold
Copy link
Member

I self-assigned the issue before I saw this PR, and now we have 2 fixes for #1687!

@stephengold stephengold linked an issue Dec 3, 2021 that may be closed by this pull request
@stephengold stephengold added this to the v3.5.0 milestone Dec 3, 2021
@stephengold stephengold added the examples specific to the jme3-examples sub-project label Dec 3, 2021
@stephengold stephengold changed the title Test chooser #1687 Fix issue #1687 (NPE in TestIssue1120) Dec 4, 2021
@stephengold stephengold merged commit 8b56ff9 into jMonkeyEngine:master Dec 4, 2021
@stephengold
Copy link
Member

Thanks for your help.
By the way ... best practice is to create a new Git branch name for each pull request.

@bob0bob
Copy link
Contributor Author

bob0bob commented Dec 4, 2021

This is what I did. I created a branch for each pull request, so I could continue working.

@bob0bob bob0bob deleted the TestChooser_#1687 branch December 4, 2021 05:58
@stephengold
Copy link
Member

Then I don't understand why GitHub was showing 19 commits in the branch. Ah well...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples specific to the jme3-examples sub-project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NullPointerException in TestIssue1120 when run from TestChooser

2 participants