From 7ef4283929c5ac7a8bb7b90e0ec0f57edcaa9939 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 21 Oct 2020 23:14:06 +0200 Subject: [PATCH] Change StmtTestUtils.sourceForResource() 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 --- .../org/opendaylight/yangtools/yang/stmt/StmtTestUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/StmtTestUtils.java b/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/StmtTestUtils.java index 3c784d309e..13a1e12a98 100644 --- a/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/StmtTestUtils.java +++ b/yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/StmtTestUtils.java @@ -79,9 +79,9 @@ public final class StmtTestUtils { 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); } } -- 2.36.6