[jboss-jira] [JBoss JIRA] (JBAS-9399) URL.getContent() returns VirtualFile instead of ImageProducer in JBoss AS 6.0.0.FINAL

Brad Maxwell (JIRA) issues at jboss.org
Tue Jul 10 14:16:00 EDT 2018


     [ https://issues.jboss.org/browse/JBAS-9399?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brad Maxwell updated JBAS-9399:
-------------------------------
    Workaround Description: 
Read the content directly such as with ImageIO.read(url.openStream().getSource() 

{code}
import java.awt.Image;
import javax.imageio.ImageIO;
import java.io.InputStream;
import java.beans.SimpleBeanInfo;

            URL url = Thread.currentThread().getContextClassLoader().getResource(resourceName);
            InputStream is = null;
            try {
               is = url.openStream();
               return ImageIO.read(is).getSource();
            } catch(Exception e) {
               e.printStackTrace();
               return null;
            } finally {
               try { is.close(); } catch(Exception e) { } 
            }
{code}
                Workaround: Workaround Exists


> URL.getContent() returns VirtualFile instead of ImageProducer in JBoss AS 6.0.0.FINAL
> -------------------------------------------------------------------------------------
>
>                 Key: JBAS-9399
>                 URL: https://issues.jboss.org/browse/JBAS-9399
>             Project: Application Server 3  4  5 and 6
>          Issue Type: Bug
>          Components: VFS
>    Affects Versions: 6.0.0.Final
>         Environment: Windows XP
>            Reporter: Nathan Blomquist
>         Attachments: server.log
>
>
> URL.getContent() behaves differently within JBoss than it does in a normal JVM.  In our case, when a jar is used in a normal JVM, URL.getContent() returns an ImageProducer.  When the same jar is used from within JBoss, a VirtualFile is returned which then causes a ClassCastException.
> Note: This worked fine in JBoss 4.2.3.GA.



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list