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

Automated Error Report: NPE when creating patient without an identifier type

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Non-Essential
    • Resolution: Cannot Reproduce
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Complexity:
      Low

      Description

      This looks like it can still come up in trunk. See HibernatePatientDAO:499.

      The PatientValidator needs to check for a patient identifier type and give that error to the user instead of continuing on to the "isIdentifierInUse" check.

      This should be applied to trunk, 1.8.x, and 1.7.x eventually.

      Version: 1.7.1 Build 17223
      Implementation ID:
      User ID: admin
      Started Modules: serialization.xstream v0.2.4, logic v0.4, dataentrystatistics v1.3, htmlformentry v1.7.1, report v0.1-SNAPSHOT, bloodbank v1.0.4-SNAPSHOT, infopathconverter v0.4, reportingcompatibility v1.5.2.1, formentry v4.5.9

      Summary:
      java.lang.NullPointerException

      Description:
      Stack trace:
      org.openmrs.api.db.hibernate.HibernatePatientDAO.isIdentifierInUseByAnotherPatient(HibernatePatientDAO.java:491)
      org.openmrs.api.impl.PatientServiceImpl.isIdentifierInUseByAnotherPatient(PatientServiceImpl.java:1227)
      at [ignored] ...
      $Proxy75.isIdentifierInUseByAnotherPatient(Unknown Source)
      at [ignored] ...
      org.openmrs.aop.LoggingAdvice.invoke(LoggingAdvice.java:107)
      at [ignored] ...
      $Proxy76.isIdentifierInUseByAnotherPatient(Unknown Source)
      at [ignored] ...
      $Proxy76.isIdentifierInUseByAnotherPatient(Unknown Source)
      org.openmrs.validator.PatientIdentifierValidator.validateIdentifier(PatientIdentifierValidator.java:86)
      org.openmrs.api.impl.PatientServiceImpl.checkPatientIdentifier(PatientServiceImpl.java:255)
      org.openmrs.api.impl.PatientServiceImpl.checkPatientIdentifiers(PatientServiceImpl.java:207)
      org.openmrs.api.impl.PatientServiceImpl.savePatient(PatientServiceImpl.java:125)
      at [ignored] ...
      $Proxy75.savePatient(Unknown Source)
      at [ignored] ...
      org.openmrs.aop.LoggingAdvice.invoke(LoggingAdvice.java:107)
      at [ignored] ...
      $Proxy76.savePatient(Unknown Source)
      at [ignored] ...
      $Proxy76.savePatient(Unknown Source)
      org.openmrs.module.bloodbank.web.controller.patient.AddOrUpdateDonorController.processSubmit(AddOrUpdateDonorController.java:166)
      <snip>

      Unit Tests

      Added unit tests to reproduce the bug In PatientServiceTest.java,
      Currently, these unit tests are annotated with @Ignore("Unignore after investigating and fixing - TRUNK-2758") .
      The corresponding pull request for the tests is https://github.com/openmrs/openmrs-core/pull/1772/

        Gliffy Diagrams

          Attachments

            Attachments-Category-Modification

              Activity

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  bwolfe Ben Wolfe
                  Watchers:
                  Anuruddhapremalal Premalal, Ben Wolfe, Christopher Hay, Daniel Kayiwa, Dengfeng Li, Mikko Suniala
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - 1 hour
                    1h
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 1 hour
                    1h