java.lang.Error.getStackTrace()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(148)

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

Error.getStackTrace介绍

暂无

代码示例

代码示例来源:origin: scouter-project/scouter

private void alert(LeakInfo2 leakInfo2) {
  ServiceSummary summary = ServiceSummary.getInstance();
  MapValue mv = new MapValue();
  mv.put(AlertPack.HASH_FLAG + TextTypes.SERVICE + "_service-name", leakInfo2.serviceHash);
  if (leakInfo2.fullstack) {
    ErrorData d = summary.process(leakInfo2.error, 0, leakInfo2.serviceHash, leakInfo2.txid, 0, 0);
    Logger.println("A156", leakInfo2.error + " " + leakInfo2.innerObject);
    if (d != null && d.fullstack == 0) {
      String fullstack = ThreadUtil.getStackTrace(leakInfo2.error.getStackTrace(), leakInfo2.fullstackSkip);
      d.fullstack = DataProxy.sendError(fullstack);
      Logger.println("A157", fullstack);
    }
    mv.put(AlertPack.HASH_FLAG + TextTypes.ERROR + "_full-stack", d.fullstack);
  } else {
    summary.process(leakInfo2.error, 0, leakInfo2.serviceHash, leakInfo2.txid, 0, 0);
    Logger.println("A179", leakInfo2.error + " " + leakInfo2.innerObject);
  }
  DataProxy.sendAlert(AlertLevel.WARN, "CONNECTION_NOT_CLOSE", "Connection may not closed", mv);
  if(conf._trace) Logger.trace("[Force-Close-InnerObject]" + System.identityHashCode(leakInfo2.innerObject));
  boolean closeResult = leakInfo2.closeManager.close(leakInfo2.innerObject);
  //Logger.println("G003", "connection auto closed:" + closeResult);
}

代码示例来源:origin: scouter-project/scouter

private void alert(LeakInfo2 leakInfo2) {
  ServiceSummary summary = ServiceSummary.getInstance();
  MapValue mv = new MapValue();
  mv.put(AlertPack.HASH_FLAG + TextTypes.SERVICE + "_service-name", leakInfo2.serviceHash);
  if (leakInfo2.fullstack) {
    ErrorData d = summary.process(leakInfo2.error, 0, leakInfo2.serviceHash, leakInfo2.txid, 0, 0);
    Logger.println("A156", leakInfo2.error + " " + leakInfo2.innerObject);
    if (d != null && d.fullstack == 0) {
      String fullstack = ThreadUtil.getStackTrace(leakInfo2.error.getStackTrace(), leakInfo2.fullstackSkip);
      d.fullstack = DataProxy.sendError(fullstack);
      Logger.println("A157", fullstack);
    }
    mv.put(AlertPack.HASH_FLAG + TextTypes.ERROR + "_full-stack", d.fullstack);
  } else {
    summary.process(leakInfo2.error, 0, leakInfo2.serviceHash, leakInfo2.txid, 0, 0);
    Logger.println("A179", leakInfo2.error + " " + leakInfo2.innerObject);
  }
  DataProxy.sendAlert(AlertLevel.WARN, "CONNECTION_NOT_CLOSE", "Connection may not closed", mv);
  if(conf._trace) Logger.trace("[Force-Close-InnerObject]" + System.identityHashCode(leakInfo2.innerObject));
  boolean closeResult = leakInfo2.closeManager.close(leakInfo2.innerObject);
  //Logger.println("G003", "connection auto closed:" + closeResult);
}

代码示例来源:origin: scouter-project/scouter

private void alert(LeakInfo leakInfo) {
  ServiceSummary summary = ServiceSummary.getInstance();
  MapValue mv = new MapValue();
  mv.put(AlertPack.HASH_FLAG + TextTypes.SERVICE + "_service-name", leakInfo.serviceHash);
  if (leakInfo.fullstack) {
    ErrorData d = summary.process(leakInfo.error, 0, leakInfo.serviceHash, leakInfo.txid, 0, 0);
    Logger.println("A156", leakInfo.error + " " + leakInfo.inner);
    if (d != null && d.fullstack == 0) {
      String fullstack = ThreadUtil.getStackTrace(leakInfo.error.getStackTrace(), leakInfo.fullstackSkip);
      d.fullstack = DataProxy.sendError(fullstack);
      Logger.println("A157", fullstack);
    }
    mv.put(AlertPack.HASH_FLAG + TextTypes.ERROR + "_full-stack", d.fullstack);
  } else {
    summary.process(leakInfo.error, 0, leakInfo.serviceHash, leakInfo.txid, 0, 0);
    Logger.println("A179", leakInfo.error + " " + leakInfo.inner);
  }
  DataProxy.sendAlert(AlertLevel.WARN, "CONNECTION_NOT_CLOSE", "Connection may not closed", mv);
}

代码示例来源:origin: scouter-project/scouter

private void alert(LeakInfo leakInfo) {
  ServiceSummary summary = ServiceSummary.getInstance();
  MapValue mv = new MapValue();
  mv.put(AlertPack.HASH_FLAG + TextTypes.SERVICE + "_service-name", leakInfo.serviceHash);
  if (leakInfo.fullstack) {
    ErrorData d = summary.process(leakInfo.error, 0, leakInfo.serviceHash, leakInfo.txid, 0, 0);
    Logger.println("A156", leakInfo.error + " " + leakInfo.inner);
    if (d != null && d.fullstack == 0) {
      String fullstack = ThreadUtil.getStackTrace(leakInfo.error.getStackTrace(), leakInfo.fullstackSkip);
      d.fullstack = DataProxy.sendError(fullstack);
      Logger.println("A157", fullstack);
    }
    mv.put(AlertPack.HASH_FLAG + TextTypes.ERROR + "_full-stack", d.fullstack);
  } else {
    summary.process(leakInfo.error, 0, leakInfo.serviceHash, leakInfo.txid, 0, 0);
    Logger.println("A179", leakInfo.error + " " + leakInfo.inner);
  }
  DataProxy.sendAlert(AlertLevel.WARN, "CONNECTION_NOT_CLOSE", "Connection may not closed", mv);
}

代码示例来源:origin: org.multiverse/multiverse-core

@Override
  public StackTraceElement[] getStackTrace() {
    if (fillStackTrace) {
      return super.getStackTrace();
    } else {
      return new StackTraceElement[0];
    }
  }
}

代码示例来源:origin: pveentjer/Multiverse

@Override
  public StackTraceElement[] getStackTrace() {
    if (fillStackTrace) {
      return super.getStackTrace();
    } else {
      return new StackTraceElement[0];
    }
  }
}

代码示例来源:origin: org.appdapter/org.appdapter.lib.gui

@Override public StackTraceElement[] getStackTrace() {
  rethrowThisMaybe();
  return super.getStackTrace();
}

代码示例来源:origin: org.biojava.thirdparty/forester

final static void unexpectedError( final Error e ) {
  System.err.println();
  e.printStackTrace( System.err );
  System.err.println();
  final StringBuffer sb = new StringBuffer();
  for( final StackTraceElement s : e.getStackTrace() ) {
    sb.append( s + "\n" );
  }
  JOptionPane
  .showMessageDialog( null,
            "An unexpected (possibly severe) error has occured - terminating. \nPlease contact: "
                + Constants.AUTHOR_EMAIL + " \nError: " + e.getLocalizedMessage() + "\n"
                + sb,
                "Unexpected Severe Error [" + Constants.PRG_NAME + " " + Constants.VERSION + "]",
                JOptionPane.ERROR_MESSAGE );
  System.exit( -1 );
}

代码示例来源:origin: wildfly/wildfly-core

@Override
public final Error invalidObjectName(final String name, final String message) {
  final Error result = new Error(String.format(getLoggingLocale(), invalidObjectName2$str(), name, message));
  final StackTraceElement[] st = result.getStackTrace();
  result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
  return result;
}
private static final String invalidObjectName3 = "WFLYJMX0015: Invalid ObjectName: %s,%s; %s";

代码示例来源:origin: org.jboss.ws/jbossws-common

@Override
public final Error invalidObjectName(final Throwable cause, final String message) {
  final Error result = new Error(String.format(getLoggingLocale(), invalidObjectName$str(), message), cause);
  final StackTraceElement[] st = result.getStackTrace();
  result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
  return result;
}
private static final String invalidBinaryComponentForArray = "JBWS022005: Could not get component type from array; invalid binary component for array: %s";

代码示例来源:origin: EvoSuite/evosuite

public MockError(String message) {
  super(message);
  delegate = new MockThrowable(message);
  delegate.setOriginForDelegate(super.getStackTrace()[0]);
}

代码示例来源:origin: wildfly/wildfly-core

@Override
public final Error invalidObjectName(final String domain, final java.util.Hashtable<String, String> table, final String message) {
  final Error result = new Error(String.format(getLoggingLocale(), invalidObjectName3$str(), domain, table, message));
  final StackTraceElement[] st = result.getStackTrace();
  result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
  return result;
}
private static final String invalidObjectName4 = "WFLYJMX0015: Invalid ObjectName: %s,%s,%s; %s";

代码示例来源:origin: wildfly/wildfly-core

@Override
public final Error invalidObjectName(final String domain, final String key, final String value, final String message) {
  final Error result = new Error(String.format(getLoggingLocale(), invalidObjectName4$str(), domain, key, value, message));
  final StackTraceElement[] st = result.getStackTrace();
  result.setStackTrace(Arrays.copyOfRange(st, 1, st.length));
  return result;
}
private static final String mbeanNotFound = "WFLYJMX0017: No MBean found with name %s";

代码示例来源:origin: EvoSuite/evosuite

public MockError() {
  super();
  delegate = new MockThrowable();
  delegate.setOriginForDelegate(super.getStackTrace()[0]);
}

代码示例来源:origin: EvoSuite/evosuite

protected MockError(String message, Throwable cause,
    boolean enableSuppression,
    boolean writableStackTrace) {
  super(message,cause,enableSuppression,writableStackTrace);
  delegate = new MockThrowable(message, cause, enableSuppression, writableStackTrace);
  delegate.setOriginForDelegate(super.getStackTrace()[0]);
}

代码示例来源:origin: EvoSuite/evosuite

public MockError(Throwable cause) {
  super(cause);
  delegate = new MockThrowable(cause);
  delegate.setOriginForDelegate(super.getStackTrace()[0]);
}

代码示例来源:origin: EvoSuite/evosuite

private MockThrowable getDelegate(){
  if(delegate == null){
    delegate = new MockThrowable(); //placeholder
    delegate.setOriginForDelegate(super.getStackTrace()[0]);
  }
  return delegate;
}

代码示例来源:origin: EvoSuite/evosuite

public MockError(String message, Throwable cause) {
  super(message, cause);
  delegate = new MockThrowable(message, cause);
  delegate.setOriginForDelegate(super.getStackTrace()[0]);
}

代码示例来源:origin: Camelcade/Perl5-IDEA

protected void locateToken() {
  if (myTokenType != null) {
   return;
  }
  try {
   compileState();
   myTokenType = myFlex.advance();
  }
  catch (IOException e) { /*Can't happen*/ }
  catch (Error e) {
   // add lexer class name to the error
   final Error error = new Error(myFlex.getClass().getName() + ": " + e.getMessage());
   error.setStackTrace(e.getStackTrace());
   throw error;
  }
 }
}

代码示例来源:origin: EvoSuite/evosuite

/**
  @Override
  public synchronized Throwable fillInStackTrace() {
    if(!MockFramework.isEnabled()){
      return super.fillInStackTrace();
    }
    return getDelegate().fillInStackTrace();
  }
*/
  @Override
  public StackTraceElement[] getStackTrace() {		
    if(!MockFramework.isEnabled()){
      return super.getStackTrace();
    }
    return getDelegate().getStackTrace();
  }

相关文章