java.lang.Exception.fillInStackTrace()方法的使用及代码示例

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

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

Exception.fillInStackTrace介绍

暂无

代码示例

代码示例来源:origin: gocd/gocd

public void building() {
  if (state != null && !isReRun()) {
    LOG.warn("Expected stage [{}] to have no state, but was {}", identifier, state, new Exception().fillInStackTrace());
  }
  state = StageState.Building;
}

代码示例来源:origin: jenkinsci/jenkins

Throwable e = new Exception().fillInStackTrace();
LOGGER.log(Level.WARNING,msg,e);

代码示例来源:origin: robolectric/robolectric

Exception e = exceptions.get(dataSource);
if (e != null) {
 e.fillInStackTrace();
 if (e instanceof IOException) {
  throw (IOException)e;

代码示例来源:origin: gocd/gocd

private void logIfJobIsCompleted(JobInstance jobInstance) {
  JobState currentState = getCurrentState(jobInstance.getId());
  if (currentState.isCompleted() && !jobInstance.isCopy()) {
    String message = String.format(
        "State change for a completed Job is not allowed. Job %s is currently State=%s, Result=%s",
        jobInstance.getIdentifier(), jobInstance.getState(), jobInstance.getResult());
    LOG.warn(message, new Exception().fillInStackTrace());
  }
}

代码示例来源:origin: geoserver/geoserver

if (LOGGER.isLoggable(Level.FINE)) {
  Exception e = new Exception("Full stack trace for the session creation path");
  e.fillInStackTrace();
  LOGGER.log(
      Level.FINE,
if (LOGGER.isLoggable(Level.INFO)) {
  Exception e = new Exception("Full stack trace for the session creation path");
  e.fillInStackTrace();
  LOGGER.log(
      Level.INFO,

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

final DiscoveryGroupConfiguration discoveryGroupConfiguration,
            final TransportConfiguration[] transportConfigs) {
traceException.fillInStackTrace();

代码示例来源:origin: alibaba/jstorm

public static void test() {
  
  String[] className = Thread.currentThread().getStackTrace()[1].getClassName().split("\\.");
  String topologyName = className[className.length - 1];
  
  try {
    TopologyBuilder builder = new TopologyBuilder();
    builder.setSpout("integer", new RandomIntegerSpout(), 1);
    builder.setBolt("slidingsum", new SlidingWindowSumBolt().withWindow(new Count(30), new Count(10)), 1)
        .shuffleGrouping("integer");
    builder.setBolt("tumblingavg", new TumblingWindowAvgBolt().withTumblingWindow(new Count(3)), 1)
        .shuffleGrouping("slidingsum");
    builder.setBolt("printer", new PrinterBolt(), 1).shuffleGrouping("tumblingavg");
    
    conf.setDebug(true);
    
    JStormHelper.runTopology(builder.createTopology(), topologyName, conf, 60,
        new JStormHelper.CheckAckedFail(conf), isLocal);
  } catch (Exception e) {
    // TODO Auto-generated catch block
    e.fillInStackTrace();
    Assert.fail("Failed to submit topology");
  }
}

代码示例来源:origin: geotools/geotools

public NetCDFImageReader(ImageReaderSpi originatingProvider) {
  super(originatingProvider);
  if (NetCDFUtilities.TRACE_ENABLED) {
    tracer = new Exception();
    tracer.fillInStackTrace();
  }
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Creates a stack trace representing the existing thread's current state.
 * @return a string object representing the current state.
 * TODO investigate if we simply should store {@link java.lang.Thread#getStackTrace()} elements
 */
protected static String getThreadDump() {
  Exception x = new Exception();
  x.fillInStackTrace();
  return getStackTrace(x);
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

pMarker1.addParents(gfMarker);
final Exception sourceHelper = new Exception();
sourceHelper.fillInStackTrace();
final Exception cause = new NullPointerException("testNPEx");
sourceHelper.fillInStackTrace();
final StackTraceElement source = sourceHelper.getStackTrace()[0];
final IOException ioException = new IOException("testIOEx", cause);

代码示例来源:origin: geotools/geotools

public ShapefileDataStore(URL url) {
  shpFiles = new ShpFiles(url);
  if (TRACE_ENABLED) {
    trace = new Exception();
    trace.fillInStackTrace();
  }
  shpManager = new ShapefileSetManager(shpFiles, this);
  indexManager = new IndexManager(shpFiles, this);
}

代码示例来源:origin: advantageous/qbit

ex.fillInStackTrace();
logger.debug("Health Service CREATED", ex);

代码示例来源:origin: geotools/geotools

tracer.fillInStackTrace();

代码示例来源:origin: org.apache.aries.testsupport/org.apache.aries.testsupport.unit

public Object handle(MethodCall methodCall, Skeleton parent) throws Exception
 {
  thingToThrow.fillInStackTrace();
  throw thingToThrow;
 }
});

代码示例来源:origin: geotools/geotools

tracer.fillInStackTrace();

代码示例来源:origin: freenet/fred

@Override
  public final Throwable fillInStackTrace() {
    if (shouldFillInStackTrace()) {
      return super.fillInStackTrace();
    }
    return null;
  }
}

代码示例来源:origin: org.apache.tomcat/tomcat-jdbc

/**
 * Creates a stack trace representing the existing thread's current state.
 * @return a string object representing the current state.
 * TODO investigate if we simply should store {@link java.lang.Thread#getStackTrace()} elements
 */
protected static String getThreadDump() {
  Exception x = new Exception();
  x.fillInStackTrace();
  return getStackTrace(x);
}

代码示例来源:origin: apache/cxf

public void run() {
  try {
    startSignal.await();
    checkBook(address, id, expected);
    doneSignal.countDown();
  } catch (InterruptedException ex) {
    // ignore
  } catch (Exception ex) {
    ex.fillInStackTrace();
    error = ex;
  }
}

代码示例来源:origin: apache/cxf

public String sayHi() {
  // throw the exception out with some cause
  Exception cause = new IllegalArgumentException("Get a wrong name <sayHi>",
                          new NullPointerException("Test cause."));
  cause.fillInStackTrace();
  throw new Fault("sayHiFault", LOG, cause);
}

代码示例来源:origin: Netflix/spectator

@Test
public void numStackTraces() {
 Counter c = registry.counter("log4j.numStackTraces",
   "loglevel", "5_DEBUG",
   "exception", "IllegalArgumentException",
   "file", "?"); // Location is unknown because it is not called via logger
 Assertions.assertEquals(0, c.count());
 Exception e = new IllegalArgumentException("foo");
 e.fillInStackTrace();
 appender.append(newEvent(Level.DEBUG, e));
 Assertions.assertEquals(1, c.count());
}

相关文章