Version 1.2025.5 on Windows gives error "java.lang.UnsupportedOperationException: Compression not supported."

0 votes
asked Oct 14 in Bug by dragondive (1,380 points)

When running plantuml from the command line, I get the error shown below. In my tests so far, this happens only on version 1.2025.5 on Windows. This also occurs only on Windows server 2022 runner, not 2025.

The problem goes away in version 1.2025.8, but by looking at the code changes, it is not clear (at least to me) why the error occurred and how it got fixed. This also leaves open the possibility that the bug could recur in future.

In my test, I load some data from a JSON file, but I verified that the issue happens even with a "simple" Alice -> Bob diagram, so the JSON load is not relevant to the issue. 

While I do have a fair understanding of Java, I am not familiar with the intricacies of JVM, especially on Windows. 

Given that the error occurs only on Windows server 2022 and with PlantUML version 1.2025.5, perhaps that PlantUML version somehow triggered a "bug" in the specific JRE version that's loaded on the Github Actions runner?

Does anyone have any more insights into this issue? 
 

java.lang.UnsupportedOperationException: Compression not supported. 
at javax.imageio.ImageWriteParam.setCompressionMode(ImageWriteParam.java:914) 
at net.sourceforge.plantuml.png.PngIOMetadata.writeWithMetadata(PngIOMetadata.java:67) 
at net.sourceforge.plantuml.png.PngIO.write(PngIO.java:90) 
at net.sourceforge.plantuml.klimt.drawing.g2d.UGraphicG2d.writeToStream(UGraphicG2d.java:214) 
at net.atmp.ImageBuilder.writeImageInternal(ImageBuilder.java:277) 
at net.atmp.ImageBuilder.write(ImageBuilder.java:239) 
at net.sourceforge.plantuml.sequencediagram.graphic.SequenceDiagramFileMakerPuma2.createOne(SequenceDiagramFileMakerPuma2.java:151) 
at net.sourceforge.plantuml.sequencediagram.SequenceDiagram.exportDiagramInternal(SequenceDiagram.java:318) 
at net.sourceforge.plantuml.UmlDiagram.exportDiagramNow(UmlDiagram.java:119) 
at net.sourceforge.plantuml.AbstractPSystem.exportDiagram(AbstractPSystem.java:217) 
at net.sourceforge.plantuml.PSystemUtils.exportDiagramsSequence(PSystemUtils.java:153) 
at net.sourceforge.plantuml.PSystemUtils.exportDiagrams(PSystemUtils.java:89) 
at net.sourceforge.plantuml.SourceFileReaderAbstract.getGeneratedImages(SourceFileReaderAbstract.java:195) 
at net.sourceforge.plantuml.Run.manageFileInternal(Run.java:526) 
at net.sourceforge.plantuml.Run.processArgs(Run.java:420) 
at net.sourceforge.plantuml.Run.manageAllFiles(Run.java:387) 
at net.sourceforge.plantuml.Run.main(Run.java:222) 
Exception in thread "main" java.lang.UnsupportedOperationException: Compression not supported. 
at net.sourceforge.plantuml.crash.CrashReportHandler.exportDiagramError(CrashReportHandler.java:70) 
at net.sourceforge.plantuml.UmlDiagram.exportDiagramNow(UmlDiagram.java:166) 
at net.sourceforge.plantuml.Run.main(Run.java:222)

1 Answer

+1 vote
answered Oct 14 by plantuml (297,300 points)
selected Oct 15 by dragondive
 
Best answer
On certain JVMs (notably on Windows Server 2022 runners), the call to configure compression mode and quality could throw an exception, which caused the crash you observed.

This was fixed in https://github.com/plantuml/plantuml/commit/d3fdcbd5a2fc575375c1d687806bed61f4c25355 by wrapping the compression configuration in a try/catch block.

This change ensures that if the JVM or image writer does not support explicit compression settings, PlantUML logs a warning instead of failing.
That explains why the problem disappears in 1.2025.8 and also why it only affected specific environments.

Using a try/catch around the compression settings isn't a great solution, but it works in practice.
...