stringtemplate4
stringtemplate4 copied to clipboard
MalforumedURIExceptin when import STG as resource stream in jar
This is for java.
I have a common TTML.stg that I import "TTML.stg" in a TTMLClock.stg and a TTMLSmpte.stg
They are all in the same directory.
When I
return new STGroupString(Resources.toString(CaptionTemplates.class.getResource(format("templates/%s.stg", name)), StandardCharsets.UTF_8));
I get a MalformedURLException always with null/ as the root directory
Is this a known limitation that import does not work with a stream?
The workaround is to use imporTemplates, which is fine, but without stream support, The import "Foo.stg" scheme couldn't work for resources inside jars. I saw a similar bug, but I didn't feel like it fully explained the consequences for Java.
Is this related to https://github.com/antlr/stringtemplate4/pull/207 ?