Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-2903

AuditableInterceptor fails with a NPE at startup if there are scheduled tasks to run at startup

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.9 Beta Sprint
    • Component/s: None
    • Labels:
    • Complexity:
      Undetermined

      Description

      AuditableInterceptor throws a NPE if there are started tasks at startup which results in OpenMRS failing to start. This is because when tasks are started at startup, the schedulerService logic sets certain fields on the taskDefinition and calls saveTask() while scheduling them, the Daemon thread is exited and the proceeding startup logic is executed, so when hibernate tries to flush the session at a later point, the auditable interceptor sets in and tries to set the changedBy property to the user returned by Context.getAuthenticatedUser() which will always be null since there is no loggedin user yet and and the call is out of the daemon thread already.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dkayiwa Daniel Kayiwa
              Reporter:
              wyclif Wyclif Luyima
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: