本文整理了Java中java.lang.RuntimeException.getStackTrace()
方法的一些代码示例,展示了RuntimeException.getStackTrace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RuntimeException.getStackTrace()
方法的具体详情如下:
包路径:java.lang.RuntimeException
类名称:RuntimeException
方法名:getStackTrace
暂无
代码示例来源:origin: hs-web/hsweb-framework
@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();
}
}
代码示例来源:origin: immutables/immutables
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;
}
}
代码示例来源:origin: wildfly/wildfly
@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\"";
代码示例来源:origin: wildfly/wildfly
@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\"";
代码示例来源:origin: wildfly/wildfly
@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].";
代码示例来源:origin: wildfly/wildfly
@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";
代码示例来源:origin: wildfly/wildfly
@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";
代码示例来源:origin: wildfly/wildfly
@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'";
代码示例来源:origin: wildfly/wildfly
@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";
代码示例来源:origin: wildfly/wildfly
@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";
代码示例来源:origin: wildfly/wildfly
@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";
代码示例来源:origin: wildfly/wildfly
@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";
代码示例来源:origin: wildfly/wildfly
@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";
代码示例来源:origin: wildfly/wildfly
@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";
代码示例来源:origin: wildfly/wildfly
@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";
代码示例来源:origin: wildfly/wildfly
@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";
代码示例来源:origin: wildfly/wildfly
@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";
代码示例来源:origin: wildfly/wildfly
@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";
代码示例来源:origin: wildfly/wildfly
@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.";
代码示例来源:origin: robolectric/robolectric
@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());
}
}
内容来源于网络,如有侵权,请联系作者删除!