cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Newland" <chris.newl...@emorphia.com>
Subject RE: HttpRequest.getCookies() causes NPE in XSPCookieHelper.getCookies()
Date Thu, 16 Aug 2001 13:27:52 GMT
Hi Carsten,

That fixed the first problem but I'm afraid that cookies.length is called
without testing for null in 5 more places (sorry for not spotting this
earlier):

XSPCookieHelper.getCookie(Map objectModel , String cookieName ,int
cookieIndex):


        if (retrieveByName)
        {
            for(count=0; count<cookies.length; count++)      <---- *here*
            {
                currentCookie = cookies[count];

                if (currentCookie.getName().equals(cookieName))
                    matchFound = true;
            }
        }
        else if(retrieveByIndex)
        {
            if(cookies.length > cookieIndex)   <---- *here*
            {
                currentCookie = cookies[cookieIndex];
                matchFound = true;
            }
        }

XSPCookieHelper.returnCookieProperty(Map objectModel , String cookieName ,
int cookieIndex , String propertyPrefix):

        Cookie[] cookies = request.getCookies();

        if (cookies.length > 0)  <---- *here*
        {
            if (retrieveByName)
            {
                for(count=0; count<cookies.length; count++)   <---- *here*
                {
                    currentCookie = cookies[count];

                    if (currentCookie.getName().equals(cookieName))
                        matchFound = true;
                }
            }
            else if (retrieveByIndex)
            {
                if(cookies.length > cookieIndex) <---- *here*
                {
                    currentCookie = cookies[cookieIndex];
                    matchFound = true;
                }
            }

Do you want me to fix these? If so, what format do you want the patches in?

Best Regards,

Chris


> -----Original Message-----
> From: Carsten Ziegeler [mailto:cziegeler@sundn.de]
> Sent: 16 August 2001 13:23
> To: cocoon-dev@xml.apache.org
> Subject: AW: HttpRequest.getCookies() causes NPE in
> XSPCookieHelper.getCookies()
>
>
> Thanks for reporting this Chris.
>
> I fixed it, please check if this is working now.
>
>
> Carsten
>
> Open Source Group                        sunShine - b:Integrated
> ================================================================
> Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
> www.sundn.de                          mailto: cziegeler@sundn.de
> ================================================================
>
>
> > -----Urspr√ľngliche Nachricht-----
> > Von: Chris Newland [mailto:chris.newland@emorphia.com]
> > Gesendet: Donnerstag, 16. August 2001 13:58
> > An: Cocoon Dev
> > Betreff: HttpRequest.getCookies() causes NPE in
> > XSPCookieHelper.getCookies()
> >
> >
> > Hi All,
> >
> > I think there is an unhandled case in
> > org.apache.cocoon.environment.http.HttpRequest (CVS 1.1.1.1.2.4)
> > that causes
> > a null pointer exception in
> > org.apache.cocoon.components.language.markup.xsp.XSPCookieHelper (CVS
> > 1.2.2.1).


<snip>



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message