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/04/25 17:18:15 UTC
[jira] Created: (WICKET-500)
org.apache.wicket.extensions.yui.calendar.DateField; throws NPE upon
validation.
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
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> <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.
[jira] Updated: (WICKET-500)
org.apache.wicket.extensions.yui.calendar.DateField; throws NPE upon
validation.
Posted by "Alastair Maw (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alastair Maw updated WICKET-500:
--------------------------------
Fix Version/s: 1.3.0-rc1
> 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
> Assignee: Eelco Hillenius
> Fix For: 1.3.0-rc1
>
>
> 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> <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.
[jira] Resolved: (WICKET-500)
org.apache.wicket.extensions.yui.calendar.DateField; throws NPE upon
validation.
Posted by "Eelco Hillenius (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eelco Hillenius resolved WICKET-500.
------------------------------------
Resolution: Fixed
I solved it by removing final from FormComponent#getConvertedInput and implementing that method appropriately in DateField and DateTimeField. This replaces the implementation of updateModel.
Comment from DateField's and DateTimeField's getConvertedInput Javadoc:
* Note that overriding this method is a better option than overriding
* {@link #updateModel()} like the first versions of this class did. The
* reason for that is that this method can be used by form validators
* without having to depend on the actual model being updated, and this
* method is called by the default implementation of {@link #updateModel()}
* anyway (so we don't have to override that anymore).
> 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
> Components: wicket-datetime
> Environment: URL: https://svn.apache.org/repos/asf/incubator/wicket/trunk/jdk-1.4/wicket-datetime
> Revision: 532322
> Reporter: Martin Funk
> Assignee: Eelco Hillenius
> Fix For: 1.3.0-rc1
>
>
> 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> <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.
[jira] Updated: (WICKET-500)
org.apache.wicket.extensions.yui.calendar.DateField; throws NPE upon
validation.
Posted by "Alastair Maw (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alastair Maw updated WICKET-500:
--------------------------------
Component/s: wicket-datetime
> 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
> Components: wicket-datetime
> Environment: URL: https://svn.apache.org/repos/asf/incubator/wicket/trunk/jdk-1.4/wicket-datetime
> Revision: 532322
> Reporter: Martin Funk
> Assignee: Eelco Hillenius
> Fix For: 1.3.0-rc1
>
>
> 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> <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.
[jira] Commented: (WICKET-500)
org.apache.wicket.extensions.yui.calendar.DateField; throws NPE upon
validation.
Posted by "Eelco Hillenius (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12492798 ]
Eelco Hillenius commented on WICKET-500:
----------------------------------------
The stack trace doesn't make sense to me. Could you please update to the latest sources and paste in the full stack trace? Thanks.
> 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> <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.
[jira] Commented: (WICKET-500)
org.apache.wicket.extensions.yui.calendar.DateField; throws NPE upon
validation.
Posted by "Martin Funk (JIRA)" <ji...@apache.org>.
[ 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> <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.
[jira] Assigned: (WICKET-500)
org.apache.wicket.extensions.yui.calendar.DateField; throws NPE upon
validation.
Posted by "Eelco Hillenius (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eelco Hillenius reassigned WICKET-500:
--------------------------------------
Assignee: Eelco Hillenius
> 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> <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.
[jira] Updated: (WICKET-500)
org.apache.wicket.extensions.yui.calendar.DateField; throws NPE upon
validation.
Posted by "Alastair Maw (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WICKET-500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alastair Maw updated WICKET-500:
--------------------------------
Fix Version/s: (was: 1.3.0-rc1)
1.3.0-beta3
> 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
> Components: wicket-datetime
> Environment: URL: https://svn.apache.org/repos/asf/incubator/wicket/trunk/jdk-1.4/wicket-datetime
> Revision: 532322
> Reporter: Martin Funk
> Assignee: Eelco Hillenius
> Fix For: 1.3.0-beta3
>
>
> 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> <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.