In a headless linux environment svg fails
An IllegalArgumentException is thrown with the following stack trace:
java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at de.erichseifert.gral.io.plots.DrawableWriterFactory.get(SourceFile:81) ...(My API stack)... Caused by: java.lang.IllegalArgumentException: Unsupported file format: image/svg+xml at de.erichseifert.gral.io.plots.VectorWriter.
(SourceFile:132) ... 38 more java.lang.IllegalArgumentException: Unsupported MIME type: image/svg+xml at de.erichseifert.gral.io.plots.DrawableWriterFactory.get(SourceFile:104) ...(My API stack)...
the message from the Exception is :
Unsupported MIME type: image/svg+xml
To reproduce use a headless server or docker image (make sure it is actually headless)
This is how I used the writer (note that it works perfectly fine on windows):
try {
DrawableWriter writer = DrawableWriterFactory.getInstance().get("image/svg+xml");
writer.write(plot, outputStream, 1450, 538);
} catch (IOException e) {
e.printStackTrace();
}
This is likely related to issue https://github.com/eseifert/gral/issues/145
Thanks for reporting this. I’ll have a look into it as soon as I can.