[ 
https://issues.apache.org/jira/browse/ISIS-1269?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dan Haywood resolved ISIS-1269.
-------------------------------
    Resolution: Fixed

> Deleting an object from a list can cause NPE when that list is re-rendered.
> ---------------------------------------------------------------------------
>
>                 Key: ISIS-1269
>                 URL: https://issues.apache.org/jira/browse/ISIS-1269
>             Project: Isis
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.10.0
>            Reporter: Dan Haywood
>            Assignee: Dan Haywood
>            Priority: Minor
>             Fix For: 1.11.0
>
>
> For example, in the todoapp the home page displays all the todo items, not 
> yet completed vs completed.
> If select "Buy Milk" (when not complete) and delete it, then the NPE is 
> thrown.
> This is ultimately because the list returned from ToDoItem#delete() is stale:
> {code}
>     public List<ToDoItem> delete() {
>         // obtain title first, because cannot reference object after deleted
>         final String title = container.titleOf(this);
>         final List<ToDoItem> returnList = actionInvocationContext.isLast() ? 
> toDoItems.notYetComplete() : null;
>         container.removeIfNotAlready(this);
>         container.informUser(
>                 TranslatableString.tr("Deleted {title}", "title", title), 
> this.getClass(), "delete");
>         return returnList;
>     }
> {code}
> It ought not to return the current object about to be deleted.
> Even so, we can handle this application programming error easily enough, by 
> filtering out any null objects.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to