public void actionPerformed(ActionEvent e) { infoArea.setText(""); infoArea.setForeground(Color.black); final String fname = filename.getText(); File f = new File(fname); if (!f.exists()) { reportError("File '" + fname + "' was not found"); return; } int cnt = 0; try { RawRequestSourcePreProcessor preproc = new RawRequestSourcePreProcessor(); preproc.testStarted(); preproc.setFileName(fname); preproc.setVarName("test"); preproc.setRewindOnEOF(false); while (true) { preproc.process(); cnt++; } } catch (RuntimeEOFException ex) { reportOk("File seems to be OK."); infoArea.setForeground(Color.decode("0x00009900")); } catch (RuntimeException ex) { log.debug("Runtime Exception", ex); reportError(ex.toString()+" "+JMeterPluginsUtils.getStackTrace(ex)); } reportOk("Parsed " + cnt + " requests in " + fname); }
public void actionPerformed(ActionEvent e) { infoArea.setText(""); infoArea.setForeground(Color.black); final String fname = filename.getText(); File f = new File(fname); if (!f.exists()) { reportError("File '" + fname + "' was not found"); return; } int cnt = 0; try { RawRequestSourcePreProcessor preproc = new RawRequestSourcePreProcessor(); preproc.testStarted(); preproc.setFileName(fname); preproc.setVarName("test"); preproc.setRewindOnEOF(false); while (true) { preproc.process(); cnt++; } } catch (RuntimeEOFException ex) { reportOk("File seems to be OK."); infoArea.setForeground(Color.decode("0x00009900")); } catch (RuntimeException ex) { log.debug("Runtime Exception", ex); reportError(ex.toString()+" "+JMeterPluginsUtils.getStackTrace(ex)); } reportOk("Parsed " + cnt + " requests in " + fname); }
@Override public SampleResult sample(Entry entry) { SampleResult res = new SampleResult(); res.setSampleLabel(getName()); res.setSamplerData(getRequestData()); res.sampleStart(); res.setDataType(SampleResult.TEXT); res.setSuccessful(true); res.setResponseCode(HTTPRawSampler.RC200); try { res.setResponseData(processIO(res)); } catch (Exception ex) { if (!(ex instanceof SocketTimeoutException)) { log.error(getHostName(), ex); } res.sampleEnd(); res.setSuccessful(false); res.setResponseCode(HTTPRawSampler.RC500); res.setResponseMessage(ex.toString()); res.setResponseData((ex.toString() + HTTPRawSampler.CRLF + JMeterPluginsUtils.getStackTrace(ex)).getBytes()); } return res; }
LOGGER.error(ex.getMessage()); res.setResponseMessage(ex.getMessage()); res.setResponseData((ex.toString() + "\r\n" + JMeterPluginsUtils.getStackTrace(ex)).getBytes()); res.setResponseCode("500"); res.setSuccessful(false);