From: Tim P <ti...@us...> - 2006-04-13 11:42:22
|
Update of /cvsroot/webmacro/webmacro/src/org/webmacro/servlet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25758/src/org/webmacro/servlet Modified Files: Form.java Log Message: Jetty6 Maven Plugin appears to have a bug such that getParameterValues returns a null String rather than null if field does not exist. Index: Form.java =================================================================== RCS file: /cvsroot/webmacro/webmacro/src/org/webmacro/servlet/Form.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Form.java 27 May 2005 19:44:59 -0000 1.11 --- Form.java 13 Apr 2006 11:42:19 -0000 1.12 *************** *** 37,41 **** /** ! * Provide access to form variables */ final public class Form implements Bag --- 37,41 ---- /** ! * Provide access to form variables. */ final public class Form implements Bag *************** *** 43,47 **** /** ! * This is the request object from the WebContext */ final HttpServletRequest _request; --- 43,47 ---- /** ! * This is the request object from the WebContext. */ final HttpServletRequest _request; *************** *** 50,54 **** * Read the form data from the supplied Request object */ ! Form (final HttpServletRequest r) { _request = r; --- 50,54 ---- * Read the form data from the supplied Request object */ ! Form(final HttpServletRequest r) { _request = r; *************** *** 56,66 **** /** ! * Get a form value */ ! final public Object get (String field) { try { ! return _request.getParameterValues(field)[0]; } catch (NullPointerException ne) --- 56,67 ---- /** ! * Get a form value. */ ! final public Object get(String field) { + String[] values = _request.getParameterValues(field); try { ! return values[0]; } catch (NullPointerException ne) *************** *** 68,82 **** return null; } } /** ! * Try to get a form value * ! * @param strKey = The form key that we're looking for. * * @return The value of that form key if found, else null * **/ ! final public Object getPossibleForm (String strKey) { String strElement; --- 69,88 ---- return null; } + catch (ArrayIndexOutOfBoundsException e) + { + // Seems to be a bug in Jetty + return null; + } } /** ! * Try to get a form value. * ! * @param strKey The form key that we're looking for. * * @return The value of that form key if found, else null * **/ ! final public Object getPossibleForm(String strKey) { String strElement; *************** *** 107,113 **** /** ! * Get a form value as an array */ ! final public Object[] getList (String field) { try --- 113,119 ---- /** ! * Get a form value as an array. */ ! final public Object[] getList(String field) { try *************** *** 122,128 **** /** ! * Unsupported */ ! final public void put (String key, Object value) throws UnsettableException { --- 128,134 ---- /** ! * Unsupported. */ ! final public void put(String key, Object value) throws UnsettableException { |