Fixed missing slash in generated YangModuleInfo implementations 81/4981/2
authorTony Tkacik <ttkacik@cisco.com>
Fri, 31 Jan 2014 13:09:34 +0000 (14:09 +0100)
committerTony Tkacik <ttkacik@cisco.com>
Fri, 31 Jan 2014 13:09:34 +0000 (14:09 +0100)
Change-Id: I2d667fe8c7ddb9c18d521a314f9b00c133141b6a
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
code-generator/binding-java-api-generator/src/main/java/org/opendaylight/yangtools/sal/java/api/generator/YangModuleInfoTemplate.xtend

index b805fb232358244205842c4aa87b6c103941a2fb..7c19f20a9db35d6b6263b8ce49c7050031fb2b4a 100644 (file)
@@ -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»