axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Toshiyuki Kimura (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Assigned: (AXIS-1809) BeanDeserializer fails to deserialize if element name is "class"
Date Thu, 10 Feb 2005 09:23:13 GMT
     [ http://issues.apache.org/jira/browse/AXIS-1809?page=history ]

Toshiyuki Kimura reassigned AXIS-1809:
--------------------------------------

    Assign To: Toshiyuki Kimura

Kishimoto-san,

 Thank you for filing this report.
Initially, it was reported at the Japanese Axis Community.
Then, they have a plan to follow up on this issue.

Thanks,
Toshi

> BeanDeserializer fails to deserialize if element name is "class"
> ----------------------------------------------------------------
>
>          Key: AXIS-1809
>          URL: http://issues.apache.org/jira/browse/AXIS-1809
>      Project: Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: current (nightly)
>  Environment: Linux, Sun J2SE 1.4.2_06-b03
>     Reporter: Makoto Kishimoto
>     Assignee: Toshiyuki Kimura
>     Priority: Minor

>
> When deserializing xsd:any type element, if the top level element's
> element name is "class", BeanDeserializer throws NullPointerException.
> Because "class" is a property name of any Beans have, logic of near of
> following code looks fail.
> BeanDeserializer#onStartChild()
> ----
>     if (propDesc == null) {
>         // look for a field by this name.
>         propDesc = (BeanPropertyDescriptor) propertyMap.get(localName);
>     }
>     // try and see if this is an xsd:any namespace="##any" element before
>     // reporting a problem
>     if (propDesc == null) {
>         // try to put unknown elements into a SOAPElement property, if
>         // appropriate
>         propDesc = getAnyPropertyDesc();
>         if (propDesc != null) {
>             try {
> ----
> java.lang.NullPointerException
>         at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:269)
>         at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
>         at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
>         at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1140)
>         at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:369)
>         at org.apache.axis.encoding.ser.BeanDeserializer.startElement(BeanDeserializer.java:130)
>         at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1048)
>         at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
>         at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1140)
>         at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:347)
>         at org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
>         at org.apache.axis.client.Call.invoke(Call.java:2437)
>         at org.apache.axis.client.Call.invoke(Call.java:2336)
>         at org.apache.axis.client.Call.invoke(Call.java:1793)
>         at BarTest.main(BarTest.java:32)
> To reproduce, please use following sample.
> ----
> deploy.wsdd
> --
> <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
>     <service name="BarPort" provider="java:RPC" style="rpc" use="encoded">
>         <parameter name="className" value="com.example.bar.BarImpl"/>
>         <parameter name="allowedMethods" value="testOp"/>
>         <beanMapping qname="bar:TestOpResponse" xmlns:bar="http://example.com/bar"
languageSpecificType="java:com.example.bar.TestOpResponse"/>
>     </service>
> </deployment>
> ----
> com/example/bar/BarImpl.java
> --
> package com.example.bar;
> import org.apache.axis.message.MessageElement;
> public class BarImpl {
>     public TestOpResponse testOp() {
>         final TestOpResponse response = new TestOpResponse();
>         response.set_any(new MessageElement[] {new MessageElement("", "class")});
>         return response;
>     }
> }
> ----
> com/example/bar/TestOpResponse.java
> --
> package com.example.bar;
> import org.apache.axis.description.TypeDesc;
> import org.apache.axis.message.MessageElement;
> public class TestOpResponse {
>     private MessageElement[] _any;
>     public MessageElement[] get_any() {
>         return _any;
>     }
>     public void set_any(MessageElement[] _any) {
>         this._any = _any;
>     }
>     private static TypeDesc typeDesc = new TypeDesc(TestOpResponse.class, true);
>     static {
>         typeDesc.setXmlType(new javax.xml.namespace.QName("http://example.com/bar", "TestOpResponse"));
>     }
>     public static TypeDesc getTypeDesc() {
>         return typeDesc;
>     }
> }
> ----
> BarTest.java
> --
> import java.net.URL;
> import java.util.Arrays;
> import java.util.Collections;
> import java.util.Iterator;
> import java.util.List;
> import javax.xml.namespace.QName;
> import org.apache.axis.client.Call;
> import org.apache.axis.client.Service;
> import org.apache.axis.message.MessageElement;
> import com.example.bar.TestOpResponse;
> public class BarTest {
>     public static void main(String[] args) throws Exception {
>         Service service = new Service();
>         Call call = (Call)service.createCall();
>         QName testOpResponseQName = new QName("http://example.com/bar", "TestOpResponse");
>         call.registerTypeMapping(
>             TestOpResponse.class,
>             testOpResponseQName,
>             new org.apache.axis.encoding.ser.BeanSerializerFactory(
>                 TestOpResponse.class,
>                 testOpResponseQName),
>             new org.apache.axis.encoding.ser.BeanDeserializerFactory(
>                 TestOpResponse.class,
>                 testOpResponseQName));
>         call.setTargetEndpointAddress(new URL("http://localhost:8080/axis/services/BarPort"));
>         call.setOperationName(new QName("", "testOp"));
>         call.setReturnType(testOpResponseQName, TestOpResponse.class);
>         TestOpResponse result = (TestOpResponse)call.invoke(new Object[0]);
>         if (result != null) {
>             MessageElement[] messageElements = result.get_any();
>             if (messageElements != null) {
>                 List elementList = Collections.synchronizedList(Arrays.asList(messageElements));
>                 synchronized (elementList) {
>                     for (
>                                 Iterator iter = elementList.iterator();
>                                 iter.hasNext();
>                                 ) {
>                         System.out.println(iter.next());
>                     }
>                 }
>             }
>         }
>     }
> }
> ----

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Mime
View raw message