Date stamp = saveConfig.formatter().parse(text);
timeStamp = stamp.getTime();
} else { // can this happen?
final String msg = "Unknown timestamp format";
log.warn(msg);
throw new JMeterError(msg);
}
}
if (saveConfig.saveTime()) {
field = CSV_ELAPSED;
text = parts[i++];
elapsed = Long.parseLong(text);
}
if (saveConfig.saveSampleCount()) {
result = new StatisticalSampleResult(timeStamp, elapsed);
} else {
result = new SampleResult(timeStamp, elapsed);
}
if (saveConfig.saveLabel()) {
field = LABEL;
text = parts[i++];
result.setSampleLabel(text);
}
if (saveConfig.saveCode()) {
field = RESPONSE_CODE;
text = parts[i++];
result.setResponseCode(text);
}
if (saveConfig.saveMessage()) {
field = RESPONSE_MESSAGE;
text = parts[i++];
result.setResponseMessage(text);
}
if (saveConfig.saveThreadName()) {
field = THREAD_NAME;
text = parts[i++];
result.setThreadName(text);
}
if (saveConfig.saveDataType()) {
field = DATA_TYPE;
text = parts[i++];
result.setDataType(text);
}
if (saveConfig.saveSuccess()) {
field = SUCCESSFUL;
text = parts[i++];
result.setSuccessful(Boolean.valueOf(text).booleanValue());
}
if (saveConfig.saveAssertionResultsFailureMessage()) {
i++;
// TODO - should this be restored?
}
if (saveConfig.saveBytes()) {
field = CSV_BYTES;
text = parts[i++];
result.setBytes(Integer.parseInt(text));
}
if (saveConfig.saveThreadCounts()) {
field = CSV_THREAD_COUNT1;
text = parts[i++];
result.setGroupThreads(Integer.parseInt(text));
field = CSV_THREAD_COUNT2;
text = parts[i++];
result.setAllThreads(Integer.parseInt(text));
}
if (saveConfig.saveUrl()) {
i++;
// TODO: should this be restored?
}
if (saveConfig.saveFileName()) {
field = CSV_FILENAME;
text = parts[i++];
result.setResultFileName(text);
}
if (saveConfig.saveLatency()) {
field = CSV_LATENCY;
text = parts[i++];
result.setLatency(Long.parseLong(text));
}
if (saveConfig.saveEncoding()) {
field = CSV_ENCODING;
text = parts[i++];
result.setEncodingAndType(text);
}
if (saveConfig.saveSampleCount()) {
field = CSV_SAMPLE_COUNT;
text = parts[i++];
result.setSampleCount(Integer.parseInt(text));
field = CSV_ERROR_COUNT;
text = parts[i++];
result.setErrorCount(Integer.parseInt(text));
}
if (saveConfig.saveHostname()) {
field = CSV_HOSTNAME;
hostname = parts[i++];
}
if (saveConfig.saveIdleTime()) {
field = CSV_IDLETIME;
text = parts[i++];
result.setIdleTime(Long.parseLong(text));
}
if (i + saveConfig.getVarCount() < parts.length) {
log.warn("Line: " + lineNumber + ". Found " + parts.length
+ " fields, expected " + i
+ ". Extra fields have been ignored.");
}
} catch (NumberFormatException e) {
log.warn("Error parsing field '" + field + "' at line "
+ lineNumber + " " + e);
throw new JMeterError(e);
} catch (ParseException e) {
log.warn("Error parsing field '" + field + "' at line "
+ lineNumber + " " + e);
throw new JMeterError(e);
} catch (ArrayIndexOutOfBoundsException e) {
log.warn("Insufficient columns to parse field '" + field
+ "' at line " + lineNumber);
throw new JMeterError(e);
}
return new SampleEvent(result, "", hostname);
}