Home pageFind It!Contact PJAPJA documentation

PJA

 PJA Toolkit forum

This forum is dedicated to PJA Toolkit.
You may read freely the messages it contents. If you want to write a message or answer to a subject, subscribe to it first.

Subjects Recent messages Login Subscribe

Messages of subject ClassCastException in PJAGraphicsManager.getImage

hubbachick

Location : Montreal, Canada
Member since : Mar 18, 2005
Messages : 1
 Mar 18, 2005 at 10:06 PM
Has anyone seen this before? As far as we can tell from our own code, we are trying to open a .gif at that point, but all the .gif's on the system are valid. We are running jdk 1.3.1 and PJAToolkit 2.4_1.

java.lang.ClassCastException
at com.eteks.awt.PJAGraphicsManager.getImage(java.net.URL) (PJAGraphicsManager.java:804) (pc 86)
at com.eteks.awt.PJAGraphicsManager.getImage(java.lang.String) (PJAGraphicsManager.java:762) (pc 82)
at com.eteks.awt.PJAToolkit.getImage(java.lang.String) (PJAToolkit.java:580) (pc 4)
at javax.swing.ImageIcon.<init>(java.lang.String,java.lang.String) (ImageIcon.java:77) (pc 34)
at javax.swing.ImageIcon.<init>(java.lang.String) (ImageIcon.java:103) (pc 3)

edgaro

Location : Montreal
Member since : Mar 21, 2005
Messages : 1
 Mar 21, 2005 at 2:53 PM
Has anyone faced a similar case ? I got the following exception stack :

java.lang.ClassCastException
at com.eteks.awt.PJAGraphicsManager.getImage(java.net.URL) (PJAGraphicsManager.java:804) (pc 86)
at com.eteks.awt.PJAGraphicsManager.getImage(java.lang.String) (PJAGraphicsManager.java:762) (pc 82)
at com.eteks.awt.PJAToolkit.getImage(java.lang.String) (PJAToolkit.java:580) (pc 4)
at javax.swing.ImageIcon.<init>(java.lang.String,java.lang.String) (ImageIcon.java:77) (pc 34)
at javax.swing.ImageIcon.<init>(java.lang.String) (ImageIcon.java:103) (pc 3)
...

Could it be possible that the implicit cast is failing ?

in class: PJAGraphicsManager.java
method : public Image getImage (URL url)

java.net.URLConnection conn = url.openConnection();

If the openConnection() failed, we would have got an IOException.
Wouldn't we ?

The statement throwing the exception is this:

return createImage ((ImageProducer)(conn.getContent ()));

What do you think about an explicit cast:

Object content = conn.getContent();
ImageProducer producer;
try {
producer = (ImageProducer) content;
}
catch (ClassCastException e) {
}
return createImage ( producer );


[Message moved my moderator from Jeks forum to PJA Toolkit forum]
---
Edgar


Home pageFind It!ContactTop

© Copyrights 1997-2014 eTeks - All rights reserved

PJAPJA documentation