Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

StructurizrPlantUMLExporter crashes when used in native binaries #47

Closed
dylanwatsonsoftware opened this issue Feb 24, 2023 · 0 comments · Fixed by #48
Closed

StructurizrPlantUMLExporter crashes when used in native binaries #47

dylanwatsonsoftware opened this issue Feb 24, 2023 · 0 comments · Fixed by #48

Comments

@dylanwatsonsoftware
Copy link
Contributor

dylanwatsonsoftware commented Feb 24, 2023

Problem:
If StructurizrPlantUMLExporter is compiled into a native binary with graalvm, it crashes at runtime since AWT classes are not available,

Context:
The plant UML exporter uses java.awt.image.BufferedImage to determine the icon size but this is not available on the classpath currently in graalvm builds.

There is currently an UnsatisfiedLinkError that is thrown when this happens but since the try/catch handler in the method that uses BufferedImage is only catching Exception, this isn't caught.

Solution:
I believe the simplest solution is to simply catch ANY Throwables inStructurizrPlantUMLExporter#calculateIconScale
This will allow the process to continue on, without completely failing. Possibly we could just also just swallow UnsatisfiedLinkErrors rather than printing the stacktrace in that case, since this is a known error and not one we'd want to spam the logs for.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant