Tabnine Logo
Throwable.addSuppressed
Code IndexAdd Tabnine to your IDE (free)

How to use
addSuppressed
method
in
java.lang.Throwable

Best Java code snippets using java.lang.Throwable.addSuppressed (Showing top 20 results out of 2,673)

origin: apache/incubator-druid

 private void suppress(Throwable thrown, Throwable suppressed)
 {
  if (thrown != suppressed) {
   thrown.addSuppressed(suppressed);
  }
 }
}
origin: neo4j/neo4j

public static <T extends Throwable> T chain( T initial, T current )
{
  if ( initial == null )
  {
    return current;
  }
  if ( current != null )
  {
    initial.addSuppressed( current );
  }
  return initial;
}
origin: prestodb/presto

  @SuppressWarnings("ObjectEquality")
  private static void closeWithSuppression(Connection connection, Throwable throwable)
  {
    try {
      connection.close();
    }
    catch (Throwable t) {
      // Self-suppression not permitted
      if (throwable != t) {
        throwable.addSuppressed(t);
      }
    }
  }
}
origin: com.h2database/h2

private void handleException(Throwable ex) {
  if (backgroundExceptionHandler != null) {
    try {
      backgroundExceptionHandler.uncaughtException(null, ex);
    } catch(Throwable ignore) {
      if (ex != ignore) { // OOME may be the same
        ex.addSuppressed(ignore);
      }
    }
  }
}
origin: neo4j/neo4j

/**
 * @deprecated Use {@link Throwable#addSuppressed(Throwable)} instead.
 */
@Deprecated
public static <T extends Throwable> T withSuppressed( T exception, Throwable... suppressed )
{
  if ( suppressed != null )
  {
    for ( Throwable s : suppressed )
    {
      exception.addSuppressed( s );
    }
  }
  return exception;
}
origin: prestodb/presto

private void closeWithSuppression(Throwable throwable)
{
  requireNonNull(throwable, "throwable is null");
  try {
    close();
  }
  catch (Exception e) {
    if (e != throwable) {
      throwable.addSuppressed(e);
    }
  }
}
origin: prestodb/presto

protected void closeWithSuppression(Throwable throwable)
{
  requireNonNull(throwable, "throwable is null");
  try {
    close();
  }
  catch (RuntimeException e) {
    // Self-suppression not permitted
    if (throwable != e) {
      throwable.addSuppressed(e);
    }
  }
}
origin: prestodb/presto

private void closeWithSuppression(Throwable throwable)
{
  requireNonNull(throwable, "throwable is null");
  try {
    close();
  }
  catch (RuntimeException e) {
    // Self-suppression not permitted
    if (e != throwable) {
      throwable.addSuppressed(e);
    }
  }
}
origin: prestodb/presto

protected void closeWithSuppression(Throwable throwable)
{
  requireNonNull(throwable, "throwable is null");
  try {
    close();
  }
  catch (RuntimeException e) {
    // Self-suppression not permitted
    if (throwable != e) {
      throwable.addSuppressed(e);
    }
  }
}
origin: prestodb/presto

public static void closeWithSuppression(RecordCursor recordCursor, Throwable throwable)
{
  requireNonNull(recordCursor, "recordCursor is null");
  requireNonNull(throwable, "throwable is null");
  try {
    recordCursor.close();
  }
  catch (RuntimeException e) {
    // Self-suppression not permitted
    if (throwable != e) {
      throwable.addSuppressed(e);
    }
  }
}
origin: netty/netty

@SuppressJava6Requirement(reason = "Throwable addSuppressed is only available for >= 7. Has check for < 7.")
public static void addSuppressed(Throwable target, Throwable suppressed) {
  if (!haveSuppressed()) {
    return;
  }
  target.addSuppressed(suppressed);
}
origin: redisson/redisson

@SuppressJava6Requirement(reason = "Throwable addSuppressed is only available for >= 7. Has check for < 7.")
public static void addSuppressed(Throwable target, Throwable suppressed) {
  if (!haveSuppressed()) {
    return;
  }
  target.addSuppressed(suppressed);
}
origin: neo4j/neo4j

  private <EX extends Throwable> EX withCallTraces( EX failure )
  {
    for ( StackTraceElement[] waitCall : waitCalls )
    {
      RuntimeException call = new RuntimeException( "Wait called" );
      call.setStackTrace( waitCall );
      failure.addSuppressed( call );
    }
    return failure;
  }
}
origin: prestodb/presto

public void assertInvalidFunction(String projection, SemanticErrorCode expectedErrorCode)
{
  try {
    evaluateInvalid(projection);
    fail(format("Expected to throw %s exception", expectedErrorCode));
  }
  catch (SemanticException e) {
    try {
      assertEquals(e.getCode(), expectedErrorCode);
    }
    catch (Throwable failure) {
      failure.addSuppressed(e);
      throw failure;
    }
  }
}
origin: prestodb/presto

public void assertInvalidCast(String projection)
{
  try {
    evaluateInvalid(projection);
    fail("Expected to throw an INVALID_CAST_ARGUMENT exception");
  }
  catch (PrestoException e) {
    try {
      assertEquals(e.getErrorCode(), INVALID_CAST_ARGUMENT.toErrorCode());
    }
    catch (Throwable failure) {
      failure.addSuppressed(e);
      throw failure;
    }
  }
}
origin: prestodb/presto

public void assertInvalidFunction(String projection, ErrorCodeSupplier expectedErrorCode)
{
  try {
    evaluateInvalid(projection);
    fail(format("Expected to throw %s exception", expectedErrorCode.toErrorCode()));
  }
  catch (PrestoException e) {
    try {
      assertEquals(e.getErrorCode(), expectedErrorCode.toErrorCode());
    }
    catch (Throwable failure) {
      failure.addSuppressed(e);
      throw failure;
    }
  }
}
origin: prestodb/presto

public void assertNumericOverflow(String projection, String message)
{
  try {
    evaluateInvalid(projection);
    fail("Expected to throw an NUMERIC_VALUE_OUT_OF_RANGE exception with message " + message);
  }
  catch (PrestoException e) {
    try {
      assertEquals(e.getErrorCode(), NUMERIC_VALUE_OUT_OF_RANGE.toErrorCode());
      assertEquals(e.getMessage(), message);
    }
    catch (Throwable failure) {
      failure.addSuppressed(e);
      throw failure;
    }
  }
}
origin: prestodb/presto

protected void assertNotSupported(String projection, String message)
{
  try {
    functionAssertions.executeProjectionWithFullEngine(projection);
    fail("expected exception");
  }
  catch (PrestoException e) {
    try {
      assertEquals(e.getErrorCode(), NOT_SUPPORTED.toErrorCode());
      assertEquals(e.getMessage(), message);
    }
    catch (Throwable failure) {
      failure.addSuppressed(e);
      throw failure;
    }
  }
}
origin: prestodb/presto

public void assertInvalidCast(String projection, String message)
{
  try {
    evaluateInvalid(projection);
    fail("Expected to throw an INVALID_CAST_ARGUMENT exception");
  }
  catch (PrestoException e) {
    try {
      assertEquals(e.getErrorCode(), INVALID_CAST_ARGUMENT.toErrorCode());
      assertEquals(e.getMessage(), message);
    }
    catch (Throwable failure) {
      failure.addSuppressed(e);
      throw failure;
    }
  }
}
origin: prestodb/presto

public void assertInvalidFunction(String projection, StandardErrorCode errorCode, String messagePattern)
{
  try {
    evaluateInvalid(projection);
    fail("Expected to throw a PrestoException with message matching " + messagePattern);
  }
  catch (PrestoException e) {
    try {
      assertEquals(e.getErrorCode(), errorCode.toErrorCode());
      assertTrue(e.getMessage().equals(messagePattern) || e.getMessage().matches(messagePattern), format("Error message [%s] doesn't match [%s]", e.getMessage(), messagePattern));
    }
    catch (Throwable failure) {
      failure.addSuppressed(e);
      throw failure;
    }
  }
}
java.langThrowableaddSuppressed

Javadoc

Adds throwable to the list of throwables suppressed by this. The throwable will included when this exception's stack trace is printed.

Popular methods of Throwable

  • getMessage
    Returns the detail message string of this throwable.
  • printStackTrace
  • getCause
    Returns the cause of this throwable or null if the cause is nonexistent or unknown. (The cause is th
  • toString
    Returns a short description of this throwable. The result is the concatenation of: * the Class#getN
  • getStackTrace
    Provides programmatic access to the stack trace information printed by #printStackTrace(). Returns a
  • <init>
    Constructs a new throwable with the specified cause and a detail message of (cause==null ? null : ca
  • getLocalizedMessage
    Creates a localized description of this throwable. Subclasses may override this method in order to p
  • setStackTrace
    Sets the stack trace elements that will be returned by #getStackTrace() and printed by #printStackTr
  • initCause
    Initializes the cause of this throwable to the specified value. (The cause is the throwable that cau
  • fillInStackTrace
  • getSuppressed
    Returns the throwables suppressed by this.
  • countDuplicates
    Counts the number of duplicate stack frames, starting from the end of the stack.
  • getSuppressed,
  • countDuplicates,
  • getInternalStackTrace,
  • nativeFillInStackTrace,
  • nativeGetStackTrace,
  • fillInStackTrace0,
  • genStackTrace,
  • genStackTraceFromError,
  • getOurStackTrace

Popular in Java

  • Reactive rest calls using spring rest template
  • getResourceAsStream (ClassLoader)
  • runOnUiThread (Activity)
  • getApplicationContext (Context)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now