Muse
  1. Muse
  2. MUSE-56

Nullpointer in SimpleSoapClient when sending empty bodies

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 2.0.0 M2
    • Fix Version/s: 2.0.0 M2
    • Component/s: None
    • Labels:
      None
    • Environment:
      any

      Description

      When I send empty bodies using SimpleSoapClient, I get a null pointer exception:

      java.lang.NullPointerException
      at org.apache.muse.ws.addressing.soap.SimpleSoapClient.createMessage(SimpleSoapClient.java:117)
      at org.apache.muse.ws.addressing.soap.SimpleSoapClient.send(SimpleSoapClient.java:213)

      The following is a diff of the fix, I have attached source as well:

      Index: SimpleSoapClient.java
      ===================================================================
      RCS file: /cvs/cowbell/muse-wsa-soap/src/org/apache/muse/ws/addressing/soap/SimpleSoapClient.java,v
      retrieving revision 1.4
      diff -u -r1.4 SimpleSoapClient.java
      — SimpleSoapClient.java 2 Aug 2006 17:34:31 -0000 1.4
      +++ SimpleSoapClient.java 14 Aug 2006 22:54:38 -0000
      @@ -114,10 +114,14 @@

      for (int n = 0; n < bodyElements.length; ++n)
      {
      + if(bodyElements[n] != null)
      +

      { + if (bodyElements[n].getOwnerDocument() != doc) bodyElements[n] = (Element)doc.importNode(bodyElements[n], true); bodyXML.appendChild(bodyElements[n]); + }

      }

      return soapXML;

        Activity

        Dan Jemiolo made changes -
        Field Original Value New Value
        Fix Version/s 2.0.0 M2 [ 12311989 ]
        Resolution Invalid [ 6 ]
        Status Open [ 1 ] Closed [ 6 ]
        Hide
        Dan Jemiolo added a comment -

        If you pass a null array to send( ) instead of an array of null pointers, you will get the desired behavior (an empty SOAP body). see the first few lines of send( ) - it checks for a null array and uses an empty one in its place so that the for loop works.

        Show
        Dan Jemiolo added a comment - If you pass a null array to send( ) instead of an array of null pointers, you will get the desired behavior (an empty SOAP body). see the first few lines of send( ) - it checks for a null array and uses an empty one in its place so that the for loop works.
        Mohammad Fakhar created issue -

          People

          • Assignee:
            Dan Jemiolo
            Reporter:
            Mohammad Fakhar
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development