My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 44: removeCommand(null) on a Displayable gives incorrectly a NullPointerException
2 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Apr 2010


 
Reported by jacob.nordfalk, Apr 28, 2010
What steps will reproduce the problem?
1. Open Web start from
http://snapshot.microemu.org/microemu-webstart/index.html
2. Download a dictionary from
http://dictionarymid.sourceforge.net/dict.html and put it on a web page
(Ive done that at: http://javabog.dk/filer/DictionaryForMIDs-crash )
3. Open the emulator's log window
4. Drag the JAD file to the emulator and start it

What is the expected output? What do you see instead?
I see a NullPointerException, caused by invoking removeCommand(null) on a
Displayable (unfortunately I can't copy text from the log window in
microemu...)


What version of the product are you using? On what operating system?
I tried all microemu versions.

Please provide any additional information below.
The javadoc specifies that removeCommand(null) should be possible.

removeCommand

public void removeCommand(Command cmd)

    Removes a command from the Displayable. If the command is not in the
Displayable (tested by comparing the object references), the method has no
effect. If the Displayable is actually visible on the display, and this
call affects the set of visible commands, the implementation should update
the display as soon as it is feasible to do so. If cmd is null, this method
does nothing.

    Parameters:
        cmd - the command to be removed

(I copied from
http://www.j2medev.com/api/midp/javax/microedition/lcdui/Displayable.html#removeCommand%28javax.microedition.lcdui.Command%29)

Apr 28, 2010
#1 jacob.nordfalk

Here is the code:

        public void removeCommand(Command cmd)
        {
                ui.removeCommandUI(cmd.ui);
        }

Please change this to

        public void removeCommand(Command cmd)
        {
                if (cmd != null) ui.removeCommandUI(cmd.ui);
        }


The class is in
 
http://microemu.googlecode.com/svn›
trunk›
microemulator›
microemu-midp›
src›
main›
java›
javax›
microedition›
lcdui›
Displayable.java


Thanks,
Jacob
Apr 29, 2010
#3 Guillaum...@gmail.com
I also found this problem.

Could you fix it ?
Apr 29, 2010
Project Member #4 bar...@gmail.com
Fixed in trunk
Status: Fixed
Labels: Milestone-3.0
Apr 30, 2010
#5 jacob.nordfalk
Thanks.
When would this be available for the public?
Would the http://snapshot.microemu.org/ version be dependable upon?
Apr 30, 2010
Project Member #6 bar...@gmail.com
http://snapshot.microemu.org/ is available the day after the fix, so in that case it
is available now.

Powered by Google Project Hosting