Author: sebb
Date: Tue Apr 12 17:17:45 2011
New Revision: 1091505

URL: http://svn.apache.org/viewvc?rev=1091505&view=rev
Log:
Bug 51002 - Stop Thread if CSV file is not available. JMeter now treats IOError 
as EOF.

Modified:
    jakarta/jmeter/trunk/src/components/org/apache/jmeter/config/CSVDataSet.java
    jakarta/jmeter/trunk/xdocs/changes.xml

Modified: 
jakarta/jmeter/trunk/src/components/org/apache/jmeter/config/CSVDataSet.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/components/org/apache/jmeter/config/CSVDataSet.java?rev=1091505&r1=1091504&r2=1091505&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/components/org/apache/jmeter/config/CSVDataSet.java 
(original)
+++ 
jakarta/jmeter/trunk/src/components/org/apache/jmeter/config/CSVDataSet.java 
Tue Apr 12 17:17:45 2011
@@ -132,7 +132,6 @@ public class CSVDataSet extends ConfigTe
                 vars = JOrphanUtils.split(names, ","); // $NON-NLS-1$
             }
         }
-        try {
             String delim = getDelimiter();
             if (delim.equals("\\t")) { // $NON-NLS-1$
                 delim = "\t";// Make it easier to enter a Tab // $NON-NLS-1$
@@ -142,13 +141,22 @@ public class CSVDataSet extends ConfigTe
             }
             // TODO: fetch this once as per vars above?
             JMeterVariables threadVars = context.getVariables();
-            String line = server.readLine(alias, getRecycle(), 
firstLineIsNames);
+            String line = null;
+            try {
+                line = server.readLine(alias, getRecycle(), firstLineIsNames);
+            } catch (IOException e) { // treat the same as EOF
+                log.error(e.toString());
+            }
             if (line!=null) {// i.e. not EOF
-                String[] lineValues = getQuotedData() ?
-                        CSVSaveService.csvSplitString(line, delim.charAt(0))
-                        : JOrphanUtils.split(line, delim, false);
-                for (int a = 0; a < vars.length && a < lineValues.length; a++) 
{
-                    threadVars.put(vars[a], lineValues[a]);
+                try {
+                    String[] lineValues = getQuotedData() ?
+                            CSVSaveService.csvSplitString(line, 
delim.charAt(0))
+                            : JOrphanUtils.split(line, delim, false);
+                            for (int a = 0; a < vars.length && a < 
lineValues.length; a++) {
+                                threadVars.put(vars[a], lineValues[a]);
+                            }
+                } catch (IOException e) { // Should only happen for quoting 
errors
+                   log.error("Unexpected error splitting '"+line+"' on 
'"+delim.charAt(0)+"'");
                 }
                 // TODO - report unused columns?
                 // TODO - provide option to set unused variables ?
@@ -160,9 +168,6 @@ public class CSVDataSet extends ConfigTe
                     threadVars.put(vars[a], EOFVALUE);
                 }
             }
-        } catch (IOException e) {// TODO - should the error be indicated in 
the variables?
-            log.error(e.toString());
-        }
     }
 
     /**

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=1091505&r1=1091504&r2=1091505&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Tue Apr 12 17:17:45 2011
@@ -138,6 +138,7 @@ Bug 50675 - CVS Data Set Config incompat
 Fixed RMI startup to provide location of JMX file relative to user.dir.
 </li>
 <li>Bug 50221 - Renaming elements in the tree does not resize label</li>
+<li>Bug 51002 - Stop Thread if CSV file is not available. JMeter now treats 
IOError as EOF.</li>
 </ul>
 
 <!-- ==================================================== -->



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@jakarta.apache.org
For additional commands, e-mail: notifications-h...@jakarta.apache.org

Reply via email to