Attachments: Problem rendering complex obs created outside of module

I was testing out the Attachments module , it couldn’t load an image that has been uploaded out side the Attachments API ,say directly via Complex Obs API ,

say if i create a Complex Obs via the Rest API ,like here

or if i Upload an image using the Manage Observation page on the Legacy UI

1 Like

What do you mean by “couldn’t load” ?

the image is displayed as any file ,Actually it could throw errors

Are @reagan or yourself able to analyse the logs or do some debugging to see what goes wrong with the handlers?

2 Likes

I have reproduced the bug again on the qa-server.

  • I uploaded one image from the Attachments page ,

  • I uploaded the second image on the Legacy Observation Management page ,

i used the same concept ATT IMAGE ATTACHMENT ,

but the second image fails in the attachment widget.

@reagan ,you can go ahead create a ticket for this , we shall investage a little more

1 Like

Ticketed here https://issues.openmrs.org/browse/ATT-39 @mksd @mozzy

1 Like

Will look into it and see.

1 Like

@mozzy could you fill the ‘2. Steps to reproduce’ section of the description on ATT-39?

It seems that you had a REST call ready to paste?

2 Likes

i havent got you.

Ah no sorry you did this:

I uploaded the second image on the Legacy Observation Management page

Just detail those steps.

But actually it should be possible to create a Spring test that reproduce this error, that would be the best foundation to work on this.

Thanks @mozzy.

Anyone of you two (@mozzy, @reagan) willing to pick up ATT-39?

If yes, the first step will be to write a failing Spring test for it.

2 Likes

hello @mksd @mozzy @reagan

i have been going through this thread and i upload images to the attachment widget from the manage observation in the legacy ui .

Though on clicking the Save Observation button in the manage obs section under legacy ui the images are attached to the widget but the server throws an error.

i used the ATT IMAGE ATTACHMENT concept of complex datatype and did use it to create a complex obs in manage observations in legacy ui

i i was able to reproduce the above error that @mozzy reported when i selected handlers which are not from the attachment module

Thanks a lot @gcliff, the log is really useful. For info what this says:

AbstractMethodError:
  ImageAttachmentHandler.supportsView(Ljava/lang/String;)Z

is that ImageAttachmentHandler#supportsView(String) does not exist, which is true. It’s the appended “Z” that says that the method is not found.

Turns out that this will be fixed as part of ATT-38. Just waiting for @reagan to merge my PR to his repo.

The upcoming fix is here actually. In plain English: AbstractAttachmentHandler#supportsView(String view) was added, so all “Attachments handlers” (those that extend AbstractAttachmentHandler) will expose that method.

Would be great if you could test again once ATT-38 is merged.

1 Like

@gcliff it was merged, see here on ATT-38.

1 Like

let me test it out with the new changes

1 Like

@mksd your spot on right…figured your changes in the AbstractAttachmentHandler bean https://github.com/reagan-meant/openmrs-module-attachments/pull/1/files#diff-493f0a3d8c5aa07953f4b231373443d1R79 will fix it because it seems like everything was working out well before ATT-33. will test it out shortly.

@mksd @reagan i cant compile after pulling the latest changes https://pastebin.com/8AuZcxki

1 Like

There’s actually an error reported by Travis here. Looking into it.

2 Likes