You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Funk (JIRA)" <ji...@apache.org> on 2007/05/02 15:29:20 UTC

[jira] Commented: (WICKET-500) org.apache.wicket.extensions.yui.calendar.DateField; throws NPE upon validation.

    [ https://issues.apache.org/jira/browse/WICKET-500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12493100 ] 

Martin Funk commented on WICKET-500:
------------------------------------

I'm sorry, probably I missed a relevant detail, there is a validator added to the form.
It might be that DateField.getConvertedInput() is missing the right input.

    		add(new AbstractFormValidator() {
				public void validate(Form form) {
					if (!new DateMidnight(arrivalDatePropertyTextField
							.getConvertedInput())
							.isBefore(new DateMidnight(
									departureDatePropertyTextField
											.getConvertedInput()))) {
						final String key = resourceKey();
						departureDatePropertyTextField.error(key);
					}
				}

				public FormComponent[] getDependentFormComponents() {
					return new FormComponent[] { arrivalDatePropertyTextField,
							departureDatePropertyTextField };
				}

			});

> org.apache.wicket.extensions.yui.calendar.DateField; throws NPE upon validation.
> --------------------------------------------------------------------------------
>
>                 Key: WICKET-500
>                 URL: https://issues.apache.org/jira/browse/WICKET-500
>             Project: Wicket
>          Issue Type: Bug
>         Environment: URL: https://svn.apache.org/repos/asf/incubator/wicket/trunk/jdk-1.4/wicket-datetime
> Revision: 532322
>            Reporter: Martin Funk
>         Assigned To: Eelco Hillenius
>
> org.apache.wicket.extensions.yui.calendar.DateField; throws NPE upon validation.
> The situation:
> markup:
> <span wicket:id="arrivalDateProperty" id="arrivalDateProperty"
> 					type="text" size="15"></span>
> the code:
> 			final DateField arrivalDatePropertyTextField = new DateField(
> 					"arrivalDateProperty");
> 			arrivalDatePropertyTextField.add(DateValidator
> 					.minimum(new DateMidnight().toDate()));
> 			add(arrivalDatePropertyTextField);
> the generated markup:
> <span id="arrivalDateProperty" name="arrivalDateProperty" type="text" size="15">
>   <span style="white-space: nowrap;">
>     <input id="date0" name="arrivalDateProperty:date" value="25.04.07" type="text" size="8"/>
> <span>&nbsp;<div style="display:none;z-index: 99999;position:absolute;" id="date0Dp"></div><img style="cursor: pointer; border: none;" id="date0Icon" src="resources/org.apache.wicket.extensions.yui.calendar.DatePicker/icon1.gif" /></span><input type="hidden"/>
>   </span>
> </span>
> The stacktrace
> DateConverter.convertToObject(String, Locale) line: 37	
> DateField(FormComponent).convert() line: 803	
> Form$13.validate(FormComponent) line: 1051	
> [...]
> shows that DateField 's convert() is called, which in this situation is looking for the parameter "arrivalDateProperty" whereas it probably should look for the parameter "arrivalDateProperty:date"
> Probably its DateTextField value should be validated.
> My first shot would be delegating the the DateField 's convert() method to its DateTextField ' s convert() method,
> but maybe the wicket way is different.
> mf

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.