Svace : Apply svace fixes
authorbdragon.park <bdragon.park@samsung.com>
Wed, 18 Oct 2017 07:47:03 +0000 (16:47 +0900)
committerbdragon.park <bdragon.park@samsung.com>
Wed, 18 Oct 2017 07:47:03 +0000 (16:47 +0900)
- 302771, 302772, 302773, 302799, 302800, 302801

Signed-off-by: bdragon.park <bdragon.park@samsung.com>
rt-ide/tizen.rt.product.meta/src/org/tizen/rt/product/meta/util/MetaModelUtil.java

index 1416211..f88f39f 100755 (executable)
@@ -79,10 +79,21 @@ public class MetaModelUtil {
      * @throws JAXBException
      */
     public static Build copyDefaultBuildModelAndLoad(String destination) throws IOException, JAXBException {
-        InputStream source = RtMetaPlugin.class.getResourceAsStream("resources" + File.separator + IModelConstants.FILE_NAME_BUILD_META_XML);
-        Build model = copyDefaultModelAndLoad(Build.class, source, destination);
-        if (source != null) {
-            source.close();
+        Build model = null;
+        InputStream source = null;
+        try {
+            source = RtMetaPlugin.class.getResourceAsStream("resources" + File.separator + IModelConstants.FILE_NAME_BUILD_META_XML);
+            model = copyDefaultModelAndLoad(Build.class, source, destination);
+        } catch (Exception e) {
+            throw e;
+        } finally {
+            if (source != null) {
+                try {
+                    source.close();
+                } catch (IOException e) {
+                    // Do nothing
+                }
+            }
         }
         return model;
     }
@@ -95,10 +106,21 @@ public class MetaModelUtil {
      * @throws JAXBException
      */
     public static Flash copyDefaultFlashModelAndLoad(String destination) throws IOException, JAXBException {
-        InputStream source = RtMetaPlugin.class.getResourceAsStream("resources" + File.separator + IModelConstants.FILE_NAME_FLASH_META_XML);
-        Flash model = copyDefaultModelAndLoad(Flash.class, source, destination);
-        if (source != null) {
-            source.close();
+        Flash model = null;
+        InputStream source = null;
+        try {
+            source = RtMetaPlugin.class.getResourceAsStream("resources" + File.separator + IModelConstants.FILE_NAME_FLASH_META_XML);
+            model = copyDefaultModelAndLoad(Flash.class, source, destination);
+        } catch (Exception e) {
+            throw e;
+        } finally {
+            if (source != null) {
+                try {
+                    source.close();
+                } catch (IOException e) {
+                    // Do nothing
+                }
+            }
         }
         return model;
     }
@@ -111,10 +133,21 @@ public class MetaModelUtil {
      * @throws JAXBException
      */
     public static Debugs copyDefaultDebugModelAndLoad(String destination) throws IOException, JAXBException {
-        InputStream source = RtMetaPlugin.class.getResourceAsStream("resources" + File.separator + IModelConstants.FILE_NAME_DEBUG_META_XML);
-        Debugs model = copyDefaultModelAndLoad(Debugs.class, source, destination);
-        if (source != null) {
-            source.close();
+        Debugs model = null;
+        InputStream source = null;
+        try {
+            source = RtMetaPlugin.class.getResourceAsStream("resources" + File.separator + IModelConstants.FILE_NAME_DEBUG_META_XML);
+            model = copyDefaultModelAndLoad(Debugs.class, source, destination);
+        } catch (Exception e) {
+            throw e;
+        } finally {
+            if (source != null) {
+                try {
+                    source.close();
+                } catch (IOException e) {
+                    // Do nothing
+                }
+            }
         }
         return model;
     }
@@ -325,28 +358,58 @@ public class MetaModelUtil {
 
     public static void validateBuildFile(InputStream xmlFileStream)
             throws FileNotFoundException, ParserConfigurationException, SAXException, IOException {
-        InputStream xsdFileStream = RtMetaPlugin.class.getResourceAsStream("resources/buildSpec.xsd"); //$NON-NLS-1$
-        validate(xmlFileStream, xsdFileStream);
-        if (xsdFileStream != null) {
-            xsdFileStream.close();
+        InputStream xsdFileStream = null;
+        try {
+            xsdFileStream = RtMetaPlugin.class.getResourceAsStream("resources/buildSpec.xsd"); //$NON-NLS-1$
+            validate(xmlFileStream, xsdFileStream);
+        } catch (Exception e) {
+            throw e;
+        } finally {
+            if (xsdFileStream != null) {
+                try {
+                    xsdFileStream.close();
+                } catch (IOException e) {
+                    // Do nothing
+                }
+            }
         }
     }
 
     public static void validateFlashFile(InputStream xmlFileStream)
             throws FileNotFoundException, ParserConfigurationException, SAXException, IOException {
-        InputStream xsdFileStream = RtMetaPlugin.class.getResourceAsStream("resources/flashSpec.xsd"); //$NON-NLS-1$
-        validate(xmlFileStream, xsdFileStream);
-        if (xsdFileStream != null) {
-            xsdFileStream.close();
+        InputStream xsdFileStream = null;
+        try {
+            xsdFileStream = RtMetaPlugin.class.getResourceAsStream("resources/flashSpec.xsd"); //$NON-NLS-1$
+            validate(xmlFileStream, xsdFileStream);
+        } catch (Exception e) {
+            throw e;
+        } finally {
+            if (xsdFileStream != null) {
+                try {
+                    xsdFileStream.close();
+                } catch (IOException e) {
+                    // Do nothing
+                }
+            }
         }
     }
 
     public static void validateDebugFile(InputStream xmlFileStream)
             throws FileNotFoundException, ParserConfigurationException, SAXException, IOException {
-        InputStream xsdFileStream = RtMetaPlugin.class.getResourceAsStream("resources/debugSpec.xsd"); //$NON-NLS-1$
-        validate(xmlFileStream, xsdFileStream);
-        if (xsdFileStream != null) {
-            xsdFileStream.close();
+        InputStream xsdFileStream = null;
+        try {
+            xsdFileStream = RtMetaPlugin.class.getResourceAsStream("resources/debugSpec.xsd"); //$NON-NLS-1$
+            validate(xmlFileStream, xsdFileStream);
+        } catch (Exception e) {
+            throw e;
+        } finally {
+            if (xsdFileStream != null) {
+                try {
+                    xsdFileStream.close();
+                } catch (IOException e) {
+                    // Do nothing
+                }
+            }
         }
     }