Page 1 of 1

How can I show a message during game startup?

PostPosted: 19 Feb 2012, 20:24
by Max mtg
I have a few lines of code in forge.deck.io.DeckReaderBase.readAll()
Code: Select all
            try {
                final T newDeck = read(file);
                if ( null == newDeck )
                {
                    String msg =  "A deck or similiar object at " + file.getPath() + " failed to load.\nPlease submit this as a bug with the mentioned file/directory attached.";
                    // JOptionPane.showMessageDialog(null, msg);
                } else 
                    result.put(newDeck.getName(), newDeck);
            } catch (final NoSuchElementException ex) {
I would love to trace the reason why some decks failed to load, so I want to ask player to submit the file that caused the error.
However, if a pop a JOptionPane.showMessageDialog, I get another exception.

Code: Select all
This is a Crash Report. An error has occurred. Please save this message to a file.
Please follow the instructions at this address to submit this Crash Report, plus what you were doing at the time:
   http://tinyurl.com/3zzrnyb
Reporting bugs in Forge is very important. We thank you for your time.

null


Version:
Forge version SVN

OS: Windows 7 Version: 6.1 Architecture: amd64

Java Version: 1.6.0_24 Vendor: Sun Microsystems Inc.

Detailed error trace:
java.lang.NullPointerException
   at forge.view.Main$1.run(Main.java:87)
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$000(Unknown Source)
   at java.awt.EventQueue$1.run(Unknown Source)
   at java.awt.EventQueue$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.Dialog$1.run(Unknown Source)
   at java.awt.Dialog$3.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.awt.Dialog.show(Unknown Source)
   at javax.swing.JOptionPane.showOptionDialog(Unknown Source)
   at javax.swing.JOptionPane.showMessageDialog(Unknown Source)
   at javax.swing.JOptionPane.showMessageDialog(Unknown Source)
   at javax.swing.JOptionPane.showMessageDialog(Unknown Source)
   at forge.deck.io.DeckReaderBase.readAll(DeckReaderBase.java:110)
   at forge.util.FolderMapView.<init>(FolderMapView.java:47)
   at forge.util.FolderMap.<init>(FolderMap.java:42)
   at forge.deck.CardCollections.<init>(CardCollections.java:28)
   at forge.AllZone.getDecks(AllZone.java:97)
   at forge.control.home.ControlConstructed.getCustomNames(ControlConstructed.java:325)
   at forge.control.home.ControlConstructed.updateDeckLists(ControlConstructed.java:162)
   at forge.control.home.ControlConstructed.<init>(ControlConstructed.java:96)
   at forge.view.home.ViewConstructed.<init>(ViewConstructed.java:67)
   at forge.view.ViewHomeUI.<init>(ViewHomeUI.java:77)
   at forge.view.FView.instantiateCachedUIStates(FView.java:164)
   at forge.view.FView$2.run(FView.java:103)
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$000(Unknown Source)
   at java.awt.EventQueue$1.run(Unknown Source)
   at java.awt.EventQueue$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)
Do you have any ideas on how I can show user a message?


(Way to reproduce the problem: create an empty dir in /res/decks/sealed or draft, uncomment the showMessage line)

Re: How can I show a message during game startup?

PostPosted: 20 Feb 2012, 18:11
by Max mtg
This is also affecting other areas - user needs to confirm deck deletion if it has wrong cards there or deletion on orphaned sealed parts.