NullPointerException when attempting to open an SGF
Hey there! First off, thanks for all your hard work on Lizzie - it's awesome!
The latest release (Lizzie.0.5.Windows.x64.GPU) is giving me some trouble when trying to open an SGF. Here's the stacktrace:
at featurecat.lizzie.gui.LizzieFrame.openSgf(LizzieFrame.java:211)
at featurecat.lizzie.gui.Input.keyPressed(Input.java:267)
at java.desktop/java.awt.Component.processKeyEvent(Unknown Source)
at java.desktop/java.awt.Component.processEvent(Unknown Source)
at java.desktop/java.awt.Container.processEvent(Unknown Source)
at java.desktop/java.awt.Window.processEvent(Unknown Source)
at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue.access$600(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at featurecat.lizzie.gui.LizzieFrame.openSgf(LizzieFrame.java:211)
at featurecat.lizzie.gui.Input.keyPressed(Input.java:267)
at java.desktop/java.awt.Component.processKeyEvent(Unknown Source)
at java.desktop/java.awt.Component.processEvent(Unknown Source)
at java.desktop/java.awt.Container.processEvent(Unknown Source)
at java.desktop/java.awt.Window.processEvent(Unknown Source)
at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue.access$600(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
And what I think may be related on startup:
at org.json.JSONTokener.syntaxError(JSONTokener.java:505)
at org.json.JSONObject.<init>(JSONObject.java:214)
at featurecat.lizzie.Config.loadAndMergeConfig(Config.java:49)
at featurecat.lizzie.Config.<init>(Config.java:127)
at featurecat.lizzie.Lizzie.main(Lizzie.java:28)
And when trying to close the program (and thus persist the config file):
at featurecat.lizzie.Config.writeConfig(Config.java:266)
at featurecat.lizzie.Config.persist(Config.java:273)
at featurecat.lizzie.Lizzie.shutdown(Lizzie.java:61)
at featurecat.lizzie.gui.LizzieFrame$1.windowClosing(LizzieFrame.java:139)
at java.desktop/java.awt.Window.processWindowEvent(Unknown Source)
at java.desktop/javax.swing.JFrame.processWindowEvent(Unknown Source)
at java.desktop/java.awt.Window.processEvent(Unknown Source)
at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue.access$600(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
My config file is unedited and default, and passes a JSON validator without any problem. Attached here for good measure:
"leelaz": {
"automatically-download-latest-network": false,
"max-analyze-time-minutes": 5,
"analyze-update-interval-centisec": 10,
"network-file": "network",
"max-game-thinking-time-seconds": 2,
"engine-start-location": ".",
"engine-command": "./leelaz --gtp --lagbuffer 0 --weights %network-file --threads 2",
"print-comms": false
},
"ui": {
"shadows-enabled": true,
"board-color": [
217,
152,
77
],
"shadow-size": 100,
"show-winrate": true,
"fancy-board": true,
"show-variation-graph": true,
"win-rate-always-black": false,
"confirm-exit": false,
"handicap-instead-of-winrate": false,
"large-subboard": false,
"show-move-number": false,
"show-next-moves": true,
"show-leelaz-variation": true,
"show-subboard": true,
"theme": "DefaultTheme",
"fancy-stones": true,
"show-best-moves": true,
"board-size": 19
}
}
please also attach the sgf! the ones I tested so far all worked. thanks.
I wasn't able to get to the point of actually loading an SFG - on pressing o the program was doing nothing and printing the stack trace to the console.
However I was able to track down the source! The persist config file written was somehow written with no content, resulting in the JSON parsing error. I deleted the empty file and it appears to have been re-written with the content {"filesystem": {"last-folder": ""}}, which looks like the expected default in the code. Not sure how I ended up with an empty one!
oh my! thank you for tracking it down... quite odd, will add some sort of precaution for failed json loading.
leaving this open so I can remember later.
Happy to help!
@colinwd please test with #824