Prevent a NullPointerException from a null request, by making that test first.

This commit is contained in:
jeb228 2011-02-07 17:47:22 +00:00
parent 2903d0c20d
commit a3345f4c53

View file

@ -170,12 +170,12 @@ public class TabWebUtil {
*/ */
public static Tab findStashedTab( String tabId, HttpServletRequest request) public static Tab findStashedTab( String tabId, HttpServletRequest request)
throws JspException{ throws JspException{
if( request == null )
throw new JspException("findStashedTab: request was null");
if( request.getAttribute(STASHED_KEY) == null ) if( request.getAttribute(STASHED_KEY) == null )
throw new JspException("findStashedTab: called before stashTabsInRequest."); throw new JspException("findStashedTab: called before stashTabsInRequest.");
if( tabId == null) if( tabId == null)
throw new JspException("findStashedTab: tabId was null"); throw new JspException("findStashedTab: tabId was null");
if( request == null )
throw new JspException("findStashedTab: request was null");
Object obj = request.getAttribute("tab"+tabId); Object obj = request.getAttribute("tab"+tabId);
if( obj == null ) if( obj == null )
throw new JspException("findStashedTab: tab"+tabId+" not found in vitro request"); throw new JspException("findStashedTab: tab"+tabId+" not found in vitro request");