antlr / antlr/stringtemplate4

MalforumedURIExceptin when import STG as resource stream in jar

Open
#190 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.