Salome HOME
PMD plugin is refreshed. Some code is modified to respect PMD rules. Ant build proced...
[tools/siman.git] / Workspace / SPlat / src / org / splat / manox / XDOM.java
index 8cc45982fe8676bd66126b7228381a3e992d5ba3..3c2eea1d242c8800ae1ee008ba3f59422d5078ce 100644 (file)
@@ -5,7 +5,6 @@ package org.splat.manox;
  * @copyright OPEN CASCADE 2012
  */
 
-import org.apache.log4j.Logger;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
@@ -20,6 +19,7 @@ import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
+import org.apache.log4j.Logger;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -27,9 +27,9 @@ import org.w3c.dom.NodeList;
 
 public class XDOM {
 
-    private final static  Logger  logger = Logger.getLogger(XDOM.class);
+    private final static  Logger  LOGGER = Logger.getLogger(XDOM.class);
 
-    public static org.w3c.dom.Document createDocument (String name) {
+    public static org.w3c.dom.Document createDocument (final String name) {
 //  ---------------------------------------------------------------
       DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
       try {
@@ -42,17 +42,19 @@ public class XDOM {
         return document;
       }
       catch (Exception error) {
-        logger.error("Could not create document " + name + ", reason:", error);
+        LOGGER.error("Could not create document " + name + ", reason:", error);
         return null;
       }
        }
 
-    public static Node getChildNode (String name, Node from) {
+    public static Node getChildNode (final String name, final Node from) {
 //  --------------------------------------------------------
       NodeList nlist = from.getChildNodes();
       for (int i=0; i<nlist.getLength(); i++) {
         Node cnode = nlist.item(i);
-        if (cnode.getNodeName().equals(name)) return cnode;
+        if (cnode.getNodeName().equals(name)) {
+                       return cnode;
+               }
       }
       return null;
     }
@@ -64,13 +66,15 @@ public class XDOM {
       for (int i=0; i<nlist.getLength(); i++) {
         node = nlist.item(i);
         String name = node.getNodeName();
-        if (name.startsWith("#")) continue;
+        if (name.startsWith("#")) {
+                       continue;
+               }
         result.put(name, node);
       }
       return result;
        }
        
-       public static boolean saveDocument (File xmlOutputFile, org.w3c.dom.Document doc) {
+       public static boolean saveDocument (final File xmlOutputFile, final org.w3c.dom.Document doc) {
 //  ---------------------------------------------------------------------------------
 //    Open output stream where XML Document will be saved
 //    File xmlOutputFile = new File(fileName);
@@ -80,7 +84,7 @@ public class XDOM {
         fos = new FileOutputStream(xmlOutputFile);
       }
       catch (FileNotFoundException error) {
-        logger.error("Could not open the " + xmlOutputFile.getName() + " file, reason:", error);
+        LOGGER.error("Could not open the " + xmlOutputFile.getName() + " file, reason:", error);
         return false;
       }
 //    Use a Transformer for output
@@ -89,7 +93,7 @@ public class XDOM {
         transformer = transformerFactory.newTransformer();
       }
       catch (TransformerConfigurationException error) {
-        logger.error("Transformer configuration error, reason:", error);
+        LOGGER.error("Transformer configuration error, reason:", error);
         return false;
       }
       DOMSource    source = new DOMSource(doc);
@@ -99,7 +103,7 @@ public class XDOM {
         transformer.transform(source, result);
       }
       catch (TransformerException error) {
-        logger.error("Error during XML transformation, reason:", error);
+        LOGGER.error("Error during XML transformation, reason:", error);
       }
       return true;
     }