Hi,
i have experienced a NullPointerException in Check.java during render of my
page. I have a page which has DropDownChoice (
wantOnSelectionChangedNotifications=true) and  CheckGroup (contains Check
objects).  If i change the dropdown, and refreshes the page, then i am
getting NullPE as below:

Caused by: java.lang.NullPointerException
           at wicket.markup.html.form.Check.onComponentTag(Check.java:132)
           at wicket.Component.renderComponent(Component.java:1688)

When i looked in source codes:

(at line 128: Check.java)
 if (group.hasRawInput()){
  final String[] input = group.getInputAsArray();
  for (int i = 0; i < input.length; i++)

"group.getInputAsArray()" returns "null" value, because the page has been
refreshed but none of checkboxes are checked.

So my suggestion is that just override these 2 methods of FormComponent in
CheckGroup as below;

/**
 * OVERRIDEN OF FormComponent!  (K.GUMUS/NxmBogazici)
 */
public String[] getInputAsArray()
{
 String[] values = getRequest().getParameters(getInputName());
 if (!isInputNullable())
 {
  if (values != null && values.length == 1 && values[0] == null)
  {
   return EMPTY_STRING_ARRAY;
  }
  else if (values == null)
  {
   return ZERO_STRING_ARRAY;    //new String[0]
  }
 }
 return values;
}

/**
 * OVERRIDEN OF FormComponent!  (K.GUMUS/NxmBogazici)
 */
public boolean isInputNullable()
{
 return false;
}



What do you think? am i right? May i enter a JIRA issue?

Regards

Kadir
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to