axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "nadir amra (JIRA)" <axis-c-...@ws.apache.org>
Subject [jira] Commented: (AXISCPP-770) const AnyElement* XMLParserXerces::next(bool isCharData) crashes
Date Sat, 12 Aug 2006 06:16:14 GMT
    [ http://issues.apache.org/jira/browse/AXISCPP-770?page=comments#action_12427678 ] 
            
nadir amra commented on AXISCPP-770:
------------------------------------

There was a problem with XMLParserXerces::next in that it invoked m_pParser->parseNext(m_ScanToken)
even when there may have been nothing to parse. 

I have fixed this (and simplified) and am currently running the test bucket, but the fix for
XMLParserXerces::next  is as follows:

OLD CODE:
   bool bCanParseMore = false;
    while (true)
    {
        AnyElement* elem = m_Xhandler.getAnyElement();
        if (!elem)
        {
            //Chinthana:check the peek is called or not
            if(!m_bPeeked) 
                bCanParseMore = m_pParser->parseNext(m_ScanToken);
            else
            {
                m_bPeeked = false;
                bCanParseMore = true;
            }
            elem = m_Xhandler.getAnyElement();
        }
        if (elem)
        {
            if (!isCharData && (CHARACTER_ELEMENT == elem->m_type))
            { /* ignorable white space */
                m_Xhandler.freeElement();
                continue;
            }

            if( m_bPeeked )
                m_bPeeked = false;
            
            return elem;
        }
        else if (AXIS_FAIL == m_Xhandler.getStatus()) 
            return NULL;
        else if (!bCanParseMore) 
            return NULL;
    }

NEW CODE:

    bool bCanParseMore = true;
    AnyElement* elem;
    while (bCanParseMore)
    {
        // See if we have a token to consume
        elem = m_Xhandler.getAnyElement();
        
        // Since we have consumed whatever is there, ensure peek flag is set to false
        m_bPeeked = false;
        
        // If we do not have an element, then parse next token; else if
        // whitespace, ignore whitespace; else return token
        if (!elem)
        {     
            bCanParseMore = m_pParser->parseNext(m_ScanToken);
            if (AXIS_FAIL == m_Xhandler.getStatus())
                break;
        }
        else if (!isCharData && (CHARACTER_ELEMENT == elem->m_type))
            m_Xhandler.freeElement();
        else
            return elem;
    }
    
    return NULL;
==============================

The fix for XMLParserXerces::peek is as follows:

OLD CODE:

         
        bool bCanParseMore = true;
        
        m_Xhandler.freeElement();
        bCanParseMore = m_pParser->parseNext(m_ScanToken);
        AnyElement* elem = m_Xhandler.getAnyElement();
        while (CHARACTER_ELEMENT == elem->m_type) // we never peek for char data
                                                  //hence this is a white space
        { /* ignorable white space */
            m_Xhandler.freeElement();
            bCanParseMore = m_pParser->parseNext(m_ScanToken);
            elem = m_Xhandler.getAnyElement();
         }

NEW CODE:

        
        m_Xhandler.freeElement();
        
        AnyElement* elem;
        while (m_pParser->parseNext(m_ScanToken)) 
        { 
            // Attempt to get token
            elem = m_Xhandler.getAnyElement();
            
            // we never peek for char data hence this is a white space - ignore it.
            if (elem && CHARACTER_ELEMENT == elem->m_type)
                m_Xhandler.freeElement();
            else
                break;
         }

> const AnyElement* XMLParserXerces::next(bool isCharData) crashes
> ----------------------------------------------------------------
>
>                 Key: AXISCPP-770
>                 URL: http://issues.apache.org/jira/browse/AXISCPP-770
>             Project: Axis-C++
>          Issue Type: Bug
>          Components: Parser Library - Xerces
>    Affects Versions: 1.5 Final
>         Environment: linux 2.6.11
>            Reporter: jose
>         Assigned To: nadir amra
>
> The function const AnyElement* XMLParserXerces::next(bool isCharData) of XMLParserXerces.cpp
crashes on the next line:
>                 bCanParseMore = m_pParser->parseNext(m_ScanToken);
> I have tested with xerces 2.2 and with xerces 2.6 and the problem continues.
> If I HTTP GET the Web Services List via http://localhost:8080/axis/ the parser works
fine for the server.wsdd file, but when I
> call the web service example Calculator and the engine tries to parse the soap request
in process(), then crashes.
> P.D.: Please, migrate to stable xerces 2.6

-- 
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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


Mime
View raw message