Date date;   String dateStringPresence = request.getParameter(nameRoot + HASDATE_SUFFIX); if (dateStringPresence.equals(NODATE_VALUE)) { return defaultDate; }  String dateStr = request.getParameter(nameRoot + DATETEXT_SUFFIX); SimpleDateFormat formatter = new SimpleDateFormat(DATE_FORMAT); try { date = formatter.parse(dateStr); } catch (ParseException pe) { throw new DataEntryException(pe, nameRoot, dateStr, DATE_SAMPLE); }  return date;
return getDateParam (request, nameRoot, null);
  static public Date getDateParam    (HttpServletRequest request,     String             nameRoot,     Date               defaultDate)  throws DataEntryException  {    Date date;        // First, let's see if the date is present or not.    String dateStringPresence = request.getParameter(nameRoot + HASDATE_SUFFIX);    if (dateStringPresence.equals(NODATE_VALUE))    {      return defaultDate;    }        String dateStr = request.getParameter(nameRoot + DATETEXT_SUFFIX);    SimpleDateFormat formatter = new SimpleDateFormat(DATE_FORMAT);    try    {      date = formatter.parse(dateStr);    }    catch (ParseException pe)    {      throw new DataEntryException(pe, nameRoot, dateStr, DATE_SAMPLE);    }        return date;  }