[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/utils/JavaFileGeneratorUtils.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGeneratorUtils.java
index a591435..09bb72b 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGeneratorUtils.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGeneratorUtils.java
@@ -334,6 +334,12 @@
                                                   String pkg, YangPluginConfig pluginConfig)
             throws IOException {
 
+        if (file.exists()) {
+            throw new IOException(" file " + file.getName() + " is already generated." +
+                    "please check whether multiple yang files has same module/submodule \"name\" and \"namespace\"" +
+                    "or You may have generated code of previous build present in your directory.");
+        }
+
         boolean isFileCreated;
         try {
             isFileCreated = file.createNewFile();
@@ -360,6 +366,11 @@
                                                   YangNode curNode, String className)
             throws IOException {
 
+        if (file.exists()) {
+            throw new IOException(" file " + file.getName() + " is already generated." +
+                    "please check whether multiple yang files has same module/submodule \"name\" and \"namespace\"" +
+                    "or You may have generated code of previous build present in your directory.");
+        }
         boolean isFileCreated;
         try {
             isFileCreated = file.createNewFile();