Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-1269

Deleting an object from a list can cause NPE when that list is re-rendered.

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.10.0
    • Fix Version/s: 1.11.0
    • Component/s: Core
    • Labels:
      None

      Description

      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:

          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;
          }
      

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              danhaywood Dan Haywood
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: