axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "R J Scheuerle Jr" <sc...@us.ibm.com>
Subject Re: NullPointer in BeanSerializer/BeanPropertyTarget
Date Tue, 02 Apr 2002 14:09:28 GMT
I need more information to understand why this change is necessary.  Could
you please send the bean and wsdl snippet.

Rich Scheuerle
XML & Web Services Development
512-838-5115  (IBM TL 678-5115)


                                                                                         
                                  
                      "David L. Cole"                                                    
                                  
                      <DLCole@cmsenergy        To:       axis-dev@xml.apache.org      
                                     
                      .com>                    cc:                                    
                                     
                                               Subject:  NullPointer in BeanSerializer/BeanPropertyTarget
                  
                      04/01/2002 11:31                                                   
                                  
                      AM                                                                 
                                  
                      Please respond to                                                  
                                  
                      axis-dev                                                           
                                  
                                                                                         
                                  
                                                                                         
                                  




----- Forwarded by David L. Cole/IS/PPLC on 04/01/2002 11:29 AM -----

                    "David L.

                    Cole"                To:     axis-dev@xml.apache.org

                    <DLCole@cmsen        cc:

                    ergy.com>            Subject:     NullPointer in
BeanSerializer/BeanPropertyTarget

                    03/29/2002

                    10:24 AM

                    Please

                    respond to

                    axis-dev







I have the following method within my Object which is mapped to
BeanSerializer/Deserializer:

    public void setValidDates( java.util.ArrayList newValue )
    {
        validDates = newValue;
    }

During deserialization, I was getting the following error:

- Could not convert [Ljava.lang.Object; to bean field 'validDates[0]', type
java.util.Collection
- Exception:
java.lang.NullPointerException
        at
org.apache.axis.encoding.ser.BeanPropertyTarget.set(BeanPropertyTarget.java:136)


        at
org.apache.axis.encoding.DeserializerImpl.valueComplete(DeserializerImpl.java:258)


        at
org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:386)


        at
org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:834)


        at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:197)


        at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:578)


        at
org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:367)


        at
org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:834)


        at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:197)


        at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:578)


        at
org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:367)


        at
org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:834)


        at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:197)


        at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:578)


        at
org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:367)


        at
org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:834)


        at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:197)


        at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:578)


        at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:207)
        at
org.apache.axis.message.RPCElement.getParams(RPCElement.java:231)
        at org.apache.axis.client.Call.invoke(Call.java:1607)


The result of the error turns out the the BeanPropertyDescriptor is
returning null for the call to getWriteMethod()
By making the 2 following changes to BeanDeserializer and
BeanPropertyTarget which simply checks for null as a result to
the call to getWriteMethod(), I was able to solve the problem.

BeanDeserializer.onStartChild() Line #199
         Changed from:
          if (propDesc.getWriteMethod().getParameterTypes().length == 1) {
         To:
               if (propDesc != null && (propDesc.getWriteMethod() != null)
                       &&
            (propDesc.getWriteMethod().getParameterTypes().length == 1)) {

BeanPropertyTarget.set(Object value):
     check for null on call to pd.getWriteMethod() at beginning of method

        if(pd.getWriteMethod() == null)
        {
          return;
        }

Once the changes where made...Everything went smooth.
Could one of the dev team consider making these changes to
BeanSerializer/BeanPropertyTarget
for future builds?


Thanks,
David Cole








Mime
View raw message