mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Throw exception from user code in SpringFailOnTimeout even if a timeout occurs
Issue: SPR-16717
This commit is contained in:
committed by
Sam Brannen
parent
697d2e326f
commit
3c34a1cb8c
+5
-9
@@ -88,15 +88,11 @@ public class SpringFailOnTimeout extends Statement {
|
||||
}
|
||||
else {
|
||||
long startTime = System.currentTimeMillis();
|
||||
try {
|
||||
this.next.evaluate();
|
||||
}
|
||||
finally {
|
||||
long elapsed = System.currentTimeMillis() - startTime;
|
||||
if (elapsed > this.timeout) {
|
||||
throw new TimeoutException(
|
||||
String.format("Test took %s ms; limit was %s ms.", elapsed, this.timeout));
|
||||
}
|
||||
this.next.evaluate();
|
||||
long elapsed = System.currentTimeMillis() - startTime;
|
||||
if (elapsed > this.timeout) {
|
||||
throw new TimeoutException(
|
||||
String.format("Test took %s ms; limit was %s ms.", elapsed, this.timeout));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user