Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need of a callback for error originated from URLImage.createCachedImage #2703

Closed
kutoman opened this issue Feb 12, 2019 · 0 comments

Comments

@kutoman
Copy link
Contributor

commented Feb 12, 2019

I'm loading blog posts with their contents including images from a server.
Therefore I use URLImage.createCachedImage to load the images. The images are solely jpgs but it happens that some of them are using certain jpg formats (e.g. cmyk). Those are handled on the various paltforms differently. The simulator can't handle these formats successfully unfortunately. Imho there should be a way to catch these errors when using URLImage.createCachedImage in order to replace the failed images with placeholders instead for example.

The error:

java.io.IOException: javax.imageio.IIOException: Unsupported Image Type
	at com.codename1.impl.javase.JavaSEPort.createImage(JavaSEPort.java:5163)
	at com.codename1.ui.Image.createImage(Image.java:557)
	at com.codename1.impl.javase.JavaSEPort$78.save(JavaSEPort.java:10012)
	at com.codename1.ui.EncodedImage.scaledEncoded(EncodedImage.java:627)
	at com.codename1.ui.URLImage$2.adaptImage(URLImage.java:104)
	at com.codename1.ui.URLImage$DownloadCompleted.actionPerformed(URLImage.java:240)
	at com.codename1.ui.URLImage$4.onSucess(URLImage.java:308)
	at com.codename1.ui.URLImage$4.onSucess(URLImage.java:304)
	at com.codename1.util.CallbackDispatcher.run(CallbackDispatcher.java:53)
	at com.codename1.ui.Display.processSerialCalls(Display.java:1138)
	at com.codename1.ui.Display.edtLoopImpl(Display.java:1082)
	at com.codename1.ui.Display.mainEDTLoop(Display.java:970)
	at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
	at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
java.lang.NullPointerException
	at com.codename1.ui.URLImage$DownloadCompleted.actionPerformed(URLImage.java:249)
	at com.codename1.ui.URLImage$4.onSucess(URLImage.java:308)
	at com.codename1.ui.URLImage$4.onSucess(URLImage.java:304)
	at com.codename1.util.CallbackDispatcher.run(CallbackDispatcher.java:53)
	at com.codename1.ui.Display.processSerialCalls(Display.java:1138)
	at com.codename1.ui.Display.edtLoopImpl(Display.java:1082)
	at com.codename1.ui.Display.mainEDTLoop(Display.java:970)
	at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
	at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)

@codenameone codenameone self-assigned this Mar 10, 2019

@codenameone codenameone added this to the Version 7.0 milestone Mar 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.