The Source for Java Technology Collaboration

Home » java.net Forums » Mobile & Embedded » LWUIT

Thread: NullPointerException in TextArea

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
This question is answered. Helpful answers available: 2. Correct answers available: 1.

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 4 - Last Post: Oct 21, 2008 2:48 AM by: cknappe
cknappe

Posts: 51
NullPointerException in TextArea
Posted: Oct 19, 2008 11:04 PM
 
  Click to reply to this thread Reply

Hi,

sometimes I get a NullPointerException when calling setText() on a TextArea. This is the trace...

NullPointerException
No detail message
gaia_final-1
TextArea
getLines
0xBD26
gaia_final-1
TextArea
isScrollableY
0xBAA6
gaia_final
Component
isScrollable
0x1604
gaia_final
Component
<private>
0x1568
gaia_final
Component
paintInternal
0x1CF4
gaia_final
Component
paintComponent
0x137C
gaia_final
Component
paintComponent
0x1265
gaia_final-1
Implementation
paintDirty
0x7A17
gaia_final-1
Implementation
edtLoopImpl
0x7CD7
gaia_final-1
Implementation
<private>
0x83A7
net_rim_cldc-1
Thread
run
0xB4B7

I am using the lib from 14.08.2008 so I don't know if this has been fixed at all.

Regards, Christian

Shai Almog
Re: NullPointerException in TextArea
Posted: Oct 20, 2008 5:01 AM   in response to: cknappe
  Click to reply to this thread Reply

Hi,
this occurs when setting text from a separate thread. Make sure you
always invoke setText and the related methods from the EDT otherwise
you might trigger this race condition.

> Hi,
>
> sometimes I get a NullPointerException when calling setText() on a
> TextArea. This is the trace...
>
> NullPointerException
> No detail message
> gaia_final-1
> TextArea
> getLines
> 0xBD26
> gaia_final-1
> TextArea
> isScrollableY
> 0xBAA6
> gaia_final
> Component
> isScrollable
> 0x1604
> gaia_final
> Component
> <private>
> 0x1568
> gaia_final
> Component
> paintInternal
> 0x1CF4
> gaia_final
> Component
> paintComponent
> 0x137C
> gaia_final
> Component
> paintComponent
> 0x1265
> gaia_final-1
> Implementation
> paintDirty
> 0x7A17
> gaia_final-1
> Implementation
> edtLoopImpl
> 0x7CD7
> gaia_final-1
> Implementation
> <private>
> 0x83A7
> net_rim_cldc-1
> Thread
> run
> 0xB4B7
>
> I am using the lib from 14.08.2008 so I don't know if this has been
> fixed at all.
>
> Regards, Christian
> [Message sent by forum member 'cknappe' (cknappe)]
>
> http://forums.java.net/jive/thread.jspa?messageID=310127
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]


cknappe

Posts: 51
Re: NullPointerException in TextArea
Posted: Oct 20, 2008 8:35 AM   in response to: Shai Almog
 
  Click to reply to this thread Reply

OK, but this is done from a Class which implements avax.microediton.location.LocationListener. After locationUpdated is called I show it in my UI. If this is a problem - I will implement this in an other way.

Christian

Shai Almog
Re: NullPointerException in TextArea
Posted: Oct 21, 2008 12:20 AM   in response to: cknappe
  Click to reply to this thread Reply

The location listener will be invoked on the MIDP thread. You will
need to use our callSerially (not MIDP's) to transition back to the
EDT from the event.

> OK, but this is done from a Class which implements
> avax.microediton.location.LocationListener. After locationUpdated
> is called I show it in my UI. If this is a problem - I will
> implement this in an other way.
>
> Christian
> [Message sent by forum member 'cknappe' (cknappe)]
>
> http://forums.java.net/jive/thread.jspa?messageID=310413
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

Shai Almog
http://lwuit.blogspot.com/

[att1.html]


cknappe

Posts: 51
Re: NullPointerException in TextArea
Posted: Oct 21, 2008 2:48 AM   in response to: Shai Almog
 
  Click to reply to this thread Reply

I did as you said. Works fine in simulator and I think the test on device will also work.

Thanks

> The location listener will be invoked on the MIDP
> thread. You will
> need to use our callSerially (not MIDP's) to
> transition back to the
> EDT from the event.
>
> > OK, but this is done from a Class which implements
>
> avax.microediton.location.LocationListener. After
> locationUpdated
> > is called I show it in my UI. If this is a problem
> - I will
> > implement this in an other way.
> >
> > Christian
> > [Message sent by forum member 'cknappe' (cknappe)]
> >
> >
> http://forums.java.net/jive/thread.jspa?messageID=3104
> 13
> >
> >
> ------------------------------------------------------
> ---------------
> > To unsubscribe, e-mail:
> users-unsubscribe@lwuit.dev.java.net
> > For additional commands, e-mail:
> users-help@lwuit.dev.java.net
> >
>
> Shai Almog
> http://lwuit.blogspot.com/
>
> [att1.html]




 XML java.net RSS