Cleaning up the htmlunit error handling code.
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@5952 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java b/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java
index d740fab..96b133c 100644
--- a/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java
+++ b/user/src/com/google/gwt/junit/RunStyleHtmlUnit.java
@@ -82,13 +82,13 @@
@Override
public void run() {
WebClient webClient = new WebClient(browser);
- webClient.setAlertHandler(this);
- webClient.setIncorrectnessListener(this);
- webClient.setThrowExceptionOnFailingStatusCode(false);
- webClient.setThrowExceptionOnScriptError(true);
- webClient.setOnbeforeunloadHandler(this);
- setupWebClient(webClient);
try {
+ webClient.setAlertHandler(this);
+ webClient.setIncorrectnessListener(this);
+ webClient.setThrowExceptionOnFailingStatusCode(false);
+ webClient.setThrowExceptionOnScriptError(true);
+ webClient.setOnbeforeunloadHandler(this);
+ setupWebClient(webClient);
Page page = webClient.getPage(url);
// TODO(jat): is this necessary?
webClient.waitForBackgroundJavaScriptStartingBefore(2000);
@@ -101,9 +101,9 @@
treeLogger.log(TreeLogger.ERROR, "Bad URL", e);
} catch (IOException e) {
treeLogger.log(TreeLogger.ERROR, "I/O error on HTTP request", e);
+ } finally {
+ webClient.closeAllWindows();
}
- webClient.closeAllWindows();
- return;
}
/**