Remove redundant class members, turn others to local variables. (sonar)
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / utils / WriteToFile.java
index 0345b90cd729001a27e0fe0da59d8eff4b42ff15..2717c942287ff42932159d95c2b0957a9c4dfb67 100644 (file)
@@ -12,6 +12,9 @@ package org.opendaylight.controller.sal.utils;
 import java.io.*;
 import java.util.ArrayList;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * Convenience object to write a file
  *
@@ -19,12 +22,12 @@ import java.util.ArrayList;
  *
  */
 public class WriteToFile {
+    protected static final Logger logger = LoggerFactory
+    .getLogger(WriteToFile.class);
     private FileWriter fstream;
     private BufferedWriter bufferOut;
-    private String fileName;
 
-    public WriteToFile(String name) throws IOException {
-        fileName = name;
+    public WriteToFile(String fileName) throws IOException {
         fstream = new FileWriter(fileName);
         bufferOut = new BufferedWriter(fstream);
     }
@@ -37,7 +40,7 @@ public class WriteToFile {
         try {
             this.bufferOut.flush();
         } catch (IOException e) {
-            e.printStackTrace();
+            logger.error("",e);
         }
     }