Possible bug in MediaHandler for Complex Obs

Hi,

while trying to backport TRUNK-5093 to 2.1.x I’ve encountered an exception in the MediaHandler class. I went on to test whether it also happens with the newest master and encountered it there as well. Here are the steps I took:

  1. Pull newest openmrs-core master from GitHub
  2. mvn clean install it to generate the .war
  3. Deploy it on a newly created distribution server by calling mvn openmrs-sdk:deploy in the openmrs-core directory
  4. Create a Test Patient and a Complex Obs concept that uses the MediaHandler
  5. Save a Complex Obs with an mp3 file (I used the one that is in the resources folder)

This is the exception stack trace: https://pastebin.com/abAzLbhH

So the FileInputStream cast of the ComplexObs data on line 100 of the MediaHandler causes this problem.

Can someone reproduce this? I’m a bit confused, as I’m pretty sure I haven’t had this error when I finished the TRUNK-5093 ticket for the master branch and tested it with the mp3 file. I will dig deeper to see where it comes from.

I was not able to reproduce this. Though i did not use the SDK. I pulled the latest code, compiled, and run from eclipse using jetty.

Thanks for testing. I will try to run it differently to see if it persists. Good to know it’s not a universal problem.

Previously I always tested openmrs-core .war files like this and never got this error. Are you sure this is not hinting at some problem? Regardless whether I could somehow make it work, I’m a bit worried about that.

For comparison, I also created a default 2.2.0 SNAPSHOT platform server via the openmrs-sdk (with openmrs-sdk:setup) and added the legacy-ui 1.4 for navigation. I did the same things and got the same error, so I can’t seem to find the problem, even though I did not deploy my own compiled openmrs-core. Since this server came purely from the openmrs-sdk, it should probably be reproducible.

I’ve now reinstalled the openmrs-sdk and created a Reference Application 2.9 SNAPSHOT server with it. Just running this completely unmodified server and doing the aforementioned steps via the legacy UI leads to the same exception for me. If there isn’t something completely wrong with my openmrs-sdk installation or database this should be reproducible. Can someone try it this way?

Which OpenMRS platform version is your Reference Application 2.9 SNAPSHOT running?

It has openmrs-2.1.3.war in its directory.

Can you try to replace it with the latest snapshot version of OpenMRS core?

Sorry for the late reply! Did anything change in the last few weeks about OpenMRS core that could relate to it? If not, I checked it with a .war I compiled from the (then) current core master branch around the time I created the original post.