@Override public StackTraceElement[] getStackTrace() { if (null != errors) { List<StackTraceElement> stackTraceElements = errors.stream() .map(Exception::getStackTrace) .flatMap(Stream::of) .collect(Collectors.toList()); stackTraceElements.addAll(Arrays.asList(super.getStackTrace())); return stackTraceElements.toArray(new StackTraceElement[stackTraceElements.size()]); } return super.getStackTrace(); } }
public Type parse(String input) { try { return doParse(input); } catch (RuntimeException ex) { IllegalArgumentException exception = new IllegalArgumentException( "Cannot parse type from input string '" + input + "'. " + ex.getMessage()); exception.setStackTrace(ex.getStackTrace()); throw exception; } }
@Override public final RuntimeException couldNotObtainCredentialWithCause(final Throwable cause) { final RuntimeException result = new RuntimeException(String.format(getLoggingLocale(), couldNotObtainCredentialWithCause$str()), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String invalidPasswordKeySpecificationForAlgorithm = "ELY01043: Invalid password key specification for algorithm \"%s\"";
@Override public final RuntimeException couldNotOpenConnection(final Throwable cause) { final RuntimeException result = new RuntimeException(String.format(getLoggingLocale(), couldNotOpenConnection$str()), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String couldNotExecuteQuery = "ELY01050: Could not execute query \"%s\"";
@Override public final RuntimeException ldapRealmFailedObtainAttributes(final String dn, final Throwable cause) { final RuntimeException result = new RuntimeException(String.format(getLoggingLocale(), ldapRealmFailedObtainAttributes$str(), dn), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String ldapRealmInvalidRdnForAttribute = "ELY01080: Attribute [%s] value [%s] must be in X.500 format in order to obtain RDN [%s].";
@Override public final RuntimeException errorGettingSlotInTxInterceptor(final Throwable cause) { final RuntimeException result = new RuntimeException(String.format(getLoggingLocale(), errorGettingSlotInTxInterceptor$str()), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String errorSettingSlotInTxInterceptor = "WFLYIIOP0058: Exception setting slot in TxServerInterceptor";
@Override public final RuntimeException cannotObtainExceptionRepositoryID(final String type, final Throwable cause) { final RuntimeException result = new RuntimeException(String.format(getLoggingLocale(), cannotObtainExceptionRepositoryID$str(), type), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String errorMashalingParams = "WFLYIIOP0083: Cannot marshal parameter: unexpected number of parameters";
@Override public final RuntimeException failedToParsePath() { final RuntimeException result = new RuntimeException(String.format(getLoggingLocale(), failedToParsePath$str())); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String authenticationFailed = "UT000038: Authentication failed, requested user name '%s'";
@Override public final RuntimeException couldNotParseUriTemplate(final String path, final int i) { final RuntimeException result = new RuntimeException(String.format(getLoggingLocale(), couldNotParseUriTemplate$str(), path, i)); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String mismatchedBraces = "UT000057: Mismatched braces in attribute string %s";
@Override public final RuntimeException hostHasNotBeenRegistered(final Object host) { final RuntimeException result = new RuntimeException(String.format(getLoggingLocale(), hostHasNotBeenRegistered$str(), host)); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String extraDataWrittenAfterChunkEnd = "UT000084: Attempted to write additional data after the last chunk";
@Override public final RuntimeException couldNotGenerateUniqueSessionId() { final RuntimeException result = new RuntimeException(String.format(getLoggingLocale(), couldNotGenerateUniqueSessionId$str())); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String controlFrameCannotHaveBodyContent = "UT000088: SPDY control frames cannot have body content";
@Override public final RuntimeException couldNotCreateClusterNodeSelector(final Exception e, final String clusterName) { final RuntimeException result = new RuntimeException(String.format(getLoggingLocale(), couldNotCreateClusterNodeSelector$str(), clusterName), e); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String cannotSpecifyBothCallbackHandlerAndUserPass = "EJBCLIENT000054: Cannot specify both a callback handler and a username/password";
@Override public final RuntimeException asyncInvocationOnlyApplicableForSessionBeans() { final RuntimeException result = new RuntimeException(String.format(getLoggingLocale(), asyncInvocationOnlyApplicableForSessionBeans$str())); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String notStatefulSessionBean = "WFLYEJB0053: %s is not a Stateful Session bean in app: %s module: %s distinct-name: %s";
@Override public final RuntimeException failedToMarshalEjbParameters(final Exception e) { final RuntimeException result = new RuntimeException(String.format(getLoggingLocale(), failedToMarshalEjbParameters$str()), e); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String unknownDeployment = "WFLYEJB0055: No matching deployment for EJB: %s";
@Override public final RuntimeException failedToLoadViewClassForComponent(final Exception e, final String componentName) { final RuntimeException result = new RuntimeException(String.format(getLoggingLocale(), failedToLoadViewClassForComponent$str(), componentName), e); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String illegalCallToEjbHomeRemove = "WFLYEJB0073: Illegal call to EJBHome.remove(Object) on a session bean";
@Override public final RuntimeException failedToLoadViewClass(final Exception e, final String viewClassName) { final RuntimeException result = new RuntimeException(String.format(getLoggingLocale(), failedToLoadViewClass$str(), viewClassName), e); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String couldNotDetermineEjbRefForInjectionTarget = "WFLYEJB0088: Could not determine type of ejb-ref %s for injection target %s";
@Override public final RuntimeException couldNotCreateCorbaObject(final Exception cause, final org.jboss.ejb.client.EJBLocator<?> locator) { final RuntimeException result = new RuntimeException(String.format(getLoggingLocale(), couldNotCreateCorbaObject$str(), locator), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String incorrectEJBLocatorForBean = "WFLYEJB0099: Provided locator %s was not for EJB %s";
@Override public final RuntimeException passivationFailed(final Throwable cause, final Object id) { final RuntimeException result = new RuntimeException(String.format(getLoggingLocale(), passivationFailed$str(), id), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String activationFailed = "WFLYEJB0401: Failed to activate %s";
@Override public final RuntimeException jmxSubsystemNotInstalled() { final RuntimeException result = new RuntimeException(String.format(getLoggingLocale(), jmxSubsystemNotInstalled$str())); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String inconsistentStatisticsSettings = "WFLYTX0012: Attributes %s and %s are alternatives; both cannot be set with conflicting values.";
@Test public void setDataSourceException_withRuntimeException() { RuntimeException e = new RuntimeException("some dummy message"); addException(toDataSource("dummy"), e); try { mediaPlayer.setDataSource("dummy"); fail("Expected exception thrown"); } catch (Exception caught) { assertThat(caught).isSameAs(e); assertThat(e.getStackTrace()[0].getClassName()) .named("Stack trace should originate in Shadow") .isEqualTo(ShadowMediaPlayer.class.getName()); } }