congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
IllegalStateException.getSuppressed
Code IndexAdd Tabnine to your IDE (free)

How to use
getSuppressed
method
in
java.lang.IllegalStateException

Best Java code snippets using java.lang.IllegalStateException.getSuppressed (Showing top 3 results out of 315)

origin: reactor/reactor-core

@Test
public void afterTerminateCallbackErrorAndErrorCallbackError2() {
  IllegalStateException afterTerminate =
      new IllegalStateException("afterTerminate");
  IllegalArgumentException error = new IllegalArgumentException("error");
  NullPointerException err = new NullPointerException();
  FluxPeek<String> flux = new FluxPeek<>(Flux.error(err), null, null, e -> {
    throw error;
  }, null, () -> {
    throw afterTerminate;
  }, null, null);
  AssertSubscriber<String> ts = AssertSubscriber.create();
  try {
    flux.subscribe(ts);
    fail("expected thrown exception");
  }
  catch (Exception e) {
    assertSame(afterTerminate, e.getCause());
    //afterTerminate suppressed error which itself suppressed original err
    assertEquals(1, afterTerminate.getSuppressed().length);
    assertEquals(error, afterTerminate.getSuppressed()[0]);
    assertEquals(1, error.getSuppressed().length);
    assertEquals(err, error.getSuppressed()[0]);
  }
  ts.assertNoValues();
  //the subscriber still sees the 'error' message since actual.onError is called before the afterTerminate callback
  ts.assertErrorMessage("error");
}
origin: reactor/reactor-core

@Test
public void afterTerminateCallbackErrorAndErrorCallbackError2() {
  IllegalStateException afterTerminate = new IllegalStateException("afterTerminate");
  IllegalArgumentException error = new IllegalArgumentException("error");
  NullPointerException err = new NullPointerException();
  FluxPeekFuseable<String> flux = new FluxPeekFuseable<>(
      Flux.error(err),
      null, null,
      e -> { throw error; }, null, () -> { throw afterTerminate; },
      null, null);
  AssertSubscriber<String> ts = AssertSubscriber.create();
  try {
    flux.subscribe(ts);
    fail("expected thrown exception");
  }
  catch (Exception e) {
    assertSame(afterTerminate, e.getCause());
    //afterTerminate suppressed error which itself suppressed original err
    assertEquals(1, afterTerminate.getSuppressed().length);
    assertEquals(error, afterTerminate.getSuppressed()[0]);
    assertEquals(1, error.getSuppressed().length);
    assertEquals(err, error.getSuppressed()[0]);
  }
  ts.assertNoValues();
  //the subscriber still sees the 'error' message since actual.onError is called before the afterTerminate callback
  ts.assertErrorMessage("error");
}
origin: org.apache.geronimo/geronimo-health

void stop(@Observes final BeforeShutdown beforeShutdown) {
  final IllegalStateException ise = new IllegalStateException("Something went wrong releasing health checks");
  contexts.forEach(c -> {
    try {
      c.release();
    } catch (final RuntimeException re) {
      ise.addSuppressed(re);
    }
  });
  final Throwable[] suppressed = ise.getSuppressed();
  if (suppressed.length == 1) {
    throw RuntimeException.class.cast(suppressed[0]);
  } else if (suppressed.length > 1) {
    throw ise;
  }
}
java.langIllegalStateExceptiongetSuppressed

Popular methods of IllegalStateException

  • <init>
    Constructs a new IllegalStateException with the current stack trace and the specified cause.
  • getMessage
  • printStackTrace
  • initCause
  • getStackTrace
  • setStackTrace
  • getCause
  • toString
  • addSuppressed
  • getLocalizedMessage
  • fillInStackTrace
  • fillInStackTrace

Popular in Java

  • Running tasks concurrently on multiple threads
  • setScale (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • getApplicationContext (Context)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Menu (java.awt)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • JTextField (javax.swing)
  • Best plugins for Eclipse
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