From 8f42f38f1f21fe025350e0a2802b39723d0dd7c4 Mon Sep 17 00:00:00 2001 From: Tony Tkacik Date: Fri, 31 Jan 2014 14:09:34 +0100 Subject: [PATCH] Fixed missing slash in generated YangModuleInfo implementations Change-Id: I2d667fe8c7ddb9c18d521a314f9b00c133141b6a Signed-off-by: Tony Tkacik --- .../java/api/generator/YangModuleInfoTemplate.xtend | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/YangModuleInfoTemplate.xtend b/code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/YangModuleInfoTemplate.xtend index b805fb2323..7c19f20a9d 100644 --- a/code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/YangModuleInfoTemplate.xtend +++ b/code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/YangModuleInfoTemplate.xtend @@ -97,10 +97,9 @@ class YangModuleInfoTemplate { importedModules = «Collections.importedName».emptySet(); «ENDIF» - «val path = m.moduleSourcePath.replace(java.io.File.separatorChar, '/')» - «InputStream.importedName» stream = «CLASS».class.getResourceAsStream("«path»"); + «InputStream.importedName» stream = «CLASS».class.getResourceAsStream("«sourcePath»"); if (stream == null) { - throw new IllegalStateException("Resource «path» is missing"); + throw new IllegalStateException("Resource «sourcePath» is missing"); } try { stream.close(); @@ -127,9 +126,9 @@ class YangModuleInfoTemplate { @Override public «InputStream.importedName» getModuleSourceStream() throws IOException { - «InputStream.importedName» stream = «CLASS».class.getResourceAsStream("«path»"); + «InputStream.importedName» stream = «CLASS».class.getResourceAsStream("«sourcePath»"); if (stream == null) { - throw new «IOException.importedName»("Resource «path» is missing"); + throw new «IOException.importedName»("Resource «sourcePath» is missing"); } return stream; } @@ -139,6 +138,10 @@ class YangModuleInfoTemplate { return importedModules; } ''' + + def getSourcePath() { + return "/" + module.moduleSourcePath.replace(java.io.File.separatorChar, '/') + } private def imports() ''' «IF !importMap.empty» -- 2.36.6