/** * Populates the provided HTTPSampleResult with details from the Exception. * Does not create a new instance, so should not be used directly to add a * subsample. * <p> * See {@link HTTPSamplerBase#errorResult(Throwable, HTTPSampleResult)} * * @param t * Exception representing the error. * @param res * SampleResult to be modified * @return the modified sampling result containing details of the Exception. * Invokes */ protected HTTPSampleResult errorResult(Throwable t, HTTPSampleResult res) { return testElement.errorResult(t, res); }
/** * Perform a sample, and return the results * * @return results of the sampling */ public SampleResult sample() { SampleResult res = null; try { res = sample(getUrl(), getMethod(), false, 0); if (res != null) { res.setSampleLabel(getName()); } return res; } catch (Exception e) { return errorResult(e, new HTTPSampleResult()); } }
HTTPSampleResult errSubResult = new HTTPSampleResult(res); errSubResult.removeSubResults(); res.addSubResult(errorResult(new Exception("Maximum frame/iframe nesting depth exceeded."), errSubResult)); } else {
res.addSubResult(errorResult(e, new HTTPSampleResult(res))); setParentSampleSuccess(res, false); url = escapeIllegalURLCharacters(url); } catch (Exception e) { // NOSONAR res.addSubResult(errorResult(new Exception(url.toString() + " is not a correct URI", e), new HTTPSampleResult(res))); setParentSampleSuccess(res, false); continue; url = url.toURI().normalize().toURL(); } catch (MalformedURLException | URISyntaxException e) { res.addSubResult(errorResult(new Exception(url.toString() + " URI can not be normalized", e), new HTTPSampleResult(res))); setParentSampleSuccess(res, false); continue; res.addSubResult(errorResult(new Exception(binURL + " is not a correct URI", e), new HTTPSampleResult(res))); setParentSampleSuccess(res, false);
errorResult(e, lastRes); lastRes = errorResult(new IOException("Exceeded maximum number of redirects: " + MAX_REDIRECTS), new HTTPSampleResult(lastRes)); totalRes.addSubResult(lastRes);