Skip to content

Commit

Permalink
Always cancel timer when we're done, even if an exception is thrown. C…
Browse files Browse the repository at this point in the history
…loses #540
  • Loading branch information
aslakhellesoy committed Jun 10, 2013
1 parent 4b35330 commit a528334
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [Git master](https://github.com/cucumber/cucumber-jvm/compare/v1.1.3...master) (not released)

* [Core] Always cancel tomeout at the end of a stepdef, even when it fails. ([#540](https://github.com/cucumber/cucumber-jvm/issues/540) irb1s)
* [Groovy] Updated examples to be more explanatory and groovier syntax ([#537](https://github.com/cucumber/cucumber-jvm/pull/522) Quantoid)
* [Core] [Picocontainer] Not shading the artifact any longer. Groovy, Jython, and Jruby are still shading it. ([#522](https://github.com/cucumber/cucumber-jvm/pull/522) Dmytro Chyzhykov)
* [Core] The `json-pretty` formatter is gone, and the `json` formatter is pretty!
Expand Down
8 changes: 5 additions & 3 deletions core/src/main/java/cucumber/runtime/Timeout.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ public void run() {
}
}, timeoutMillis, TimeUnit.MILLISECONDS);
try {
T result = callback.call();
timer.cancel(true);
return result;
return callback.call();
} catch (InterruptedException timeout) {
throw new TimeoutException("Timed out after " + timeoutMillis + "ms.");
} finally {
done.set(true);
timer.cancel(true);
}

}
}

Expand Down

0 comments on commit a528334

Please sign in to comment.