/** * Returns this delegate's <code>Nestable</code> and any nested * <code>Throwable</code>s in an array of <code>Throwable</code>s, one * element for each <code>Throwable</code>. * * @return the <code>Throwable</code>s * @since 2.0 */ public Throwable[] getThrowables() { return ExceptionUtils.getThrowables(this.nestable); }
fromIndex = 0; Throwable[] throwables = ExceptionUtils.getThrowables(throwable); if (fromIndex >= throwables.length) { return -1;
/** * <p>A way to get the entire nested stack-trace of an throwable.</p> * * <p>The result of this method is highly dependent on the JDK version * and whether the exceptions override printStackTrace or not.</p> * * @param throwable the <code>Throwable</code> to be examined * @return the nested stack trace, with the root cause first * @since 2.0 */ public static String getFullStackTrace(Throwable throwable) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw, true); Throwable[] ts = getThrowables(throwable); for (int i = 0; i < ts.length; i++) { ts[i].printStackTrace(pw); if (isNestedThrowable(ts[i])) { break; } } return sw.getBuffer().toString(); }
throw new IndexOutOfBoundsException("The start index was out of bounds: " + fromIndex); Throwable[] throwables = ExceptionUtils.getThrowables(this.nestable); if (fromIndex >= throwables.length) { throw new IndexOutOfBoundsException("The start index was out of bounds: "
return ArrayUtils.EMPTY_STRING_ARRAY; Throwable throwables[] = getThrowables(throwable); int count = throwables.length; ArrayList frames = new ArrayList();
private List<Result> send(final String gremlin) throws SaslException { try { final ResultSet rs = this.currentClient.submitAsync(gremlin, aliases, Collections.emptyMap()).get(); return timeout > NO_TIMEOUT ? rs.all().get(timeout, TimeUnit.MILLISECONDS) : rs.all().get(); } catch(TimeoutException ignored) { throw new IllegalStateException("Request timed out while processing - increase the timeout with the :remote command"); } catch (Exception e) { // handle security error as-is and unwrapped final Optional<Throwable> throwable = Stream.of(ExceptionUtils.getThrowables(e)).filter(t -> t instanceof SaslException).findFirst(); if (throwable.isPresent()) throw (SaslException) throwable.get(); throw new IllegalStateException(e.getMessage(), e); } }
/** * Returns this delegate's <code>Nestable</code> and any nested * <code>Throwable</code>s in an array of <code>Throwable</code>s, one * element for each <code>Throwable</code>. * * @return the <code>Throwable</code>s * @since 2.0 */ public Throwable[] getThrowables() { return ExceptionUtils.getThrowables(this.nestable); }
/** * Returns this delegate's <code>Nestable</code> and any nested * <code>Throwable</code>s in an array of <code>Throwable</code>s, one * element for each <code>Throwable</code>. * * @return the <code>Throwable</code>s * @since 2.0 */ public Throwable[] getThrowables() { return ExceptionUtils.getThrowables(this.nestable); }
/** * Returns this delegate's <code>Nestable</code> and any nested * <code>Throwable</code>s in an array of <code>Throwable</code>s, one * element for each <code>Throwable</code>. * * @return the <code>Throwable</code>s * @since 2.0 */ public Throwable[] getThrowables() { return ExceptionUtils.getThrowables(this.nestable); }
/** * Returns this delegate's <code>Nestable</code> and any nested * <code>Throwable</code>s in an array of <code>Throwable</code>s, one * element for each <code>Throwable</code>. * * @return the <code>Throwable</code>s * @since 2.0 */ public Throwable[] getThrowables() { return ExceptionUtils.getThrowables(this.nestable); }
/** * Returns this delegate's <code>Nestable</code> and any nested * <code>Throwable</code>s in an array of <code>Throwable</code>s, one * element for each <code>Throwable</code>. * * @return the <code>Throwable</code>s * @since 2.0 */ public Throwable[] getThrowables() { return ExceptionUtils.getThrowables(this.nestable); }
private List<Result> send(final String gremlin) throws SaslException { try { final ResultSet rs = this.currentClient.submitAsync(gremlin, aliases, Collections.emptyMap()).get(); return timeout > NO_TIMEOUT ? rs.all().get(timeout, TimeUnit.MILLISECONDS) : rs.all().get(); } catch(TimeoutException ignored) { throw new IllegalStateException("Request timed out while processing - increase the timeout with the :remote command"); } catch (Exception e) { // handle security error as-is and unwrapped final Optional<Throwable> throwable = Stream.of(ExceptionUtils.getThrowables(e)).filter(t -> t instanceof SaslException).findFirst(); if (throwable.isPresent()) throw (SaslException) throwable.get(); throw new IllegalStateException(e.getMessage(), e); } }
/** * <p>A way to get the entire nested stack-trace of an throwable.</p> * * <p>The result of this method is highly dependent on the JDK version * and whether the exceptions override printStackTrace or not.</p> * * @param throwable the <code>Throwable</code> to be examined * @return the nested stack trace, with the root cause first * @since 2.0 */ public static String getFullStackTrace(Throwable throwable) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw, true); Throwable[] ts = getThrowables(throwable); for (int i = 0; i < ts.length; i++) { ts[i].printStackTrace(pw); if (isNestedThrowable(ts[i])) { break; } } return sw.getBuffer().toString(); }
/** * <p>A way to get the entire nested stack-trace of an throwable.</p> * * <p>The result of this method is highly dependent on the JDK version * and whether the exceptions override printStackTrace or not.</p> * * @param throwable the <code>Throwable</code> to be examined * @return the nested stack trace, with the root cause first * @since 2.0 */ public static String getFullStackTrace(Throwable throwable) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw, true); Throwable[] ts = getThrowables(throwable); for (int i = 0; i < ts.length; i++) { ts[i].printStackTrace(pw); if (isNestedThrowable(ts[i])) { break; } } return sw.getBuffer().toString(); }
/** * <p>A way to get the entire nested stack-trace of an throwable.</p> * * <p>The result of this method is highly dependent on the JDK version * and whether the exceptions override printStackTrace or not.</p> * * @param throwable the <code>Throwable</code> to be examined * @return the nested stack trace, with the root cause first * @since 2.0 */ public static String getFullStackTrace(Throwable throwable) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw, true); Throwable[] ts = getThrowables(throwable); for (int i = 0; i < ts.length; i++) { ts[i].printStackTrace(pw); if (isNestedThrowable(ts[i])) { break; } } return sw.getBuffer().toString(); }
/** * <p>A way to get the entire nested stack-trace of an throwable.</p> * * <p>The result of this method is highly dependent on the JDK version * and whether the exceptions override printStackTrace or not.</p> * * @param throwable the <code>Throwable</code> to be examined * @return the nested stack trace, with the root cause first * @since 2.0 */ public static String getFullStackTrace(Throwable throwable) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw, true); Throwable[] ts = getThrowables(throwable); for (int i = 0; i < ts.length; i++) { ts[i].printStackTrace(pw); if (isNestedThrowable(ts[i])) { break; } } return sw.getBuffer().toString(); }
private boolean shouldLogAsWarn(InvocationTargetException iTE) { boolean logAsWarn = true; int index = ExceptionUtils.indexOfType(iTE, SQLException.class); if (index >= 0) { SQLException sqlException = (SQLException) ExceptionUtils.getThrowables(iTE)[index]; for (Predicate<SQLException> predicate : this.loggingFilters) { if (predicate.apply(sqlException)) { logAsWarn = false; break; } } } return logAsWarn; }
/** * Find the primary cause of the specified exception. * * @param e The exception to analyze * @return The primary cause of the exception. */ protected static Throwable findPrimaryCause(Exception e) { // The throwables from the stack of the exception Throwable[] throwables = ExceptionUtils.getThrowables(e); //Look For a Component Init Exception and use that as the primary cause of failure, if we find it int componentInitExceptionIndex = ExceptionUtils.indexOfThrowable(e, ComponentInitException.class); Throwable primaryCause; if (componentInitExceptionIndex > -1) { primaryCause = throwables[componentInitExceptionIndex]; } else { //No Component Init Exception on the Stack Trace, so we'll use the root as the primary cause. primaryCause = ExceptionUtils.getRootCause(e); } return primaryCause; }
/** * Find the primary cause of the specified exception. * * @param e The exception to analyze * @return The primary cause of the exception. */ protected static Throwable findPrimaryCause(Exception e) { // The throwables from the stack of the exception Throwable[] throwables = ExceptionUtils.getThrowables(e); //Look For a Component Init Exception and use that as the primary cause of failure, if we find it int componentInitExceptionIndex = ExceptionUtils.indexOfThrowable(e, ComponentInitException.class); Throwable primaryCause; if(componentInitExceptionIndex > -1) { primaryCause = throwables[componentInitExceptionIndex]; }else { //No Component Init Exception on the Stack Trace, so we'll use the root as the primary cause. primaryCause = ExceptionUtils.getRootCause(e); } return primaryCause; }
@Override public QueryResponse query(final SolrQuery solrQuery) throws SearchParserException { ClassLoader classLoader = this.getClass().getClassLoader(); ClassLoader originalClassLoader = ClassUtils.overrideThreadContextClassLoader(classLoader); try { return searchServer.query(solrQuery); } catch (final SolrServerException solrServerException) { final String msg = "Query failed: {} "; LOG.warn(msg, solrServerException); // check all throwables in chain for (final Throwable couse : ExceptionUtils.getThrowables(solrServerException)) { // if one of couses is ParseException if (couse instanceof ParseException) { throw new SearchParserException(null, solrQuery.toString(), null); } } throw new GeneralServiceException(solrServerException, msg, solrQuery); } finally { if (originalClassLoader != null) { Thread.currentThread().setContextClassLoader(originalClassLoader); } } }