I'm writing an MIDP 2.0 MIDlet application in Neteans 6.5, using the Nokia S60 emulator. The MIDlet was created using the Visual MIDlet design feature of Netbeans. It's a simple form that accepts a numeric entry and plays an audio file.
The commandAction method created by Netbeans is where everything happens. When the "OK" command on the phone is invoked, a value is retrieved from a text field (key) and mapped to an audio file (value) in a Hashtable. This whole process is in a try - catch block that catches all the known exceptions to expect (including InvalidArgumentException), and it executes without exceptions when the entered value maps to a valid audio file. I test for an invalid key at the top of the try - catch block and bypass everything if it does not properly map. I expect that nothing should happen when an invalid entry is given, and no exception is trapped by the try - catch block.
However, when an entry is given that does not map to a valid audio file (i.e. Hashtable.get() returns null), the try - catch does not trap an exception, but an InvalidArgumentException is thrown by "Callback". I don't know what is throwing this exception. It is not happening in the commandAction try - catch which is substantively all there is in the method. No stack trace or other diagnostic is provided, just the notation on the command line that Callback threw the exception. The phone emulator also reports (embarassingly) to the user that an "Unhandled exception" has occurred and asks if the application (MIDlet) should be closed. (If the MIDlet is allowed to continue to execute, it takes the next entry just fine and either works like a champ or exhibits the same poor behavior again depending upon the validity of the entry.
Any ideas on where to hunt down the Callback exception would be appreciated. Thanks.