Minor code refactoring and improvements.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / yang-model-parser-impl / src / main / java / org / opendaylight / controller / yang / parser / util / ParserUtils.java
index 64b06ad68ac4486389374d7c6ec0c5e16e35f245..87075e212205210dbb1da423bf2585cc9bea4fb6 100644 (file)
@@ -501,7 +501,7 @@ public final class ParserUtils {
         }
 
         // set correct path for all cases
-        if(childNode instanceof ChoiceBuilder) {
+        if (childNode instanceof ChoiceBuilder) {
             ChoiceBuilder choiceBuilder = (ChoiceBuilder) childNode;
             for (ChoiceCaseBuilder choiceCaseBuilder : choiceBuilder.getCases()) {
                 correctAugmentChildPath(choiceCaseBuilder, childNode.getPath());
@@ -601,11 +601,12 @@ public final class ParserUtils {
 
     private static TypeDefinition<?> createCorrectTypeDefinition(SchemaPath parentSchemaPath, QName nodeQName,
             TypeDefinition<?> nodeType) {
-        QName nodeTypeQName = nodeType.getQName();
-        SchemaPath newSchemaPath = createNewSchemaPath(parentSchemaPath, nodeQName, nodeTypeQName);
         TypeDefinition<?> result = null;
 
         if (nodeType != null) {
+            QName nodeTypeQName = nodeType.getQName();
+            SchemaPath newSchemaPath = createNewSchemaPath(parentSchemaPath, nodeQName, nodeTypeQName);
+
             if (nodeType instanceof BinaryTypeDefinition) {
                 BinaryTypeDefinition binType = (BinaryTypeDefinition) nodeType;