You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org> on 2004/12/02 14:08:25 UTC

[jira] Resolved: (AXIS-1695) Empty body in SOAP response causes IndexOutOfBoundsException

     [ http://nagoya.apache.org/jira/browse/AXIS-1695?page=history ]
     
Davanum Srinivas resolved AXIS-1695:
------------------------------------

    Resolution: Invalid

Closing issue as per venkat.

> Empty body in SOAP response causes IndexOutOfBoundsException
> ------------------------------------------------------------
>
>          Key: AXIS-1695
>          URL: http://nagoya.apache.org/jira/browse/AXIS-1695
>      Project: Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: beta-3
>  Environment: Using client to send SOAP request and receive SOAP response.
>     Reporter: Alexander Sherkin

>
> Axis fails with java.lang.IndexOutOfBoundsException when it is trying to receive empty SOAP response.
> I am using Axis 1.2 beta 2. I know that this issue has not been resolved in Axis 1.2 beta 3 version.
> My SOAP response:
> <s12:Envelope xmlns:s12='http://www.w3.org/2003/05/soap-envelope'
>               xmlns:wsa='http://schemas.xmlsoap.org/ws/2004/08/addressing' >
>     <s12:Header>
>         ...
>     </s12:Header>
>     <s12:Body />
> </s12:Envelope>
> The exception happens in org/apache/axis/message/SOAPBody.java in 
>     SOAPBodyElement getFirstBody() throws AxisFault
>     {
>         List bodyElements = getChildren();
>         return (bodyElements == null) ? 
>             null : (SOAPBodyElement)bodyElements.get(0);
>     } 
> Variable bodyElements is initialized before the method getFirstBody() is invoked, so bodyElements is not null. However, variable bodyElements has 0 elements, but the method does not check to make sure that bodyElements has 0th element. So, Axis fails here with java.lang.IndexOutOfBoundsException.
> Suggested fix:
>     SOAPBodyElement getFirstBody() throws AxisFault
>     {
>         List bodyElements = getChildren();
>         return (bodyElements == null || bodyElements.size() == 0) ?
>             null : (SOAPBodyElement)bodyElements.get(0);
>     }
> Stack trace:
> AxisFault
>  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
>  faultSubcode: 
>  faultString: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
>  faultActor: 
>  faultNode: 
>  faultDetail: 
> 	{http://xml.apache.org/axis/}stackTrace:java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
> 	at java.util.ArrayList.RangeCheck(ArrayList.java:507)
> 	at java.util.ArrayList.get(ArrayList.java:324)
> 	at org.apache.axis.message.SOAPBody.getFirstBody(SOAPBody.java:161)
> 	at org.apache.axis.message.SOAPEnvelope.getFirstBody(SOAPEnvelope.java:190)
> 	at org.apache.axis.client.Call.invokeEngine(Call.java:2757)
> 	at org.apache.axis.client.Call.invoke(Call.java:2718)
> 	at org.apache.axis.client.Call.invoke(Call.java:2394)
> 	at org.apache.axis.client.Call.invoke(Call.java:2317)
> 	at org.apache.axis.client.Call.invoke(Call.java:1774)
> 	…
> 	{http://xml.apache.org/axis/}hostname:ASHERKIN-W2K
> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
> 	at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
> 	at org.apache.axis.client.Call.invoke(Call.java:2397)
> 	at org.apache.axis.client.Call.invoke(Call.java:2317)
> 	at org.apache.axis.client.Call.invoke(Call.java:1774)
>                 …
> 	at java.lang.Thread.run(Thread.java:534)
> Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
> 	at java.util.ArrayList.RangeCheck(ArrayList.java:507)
> 	at java.util.ArrayList.get(ArrayList.java:324)
> 	at org.apache.axis.message.SOAPBody.getFirstBody(SOAPBody.java:161)
> 	at org.apache.axis.message.SOAPEnvelope.getFirstBody(SOAPEnvelope.java:190)
> 	at org.apache.axis.client.Call.invokeEngine(Call.java:2757)
> 	at org.apache.axis.client.Call.invoke(Call.java:2718)
> 	at org.apache.axis.client.Call.invoke(Call.java:2394)
> 	... 15 more

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira