TextArea: frozen/exception

95 views
Skip to first unread message

Ivan

unread,
Jul 22, 2013, 7:02:24 PM7/22/13
to codenameone...@googlegroups.com
Hi guys,

I have a problem with TextArea. The behaviour is "occasional" but I'm able to reproduce it. There are two cases:
1. when I write quickly sometimes it throws exception (see stack trace below)
2. when text exceeds displayed rows of TA (starts scrolling up) and I click into area between keyboard and dialog (see test code below) keyboard disappears (it's OK) but sometimes application freezes (see screenshot attached).

Is it something with my code or is it a bug? I'm testing on Android 4.1.2 (Sony Xperia SP), 4.2.2. (Google Nexus 7)

Test code:

Container noteCont = new Container(new BoxLayout(BoxLayout.Y_AXIS));
TextArea ta = new TextArea();
ta.setGrowByContent(true);
ta.setSingleLineTextArea(false);
ta.setRows(5);
ta.setColumns(50);
ta.setMaxSize(8000);
noteCont.addComponent(ta);

Dialog dlg = new Dialog("Note");
dlg.placeButtonCommands(new Command[]{new Command("OK")});
dlg.addComponent(noteCont);
dlg.setBackCommand(new Command("Cancel"));
dlg.showDialog();

Stack trace:
[EDT] 0:0:21,641 - java.lang.NullPointerException
[EDT] 0:0:21,658 - java.lang.NullPointerException
	at com.codename1.ui.TextArea.initRowString(TextArea.java:954)
	at com.codename1.ui.TextArea.getRowStrings(TextArea.java:667)
	at com.codename1.ui.TextArea.getLines(TextArea.java:681)
	at com.codename1.ui.plaf.DefaultLookAndFeel.getTextAreaSize(DefaultLookAndFeel.java:860)
	at com.codename1.ui.TextArea.calcScrollSize(TextArea.java:1023)
	at com.codename1.ui.Component.getScrollDimension(Component.java:542)
	at com.codename1.ui.TextArea.isScrollableY(TextArea.java:521)
	at com.codename1.ui.Component.isScrollable(Component.java:1373)
	at com.codename1.ui.Component.internalPaintImpl(Component.java:995)
	at com.codename1.ui.Component.paintInternalImpl(Component.java:984)
	at com.codename1.ui.Component.paintInternal(Component.java:967)
	at com.codename1.ui.Component.paintInternal(Component.java:935)
	at com.codename1.ui.Component.paintComponent(Component.java:1202)
	at com.codename1.ui.Component.paintComponent(Component.java:1154)
	at com.codename1.impl.CodenameOneImplementation.paintDirty(CodenameOneImplementation.java:370)
	at com.codename1.ui.Display.edtLoopImpl(Display.java:917)
	at com.codename1.ui.Display.invokeAndBlock(Display.java:1048)
	at com.codename1.ui.Display.invokeAndBlock(Display.java:1083)
	at com.codename1.impl.android.InPlaceEditView.waitForEditCompletion(InPlaceEditView.java:344)
	at com.codename1.impl.android.InPlaceEditView.edit(InPlaceEditView.java:465)
	at com.codename1.impl.android.AndroidImplementation.editString(AndroidImplementation.java:410)
	at com.codename1.ui.Display.editString(Display.java:1352)
	at com.codename1.ui.Display.editString(Display.java:1323)
	at com.codename1.ui.TextArea.editString(TextArea.java:541)
	at com.codename1.ui.TextArea.pointerReleased(TextArea.java:574)
	at com.codename1.ui.Form.pointerReleased(Form.java:2129)
	at com.codename1.ui.Dialog.pointerReleased(Dialog.java:1680)
	at com.codename1.ui.Component.pointerReleased(Component.java:2241)
	at com.codename1.ui.Display.handleEvent(Display.java:1709)
	at com.codename1.ui.Display.edtLoopImpl(Display.java:913)
	at com.codename1.ui.Display.invokeAndBlock(Display.java:1048)
	at com.codename1.ui.Display.invokeAndBlock(Display.java:1083)
	at com.codename1.ui.Form.showModal(Form.java:1398)
	at com.codename1.ui.Dialog.showModal(Dialog.java:1074)
	at com.codename1.ui.Dialog.show(Dialog.java:465)
	at com.codename1.ui.Dialog.showPackedImpl(Dialog.java:1351)
	at com.codename1.ui.Dialog.showPacked(Dialog.java:1262)
	at com.codename1.ui.Dialog.showImpl(Dialog.java:1034)
	at com.codename1.ui.Dialog.show(Dialog.java:1016)
	at com.codename1.ui.Dialog.showDialog(Dialog.java:1413)
	at userclasses.StateMachine.onMain_ButtonAction(StateMachine.java:61)
	at generated.StateMachineBase.handleComponentAction(StateMachineBase.java:320)
	at com.codename1.ui.util.UIBuilder$FormListener.actionPerformed(UIBuilder.java:2628)
	at com.codename1.ui.util.EventDispatcher.fireActionSync(EventDispatcher.java:383)
	at com.codename1.ui.util.EventDispatcher.fireActionEvent(EventDispatcher.java:326)
	at com.codename1.ui.Button.fireActionEvent(Button.java:376)
	at com.codename1.ui.Button.released(Button.java:407)
	at com.codename1.ui.Button.pointerReleased(Button.java:495)
	at com.codename1.ui.Form.pointerReleased(Form.java:2129)
	at com.codename1.ui.Form.pointerReleased(Form.java:2076)
	at com.codename1.ui.Component.pointerReleased(Component.java:2241)
	at com.codename1.ui.Display.handleEvent(Display.java:1709)
	at com.codename1.ui.Display.edtLoopImpl(Display.java:913)
	at com.codename1.ui.Display.mainEDTLoop(Display.java:858)
	at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:119)
	at com.codename1.impl.CodenameOneThread$1.run(CodenameOneThread.java:60)
	at java.lang.Thread.run(Thread.java:856)


frozen.png

Shai Almog

unread,
Jul 23, 2013, 12:49:43 AM7/23/13
to codenameone...@googlegroups.com
Hi,
seems like a serious bug. Can you file an issue with a test case, we will try to reproduce it. Thanks!

Ivan

unread,
Jul 23, 2013, 3:36:00 AM7/23/13
to codenameone...@googlegroups.com

Gareth Murfin

unread,
Feb 3, 2014, 9:27:31 AM2/3/14
to codenameone...@googlegroups.com
Im coming across this too cannot find a fix.

On Tuesday, July 23, 2013 3:36:00 PM UTC+8, Ivan wrote:

Gareth Murfin

unread,
Feb 3, 2014, 10:36:19 AM2/3/14
to codenameone...@googlegroups.com
a small sleep seems to fix it, i guess its a thread error on my side, accessing same object at same time, curiously I tried synchronizing etc with no luck


--
You received this message because you are subscribed to a topic in the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/codenameone-discussions/2ON3u91xkOU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/02d7ed1f-04ca-437e-a6a4-27415bdcd158%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Gareth Murfin
(Android Freelancer - www.garethmurfin.co.uk)

Shai Almog

unread,
Feb 3, 2014, 1:17:00 PM2/3/14
to codenameone...@googlegroups.com
Synchronization won't help since we access the state internally. You need to use callSerially.
Reply all
Reply to author
Forward
0 new messages