Fix of $YangModuleInfoImpl for ext. yang models 64/5364/1
authorLukas Sedlak <lsedlak@cisco.com>
Mon, 17 Feb 2014 11:38:53 +0000 (03:38 -0800)
committerLukas Sedlak <lsedlak@cisco.com>
Mon, 17 Feb 2014 11:38:53 +0000 (03:38 -0800)
Fixed bug in writeJavaSource method in CodeGeneratorImpl. If package does not exist the dir structure is created.
Without this fix yang models containing only extension definitions could not be generated.

Signed-off-by: Lukas Sedlak <lsedlak@cisco.com>
code-generator/maven-sal-api-gen-plugin/src/main/java/org/opendaylight/yangtools/maven/sal/api/gen/plugin/CodeGeneratorImpl.java

index 704596ec74dee97074ff8e935fbfa32af2eb8c96..8ee79ca105038dfa49751526cf68dc29ea08ee00 100644 (file)
@@ -168,6 +168,9 @@ public final class CodeGeneratorImpl implements CodeGenerator, BuildContextAware
     }
 
     private File writeJavaSource(File packageDir, String className, String source) {
+        if (!packageDir.exists()) {
+            packageDir.mkdirs();
+        }
         final File file = new File(packageDir, className + ".java");
         writeFile(file, source);
         return file;