antlr / stringtemplate4

StringTemplate 4
http://www.stringtemplate.org
Other
955 stars 231 forks source link

MalforumedURIExceptin when import STG as resource stream in jar #190

Open charlesritchea opened 7 years ago

charlesritchea commented 7 years ago

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.

parrt commented 6 years ago

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