Skip to main content

NullPointerException

2 replies [Last post]
david54
Offline
Joined: 2006-12-03

2/07/07
Hi,
I hope someone can help me.I am writing a very simple maze game and when I loaded it into the Sun Toolkit ,it does the Build and Run process without any problem's but when I press the launch button on the Emulator these error's came up.
Project "SavethePrincessCanvas" loaded
Project settings saved
Building "SavethePrincessCanvas"
Build complete
Running with storage root DefaultColorPhone
Running with locale: English_United States.1252
startApp threw an Exception
java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
at javax.microedition.lcdui.game.TiledLayer.(+94)
at SavethePrincessCanvas.start(+29)
at SavethePrincessMIDlet.startApp(+58)
at javax.microedition.midlet.MIDletProxy.startApp(+7)
at com.sun.midp.midlet.Scheduler.schedule(+270)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+116)
destroyApp threw an Exception
java.lang.NullPointerException
java.lang.NullPointerException
at SavethePrincessCanvas.stop(+4)
at SavethePrincessMIDlet.destroyApp(+7)
at javax.microedition.midlet.MIDletProxy.destroyApp(+8)
at com.sun.midp.midlet.Scheduler.schedule(+324)
at com.sun.midp.main.Main.runLocalClass(+28)
at com.sun.midp.main.Main.main(+116)
Execution completed.
3512244 bytecodes executed
1325 thread switches
1621 classes in the system (including system classes)
18213 dynamic objects allocated (873320 bytes)
4 garbage collections (468164 bytes collected)
I tried to research the problems but I am at a lost on how to read the error listing.
Any information would be greatly appreciated.
Thank You,
David Brown

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
wonkim
Offline
Joined: 2005-01-05

Hi,

As I saw, this is not NullPointerException. but IllegalArgumentException from TiledLayer.
Did you check about the TitledLayer constructor documentation?

TitledLayer constructor can raise IllegalArgumentException in the below cases:

IllegalArgumentException - if the number of rows or columns is less than 1
IllegalArgumentException - if tileHeight or tileWidth is less than 1
IllegalArgumentException - if the image width is not an integer multiple of the tileWidth
IllegalArgumentException - if the image height is not an integer multiple of the tileHeight

Regards.

david54
Offline
Joined: 2006-12-03

3/24/07

Hi,

Thank you for the information.
One of my tile image's was not the exact same size as the other tile layer image's.
It was corrected.
Thank you,

David Brown