https://bz.apache.org/bugzilla/show_bug.cgi?id=63614

--- Comment #6 from [email protected] ---
The Command Line I Used is

"C:\apache-jmeter-5.1.1\bin\jmeter.bat" --nongui  --remotestart 
10.89.8.23,10.89.8.19,10.89.8.21,10.89.8.22,10.89.8.20   --testfile
C:\JMeterLoadTests\SDIS_REST\SDIS_AND_QRS_REST_Sampler.jmx  --logfile
"C:\JMeterLoadTests\SDIS_REST\D07292019_110334\SDIS\log\20KB\SDIS.log" 
--reportatendofloadtests  --reportoutputfolder
"C:\JMeterLoadTests\SDIS_REST\D07292019_110334\SDIS\report\20KB\SDIS_75vusers" 
  --remoteexit


@@@@@@@@@@@@@@@@@@@
I am copying code chunk taken from the class of
org.apache.jmeter.save.CSVSaveService of Source of Jmeter master branch(from
GIT code repo). I beleive this code is unable to parse the entries of errored
samples correctly. This code parses each line into a String Array.

For example, if you compare a successful entry and a failed entry:

Failed Entry from the report file:

2019/07/29 17:25:46.807,21034,ECMaaSRESTCreateDocSampler,500,Request
Failed,10.89.8.21-Thread Group 1-2,,false,Test failed: text expected to contain
/Successfully performed action/,14,0,15,15,null,0,0,0

Success Entry from report file:

2019/07/29 17:26:07.523,303,ECMaaSRESTCreateDocSampler,200,Successfully
performed action:  HOST_IPADDRESS =10.89.8.21,10.89.8.21-Thread Group
1-13,,true,,2539,0,15,15,null,0,0,0



The above both entries have same number of tokens. But the Jmeter code is
wrongly tokenizing the failed entry. The column count and token count becoming
unequal.


@@@@@@@@@@@@@@@@ code from line # 988 to 1075 @@@@@@@@@@@@@@@

   public static String[] csvReadFile(BufferedReader infile, char delim)
            throws IOException {
        int ch;
        ParserState state = ParserState.INITIAL;
        List<String> list = new ArrayList<>();
        CharArrayWriter baos = new CharArrayWriter(200);
        boolean push = false;
        while (-1 != (ch = infile.read())) {
            push = false;
            switch (state) {
            case INITIAL:
                if (ch == QUOTING_CHAR) {
                    state = ParserState.QUOTED;
                } else if (isDelimOrEOL(delim, ch)) {
                    push = true;
                } else {
                    baos.write(ch);
                    state = ParserState.PLAIN;
                }
                break;
            case PLAIN:
                if (ch == QUOTING_CHAR) {
                    baos.write(ch);
                    throw new IOException(
                            "Cannot have quote-char in plain field:["
                                    + baos.toString() + "]");
                } else if (isDelimOrEOL(delim, ch)) {
                    push = true;
                    state = ParserState.INITIAL;
                } else {
                    baos.write(ch);
                }
                break;
            case QUOTED:
                if (ch == QUOTING_CHAR) {
                    state = ParserState.EMBEDDEDQUOTE;
                } else {
                    baos.write(ch);
                }
                break;
            case EMBEDDEDQUOTE:
                if (ch == QUOTING_CHAR) {
                    baos.write(QUOTING_CHAR); // doubled quote => quote
                    state = ParserState.QUOTED;
                } else if (isDelimOrEOL(delim, ch)) {
                    push = true;
                    state = ParserState.INITIAL;
                } else {
                    baos.write(QUOTING_CHAR);
                    throw new IOException(
                            "Cannot have single quote-char in quoted field:["
                                    + baos.toString() + "]");
                }
                break;
            default:
                throw new IllegalStateException("Unexpected state " + state);
            } // switch(state)
            if (push) {
                if (ch == '\r') {// Remove following \n if present
                    infile.mark(1);
                    if (infile.read() != '\n') {
                        infile.reset(); // did not find \n, put the character
                                        // back
                    }
                }
                String s = baos.toString();
                list.add(s);
                baos.reset();
            }
            if ((ch == '\n' || ch == '\r') && state != ParserState.QUOTED) {
                break;
            }
        } // while not EOF
        if (ch == -1) {// EOF (or end of string) so collect any remaining data
            if (state == ParserState.QUOTED) {
                throw new IOException("Missing trailing quote-char in quoted
field:[\""
                        + baos.toString() + "]");
            }
            // Do we have some data, or a trailing empty field?
            if (baos.size() > 0 // we have some data
                    || push // we've started a field
                    || state == ParserState.EMBEDDEDQUOTE // Just seen ""
            ) {
                list.add(baos.toString());
            }
        }
        return list.toArray(new String[list.size()]);
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to