You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Peter Ertl (JIRA)" <ji...@apache.org> on 2007/11/14 13:26:43 UTC
[jira] Updated: (WICKET-1160) AjaxEditableLabel#setModel() is
broken
[ https://issues.apache.org/jira/browse/WICKET-1160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Peter Ertl updated WICKET-1160:
-------------------------------
Attachment: AjaxEditableLabel.patch
Here's a patch
> AjaxEditableLabel#setModel() is broken
> --------------------------------------
>
> Key: WICKET-1160
> URL: https://issues.apache.org/jira/browse/WICKET-1160
> Project: Wicket
> Issue Type: Bug
> Components: wicket-extensions
> Reporter: Peter Ertl
> Attachments: AjaxEditableLabel.patch
>
>
> The following code
> AjaxEditableLabel label = new AjaxEditableLabel("someid");
> label.setModel(...);
> will throw an NullPointerException.
> The reason is...
> public final Component setModel(IModel model)
> {
> super.setModel(model);
> *** getLabel().setModel(model); ****
> getEditor().setModel(model);
> return this;
> }
> getLabel() returns null because the label is not initialized.
> I suggest the following fix:
> protected final Component getLabel()
> {
> return label;
> }
> should be changed to
> protected final Component getLabel()
> {
> if (label == null)
> {
> initLabelAndEditor(getParentModel());
> }
> return label;
> }
> this is similar to getEditor() which already initializes the component if it is null...
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.