axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Rapp" <Dan.R...@whizbang.com>
Subject IndexOutOfBoundsException in TypeMappingRegistry
Date Wed, 09 Jan 2002 18:05:04 GMT
An IndexOutOfBoundsException is thrown in TypeMappingRegistry (line 274)
if a message is generated with a complex type that does not have a
serializer specified. 
 
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.RangeCheck(ArrayList.java:491)
        at java.util.ArrayList.remove(ArrayList.java:375)
        at
org.apache.axis.encoding.TypeMappingRegistry.serialize(TypeMappingRegist
ry.java:274)
        at
org.apache.axis.encoding.SerializationContext.serialize(SerializationCon
text.java:425)
        at
org.apache.axis.encoding.SerializationContext.outputMultiRefs(Serializat
ionContext.java:450)
        at
org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:376)
        at
org.apache.axis.message.MessageElement.output(MessageElement.java:454)
        at org.apache.axis.SOAPPart.getAsString(SOAPPart.java:329)
        at org.apache.axis.SOAPPart.getAsBytes(SOAPPart.java:272)
        at org.apache.axis.Message.getContentType(Message.java:289)
        at
org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:542)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
 
The following change may be an appropriate solution. (With this change
the appropriate exception, IOException: No serializer found for class X
in registry org.apache.axis.encoding.TypeMappingRegistry@5a2cef is
thrown.)
 
--Dan
 
Index: java/src/org/apache/axis/encoding/TypeMappingRegistry.java
===================================================================
RCS file:
/home/cvspublic/xml-axis/java/src/org/apache/axis/encoding/TypeMappingRe
gistry.java,v
retrieving revision 1.46
diff -u -r1.46 TypeMappingRegistry.java
--- java/src/org/apache/axis/encoding/TypeMappingRegistry.java  23 Dec
2001 12:33:32 -0000      1.46
+++ java/src/org/apache/axis/encoding/TypeMappingRegistry.java  9 Jan
2002 18:04:11 -0000
@@ -271,7 +271,12 @@
                         !_class.getName().equals("java.lang.Object"))
                     classes.add( _class );
 
-                _class = (Class) classes.remove( 0 );
+                try {
+                    _class = (Class) classes.remove( 0 );
+                } catch( IndexOutOfBoundsException e ) {
+                    // classes.size can be 0 if a serializer isn't
specified
+                    _class = null;
+                }
             }
 
             if ( ser != null ) {

Mime
View raw message