jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1210151 - /jmeter/trunk/src/functions/org/apache/jmeter/functions/StringFromFile.java
Date Sun, 04 Dec 2011 17:32:03 GMT
Author: pmouawad
Date: Sun Dec  4 17:32:03 2011
New Revision: 1210151

URL: http://svn.apache.org/viewvc?rev=1210151&view=rev
Log:
Reverting closeFile removal

Modified:
    jmeter/trunk/src/functions/org/apache/jmeter/functions/StringFromFile.java

Modified: jmeter/trunk/src/functions/org/apache/jmeter/functions/StringFromFile.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/functions/org/apache/jmeter/functions/StringFromFile.java?rev=1210151&r1=1210150&r2=1210151&view=diff
==============================================================================
--- jmeter/trunk/src/functions/org/apache/jmeter/functions/StringFromFile.java (original)
+++ jmeter/trunk/src/functions/org/apache/jmeter/functions/StringFromFile.java Sun Dec  4
17:32:03 2011
@@ -35,7 +35,6 @@ import org.apache.jmeter.threads.JMeterV
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.jorphan.util.JMeterStopThreadException;
-import org.apache.jorphan.util.JOrphanUtils;
 import org.apache.log.Logger;
 
 /**
@@ -111,6 +110,22 @@ public class StringFromFile extends Abst
 
     private int myEnd = COUNT_UNUSED;
 
+    /**
+     * Close file and log
+     */
+    private void closeFile() {
+        if (myBread == null) {
+            return;
+        }
+        String tn = Thread.currentThread().getName();
+        log.info(tn + " closing file " + fileName);//$NON-NLS-1$
+        try {
+            myBread.close();
+        } catch (IOException e) {
+            log.error("closeFile() error: " + e.toString(), e);//$NON-NLS-1$
+        }
+    }
+    
     private void openFile() {
         String tn = Thread.currentThread().getName();
         fileName = ((CompoundVariable) values[0]).execute();
@@ -205,7 +220,7 @@ public class StringFromFile extends Abst
                 if (line == null) { // EOF, re-open file
                     String tn = Thread.currentThread().getName();
                     log.info(tn + " EOF on  file " + fileName);//$NON-NLS-1$
-                    JOrphanUtils.closeQuietly(myBread);
+                    closeFile();
                     openFile();
                     if (myBread != null) {
                         line = myBread.readLine();
@@ -302,7 +317,7 @@ public class StringFromFile extends Abst
 
     /** {@inheritDoc} */
     public void testEnded(String host) {
-        JOrphanUtils.closeQuietly(myBread);
+    	closeFile();
     }
 
     /** {@inheritDoc} */



Mime
View raw message