[ 
https://issues.apache.org/jira/browse/WSCOMMONS-395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rich Scheuerle resolved WSCOMMONS-395.
--------------------------------------

    Resolution: Duplicate

Raymond,

This is already fixed.  See WSCOMMONS-326 for the full solution.

Here is the latest code.  Note that the code correctly queries the OMAttrribute 
for its type, and each OMAttribute has as default type of CDATA.

public String getAttributeType(int i) {
        String returnString = null;
        if (parser != null) {
            returnString = parser.getAttributeType(i);
        } else {
            if (isStartElement() || (currentEvent == ATTRIBUTE)) {
                
                OMAttribute attrib = getAttribute((OMElement) getNode(), i);
                if (attrib != null) {
                    returnString = attrib.getAttributeType();
                }

            } else {
                throw new IllegalStateException(
                        "attribute type accessed in illegal event!");
            }
        }
        
        return returnString;
    }

Thanks,
rich

> org.apache.axiom.om.impl.llom.OMStAXWrapper.getAttributeType(int) should 
> return a default value "CDATA" instead of null
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: WSCOMMONS-395
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-395
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>            Reporter: Raymond Feng
>            Assignee: Rich Scheuerle
>
> Sun's JAXB-RI checks XMLStreamReader.getAttributeType() when it tries to 
> build a DOM representation from the stream and it throws NPE as the following 
> method in class org.apache.axiom.om.impl.llom.OMStAXWrapper returns null:
>     public String getAttributeType(int i) {
>         String returnString = null;
>         if (parser != null) {
>             returnString = parser.getAttributeType(i);
>         } else {
>             if (isStartElement() || (currentEvent == ATTRIBUTE)) {
>                 // todo implement this
>             } else {
>                 throw new IllegalStateException(
>                         "attribute type accessed in illegal event!");
>             }
>         }
>         return returnString;
>     }
> The fix can be:
>      String returnString = "CDATA";

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to