UrlImage EDT Error

12 views
Skip to first unread message

Popoola Ife

unread,
May 7, 2016, 12:40:16 PM5/7/16
to CodenameOne Discussions
If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans
Desktop OS - MAC OS X

This is the error log i get when i run my code that makes use of the urlimage apparently it violates the EDT below is my code too please help.

CODE
     final URLImage background = URLImage.createToStorage(placeholder, "file" + i + ".jpg", Newspull.featuredimageurl.elementAt(i).toString());

     

            //Display.getInstance().callSerially(r);
            //  background.fetch();

            final int j = i;
            Button opennews = new Button("Open news");
            opennews.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent evt) {

                    new Readnewspage(f, background, Newspull.featureddescr.elementAt(j).toString(), Newspull.featuredurls.elementAt(j).toString());
                }
            });

            SpanLabel title = new SpanLabel(Newspull.featuredtitle.elementAt(i).toString() + "\n\n\n", "SpanLabel");
           
title.setPreferredSize(new Dimension(Display.getInstance().getDisplayWidth(), Display.getInstance().getDisplayHeight() / 3));
            title.setUIID("SpanLabel");
            title.getAllStyles().setFgColor(0xFFFFFF, true);

            title.getAllStyles().setBgImage(background);
            title.getAllStyles().setBackgroundType(Style.BACKGROUND_IMAGE_SCALED);
            title.getAllStyles().setPaddingUnit(Style.UNIT_TYPE_DIPS, Style.UNIT_TYPE_DIPS, Style.UNIT_TYPE_DIPS, Style.UNIT_TYPE_DIPS);
            title.getAllStyles().setMarginTop(5);
            title.getAllStyles().setMarginBottom(5);
            title.getAllStyles().set3DText(true, true);
            title.setLeadComponent(opennews);

            f.add(title);



ERROR LOG
EDT violation detected!
    at com.codename1.impl.javase.JavaSEPort.checkEDT(JavaSEPort.java:416)
    at com.codename1.impl.javase.JavaSEPort.getImageWidth(JavaSEPort.java:3577)
    at com.codename1.ui.Image.getWidth(Image.java:689)
    at com.codename1.ui.EncodedImage.getWidth(EncodedImage.java:508)
    at com.codename1.ui.URLImage$ScaleToFill.adaptImage(URLImage.java:102)
    at com.codename1.ui.URLImage$DownloadCompleted.run(URLImage.java:187)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:103)
EDT violation detected!
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:140)
EDT violation detected!
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
EDT violation detected!
com.codename1.impl.javase.JavaSEPort$EDTViolation: EDT Violation Stack!
EDT violation detected!
    at com.codename1.impl.javase.JavaSEPort.checkEDT(JavaSEPort.java:416)
EDT violation detected!
EDT violation detected!
    at com.codename1.impl.javase.JavaSEPort.getImageHeight(JavaSEPort.java:3588)
EDT violation detected!
    at com.codename1.ui.Image.getHeight(Image.java:703)
EDT violation detected!
    at com.codename1.ui.Image.scaledLargerRatio(Image.java:899)
    at com.codename1.ui.URLImage$ScaleToFill.adaptImage(URLImage.java:103)
    at com.codename1.ui.URLImage$DownloadCompleted.run(URLImage.java:187)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:103)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:140)
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
com.codename1.impl.javase.JavaSEPort$EDTViolation: EDT Violation Stack!
    at com.codename1.impl.javase.JavaSEPort.checkEDT(JavaSEPort.java:416)
    at com.codename1.impl.javase.JavaSEPort.getImageWidth(JavaSEPort.java:3577)
    at com.codename1.ui.Image.getWidth(Image.java:689)
    at com.codename1.ui.Image.scaledLargerRatio(Image.java:900)
    at com.codename1.ui.URLImage$ScaleToFill.adaptImage(URLImage.java:103)
    at com.codename1.ui.URLImage$DownloadCompleted.run(URLImage.java:187)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:103)
    at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:140)
    at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)

Shai Almog

unread,
May 7, 2016, 11:57:18 PM5/7/16
to CodenameOne Discussions
This was discussed here before. The URLImage class does something that is a legal EDT violation.
We fire "false positives" on some cases because we'd rather be wrong and find a violation than always be right and miss one.

Popoola Ife

unread,
May 8, 2016, 1:35:50 PM5/8/16
to codenameone...@googlegroups.com
So how can I easily handle this  violation because i think this violation might be the cause of my app randomly crashing.

Thank you again shai.


On Sunday, May 8, 2016, Shai Almog <shai....@gmail.com> wrote:
This was discussed here before. The URLImage class does something that is a legal EDT violation.
We fire "false positives" on some cases because we'd rather be wrong and find a violation than always be right and miss one.

--
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/mfczcRfAyHA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to codenameone-discu...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/a63cacfe-f9cc-45a1-b04f-9baa2e4ade06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Popoola Ifeoluwa
Co-founder Autosave roadside assistance
Phone: +2347051990781
website: www.autosave.com.ng

Shai Almog

unread,
May 9, 2016, 12:14:39 AM5/9/16
to CodenameOne Discussions
It's unlikely to be the cause of a crash.
Reply all
Reply to author
Forward
0 new messages