When the DropDownChoice try to convert the submitted choice id back to the 
choice object
there is an iteration over the choices.
You get the NPE in this iteration because nullItem has no id.

Have a look to AbstractSingleSelectChoice's setNullValid(true) method to 
include a null value.
http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/markup/html/form/AbstractSingleSelectChoice.html#setNullValid(boolean)



François Meillet
Formation Wicket - Développement Wicket





Le 25 mai 2014 à 21:18, Marco Springer <ma...@glitchbox.nl> a écrit :

> Haven't run the code but my guess is that the idValue returns a null instead 
> of  "0".
> Take a look at AbstractSingleSelectChoice.convertChoiceIdToChoice(String) 
> line 
> 281. (Wicket 6.15.0)
> "if(renderer.getIdValue(choice, index).equals(id)"
> This would trigger a NPE if a null is returned, which would be the case with 
> your "nullItem".
> 
> Cheers,
> Marco
> 
> On Sunday 25 May 2014 21:06:41 Lucio Crusca wrote:
>> I'm pretty sure it's my fault, but I can't spot it. I'm trying to use a
>> DropDownChoice with custom renderer and a PropertyModel, without a Form.
>> 
>> I get a NullPointerException in AbstractSingleSelectChoice, here is the
>> quickstart:
>> 
>> http://www.sulweb.org/download/sparsi/quickstart.zip
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 

Reply via email to