Return-Path: Delivered-To: apmail-xml-cocoon-users-archive@xml.apache.org Received: (qmail 71870 invoked by uid 500); 4 Jun 2002 05:47:30 -0000 Mailing-List: contact cocoon-users-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: cocoon-users@xml.apache.org Delivered-To: mailing list cocoon-users@xml.apache.org Received: (qmail 71761 invoked from network); 4 Jun 2002 05:47:29 -0000 Reply-To: From: "neil" To: Subject: patch to fix NullPointerException from MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N I've got a form that posts multiple values for a request parameter (multiple instances of ). request.getParameterValues() returns a String[] with an element for each posted value. If nothing is entered into into one of the text fields the corresponding element in the String[] is null, but this isn't handled by Request object helper + *
+ * Modified by Pinnacle Software to fix:
+ *
+ * java.lang.NullPointerException
+ *	at
org.apache.cocoon.components.language.markup.xsp.XSPObjectHelper.data(XSPObj
ectHelper.java:196)
+ *	at
org.apache.cocoon.components.language.markup.xsp.XSPObjectHelper.elementData
(XSPObjectHelper.java:93)
+ *	at
org.apache.cocoon.components.language.markup.xsp.XSPRequestHelper.getParamet
erValues(XSPRequestHelper.java:291)
+ *	at
org.apache.cocoon.www.pinnacle.assetComponents_xsp.generate(C:\jakarta-tomca
t-4.0.4-b3\work\Standalone\localhost\cocoon\cocoon-files\org/apache/cocoon/w
ww/pinnacle\assetComponents_xsp.java:1299)
+ *	at
org.apache.cocoon.generation.ServerPagesGenerator.generate(ServerPagesGenera
tor.java:260)
+ * 
* * @author Ricardo Rocha + * @version Modified from Apache's version CVS Id: XSPRequestHelper.java,v 1.11 2002/02/27 05:33:50 vgritsenko Exp * @version CVS $Id: XSPRequestHelper.java,v 1.1 2002/06/04 04:52:31 neil Exp $ */ public class XSPRequestHelper { @@ -278,15 +289,18 @@ String[] values = request.getParameterValues(name); if (values != null) { for (int i = 0; i < values.length; i++) { - if(form_encoding != null && values[i] != null && - values[i].length() > 0) { - try { - values[i] = new String(values[i].getBytes(container_encoding), - form_encoding); - } catch(java.io.UnsupportedEncodingException uee) { - throw new RuntimeException("Unsupported Encoding Exception: " + - uee.getMessage()); - } + if (values[i] != null) { + if(form_encoding != null && values[i].length() > 0) { + try { + values[i] = new String(values[i].getBytes(container_encoding), + form_encoding); + } catch(java.io.UnsupportedEncodingException uee) { + throw new RuntimeException("Unsupported Encoding Exception: " + + uee.getMessage()); + } + } + } else { + values[i] = ""; } XSPObjectHelper.elementData(URI, PREFIX, contentHandler, "value", values[i]); --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. To unsubscribe, e-mail: For additional commands, e-mail: