axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davanum Srinivas (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Resolved: (AXIS-2142) ClassCastException in JavaUtils.convert
Date Wed, 27 Jul 2005 02:51:19 GMT
     [ http://issues.apache.org/jira/browse/AXIS-2142?page=all ]
     
Davanum Srinivas resolved AXIS-2142:
------------------------------------

    Resolution: Fixed

Applied.

thanks,
dims

> ClassCastException in JavaUtils.convert
> ---------------------------------------
>
>          Key: AXIS-2142
>          URL: http://issues.apache.org/jira/browse/AXIS-2142
>      Project: Apache Axis
>         Type: Bug
>     Versions: current (nightly)
>  Environment: Axis 1.2 CVS using GNU classpathx javamail and activation implementations
with Sun JDK 1.4.2_06
>     Reporter: Archit Shah
>  Attachments: DH.patch
>
> When running the Axis (not Axis2) CVS tip with javamail and activation implementations
from GNU classpathx, two tests fail with ClassCastExceptions. These failures are due to incorrect
use of DataHandlers. The failing tests are:
> test.wsdl.interop4.groupG.dime.rpc.DimeRPCInteropTestCase
> #test2DimeRPCSoapPortEchoAttachments
> test.wsdl.interop4.groupG.mime.rpc.MimeRPCInteropTestCase
> #test2MimeRPCSoapPortEchoAttachments
> And the stack trace is:
> java.lang.ClassCastException
>     at org.apache.axis.utils.JavaUtils.convert(JavaUtils.java:325)
>     at org.apache.axis.utils.JavaUtils.convert(JavaUtils.java:472)
>     at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:118)
>     at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
>     at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
>     at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
>     at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
>     at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
>     at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
>     at org.apache.axis.transport.http.SimpleAxisWorker.execute(SimpleAxisWorker.java:428)
>     at org.apache.axis.transport.http.SimpleAxisWorker.run(SimpleAxisWorker.java:155)
>     at org.apache.axis.transport.http.SimpleAxisServer.run(SimpleAxisServer.java:245)
>     at org.apache.axis.transport.http.SimpleAxisServer.start(SimpleAxisServer.java:296)
>     at org.apache.axis.transport.http.SimpleAxisServer.start(SimpleAxisServer.java:304)
>     at org.apache.axis.transport.http.SimpleAxisServer.main(SimpleAxisServer.java:385)
> The convert method of org.apache.axis.utils.JavaUtils relies on the getContent method
of javax.activation.DataHandler to get an InputStream for the data, twice doing the following:
>   in = (InputStream)handler.getContent();
> instead of:
>   in = handler.getInputStream();
> Calling getContent and casting to InputStream is not guaranteed to work. The Javadoc
for the getContent method specifies "If no DataContentHandler can be found for the the type
of this data, the DataHandler returns an InputStream for the data." Therefore, the cast can
fail if a DataContentHandler is installed.  I ran into this exceptions because the GNU javamail
implementation has a DataContentHandler for the MIME type application/octet-stream and getContent
returns a byte array instead of the input stream.
> Casting the return value of getContent is also done in another context. JavaUtils and
SourceDataHandlerDeserializer both do:
>   StreamSource ss = new StreamSource(new StringReader(
>     (String) dh.getContent()));
> when the following would suffice:
>   StreamSource ss = new StreamSource(dh.getInputStream());

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message