Remove redundant class members, turn others to local variables. (sonar) 23/1123/1
authorAlissa Bonas <abonas@redhat.com>
Sun, 8 Sep 2013 16:09:21 +0000 (19:09 +0300)
committerAlissa Bonas <abonas@redhat.com>
Sun, 8 Sep 2013 16:09:21 +0000 (19:09 +0300)
Change-Id: I90c1c9cea67bd62900876ee373c86a33eb80765d
Signed-off-by: Alissa Bonas <abonas@redhat.com>
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/ReadFromFile.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/WriteToFile.java

index 1d31eaa..a9c9e3e 100644 (file)
@@ -20,20 +20,16 @@ import java.io.*;
  */
 public class ReadFromFile {
     private FileInputStream fileStream;
-    private DataInputStream dataInput;
-    private BufferedReader bufferedReader;
-    private String fileName;
     private File filePointer;
 
-    public ReadFromFile(String name) throws FileNotFoundException {
-        fileName = name;
-        fileStream = new FileInputStream(this.fileName);
+    public ReadFromFile(String fileName) throws FileNotFoundException {
+        fileStream = new FileInputStream(fileName);
         filePointer = new File(fileName); //needed to allow file deletion
     }
 
     public ArrayList<String> readFile() throws IOException {
-        dataInput = new DataInputStream(this.fileStream);
-        bufferedReader = new BufferedReader(new InputStreamReader(dataInput));
+        DataInputStream dataInput = new DataInputStream(this.fileStream);
+        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(dataInput));
 
         ArrayList<String> lineList = new ArrayList<String>();
         String line;
index b462432..2717c94 100644 (file)
@@ -26,10 +26,8 @@ public class WriteToFile {
     .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);
     }