提交 c9ba8424 编写于 作者: K kohsuke

report the entire call stack, not just the tip.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@33557 71c3de6d-444a-0410-be80-ed276b4c234a
上级 c4dffa48
......@@ -100,6 +100,8 @@ import org.kohsuke.stapler.export.ExportedBean;
import com.thoughtworks.xstream.XStream;
import static java.util.logging.Level.FINE;
/**
* A particular execution of {@link Job}.
*
......@@ -293,16 +295,13 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
// state can change only when we are building
assert state==State.BUILDING;
StackTraceElement caller = findCaller(Thread.currentThread().getStackTrace(),"setResult");
// result can only get worse
if(result==null) {
result = r;
LOGGER.fine(toString()+" : result is set to "+r+" by "+caller);
LOGGER.log(FINE, toString()+" : result is set to "+r,new Exception());
} else {
if(r.isWorseThan(result)) {
LOGGER.fine(toString()+" : result is set to "+r+" by "+caller);
LOGGER.log(FINE, toString()+" : result is set to "+r,new Exception());
result = r;
}
}
......@@ -329,15 +328,6 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
else return r;
}
private StackTraceElement findCaller(StackTraceElement[] stackTrace, String callee) {
for(int i=0; i<stackTrace.length-1; i++) {
StackTraceElement e = stackTrace[i];
if(e.getMethodName().equals(callee))
return stackTrace[i+1];
}
return null; // not found
}
/**
* Returns true if the build is not completed yet.
* This includes "not started yet" state.
......@@ -1263,10 +1253,10 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
throw t;
} catch( AbortException e ) {// orderly abortion.
result = Result.FAILURE;
LOGGER.log(Level.FINE, "Build "+this+" aborted",e);
LOGGER.log(FINE, "Build "+this+" aborted",e);
} catch( RunnerAbortedException e ) {// orderly abortion.
result = Result.FAILURE;
LOGGER.log(Level.FINE, "Build "+this+" aborted",e);
LOGGER.log(FINE, "Build "+this+" aborted",e);
} catch( InterruptedException e) {
// aborted
result = Result.ABORTED;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册