java.lang.RuntimeException.setStackTrace()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(9.4k)|赞(0)|评价(0)|浏览(144)

本文整理了Java中java.lang.RuntimeException.setStackTrace()方法的一些代码示例,展示了RuntimeException.setStackTrace()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RuntimeException.setStackTrace()方法的具体详情如下:
包路径:java.lang.RuntimeException
类名称:RuntimeException
方法名:setStackTrace

RuntimeException.setStackTrace介绍

暂无

代码示例

代码示例来源: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 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: apache/zookeeper

/**
 * Returns the initial vote value of the peer epoch.
 *
 * @return long
 */
private long getPeerEpoch(){
  if(self.getLearnerType() == LearnerType.PARTICIPANT)
    try {
      return self.getCurrentEpoch();
    } catch(IOException e) {
      RuntimeException re = new RuntimeException(e.getMessage());
      re.setStackTrace(e.getStackTrace());
      throw re;
    }
  else return Long.MIN_VALUE;
}

代码示例来源: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: apache/zookeeper

synchronized public void startLeaderElection() {
  try {
    if (getPeerState() == ServerState.LOOKING) {
      currentVote = new Vote(myid, getLastLoggedZxid(), getCurrentEpoch());
    }
  } catch(IOException e) {
    RuntimeException re = new RuntimeException(e.getMessage());
    re.setStackTrace(e.getStackTrace());
    throw re;
  }
  this.electionAlg = createElectionAlgorithm(electionType);
}

代码示例来源:origin: SonarSource/sonarqube

public static RuntimeException translateException(String msg, Exception cause) {
 RuntimeException runtimeException = new RuntimeException(String.format("%s: [%s] %s", msg, cause.getClass().getName(), cause.getMessage()));
 runtimeException.setStackTrace(cause.getStackTrace());
 return runtimeException;
}

相关文章