tamdinh / microemu

Automatically exported from code.google.com/p/microemu
0 stars 0 forks source link

MIDlet.getAppProperty throws exception for missing JAD prop #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Running the August 18 2009 v3.0.0 SNAPSHOT emulator locally on the
apps/microemu-demo.jad "java -jar microemulator.jar
-Xautotest:http://localhost:8000/microemu-demo.jad" with JRE 1.6.0_13 where
the JAD is modified to point "MIDlet-Jar-URL:
http://localhost:8000/microemu-demo.jar" and using a local web server on
Mac OSX 10.5 "python -m SimpleHTTPServer" in the apps/ folder the emulator
throws:

java.lang.IllegalArgumentException: microemu.accessible.host
at java.util.jar.Attributes$Name.<init>(Attributes.java:447)
at java.util.jar.Attributes.getValue(Attributes.java:99)
at org.microemu.util.JadProperties.getProperty(JadProperties.java:118)
at org.microemu.util.JadProperties.getProperty(JadProperties.java:127)
at org.microemu.app.Common.getAppProperty(Common.java:169)
at org.microemu.MIDletBridge.getAppProperty(MIDletBridge.java:127)
at javax.microedition.midlet.MIDlet.getAppProperty(MIDlet.java:84)
at
org.microemu.midp.examples.simpledemo.HTTPPanel.<init>(HTTPPanel.java:65)
at
org.microemu.midp.examples.simpledemo.SimpleDemoMIDlet.startApp(SimpleDemoM
IDlet.java:67)
at
javax.microedition.midlet.MIDlet$MIDletAccessor.startApp(MIDlet.java:49)
at org.microemu.app.Common.startMidlet(Common.java:428)
at org.microemu.app.Common.access$200(Common.java:94)
at org.microemu.app.Common$1.run(Common.java:301)

This exception should not be thrown by getAppProperty.

http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/midlet/
MIDlet.html#getAppProperty%28java.lang.String%29

A missing JAD property, in this case "microemu.accessible.host", should
result in getAppProperty returning a null String.

Further, Sun says a NullPointerException will be thrown by getAppProperty
when the parameter passed into the method is null. I believe Sun should
have thrown an IllegalArgumentException here.

MicroEmulator's getAppProperty should return a null String.

Original issue reported on code.google.com by bar...@gmail.com on 18 Nov 2009 at 11:40

GoogleCodeExporter commented 8 years ago
Fixed in trunk (future 3.0 version)

Original comment by bar...@gmail.com on 8 Jan 2010 at 11:18

GoogleCodeExporter commented 8 years ago
Fixed for 2.0.4 too

Original comment by bar...@gmail.com on 12 Jan 2010 at 1:27