Sometimes Missing Response-Headers for broken PNG Images

0 votes
asked Mar 31, 2016 in bug by anonymous

Basically when you request a broken PNG image then some response headers are omitted.
I have set 3 Response-Headers in the method sendDiagram() in Class DiagramResponse

This problem can be reproduced with JMeter for example.
There is no such problem for requested svg images.

I posted a more detailed description of the issue on github:


1 Answer

0 votes
answered Apr 1, 2016 by anonymous
We found a fix for this issue and we are going to provide a patch to plantuml soon.

The problem is within the plantuml library in Class ``PngIOMetadata``.
The outputstream was not closed properly, which leads to the observed behaviour in JMeter..
commented Apr 1, 2016 by mgriffel (180 points)
Hello Arnaud,

you'll find the fix for this problem here:

Can you please integrate this into the plantuml library?


commented Apr 1, 2016 by plantuml (131,770 points)
Sorry about this and thanks for your debug session!
Your code will be integrated in next release.

We just slightly modify it to keep synchronization on ImageWriter object. It's not clear whether or not ImageWriter are thread-safe and if they could be share/reused. And this might be JVM dependant.

So we kept synchronization, just in case. If anyone has some idea about it, do not hesitate to post.

And thanks again for your contribution and your support!
commented Apr 4, 2016 by mgriffel (180 points)
Ok thank you!

When do you plan a new release?

Just one remark about the synchronization: If the ImageWriter object is *not* thread-safe then such synchronization should also be done when writing images/PNGs *without* metadata: see PngIO#write() line 86 -> ImageIO.write(image, "png", os);

However the ImageIO.writer() Method do not synchronize the access to the ImageWriter object.


commented Apr 4, 2016 by plantuml (131,770 points)
The new release will be done today or tomorrow.
Thanks for your comment about synchronization, we'll think about it (even if we won't change anything yet in next release).