Thanks, Sven!

I guess this is true for all places where IChoiceRenderer#getIdValue() is
used ?

Martin Grigorov
Wicket Training and Consulting


On Mon, Jun 2, 2014 at 4:14 PM, Sven Meier <[email protected]> wrote:

> Hi Martin,
>
> I'd say AbstractSingleSelectChoice should throw a WicketRuntimeException
> when the id is null.
>
> The reporter of the issue should use #setNullValid(true) instead of his
> nullItem.
>
> Sven
>
>
> On 05/27/2014 03:14 PM, Martin Grigorov wrote:
>
>> Improved to not fail with NPE with
>> https://issues.apache.org/jira/browse/WICKET-5601
>>
>> I think Wicket should warn you somehow when the returned idValue is null
>> though. Because now it sets null as a model object and the client choice
>> is
>> being lost.
>> @Sven, @Igor: what do you think ?
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>>
>>
>> On Sun, May 25, 2014 at 10:29 PM, Francois Meillet <
>> [email protected]> wrote:
>>
>>  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 <[email protected]> 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: [email protected]
>>>>> For additional commands, e-mail: [email protected]
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>> For additional commands, e-mail: [email protected]
>>>>
>>>>
>>>
>

Reply via email to