Code Improvements-Vnfsdk-refrepo sonar issue fixes
[vnfsdk/refrepo.git] / vnfmarket-be / vnf-sdk-marketplace / src / main / java / org / onap / vnfsdk / marketplace / common / FileUtil.java
index 5697ddf..777080f 100644 (file)
@@ -57,11 +57,7 @@ public final class FileUtil {
      */
     public static boolean createDirectory(String dir) {
         File folder = new File(dir);
-            if (!folder.exists() && !folder.mkdirs()) {
-                return false;
-            } else {
-                return true;
-            }
+        return folder.exists() || folder.mkdirs();
     }
 
     /**
@@ -156,7 +152,7 @@ public final class FileUtil {
             gson.toJson(obj, writer);
             bResult = true;
         } catch (Exception e) { //NOSONAR
-            logger.info("Exception: writeJsonDatatoFile-->" + fileAbsPath, e);
+            logger.info("Exception: writeJsonDatatoFile-->{} {}" , fileAbsPath, e);
         }
         return bResult;
     }
@@ -180,7 +176,7 @@ public final class FileUtil {
         try(JsonReader jsonReader = new JsonReader(new FileReader(fileAbsPath))) {
             obj = gson.fromJson(jsonReader, clazz);
         } catch (Exception e1) { //NOSONAR
-            logger.info("IOException Exception: writeJsonDatatoFile-->" + fileAbsPath, e1);
+            logger.info("IOException Exception: writeJsonDatatoFile-->{} {}" , fileAbsPath, e1);
         }
         return obj;
     }