Return-Path: X-Original-To: apmail-struts-issues-archive@minotaur.apache.org Delivered-To: apmail-struts-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C745610CD3 for ; Fri, 9 Aug 2013 12:07:49 +0000 (UTC) Received: (qmail 52739 invoked by uid 500); 9 Aug 2013 12:07:49 -0000 Delivered-To: apmail-struts-issues-archive@struts.apache.org Received: (qmail 52712 invoked by uid 500); 9 Aug 2013 12:07:49 -0000 Mailing-List: contact issues-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list issues@struts.apache.org Received: (qmail 52548 invoked by uid 99); 9 Aug 2013 12:07:48 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Aug 2013 12:07:48 +0000 Date: Fri, 9 Aug 2013 12:07:48 +0000 (UTC) From: "Lukasz Lenart (JIRA)" To: issues@struts.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (WW-4168) NullPointerException on Checkboxlist MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/WW-4168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13734706#comment-13734706 ] Lukasz Lenart commented on WW-4168: ----------------------------------- Ok, thanks! I thought it will be easy to find wherefrom the null is coming, but it isn't possible. You don't have any actions involved in the stacktrace. [~phillips1021] you are right, returning null isn't a good practice but in that case user will be lost and will blame the framework ;-) > NullPointerException on Checkboxlist > ------------------------------------- > > Key: WW-4168 > URL: https://issues.apache.org/jira/browse/WW-4168 > Project: Struts 2 > Issue Type: Bug > Components: Plugin - Java Templates > Affects Versions: 2.3.15.1 > Environment: tomcat/centos 5 > Reporter: Greg Huber > Assignee: Bruce Phillips > Priority: Minor > Fix For: 2.3.16 > > > Hello, > I am getting null pointer exceptions on line : > Caused by: java.lang.NullPointerException > at template.events.CheckboxListHandler.isChecked(CheckboxListHandler.java:125) > at template.events.CheckboxListHandler.generate(CheckboxListHandler.java:80) > at org.apache.struts2.views.java.DefaultTheme.renderTag(DefaultTheme.java:120) > at org.apache.struts2.views.java.JavaTemplateEngine.renderTemplate(JavaTemplateEngine.java:95) > at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:572) > at org.apache.struts2.components.UIBean.end(UIBean.java:526) > we need to check for if(nameValues)!=null > ie: > {code:java} > private Boolean isChecked(Map params, String itemKeyStr) { > Boolean checked = false; > if (itemKeyStr != null) { > String[] nameValues = (String[]) params.get("nameValue"); > if(nameValues)!=null // need this <<<<<<<<<< > for (String value : nameValues) { > if (checked = value.equalsIgnoreCase(itemKeyStr)) > { break; } > } > } > } > return checked; > } > {code} > Cheers Greg -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira