nicho92 / MtgDesktopCompanion

Cards manager for magic the gathering
Apache License 2.0
155 stars 34 forks source link

Decklist won't fully load 'Cannot invoke "String.length()" because "s" is null' #181

Closed Ads20000 closed 2 years ago

Ads20000 commented 2 years ago

MTG Companion v2.26 (OpenJDK 16 and Oracle Java 16 (Ubuntu Linux 21.04))

I entered the Land's Wrath deck list (and added the cards in it to Stock and then Library) but after closing and reopening MTG Companion (and my computer) it won't load. The 'Open deck' dialogue box's loading circle gets stuck when trying to load it. The error is as follows:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "String.length()" because "s" is null
Rest of error message at net.coderazzi.filters.gui.editor.ChoicesListModel.addContent(ChoicesListModel.java:162)
at net.coderazzi.filters.gui.editor.PopupComponent.addChoices(PopupComponent.java:123)
at net.coderazzi.filters.gui.editor.FilterEditor.addChoices(FilterEditor.java:418)
at net.coderazzi.filters.gui.editor.FilterEditor.setChoices(FilterEditor.java:408)
at net.coderazzi.filters.gui.AdaptiveChoicesHandler$AdaptiveChoicesSupport$EditorHandle.iterationCompleted(AdaptiveChoicesHandler.java:650)
at net.coderazzi.filters.gui.AdaptiveChoicesHandler$AdaptiveChoicesSupport.extractChoices(AdaptiveChoicesHandler.java:444)
at net.coderazzi.filters.gui.AdaptiveChoicesHandler$AdaptiveChoicesSupport.rowsAdded(AdaptiveChoicesHandler.java:269)
at net.coderazzi.filters.gui.AdaptiveChoicesHandler$AdaptiveChoicesSupport.tableChanged(AdaptiveChoicesHandler.java:243)
at net.coderazzi.filters.gui.AdaptiveChoicesHandler.tableUpdated(AdaptiveChoicesHandler.java:137)
at net.coderazzi.filters.gui.ChoicesHandler.tableChanged(ChoicesHandler.java:108)
at java.desktop/javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:302)
at java.desktop/javax.swing.table.AbstractTableModel.fireTableDataChanged(AbstractTableModel.java:204)
at org.magic.gui.abstracts.GenericTableModel.addItems(GenericTableModel.java:136)
at org.magic.gui.components.dialog.JDeckChooserDialog$2.process(JDeckChooserDialog.java:150)
at java.desktop/javax.swing.SwingWorker$3.run(SwingWorker.java:423)
at java.desktop/sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
at java.desktop/javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:847)
at java.desktop/sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
at java.desktop/javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:857)
at java.desktop/javax.swing.Timer.fireActionPerformed(Timer.java:310)
at java.desktop/javax.swing.Timer$DoPostEvent.run(Timer.java:242)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:117)
at java.desktop/java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190)
at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235)
at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
at java.desktop/java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233)
at java.desktop/java.awt.Dialog.show(Dialog.java:1079)
at java.desktop/java.awt.Component.show(Component.java:1720)
at java.desktop/java.awt.Component.setVisible(Component.java:1667)
at java.desktop/java.awt.Window.setVisible(Window.java:1032)
at java.desktop/java.awt.Dialog.setVisible(Dialog.java:1014)
at org.magic.gui.components.ConstructPanel.lambda$initGUI$2(ConstructPanel.java:369)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:298)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6617)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
at java.desktop/java.awt.Component.processEvent(Component.java:6382)
at java.desktop/java.awt.Container.processEvent(Container.java:2264)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4993)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2322)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4825)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4934)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4563)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4504)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2308)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2773)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4825)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Screenshot from 2021-08-29 20-34-24

mtgcompanion.log

nicho92 commented 2 years ago

I tried to import it with success... did you saved it ? can you tried to import it from this Json file ?

Land_s_Wrath.json.txt

Ads20000 commented 2 years ago

Pretty sure it's a bug (or a database corruption or something? But pretty sure that's happened due to a bug...?) because now even less decks are loading, same error as previously.

Screenshot from 2021-08-29 23-36-44

Ads20000 commented 2 years ago

Tried importing your JSON file and it imports successfully, I hit Save, then it fails to load in the 'Open deck' dialogue, I'm always running into the '"s" is null' error (which seems to prevent the decklist loading more decks) after listing Mono-Green Stompy or Sneak Attack.

The bug occurs on both OpenJDK 16 and Oracle Java 16 (Ubuntu Linux 21.04).

nicho92 commented 2 years ago

is it possible for you to send me a export of your "decks" table ? do you use SQLIte DAO ?

nicho92 commented 2 years ago

or in other way, your %USER_HOME%/.magicDeskCompanion/data/sqlite-db file

Ads20000 commented 2 years ago

sqlite-db Thanks for being so speedy with your responses! Love this tool that you've made :)

nicho92 commented 2 years ago

OK, i see . you have stored a deck with no name... I'll fix this bug in next release. For the moment you can fix it with this Groovy Script ( File / Script) , then past and run :

dao.executeQuery("UPDATE decks set name='NO NAME' where name==null");

then restart the app

Ads20000 commented 2 years ago

No luck I'm afraid (same bug and error message after running the command above and restarting the app, also tried https://github.com/nicho92/MtgDesktopCompanion/commit/c1a38ee03626af863f945ea8797a7c4b3bbabb8a ( which includes your fix at https://github.com/nicho92/MtgDesktopCompanion/commit/37c09c67158b7c1a1f0a0b5245f630d5c60f1032 )).

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "String.length()" because "s" is null

Rest of error message at net.coderazzi.filters.gui.editor.ChoicesListModel.addContent(ChoicesListModel.java:162)
at net.coderazzi.filters.gui.editor.PopupComponent.addChoices(PopupComponent.java:123)
at net.coderazzi.filters.gui.editor.FilterEditor.addChoices(FilterEditor.java:418)
at net.coderazzi.filters.gui.editor.FilterEditor.setChoices(FilterEditor.java:408)
at net.coderazzi.filters.gui.AdaptiveChoicesHandler$AdaptiveChoicesSupport$EditorHandle.iterationCompleted(AdaptiveChoicesHandler.java:650)
at net.coderazzi.filters.gui.AdaptiveChoicesHandler$AdaptiveChoicesSupport.extractChoices(AdaptiveChoicesHandler.java:444)
at net.coderazzi.filters.gui.AdaptiveChoicesHandler$AdaptiveChoicesSupport.rowsAdded(AdaptiveChoicesHandler.java:269)
at net.coderazzi.filters.gui.AdaptiveChoicesHandler$AdaptiveChoicesSupport.tableChanged(AdaptiveChoicesHandler.java:243)
at net.coderazzi.filters.gui.AdaptiveChoicesHandler.tableUpdated(AdaptiveChoicesHandler.java:137)
at net.coderazzi.filters.gui.ChoicesHandler.tableChanged(ChoicesHandler.java:108)
at java.desktop/javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:302)
at java.desktop/javax.swing.table.AbstractTableModel.fireTableDataChanged(AbstractTableModel.java:204)
at org.magic.gui.abstracts.GenericTableModel.addItems(GenericTableModel.java:136)
at org.magic.gui.components.dialog.JDeckChooserDialog$2.process(JDeckChooserDialog.java:150)
at java.desktop/javax.swing.SwingWorker$3.run(SwingWorker.java:423)
at java.desktop/sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
at java.desktop/javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.run(SwingWorker.java:847)
at java.desktop/sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
at java.desktop/javax.swing.SwingWorker$DoSubmitAccumulativeRunnable.actionPerformed(SwingWorker.java:857)
at java.desktop/javax.swing.Timer.fireActionPerformed(Timer.java:310)
at java.desktop/javax.swing.Timer$DoPostEvent.run(Timer.java:242)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:117)
at java.desktop/java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:190)
at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:235)
at java.desktop/java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:233)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
at java.desktop/java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:233)
at java.desktop/java.awt.Dialog.show(Dialog.java:1079)
at java.desktop/java.awt.Component.show(Component.java:1720)
at java.desktop/java.awt.Component.setVisible(Component.java:1667)
at java.desktop/java.awt.Window.setVisible(Window.java:1032)
at java.desktop/java.awt.Dialog.setVisible(Dialog.java:1014)
at org.magic.gui.components.ConstructPanel.lambda$initGUI$2(ConstructPanel.java:369)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:298)
at java.desktop/java.awt.Component.processMouseEvent(Component.java:6617)
at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
at java.desktop/java.awt.Component.processEvent(Component.java:6382)
at java.desktop/java.awt.Container.processEvent(Container.java:2264)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4993)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2322)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4825)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4934)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4563)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4504)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2308)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2773)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4825)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

See latest sqlite-db here

nicho92 commented 2 years ago

Ooops .. My bad ... the query was wrong :

dao.executeQuery("UPDATE decks set name='NO NAME' where name IS null");

Ads20000 commented 2 years ago

That worked, thank you! :D

Ads20000 commented 2 years ago

Probably relating to this @nicho92, I now get the following error when trying to change the name of that 'No name' deck:

2021-10-21 22:41:15 DEBUG org.magic.gui.components.ConstructPanel 462  - saving No Name
2021-10-21 22:41:15 DEBUG org.magic.api.dao.impl.SQLLiteDAO 553  - No Name updated
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "org.magic.api.beans.MagicDeck.getName()" because "this.deck" is null
    at org.magic.gui.components.ConstructPanel.lambda$initGUI$4(ConstructPanel.java:448)
    at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
    at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
    at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
    at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
    at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
    at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:298)
    at java.desktop/java.awt.Component.processMouseEvent(Component.java:6617)
    at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
    at java.desktop/java.awt.Component.processEvent(Component.java:6382)
    at java.desktop/java.awt.Container.processEvent(Container.java:2264)
    at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4993)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2322)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4825)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4934)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4563)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4504)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2308)
    at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2773)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4825)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

It gets stuck on the progress bar and doesn't save. Screenshot from 2021-10-21 22-43-27

Ads20000 commented 2 years ago

Fixed by editing the deck names in ~/.magicDeskCompanion/data/sqlite-db with sqlitebrowser thanks for the recommendation @nicho92 !!