JavaSEPort$EDTViolation: EDT Violation Stack when running MapsDemo on simulator at PointsLayer creation

41 views
Skip to first unread message

Pete Knight

unread,
Jan 29, 2015, 5:00:52 AM1/29/15
to codenameone...@googlegroups.com
Whilst running the MapsDemo on the simulator after building on Eclipse and running in the simulator for iPhone I get an EDT Violation on creation of a PointsLayer object. It still processes the response correctly, is this something to be concerned about? I'm a complete newbie here, to codenameone and iPhone development.

PointsLayer pl = new PointsLayer(); 

steve nganga

unread,
Jan 29, 2015, 5:17:41 AM1/29/15
to codenameone...@googlegroups.com
At what point are you instantiating the PointsLayer in your code?


On Thu, Jan 29, 2015 at 1:00 PM, Pete Knight <petec...@gmail.com> wrote:
Whilst running the MapsDemo on the simulator after building on Eclipse and running in the simulator for iPhone I get an EDT Violation on creation of a PointsLayer object. It still processes the response correctly, is this something to be concerned about? I'm a complete newbie here, to codenameone and iPhone development.

PointsLayer pl = new PointsLayer(); 

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, 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/7a723a77-9212-4f6f-92b2-8893fa4c9e1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pete Knight

unread,
Jan 29, 2015, 5:25:55 AM1/29/15
to codenameone...@googlegroups.com
Running the (unaltered) MapsDemo, its in the readResponse() its after the response has been parsed and read into a map

Image im = Image.createImage("/red_pin.png");

PointsLayer pl = new PointsLayer();

pl.setPointIcon(im);


On Thursday, January 29, 2015 at 10:17:41 AM UTC, ngosti2000 wrote:
At what point are you instantiating the PointsLayer in your code?

On Thu, Jan 29, 2015 at 1:00 PM, Pete Knight <petec...@gmail.com> wrote:
Whilst running the MapsDemo on the simulator after building on Eclipse and running in the simulator for iPhone I get an EDT Violation on creation of a PointsLayer object. It still processes the response correctly, is this something to be concerned about? I'm a complete newbie here, to codenameone and iPhone development.

PointsLayer pl = new PointsLayer(); 

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.

steve nganga

unread,
Jan 29, 2015, 7:38:26 AM1/29/15
to codenameone...@googlegroups.com
Interesting coz i have executed the demo successfully on my end without getting the EDT Violation error.
Maybe shai and Chen can assist

To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.

Pete Knight

unread,
Jan 29, 2015, 8:38:05 AM1/29/15
to codenameone...@googlegroups.com
Adding the stack trace:

com.codename1.impl.javase.JavaSEPort$EDTViolation: EDT Vi

olation Stack!


at com.codename1.impl.javase.JavaSEPort.checkEDT(JavaSEPort.java:385)

at com.codename1.impl.javase.JavaSEPort.createFont(JavaSEPort.java:3976)

at com.codename1.ui.Font.<init>(Font.java:139)

at com.codename1.ui.Font.createSystemFont(Font.java:303)

at com.codename1.maps.layers.PointsLayer.<init>(PointsLayer.java:45)

at com.codename1.demos.maps.MapsDemo$3.readResponse(MapsDemo.java:161)

at com.codename1.io.ConnectionRequest.performOperation(ConnectionRequest.java:4

29)

at com.codename1.io.NetworkManager$NetworkThread.run(NetworkManager.java:261)

at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)




On Thursday, January 29, 2015 at 12:38:26 PM UTC, ngosti2000 wrote:
Interesting coz i have executed the demo successfully on my end without getting the EDT Violation error.
Maybe shai and Chen can assist
On Thu, Jan 29, 2015 at 1:25 PM, Pete Knight <petec...@gmail.com> wrote:
Running the (unaltered) MapsDemo, its in the readResponse() its after the response has been parsed and read into a map

Image im = Image.createImage("/red_pin.png");

PointsLayer pl = new PointsLayer();

pl.setPointIcon(im);


On Thursday, January 29, 2015 at 10:17:41 AM UTC, ngosti2000 wrote:
At what point are you instantiating the PointsLayer in your code?

On Thu, Jan 29, 2015 at 1:00 PM, Pete Knight <petec...@gmail.com> wrote:
Whilst running the MapsDemo on the simulator after building on Eclipse and running in the simulator for iPhone I get an EDT Violation on creation of a PointsLayer object. It still processes the response correctly, is this something to be concerned about? I'm a complete newbie here, to codenameone and iPhone development.

PointsLayer pl = new PointsLayer(); 

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsubscr...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discussions+unsub...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.

Shai Almog

unread,
Jan 29, 2015, 10:26:33 AM1/29/15
to codenameone...@googlegroups.com
The code of the map demo does seem to be violating the EDT by calling UI element from the network thread.
To learn more about the EDT you can read these:
http://www.codenameone.com/blog/callserially-the-edt-invokeandblock-part-1
http://www.codenameone.com/blog/callserially-the-edt-invokeandblock-part-2

Pete Knight

unread,
Jan 29, 2015, 5:15:08 PM1/29/15
to codenameone...@googlegroups.com

Following your EDT tutorial I have now fixed this by moving the UI related code from the network thread's readResponse() into a separate method. 

Using callSerially() to access the EDT, it runs now without any violation:

 Display.getInstance().callSerially(new Runnable() {

        public void run() {

             doTheEDTUIStuff(im, list, map, mc, progress);

        }

 });


Shai Almog

unread,
Jan 30, 2015, 2:00:08 AM1/30/15
to codenameone...@googlegroups.com
Yes, you can also override postResponse() in the connection request which is invoked on the EDT after the connection completes.

Pete Knight

unread,
Jan 30, 2015, 2:13:11 AM1/30/15
to codenameone...@googlegroups.com
Much cleaner than the former solution - implemented and tested, thanks

@Override

protected void postResponse() {

    doTheEDTUIStuff(imlist, map, mc, progress);

}

Reply all
Reply to author
Forward
0 new messages