Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian de Alwis2016-04-07 16:20:29 +0000
committerBrian de Alwis2016-04-08 14:37:13 +0000
commit87502bc98ec1c89e8adba4df7aa86d3e12dd4a06 (patch)
tree9885c30210bdb6aaede8ed576bf769d97681fea8 /org.eclipse.ua.tests/help
parent3690d52e9e3c1f9452c3061a4e3fe91f006395d6 (diff)
downloadeclipse.platform.ua-87502bc98ec1c89e8adba4df7aa86d3e12dd4a06.tar.gz
eclipse.platform.ua-87502bc98ec1c89e8adba4df7aa86d3e12dd4a06.tar.xz
eclipse.platform.ua-87502bc98ec1c89e8adba4df7aa86d3e12dd4a06.zip
Bug 491265 - Generify org.eclipse.ui.intro*
Move org.eclipse.ui.intro.universal to JavaSE-1.8 Fix leaked resources Change-Id: I831a65808709853459129c20244c42a84dd6bf02
Diffstat (limited to 'org.eclipse.ua.tests/help')
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java12
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/ProductPreferencesTest.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerInterrupt.java9
3 files changed, 12 insertions, 11 deletions
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java
index 96ad6cbe8..7038662aa 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/DynamicXHTMLProcessorTest.java
@@ -39,16 +39,18 @@ public class DynamicXHTMLProcessorTest {
private String process(String path) throws Exception {
Bundle bundle = UserAssistanceTestPlugin.getDefault().getBundle();
- InputStream is = getProcessedInput(path, bundle);
- return readStream(is);
+ try (InputStream is = getProcessedInput(path, bundle)) {
+ return readStream(is);
+ }
}
protected InputStream getProcessedInput(String path, Bundle bundle)
throws IOException, SAXException, ParserConfigurationException,
TransformerException, TransformerConfigurationException {
- InputStream in = bundle.getEntry(path).openStream();
- String href = '/' + bundle.getBundleId() +path;
- return DynamicXHTMLProcessor.process(href, in, "en", true);
+ try (InputStream in = bundle.getEntry(path).openStream()) {
+ String href = '/' + bundle.getBundleId() + path;
+ return DynamicXHTMLProcessor.process(href, in, "en", true);
+ }
}
private String readStream(InputStream is) throws Exception {
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/ProductPreferencesTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/ProductPreferencesTest.java
index 09e2c67be..6ac5ab978 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/ProductPreferencesTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/preferences/ProductPreferencesTest.java
@@ -173,7 +173,7 @@ public class ProductPreferencesTest {
public void testGetValue() {
for (String[] data : GET_VALUE_DATA) {
String key = data[0];
- Set<String> allowableValues = new HashSet<String>(ProductPreferences.tokenize(data[1]));
+ Set<String> allowableValues = new HashSet<>(ProductPreferences.tokenize(data[1]));
Properties primary = ProductPreferences.loadPropertiesFile(UserAssistanceTestPlugin.getDefault().getBundle().getSymbolicName(), "data/help/preferences/" + data[2]);
Properties[] secondary = new Properties[data.length - 3];
for (int j=0;j<secondary.length;++j) {
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerInterrupt.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerInterrupt.java
index eb6095fd2..181156d7e 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerInterrupt.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/HelpServerInterrupt.java
@@ -102,17 +102,16 @@ public class HelpServerInterrupt {
}
private void checkServer() throws Exception {
- InputStream input;
long start = System.currentTimeMillis();
try {
int port = WebappManager.getPort();
URL url = new URL("http", "localhost", port, "/help/index.jsp");
URLConnection connection = url.openConnection();
setTimeout(connection, 5000);
- input = connection.getInputStream();
- int firstbyte = input.read();
- Assert.assertTrue(firstbyte > 0);
- input.close();
+ try (InputStream input = connection.getInputStream()) {
+ int firstbyte = input.read();
+ Assert.assertTrue(firstbyte > 0);
+ }
} catch (Exception e) {
long elapsed = System.currentTimeMillis() - start;
System.out.println("Fail, milliseconds = " + elapsed);

Back to the top