Get cause and if the cause isn't exist  throw the {@link IllegalStateException}.

@return the cause of resume failed.
438123
@NonNull public ResumeFailedCause getCauseOrThrow() {
        if (!infoRight) {
            return INFO_DIRTY;
        } else if (!fileExist) {
            return FILE_NOT_EXIST;
        } else if (!outputStreamSupport) {
            return OUTPUT_STREAM_NOT_SUPPORT;
        }

        throw new IllegalStateException("No cause find with dirty: " + dirty);
    }
1013181
public static String getCurrentId()
  {
    SystemManager system = getCurrent();

    if (system == null) {
      ClassLoader loader = Thread.currentThread().getContextClassLoader();

      throw new IllegalStateException(L.l("{0} is not available in this context.\n  {1}",
                                          SystemManager.class.getSimpleName(),
                                          loader));
    }

    return system.getId();
  }
747431
public boolean getRTS() throws IllegalStateException, IOException{
        // validate state
        if (isClosed())
            throw new IllegalStateException("Serial connection is not open; cannot 'getRTS()'.");

        // get pin state
        return com.pi4j.jni.Serial.getRTS(fileDescriptor);
    }
866241
@Override
    public EJBLocalObject getEJBLocalObject() throws java.lang.IllegalStateException
    {
        EJBLocalObject result = null;

        // d367572.1 start
        if (state == PRE_CREATE || state == DESTROYED)
        {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "Incorrect state: " + getStateName(state));
            throw new IllegalStateException(getStateName(state));
        }
        // d367572.1 end

        try
        {
            result = container.wrapperManager.getWrapper(beanId).getLocalObject();// d156807.1
        } catch (IllegalStateException ise) { // d116480
            // FFDC not logged for this spec required scenario
            throw ise;
        } catch (Throwable ex) {
            // p113724
            // Not expecting any Throwable to occur. Log unexpected Throwable and
            // throw a ContainerEJBException since this is a Java EE architected interface.
            FFDCFilter.processException(ex, CLASS_NAME + ".getEJBLocalObject", "236", this);
            ContainerEJBException cex = new ContainerEJBException("getEJBLocalObject() failed",
                            ex);
            Tr.error(tc
                     , "CAUGHT_EXCEPTION_THROWING_NEW_EXCEPTION_CNTR0035E"
                     , new Object[] { ex, cex.toString() }); // d194031
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) // d144064
                Tr.debug(tc, "getEJBLocalObject() failed", ex);
            throw cex;
        }

        return result;
    }
460555
public static Class<?> getExceptionCallerClass(final Throwable t) {
		final StackTraceElement[] stackTrace = t.getStackTrace();
		for (final StackTraceElement stackTraceElement : stackTrace) {
			logger.debug(stackTraceElement.getClassName().concat(".").concat(stackTraceElement.getMethodName()));
		}
		return null;
	}
361084
public com.google.rpc.StatusOrBuilder getErrorOrBuilder() {
    if (resultCase_ == 4) {
       return (com.google.rpc.Status) result_;
    }
    return com.google.rpc.Status.getDefaultInstance();
  }
872374
private static RuntimeException getCause(final InvocationTargetException e) {
    final Throwable cause = e.getCause();
    if (cause instanceof RuntimeException) {
      throw (RuntimeException) cause;
    } else {
      throw new IllegalStateException(e.getCause());
    }
  }
523975
@Override
	public final TypeSerializer<T> restoreSerializer() {
		if (serializer == null) {
			throw new IllegalStateException(
					"Trying to restore the prior serializer via TypeSerializerConfigSnapshot, " +
					"but the prior serializer has not been set.");
		}
		else if (serializer instanceof UnloadableDummyTypeSerializer) {
			Throwable originalError = ((UnloadableDummyTypeSerializer<?>) serializer).getOriginalError();

			throw new IllegalStateException(
					"Could not Java-deserialize TypeSerializer while restoring checkpoint metadata for serializer " +
					"snapshot '" + getClass().getName() + "'. " +
					"Please update to the TypeSerializerSnapshot interface that removes Java Serialization to avoid " +
					"this problem in the future.", originalError);
		} else {
			return this.serializer;
		}
	}
1111455
public static String dumpStack(final Throwable cause) {
        if (cause == null) {
            return "Throwable was null";
        }
        final StringWriter sw = new StringWriter();
        final PrintWriter s = new PrintWriter(sw);

        // This is very close to what Thread.dumpStack does.
        cause.printStackTrace(s);

        final String stack = sw.toString();
        try {
            sw.close();
        } catch (final IOException e) {
            LOG.warn("Could not close writer", e);
        }
        s.close();
        return stack;
    }
263157
static Throwable cause(Throwable e)
  {
    while (e.getCause() != null
        && (e instanceof InstantiationException
            || e instanceof InvocationTargetException
            || e.getClass().equals(RuntimeExceptionConfig.class))) {
      e = e.getCause();
    }
    
    return e;
  }
712544
public String getExceptionStackTrace() {
        Throwable t = getException();
        if (t == null) {
            return null;
        }
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        t.printStackTrace(pw);
        return sw.toString();
    }
123177
public static Throwable getFailed(CompletionStage<?> stage) {
    CompletableFuture<?> future = stage.toCompletableFuture();
    Preconditions.checkArgument(future.isCompletedExceptionally());
    try {
      future.get();
      throw new AssertionError("future should be failed");
    } catch (InterruptedException e) {
      throw new AssertionError("Unexpected error", e);
    } catch (ExecutionException e) {
      return e.getCause();
    }
  }
927484
@Override
  public V getFailure(K key, StoreAccessException e) {
    cleanup(key, e);
    return null;
  }
666267
public Status withCause(Throwable cause) {
    if (Objects.equal(this.cause, cause)) {
      return this;
    }
    return new Status(this.code, this.description, cause);
  }
791668
public SICoreConnection getSICoreConnection() throws IllegalStateException {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "getSICoreConnection");
        }

        if (_sessionClosed) {
            throw new IllegalStateException(NLS.getFormattedMessage(
                    ("ILLEGAL_STATE_CWSJR1123"),
                    new Object[] { "getSICoreConnection"}, null));
        }
        if (_sessionInvalidated) {
            throw new IllegalStateException(NLS.getFormattedMessage(
                    ("ILLEGAL_STATE_CWSJR1124"),
                    new Object[] { "getSICoreConnection"}, null));
        }

        SICoreConnection coreConnection = null;
        if (_connection != null) {
            coreConnection = _connection.getSICoreConnection();
        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, "getSICoreConnection", coreConnection);
        }
        return coreConnection;

    }
753205
public @CheckForNull V start() throws Exception {
        V result = null;
        int currentAttempt = 0;
        boolean success = false;

        while (currentAttempt < attempts && !success) {
            currentAttempt++;
            try {
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.log(Level.INFO, Messages.Retrier_Attempt(currentAttempt, action));
                }
                result = callable.call();

            } catch (Exception e) {
                if(duringActionExceptions == null || Stream.of(duringActionExceptions).noneMatch(exception -> exception.isAssignableFrom(e.getClass()))) {
                    // if the raised exception is not considered as a controlled exception doing the action, rethrow it
                    LOGGER.log(Level.WARNING, Messages.Retrier_ExceptionThrown(currentAttempt, action), e);
                    throw e;
                } else {
                    // if the exception is considered as a failed action, notify it to the listener
                    LOGGER.log(Level.INFO, Messages.Retrier_ExceptionFailed(currentAttempt, action), e);
                    if (duringActionExceptionListener != null) {
                        LOGGER.log(Level.INFO, Messages.Retrier_CallingListener(e.getLocalizedMessage(), currentAttempt, action));
                        result = duringActionExceptionListener.apply(currentAttempt, e);
                    }
                }
            }

            // After the call and the call to the listener, which can change the result, test the result
            success = checkResult.test(currentAttempt, result);
            if (!success) {
                if (currentAttempt < attempts) {
                    LOGGER.log(Level.WARNING, Messages.Retrier_AttemptFailed(currentAttempt, action));
                    LOGGER.log(Level.FINE, Messages.Retrier_Sleeping(delay, action));
                    try {
                        Thread.sleep(delay);
                    } catch (InterruptedException ie) {
                        LOGGER.log(Level.FINE, Messages.Retrier_Interruption(action));
                        Thread.currentThread().interrupt(); // flag this thread as interrupted
                        currentAttempt = attempts; // finish
                    }
                } else {
                    // Failed to perform the action
                    LOGGER.log(Level.INFO, Messages.Retrier_NoSuccess(action, attempts));
                }
            } else {
                LOGGER.log(Level.INFO, Messages.Retrier_Success(action, currentAttempt));
            }
        }

        return result;
    }
113354
public IllegalStateException asJDKException() {
        IllegalStateException e = new IllegalStateException(getMessage()) {
            @Override
            public synchronized Throwable fillInStackTrace() {
                return this;
            }
        };
        e.setStackTrace(getStackTrace());
        return e;
    }