You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2019/08/01 18:56:06 UTC

[jmeter] branch master updated (eec7b05 -> 2d8e630)

This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git.


    from eec7b05  Use jayways github page for JSONPath reference in docs
     new 5f41f75  Log more details on broken CSV files
     new 2d8e630  Spacepolice

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/jmeter/report/core/CsvSampleReader.java   | 20 ++++++++++++++++----
 .../jmeter/report/dashboard/ReportGenerator.java     |  2 +-
 .../jmeter/gui/action/HtmlReportGeneratorSpec.groovy |  2 +-
 3 files changed, 18 insertions(+), 6 deletions(-)


[jmeter] 02/02: Spacepolice

Posted by fs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit 2d8e630039afd439ca852cc705cc6f666184e899
Author: Felix Schumacher <fe...@internetallee.de>
AuthorDate: Thu Aug 1 20:53:45 2019 +0200

    Spacepolice
    
    Don't squash the exception cause directly to our own message.
---
 src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java     | 2 +-
 test/src/org/apache/jmeter/gui/action/HtmlReportGeneratorSpec.groovy | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java b/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java
index 3c32b7d..ecf1287 100644
--- a/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java
+++ b/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java
@@ -244,7 +244,7 @@ public class ReportGenerator {
         try {
             source.run(); // NOSONAR
         } catch (SampleException ex) {
-            throw new GenerationException("Error while processing samples:"+ex.getMessage(), ex);
+            throw new GenerationException("Error while processing samples: " + ex.getMessage(), ex);
         }
         log.debug("End of samples processing");
 
diff --git a/test/src/org/apache/jmeter/gui/action/HtmlReportGeneratorSpec.groovy b/test/src/org/apache/jmeter/gui/action/HtmlReportGeneratorSpec.groovy
index da87499..9263156 100644
--- a/test/src/org/apache/jmeter/gui/action/HtmlReportGeneratorSpec.groovy
+++ b/test/src/org/apache/jmeter/gui/action/HtmlReportGeneratorSpec.groovy
@@ -127,7 +127,7 @@ class HtmlReportGeneratorSpec extends JMeterSpec{
             List<String> resultList = htmlReportGenerator.run()
         then:
             testDirectory.list().length == 0
-            resultList.get(0).contains("An error occurred: Error while processing samples:Consumer failed with message")
+            resultList.get(0).contains("An error occurred: Error while processing samples: Consumer failed with message")
         cleanup:
             if(testDirectory.exists()) {
                 if (testDirectory.list().length>0) {


[jmeter] 01/02: Log more details on broken CSV files

Posted by fs...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit 5f41f757ba6cfaee6d95892f1c15eff1d56d638b
Author: Felix Schumacher <fe...@internetallee.de>
AuthorDate: Thu Aug 1 20:49:56 2019 +0200

    Log more details on broken CSV files
    
    When corrupt CSV files are read by ReportGenerator it is often
    not clear enough where the broken data in the file is. Give
    more details in log messages and exceptions.
    
    Inspired by Bugzilla Id: 63614
---
 .../apache/jmeter/report/core/CsvSampleReader.java   | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/core/org/apache/jmeter/report/core/CsvSampleReader.java b/src/core/org/apache/jmeter/report/core/CsvSampleReader.java
index 36cfe4e..fb889fe 100644
--- a/src/core/org/apache/jmeter/report/core/CsvSampleReader.java
+++ b/src/core/org/apache/jmeter/report/core/CsvSampleReader.java
@@ -140,6 +140,7 @@ public class CsvSampleReader implements Closeable{
             SampleMetadata result;
             // Read first line
             String line = reader.readLine();
+            this.row++;
             if (line == null) {
                 throw new IllegalArgumentException("File is empty");
             }
@@ -185,10 +186,7 @@ public class CsvSampleReader implements Closeable{
             data = CSVSaveService.csvReadFile(reader, separator);
             Sample sample = null;
             if (data.length > 0) {
-                if (data.length != columnCount+numberOfSampleVariablesInCsv) {
-                    throw new SampleException("Mismatch between expected number of columns:"+columnCount+" and columns in CSV file:"+data.length+
-                            ", check your jmeter.save.saveservice.* configuration or check line is complete");
-                }
+                assertCorrectColumns(data);
                 sample = new Sample(row++, metadata, data);
             }
             return sample;
@@ -197,6 +195,20 @@ public class CsvSampleReader implements Closeable{
         }
     }
 
+    private void assertCorrectColumns(String[] data) {
+        if (data.length != columnCount + numberOfSampleVariablesInCsv) {
+            if (log.isWarnEnabled()) {
+                log.warn("Short CSV read around line {} of file '{}'. Could only read {} elements of {} expected. Data is [{}]",
+                        Long.valueOf(row + 2), file, Integer.valueOf(data.length), Integer.valueOf(columnCount),
+                        String.join(", ", data));
+            }
+            throw new SampleException(
+                    "Mismatch between expected number of columns:" + columnCount + " and columns in CSV file:"
+                            + data.length + ", check your jmeter.save.saveservice.* configuration or check if line "
+                            + (row + 2) + " in '" + file + "' is complete");
+        }
+    }
+
     /**
      * @return next sample from the file.
      */