We have a number of test resources which are considered in JPMS
world -- and hence we cannot rely on utilities to load them, as
those utilities are not authorized to use them.
Since we do not want to update massive amounts of tests, just change
how we load resources -- go through Class.getResource() and turn
that into a File and use that. That way StmtTestUtils is the caller
and it is inside our module and is allowed to do that.
JIRA: YANGTOOLS-1151
Change-Id: I6cd43e7cc7ddc1b6c3cbac5875dd9716d43be684
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
public static StatementStreamSource sourceForResource(final String resourceName) {
try {
public static StatementStreamSource sourceForResource(final String resourceName) {
try {
- return YangStatementStreamSource.create(YangTextSchemaSource.forResource(
- StmtTestUtils.class, resourceName));
- } catch (IOException | YangSyntaxErrorException e) {
+ return YangStatementStreamSource.create(YangTextSchemaSource.forFile(new File(
+ StmtTestUtils.class.getResource(resourceName).toURI())));
+ } catch (IOException | YangSyntaxErrorException | URISyntaxException e) {
throw new IllegalArgumentException("Failed to create source", e);
}
}
throw new IllegalArgumentException("Failed to create source", e);
}
}