[ 
http://issues.apache.org/jira/browse/AXIS-2153?page=comments#action_12317324 ] 

Thomas Mayr commented on AXIS-2153:
-----------------------------------

Below the full code of the method 
org.apache.axis.message.MessageElement.getValue() . 
The assignments to textClassName  and nodeClassName are only for debug purposes:


    public String getValue() {
        /*--- Fix for AXIS-1817
        if ((recorder != null) && (!_isDirty)) {
            StringWriter writer = new StringWriter();
            TextSerializationContext outputContext = 
                new TextSerializationContext(writer);
            try {
                recorder.replay(startEventIndex,
                                endEventIndex,
                                new SAXOutputter(outputContext));
            } catch (Exception t) {
                log.debug("getValue()", t);
                return null;
            }
            String value = writer.toString();
            return (value.length() == 0) ? null : value;
        } 
        ---*/

        if (textRep != null) {
            // weird case: error?
            return textRep.getNodeValue();
        }

        if (objectValue != null) {
            return getValueDOM();
        }
        String textClassName = Text.class.getPackage().getName() + "." + 
Text.class.getName ();
        String nodeClassName = Node.class.getPackage().getName() + "." + 
Node.class.getName ();
        for (Iterator i = getChildElements (); i.hasNext ();)
        {
            org.apache.axis.message.NodeImpl n = 
(org.apache.axis.message.NodeImpl) i.next ();
            if (n instanceof org.apache.axis.message.Text)
            {
                org.apache.axis.message.Text textNode = 
(org.apache.axis.message.Text) n;
                return textNode.getNodeValue ();
            }
        }

        return null;
    }



> Method org.apache.axis.message.MessageElement.getValue() always returns null 
> in a SAP WAS environment
> -----------------------------------------------------------------------------------------------------
>
>          Key: AXIS-2153
>          URL: http://issues.apache.org/jira/browse/AXIS-2153
>      Project: Apache Axis
>         Type: Bug
>     Versions: 1.2.1
>  Environment: SAP WAS 6.40 Application Server on Windows 2000 SP4
>     Reporter: Thomas Mayr
>     Priority: Critical

>
> I don't know exactly why, but the method  
> org.apache.axis.message.MessageElement.getValue()  always returns null, 
> although the message array  of the iterator contains the right element of 
> type Text with the right value. After I patched the last for loop in the 
> following way it works:
>         for (Iterator i = getChildElements(); i.hasNext(); ) {
>             org.apache.axis.message.NodeImpl n = 
> (org.apache.axis.message.NodeImpl) i.next();
>             if (n instanceof org.apache.axis.message.Text)
>             {
>                 org.apache.axis.message.Text textNode = 
> (org.apache.axis.message.Text) n;
>                 return textNode.getNodeValue();
>             }
>         }
> As you can see I casted the element returned by the method  i.next() with the 
> full qualified class path and call the method  getNodeValue() also with an 
> object casted with the full qualified class path 
> (org.apache.axis.message.Text). After this patch the correct method 
> Text.getNodeValue() is called. Previousely this method wasn't called and I 
> could not step in this method with the eclipse debugger! As I said, I don't 
> understand what's exactly going on but I''ll leave this analysys to the 
> developer ;-)
> Best regards Thomas Mayr

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to