Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.ua.tests/help/org/eclipse/ua/tests')
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerBinding.java9
1 files changed, 4 insertions, 5 deletions
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerBinding.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerBinding.java
index 8772ca3f9..8a5867bf9 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerBinding.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerBinding.java
@@ -93,16 +93,15 @@ public class HelpServerBinding {
}
private boolean canAccessServer(String host) throws Exception {
- InputStream input;
try {
int port = WebappManager.getPort();
URL url = new URL("http", host, port, "/help/index.jsp");
URLConnection connection = url.openConnection();
setTimeout(connection, 5000);
- input = connection.getInputStream();
- int firstbyte = input.read();
- input.close();
- return firstbyte > 0;
+ try (InputStream input = connection.getInputStream()) {
+ int firstbyte = input.read();
+ return firstbyte > 0;
+ }
} catch (Exception e) {
return false;
}

Back to the top