File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed
src/main/java/hudson/tasks/test Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change 2323 */
2424package hudson .tasks .test ;
2525
26+ import hudson .model .Job ;
2627import hudson .model .Result ;
2728import hudson .model .Run ;
2829import hudson .tasks .junit .TestAction ;
2930import java .util .Collection ;
3031import java .util .Collections ;
3132import java .util .Map ;
33+ import java .util .logging .Level ;
34+ import java .util .logging .Logger ;
3235
3336/**
3437 * A class that represents a general concept of a test result, without any
3841 * @since 1.343
3942 */
4043public abstract class TestResult extends TestObject {
44+ private static final Logger LOGGER = Logger .getLogger (TestResult .class .getName ());
4145
4246 /**
4347 * If the concept of a parent action is important to a subclass, then it should
@@ -136,17 +140,27 @@ public TestResult getPreviousResult() {
136140 if (b == null ) {
137141 return null ;
138142 }
143+ Job <?, ?> job = b .getParent ();
139144 while (true ) {
140145 b = b .getPreviousBuild ();
141146 if (b == null ) {
142147 return null ;
143148 }
144- AbstractTestResultAction r = b .getAction (getParentAction ().getClass ());
145- if (r != null ) {
146- TestResult result = r .findCorrespondingResult (this .getId ());
147- if (result != null ) {
148- return result ;
149+ try {
150+ AbstractTestResultAction r = b .getAction (getParentAction ().getClass ());
151+ if (r != null ) {
152+ TestResult result = r .findCorrespondingResult (this .getId ());
153+ if (result != null ) {
154+ return result ;
155+ }
149156 }
157+ } catch (RuntimeException e ) {
158+ Run <?, ?> loggedBuild = b ;
159+ LOGGER .log (
160+ Level .WARNING ,
161+ e ,
162+ () -> "Failed to load (corrupt?) build " + job .getFullName () + " #" + loggedBuild .getNumber ()
163+ + ", skipping" );
150164 }
151165 }
152166 }
You can’t perform that action at this time.
0 commit comments