[ONOS-5141],[ONOS-5142],[ONOS-5165],[ONOS-4881],[ONOS-4889],[ONOS-5104],[ONOS-5138] defect fixes

Change-Id: I435dc0cf9afae7230fc98b57f33af104e0e38e67
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java
index f89ad3d..08a6d9b 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java
@@ -227,7 +227,10 @@
         } else if (javaCodeGeneratorInfo instanceof YangChoice) {
             /*Do nothing, only the interface needs to be generated*/
         } else {
-            throw new TranslatorException("Unsupported Node Translation");
+            throw new TranslatorException("Unsupported Node Translation "
+                    + javaCodeGeneratorInfo.getLineNumber() + " at " +
+                    javaCodeGeneratorInfo.getCharPosition()
+                    + " in " + javaCodeGeneratorInfo.getFileName());
         }
     }
 
@@ -242,7 +245,10 @@
                                           YangPluginConfig yangPluginConfig)
             throws IOException {
         if (!(javaCodeGeneratorInfo instanceof YangNode)) {
-            throw new TranslatorException("translation is not supported for the node");
+            throw new TranslatorException("translation is not supported for the node "
+                    + javaCodeGeneratorInfo.getLineNumber() + " at " +
+                    javaCodeGeneratorInfo.getCharPosition()
+                    + " in " + javaCodeGeneratorInfo.getFileName());
         }
         createTempFragmentFile(javaCodeGeneratorInfo);
         updateTempFragmentFiles(javaCodeGeneratorInfo, yangPluginConfig);
@@ -288,7 +294,10 @@
                                                      YangPluginConfig yangPlugin, boolean isMultiInstance)
             throws IOException {
         if (!(javaCodeGeneratorInfo instanceof YangNode)) {
-            throw new TranslatorException("Invalid node for translation");
+            throw new TranslatorException("Invalid node for translation " +
+                    javaCodeGeneratorInfo.getLineNumber() + " at " +
+                    javaCodeGeneratorInfo.getCharPosition()
+                    + " in " + javaCodeGeneratorInfo.getFileName());
         }
 
         /*
@@ -313,7 +322,10 @@
                                                      YangPluginConfig yangPlugin)
             throws IOException {
         if (!(javaCodeGeneratorInfo instanceof YangNode)) {
-            throw new TranslatorException("invalid node for translation");
+            throw new TranslatorException("invalid node for translation " +
+                    javaCodeGeneratorInfo.getLineNumber() + " at " +
+                    javaCodeGeneratorInfo.getCharPosition()
+                    + " in " + javaCodeGeneratorInfo.getFileName());
         }
 
         generateCodeOfNode(javaCodeGeneratorInfo, yangPlugin);
@@ -375,7 +387,10 @@
                                           YangPluginConfig yangPluginConfig)
             throws IOException {
         if (!(javaCodeGeneratorInfo instanceof YangNode)) {
-            throw new TranslatorException("invalid node for translation");
+            throw new TranslatorException("invalid node for translation "
+                    + javaCodeGeneratorInfo.getLineNumber() + " at " +
+                    javaCodeGeneratorInfo.getCharPosition()
+                    + " in " + javaCodeGeneratorInfo.getFileName());
         }
         updatePackageInfo(javaCodeGeneratorInfo, yangPluginConfig);
         generateTempFiles(javaCodeGeneratorInfo, yangPluginConfig);
@@ -393,7 +408,10 @@
                                               YangPluginConfig yangPluginConfig, String rootPkg)
             throws IOException {
         if (!(javaCodeGeneratorInfo instanceof YangNode)) {
-            throw new TranslatorException("invalid node for translation");
+            throw new TranslatorException("invalid node for translation " + javaCodeGeneratorInfo.getLineNumber()
+                    + " at " +
+                    javaCodeGeneratorInfo.getCharPosition()
+                    + " in " + javaCodeGeneratorInfo.getFileName());
         }
         updatePackageInfo(javaCodeGeneratorInfo, yangPluginConfig, rootPkg);
 
@@ -415,12 +433,20 @@
         String pkg;
         if (!(curNode instanceof JavaFileInfoContainer)
                 || curNode.getParent() == null) {
-            throw new TranslatorException("missing parent node to get current node's package");
+            throw new TranslatorException("missing parent node to get current node's package " +
+                    curNode.getName() + " in " +
+                    curNode.getLineNumber() + " at " +
+                    curNode.getCharPosition()
+                    + " in " + curNode.getFileName());
         }
 
         YangNode parentNode = DataModelUtils.getParentNodeInGenCode(curNode);
         if (!(parentNode instanceof JavaFileInfoContainer)) {
-            throw new TranslatorException("missing parent java node to get current node's package");
+            throw new TranslatorException("missing parent java node to get current node's package " +
+                    curNode.getName() + " in " +
+                    curNode.getLineNumber() + " at " +
+                    curNode.getCharPosition()
+                    + " in " + curNode.getFileName());
         }
         JavaFileInfoTranslator parentJavaFileHandle = ((JavaFileInfoContainer) parentNode).getJavaFileInfo();
         pkg = parentJavaFileHandle.getPackage() + PERIOD + parentJavaFileHandle.getJavaName();
@@ -460,6 +486,26 @@
     }
 
     /**
+     * Returns true if only augment nodes present in module.
+     *
+     * @param curNode root node
+     * @return true if only augment nodes present in module
+     */
+    public static boolean isOnlyAugmentNodeInRoot(YangNode curNode) {
+        List<Boolean> booleanData = new ArrayList<>();
+        curNode = curNode.getChild();
+        while (curNode != null) {
+            if (curNode instanceof YangAugment) {
+                booleanData.add(true);
+            } else {
+                booleanData.add(false);
+            }
+            curNode = curNode.getNextSibling();
+        }
+        return !booleanData.contains(false);
+    }
+
+    /**
      * Returns nodes package.
      *
      * @param node             YANG node