Opened 3 years ago

Closed 3 years ago

#1342 closed defect (fixed)

NullPointerException when running "Reference date and linked cases" wizard

Reported by: Nicklas Nordborg Owned by: Nicklas Nordborg
Priority: critical Milestone: Reggie v4.33.2
Component: net.sf.basedb.reggie Keywords:
Cc:

Description

It stops with an error message: Cannot invoke "java.util.Date.getTime()" because "otherDate" is null.

A full stack trace is in the log file:

java.lang.NullPointerException: Cannot invoke "java.util.Date.getTime()" because "otherDate" is null
  at net.sf.basedb.reggie.servlet.ReferenceDateServlet.doPost(ReferenceDateServlet.java:265)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:652)
...

Investigations indicate that the error happens when there is a patient that has two cases and at least one of the cases is missing a current ReferenceDate annotation.

Change History (1)

comment:1 by Nicklas Nordborg, 3 years ago

Resolution: fixed
Status: newclosed

In 6437:

Fixes #1342: NullPointerException when running "Reference date and linked cases" wizard

The problem was caused by the implementation of #1287. The wizard is used for both updating the ReferenceDate annotation and the LinkedCase annotation. The first part of the wizard calculates a new ReferenceDate and all cases will get a date. The second part calculates the LinkedCase annotation for pairs of cases belonging to the same patient. The bug was that the second part used date information from the database which may contain null or obsolete values since the update is not taking place until both steps have been completed. The solution is to keep track of dates that are calculated in the first step and use in the second step.

Note: See TracTickets for help on using tickets.