stringtemplate4 icon indicating copy to clipboard operation
stringtemplate4 copied to clipboard

MalforumedURIExceptin when import STG as resource stream in jar

Open charlesritchea opened this issue 8 years ago • 1 comments

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.

charlesritchea avatar Sep 06 '17 13:09 charlesritchea

Is this related to https://github.com/antlr/stringtemplate4/pull/207 ?

parrt avatar Nov 08 '18 20:11 parrt