axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From axis-...@ws.apache.org
Subject [jira] Updated: (AXIS-1585) npe after using SerializationContext one-arg constructor
Date Mon, 04 Oct 2004 18:47:33 GMT
The following issue has been updated:

    Updater: toby cabot (mailto:toby@caboteria.org)
       Date: Mon, 4 Oct 2004 11:45 AM
    Comment:
patch to SerializationContext and BeanSerializer

    Changes:
             Attachment changed to axis-npe-patch.txt
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://issues.apache.org/jira/browse/AXIS-1585?page=history

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/AXIS-1585

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: AXIS-1585
    Summary: npe after using SerializationContext one-arg constructor
       Type: Bug

     Status: Unassigned
   Priority: Major

    Project: Axis
 Components: 
             Serialization/Deserialization
   Versions:
             1.1RC1

   Assignee: 
   Reporter: toby cabot

    Created: Mon, 4 Oct 2004 11:42 AM
    Updated: Mon, 4 Oct 2004 11:45 AM
Environment: fedora core 2
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
axis cvs as of 2004-10-04

Description:
Hi.

I'm working on an application that needs to serialize trees of wsdl2java-generated objects
e.g. to write them to disk as XML documents.  I'm using code that looks like:

        Writer out = new FileWriter("build/ECReport-test.xml");
        SerializationContext ser = new SerializationContext(out);
        ser.setPretty(true); 
        ser.serialize(new QName("ECReport"), new AttributesImpl(), output, null, false, Boolean.FALSE);
        out.flush();
        out.close();

When I tried running the code it didn't serialize, so I looked at SerializationContext and
found a bug in getSerializerFromClass(). 

        try {
            Method method = javaType.getMethod(
                    SERIALIZER_METHOD, SERIALIZER_CLASSES);
            if (method != null) {
                serializer = (Serializer) method.invoke(null,
                     new Object[] {msgContext.getEncodingStyle(), javaType, qname});
            }
       } catch (Exception e) {
       }

Because msgContext is null the call to msgContext.getEncodingStyle() will cause a NullPointerException.
 The NPE was being thrown away because of the catch(Exception e).  I'll attach a patch that
fixes this, and one downstream bug in BeanSerializer and seems to work for me.



---------------------------------------------------------------------
JIRA INFORMATION:
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