NullPointerException when voiding a ComplexObs

Tags: #<Tag:0x00007f0a3da09be8> #<Tag:0x00007f0a3da09800>

Hello,

I’ve been working on an issue concerning openmrs-core complex obs and I think I’ve stumbled upon a bug. At first I thought my changed code is the cause, but apparently it isn’t.

What I did to arrive at the error:

  1. Create an OpenMRS Distribution Server via openmrs-sdk (newest version, default settings mostly except for naming)
  2. Create an OpenMRS RefApp Module via openmrs-sdk
  3. Start Module on the Distribution Server
  4. Open the Legacy UI, create new User and new ComplexObs concept with ImageHandler as Handler (I guess another handler might also produce the same error?)
  5. Create new ComplexObs for that User of the newly defined concept, upload an image and save it
  6. Void/Remove the Obs

This produces the following NullPointerException with stacktrace: https://pastebin.com/MWzbGStd

Kind regards, Florian

You are seeing this exception because this line is the one executed when you void an obs and even though the method return an instance of the saved obs, it has not been assigned to this variable which is not supposed to be null when this line is executed. A quick fix would be to do the assignment. But the question here is, is it really desirable to display the voided obs? because that is what is going to happen if this code is fixed that way. IMO I think we don’t and probably this should be handled differently, I am open to hear others ideas.

In the mean time you can go ahead and create a ticket on the legacy UI project with exactly the same details.

1 Like

I created the ticket and formulated it more generally, as it seems to affect all Obs (regardless if complex or not). I’m not sure about the severity rating, so I set it to none. I just realized I can’t seem to edit that now, is it okay like that?

Link: https://issues.openmrs.org/browse/LUI-134

1 Like

That is totally okay. Thanks.

1 Like