You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Eelco Hillenius (JIRA)" <ji...@apache.org> on 2007/08/01 23:39:52 UTC

[jira] Created: (WICKET-808) print out warning instead of letting NPE happen for repeaters when they have null elements.

print out warning instead of letting NPE happen for repeaters when they have null elements.
-------------------------------------------------------------------------------------------

                 Key: WICKET-808
                 URL: https://issues.apache.org/jira/browse/WICKET-808
             Project: Wicket
          Issue Type: Improvement
    Affects Versions: 1.3.0-beta2
            Reporter: Eelco Hillenius
            Assignee: Eelco Hillenius
             Fix For: 1.3.0-beta3


Currently, when you provide null elements in the model (renderIterator), you'll get a NPE exception further down the line (in ListView#renderItem for instance). We should either throw an meaningful exception earlier, or we should make repeaters more lenient and just print out a warning message. I opt for the latter. This should be clear enough when developing (you probably would wonder where your data is to start with) and a lot better than unexpectedly getting NPEs in a production systems in case you missed it.

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


[jira] Resolved: (WICKET-808) print out warning instead of letting NPE happen for repeaters when they have null elements.

Posted by "Eelco Hillenius (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eelco Hillenius resolved WICKET-808.
------------------------------------

    Resolution: Fixed

> print out warning instead of letting NPE happen for repeaters when they have null elements.
> -------------------------------------------------------------------------------------------
>
>                 Key: WICKET-808
>                 URL: https://issues.apache.org/jira/browse/WICKET-808
>             Project: Wicket
>          Issue Type: Improvement
>    Affects Versions: 1.3.0-beta2
>            Reporter: Eelco Hillenius
>            Assignee: Eelco Hillenius
>             Fix For: 1.3.0-beta3
>
>
> Currently, when you provide null elements in the model (renderIterator), you'll get a NPE exception further down the line (in ListView#renderItem for instance). We should either throw an meaningful exception earlier, or we should make repeaters more lenient and just print out a warning message. I opt for the latter. This should be clear enough when developing (you probably would wonder where your data is to start with) and a lot better than unexpectedly getting NPEs in a production systems in case you missed it.

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


[jira] Commented: (WICKET-808) renderIterator of ListView and Loop should use the number of children rather than the current size of the model

Posted by "Eelco Hillenius (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12517329 ] 

Eelco Hillenius commented on WICKET-808:
----------------------------------------

I changed the header of this bug report, and I'm going ahead with changing renderIterator of ListView and Loop to use the number of children they have rather than the element count of their models. Like I pointed out above, the model can change in between the call to onBeforeRender and renderIterator, but onBeforeRender adds the children which have to be rendered.

> renderIterator of ListView and Loop should use the number of children rather than the current size of the model
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-808
>                 URL: https://issues.apache.org/jira/browse/WICKET-808
>             Project: Wicket
>          Issue Type: Improvement
>    Affects Versions: 1.3.0-beta2
>            Reporter: Eelco Hillenius
>            Assignee: Eelco Hillenius
>             Fix For: 1.3.0-beta3
>
>
> Currently, when you provide null elements in the model (renderIterator), you'll get a NPE exception further down the line (in ListView#renderItem for instance). We should either throw an meaningful exception earlier, or we should make repeaters more lenient and just print out a warning message. I opt for the latter. This should be clear enough when developing (you probably would wonder where your data is to start with) and a lot better than unexpectedly getting NPEs in a production systems in case you missed it.

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


[jira] Resolved: (WICKET-808) renderIterator of ListView and Loop should use the number of children rather than the current size of the model

Posted by "Eelco Hillenius (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eelco Hillenius resolved WICKET-808.
------------------------------------

    Resolution: Fixed

> renderIterator of ListView and Loop should use the number of children rather than the current size of the model
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-808
>                 URL: https://issues.apache.org/jira/browse/WICKET-808
>             Project: Wicket
>          Issue Type: Improvement
>    Affects Versions: 1.3.0-beta2
>            Reporter: Eelco Hillenius
>            Assignee: Eelco Hillenius
>             Fix For: 1.3.0-beta3
>
>
> Currently, when you provide null elements in the model (renderIterator), you'll get a NPE exception further down the line (in ListView#renderItem for instance). We should either throw an meaningful exception earlier, or we should make repeaters more lenient and just print out a warning message. I opt for the latter. This should be clear enough when developing (you probably would wonder where your data is to start with) and a lot better than unexpectedly getting NPEs in a production systems in case you missed it.

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


[jira] Commented: (WICKET-808) print out warning instead of letting NPE happen for repeaters when they have null elements.

Posted by "Eelco Hillenius (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12517326 ] 

Eelco Hillenius commented on WICKET-808:
----------------------------------------

Yeah, you're right.

Things like this happen when e.g. list view components mutate the model in onBeforeRender. We had this piece of code which is part of a panel that nests a listview:

	protected void onBeforeRender() {
		super.onBeforeRender();
		statuses.clear();
		statuses.addAll(Ts4Session.get().getStatuses());
		Ts4Session.get().clearStatuses();
	}

This resulted in a NPE because that super call at the start would result in the list view building it's children based on the statuses before any of the operations you see above were applied, while renderIterator is based on the size of the model.

So a better fix here would be to base the render iterator on the number of children. Though the disadvantage of that is that the above bug (which can be fixed by moving the super call to the bottom) would be hard to detect (it would be silent).

> print out warning instead of letting NPE happen for repeaters when they have null elements.
> -------------------------------------------------------------------------------------------
>
>                 Key: WICKET-808
>                 URL: https://issues.apache.org/jira/browse/WICKET-808
>             Project: Wicket
>          Issue Type: Improvement
>    Affects Versions: 1.3.0-beta2
>            Reporter: Eelco Hillenius
>            Assignee: Eelco Hillenius
>             Fix For: 1.3.0-beta3
>
>
> Currently, when you provide null elements in the model (renderIterator), you'll get a NPE exception further down the line (in ListView#renderItem for instance). We should either throw an meaningful exception earlier, or we should make repeaters more lenient and just print out a warning message. I opt for the latter. This should be clear enough when developing (you probably would wonder where your data is to start with) and a lot better than unexpectedly getting NPEs in a production systems in case you missed it.

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


[jira] Reopened: (WICKET-808) print out warning instead of letting NPE happen for repeaters when they have null elements.

Posted by "Eelco Hillenius (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eelco Hillenius reopened WICKET-808:
------------------------------------


> print out warning instead of letting NPE happen for repeaters when they have null elements.
> -------------------------------------------------------------------------------------------
>
>                 Key: WICKET-808
>                 URL: https://issues.apache.org/jira/browse/WICKET-808
>             Project: Wicket
>          Issue Type: Improvement
>    Affects Versions: 1.3.0-beta2
>            Reporter: Eelco Hillenius
>            Assignee: Eelco Hillenius
>             Fix For: 1.3.0-beta3
>
>
> Currently, when you provide null elements in the model (renderIterator), you'll get a NPE exception further down the line (in ListView#renderItem for instance). We should either throw an meaningful exception earlier, or we should make repeaters more lenient and just print out a warning message. I opt for the latter. This should be clear enough when developing (you probably would wonder where your data is to start with) and a lot better than unexpectedly getting NPEs in a production systems in case you missed it.

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


[jira] Commented: (WICKET-808) print out warning instead of letting NPE happen for repeaters when they have null elements.

Posted by "Jean-Baptiste Quenot (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12517185 ] 

Jean-Baptiste Quenot commented on WICKET-808:
---------------------------------------------

Eelco, it is not really the models, but rather the components returned by renderIterator().  And I don't really understand how those components can be null with the current ListView or RepeatingView, unless you create your own repeater.

> print out warning instead of letting NPE happen for repeaters when they have null elements.
> -------------------------------------------------------------------------------------------
>
>                 Key: WICKET-808
>                 URL: https://issues.apache.org/jira/browse/WICKET-808
>             Project: Wicket
>          Issue Type: Improvement
>    Affects Versions: 1.3.0-beta2
>            Reporter: Eelco Hillenius
>            Assignee: Eelco Hillenius
>             Fix For: 1.3.0-beta3
>
>
> Currently, when you provide null elements in the model (renderIterator), you'll get a NPE exception further down the line (in ListView#renderItem for instance). We should either throw an meaningful exception earlier, or we should make repeaters more lenient and just print out a warning message. I opt for the latter. This should be clear enough when developing (you probably would wonder where your data is to start with) and a lot better than unexpectedly getting NPEs in a production systems in case you missed it.

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


[jira] Updated: (WICKET-808) renderIterator of ListView and Loop should use the number of children rather than the current size of the model

Posted by "Eelco Hillenius (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-808?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eelco Hillenius updated WICKET-808:
-----------------------------------

    Summary: renderIterator of ListView and Loop should use the number of children rather than the current size of the model  (was: print out warning instead of letting NPE happen for repeaters when they have null elements.)

> renderIterator of ListView and Loop should use the number of children rather than the current size of the model
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-808
>                 URL: https://issues.apache.org/jira/browse/WICKET-808
>             Project: Wicket
>          Issue Type: Improvement
>    Affects Versions: 1.3.0-beta2
>            Reporter: Eelco Hillenius
>            Assignee: Eelco Hillenius
>             Fix For: 1.3.0-beta3
>
>
> Currently, when you provide null elements in the model (renderIterator), you'll get a NPE exception further down the line (in ListView#renderItem for instance). We should either throw an meaningful exception earlier, or we should make repeaters more lenient and just print out a warning message. I opt for the latter. This should be clear enough when developing (you probably would wonder where your data is to start with) and a lot better than unexpectedly getting NPEs in a production systems in case you missed it.

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