>Number:         3601
>Category:       mod_jserv
>Synopsis:       NullPointerException in JServSSI.getParameter(String name)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    jserv
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Mon Dec 28 15:20:01 PST 1998
>Last-Modified:
>Originator:     [EMAIL PROTECTED]
>Organization:
apache
>Release:        Apache 1.3.3
>Environment:
JServ 1.0b1 1998-12-19  and JServ-SSI 1.0
Windows NT 4.0 SP3
JDK 1.1.6
>Description:
JServSSI.getParameter(String name) throws a NullPointerExecption if
req.getParameterValues(name) returns null (it does if the page is
requested without parameters).

>How-To-Repeat:
Use the <SERVLET> tag without <PARAM> tags to invoke a servlet on
a page requested without any request parameters.
>Fix:
The following modified version of the method works:

    public String getParameter(String name) {
        String value = (String) params.get(name);
        String rvalues[] = req.getParameterValues(name);

        // Added null test below
        if (rvalues == null) return value;

        return (value != null) ? value : (rvalues.length > 0 ? rvalues[0] : 
null);
    }
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <[EMAIL PROTECTED]> in the Cc line ]
[and leave the subject line UNCHANGED.  This is not done]
[automatically because of the potential for mail loops. ]
[If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request ]
[from a developer.                                      ]
[Reply only with text; DO NOT SEND ATTACHMENTS!         ]



Reply via email to