I don't fully understand this code or the possible negative repercussions of
this fix, but this function threw a NullPointerException for me, so I made
it so it wouldn't do that anymore by adding code for it to check if
"request==null" before attempting to call request.getCookies();

Is this ok?  If it is, could it be added to the code base so that the next
time I update from SVN, it doesn't write over my fix?

    private static Cookie getCookie(HttpServletRequest request, String
cookieName) {
        Cookie cookies[] = null;
        if( request != null ){
                cookies = request.getCookies();
        }
        if (cookies != null) {
            for (Cookie cookie : cookies) {
                if (cookie.getName().equals(cookieName)) {
                    return cookie;
                }
            }
        }
        return null;
    }
-- 
View this message in context: 
http://n2.nabble.com/I-may-have-fixed-a-bug-in-CookieAttribute-java-tp4623279p4623279.html
Sent from the Shiro User mailing list archive at Nabble.com.

Reply via email to