diff options
author | Chris Goldthorpe | 2011-10-12 17:42:53 +0000 |
---|---|---|
committer | Chris Goldthorpe | 2011-10-12 17:42:53 +0000 |
commit | a060838fb5b749bf2632e890047e823ade6e9760 (patch) | |
tree | bb68ad3c7eadc3a277c15dedb209b7a69e61c1bc /org.eclipse.ua.tests/help/org | |
parent | e58c6b3fb4de4d8ce545d6702f2b4e5a9b1f03e4 (diff) | |
download | eclipse.platform.ua-a060838fb5b749bf2632e890047e823ade6e9760.tar.gz eclipse.platform.ua-a060838fb5b749bf2632e890047e823ade6e9760.tar.xz eclipse.platform.ua-a060838fb5b749bf2632e890047e823ade6e9760.zip |
Bug 360704 - [Test] warnings about not closing streams in
org.eclipse.ua.tests
Diffstat (limited to 'org.eclipse.ua.tests/help/org')
14 files changed, 36 insertions, 20 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 fcf0a42ea..863c8899c 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -68,6 +68,7 @@ public class DynamicXHTMLProcessorTest extends TestCase { buffer.append(cbuf, 0, len); } } while (len >= 0); + inputStreamReader.close(); return buffer.toString(); } diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/EntityResolutionTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/EntityResolutionTest.java index dae79efde..1a0c23703 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/EntityResolutionTest.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/other/EntityResolutionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -31,6 +31,7 @@ public class EntityResolutionTest extends TestCase { if (reader != null) { char[] cbuf = new char[5]; read = reader.read(cbuf); + reader.close(); } else { byte buf[] = new byte[5]; read = stream.read(buf); @@ -40,6 +41,9 @@ public class EntityResolutionTest extends TestCase { } else { assertTrue("Unsupported Entity did not return empty stream", read == -1); } + if (stream != null) { + stream.close(); + } } public void testXhtml1() throws Exception { diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/RemoteTestUtils.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/RemoteTestUtils.java index 30ac88c73..8523acfa8 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/RemoteTestUtils.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/remote/RemoteTestUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. + * Copyright (c) 2009, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -66,6 +66,7 @@ public class RemoteTestUtils { buffer.append(cbuf, 0, len); } } while (len >= 0); + inputStreamReader.close(); return buffer.toString(); } diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/ExtraDirTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/ExtraDirTest.java index bbf01e17c..a588c06e5 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/ExtraDirTest.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/ExtraDirTest.java @@ -145,7 +145,7 @@ public class ExtraDirTest extends TestCase { // run test final Set<String> unexpectedHrefs = new HashSet<String>(); - ISearchQuery query = new SearchQuery(searchWord, false, new ArrayList(), Platform.getNL()); + ISearchQuery query = new SearchQuery(searchWord, false, new ArrayList<String>(), Platform.getNL()); SearchResults collector = new SearchResults(workingSets, 500, Platform.getNL()); BaseHelpSystem.getSearchManager().search(query, collector, new NullProgressMonitor()); SearchHit[] hits = collector.getSearchHits(); diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MetaKeywords.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MetaKeywords.java index 0df50ecd1..b45f59d3d 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MetaKeywords.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/MetaKeywords.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -63,7 +63,7 @@ public class MetaKeywords extends TestCase { } private SearchHit[] getResultDescriptions(String searchWord, String nl) { - ISearchQuery query = new SearchQuery(searchWord, false, new ArrayList(), nl); + ISearchQuery query = new SearchQuery(searchWord, false, new ArrayList<String>(), nl); SearchResults collector = new SearchResults(null, 500, nl); BaseHelpSystem.getSearchManager().search(query, collector, new NullProgressMonitor()); return collector.getSearchHits(); diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java index 83b668e25..9cd5d8b45 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/PrebuiltIndexCompatibility.java @@ -148,7 +148,7 @@ public class PrebuiltIndexCompatibility extends TestCase { Directory luceneDirectory = new NIOFSDirectory(new File(filePath)); IndexSearcher searcher = new IndexSearcher(luceneDirectory, true); QueryBuilder queryBuilder = new QueryBuilder("eclipse", new AnalyzerDescriptor("en-us")); - Query luceneQuery = queryBuilder.getLuceneQuery(new ArrayList() , false); + Query luceneQuery = queryBuilder.getLuceneQuery(new ArrayList<String>() , false); TopDocs hits = searcher.search(luceneQuery, 500); assertEquals(hits.totalHits, 1); } else { diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchCheatsheet.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchCheatsheet.java index 62fc0fed7..aa6f5c51f 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchCheatsheet.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchCheatsheet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,7 +35,7 @@ public class SearchCheatsheet extends TestCase { } public SearchHit[] findHits(String searchWord) { - ISearchQuery query = new SearchQuery(searchWord, false, new ArrayList(), Platform.getNL()); + ISearchQuery query = new SearchQuery(searchWord, false, new ArrayList<String>(), Platform.getNL()); SearchResults collector = new SearchResults(null, 10, Platform.getNL()); BaseHelpSystem.getSearchManager().search(query, collector, new NullProgressMonitor()); return collector.getSearchHits(); diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchIntro.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchIntro.java index c2b7f4ff4..3f4af3869 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchIntro.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchIntro.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,7 +35,7 @@ public class SearchIntro extends TestCase { } public SearchHit[] findHits(String searchWord) { - ISearchQuery query = new SearchQuery(searchWord, false, new ArrayList(), Platform.getNL()); + ISearchQuery query = new SearchQuery(searchWord, false, new ArrayList<String>(), Platform.getNL()); SearchResults collector = new SearchResults(null, 10, Platform.getNL()); BaseHelpSystem.getSearchManager().search(query, collector, new NullProgressMonitor()); return collector.getSearchHits(); diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchRanking.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchRanking.java index 9e084da16..a7573296b 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchRanking.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchRanking.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. + * Copyright (c) 2010, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,7 +36,7 @@ public class SearchRanking extends TestCase { } public SearchHit[] findHits(String searchWord) { - ISearchQuery query = new SearchQuery(searchWord, false, new ArrayList(), Platform.getNL()); + ISearchQuery query = new SearchQuery(searchWord, false, new ArrayList<String>(), Platform.getNL()); SearchResults collector = new SearchResults(null, 10, Platform.getNL()); BaseHelpSystem.getSearchManager().search(query, collector, new NullProgressMonitor()); return collector.getSearchHits(); diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchTestUtils.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchTestUtils.java index d85fa9f1b..c4301a66d 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchTestUtils.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/SearchTestUtils.java @@ -96,7 +96,7 @@ public class SearchTestUtils { public static SearchHit[] getSearchHits(String searchWord, String nl) { SearchHit[] hits; - ISearchQuery query = new SearchQuery(searchWord, false, new ArrayList(), nl); + ISearchQuery query = new SearchQuery(searchWord, false, new ArrayList<String>(), nl); SearchResults collector = new SearchResults(null, 500, nl); BaseHelpSystem.getSearchManager().search(query, collector, new NullProgressMonitor()); hits = collector.getSearchHits(); diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/LoadServletUtil.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/LoadServletUtil.java index 9d56cb243..ebdda49e6 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/LoadServletUtil.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/LoadServletUtil.java @@ -34,11 +34,10 @@ public class LoadServletUtil { URL url = new URL("http", "localhost", port, "/help/index.jsp"); URLConnection connection = url.openConnection(); setTimeout(connection, 5000); - InputStream input = connection.getInputStream(); - input = url.openStream(); + InputStream input = url.openStream(); int firstbyte = input.read(); - Assert.assertTrue(firstbyte > 0); input.close(); + Assert.assertTrue(firstbyte > 0); } /** diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/FilterTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/FilterTest.java index 94960af3b..eecb269ed 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/FilterTest.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/FilterTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. + * Copyright (c) 2007, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -59,6 +59,7 @@ public class FilterTest extends TestCase { filteredOutput.write(BODY1.getBytes()); filteredOutput.write(CONTENT1.getBytes()); filteredOutput.write(BODY2.getBytes()); + filteredOutput.close(); } catch (IOException e) { fail("IO Exception"); } @@ -78,6 +79,7 @@ public class FilterTest extends TestCase { filteredOutput.write(BODY1.getBytes()); filteredOutput.write(CONTENT1.getBytes()); filteredOutput.write(BODY2.getBytes()); + filteredOutput.close(); } catch (IOException e) { fail("IO Exception"); } @@ -95,6 +97,7 @@ public class FilterTest extends TestCase { filteredOutput.write(BODYLC1.getBytes()); filteredOutput.write(CONTENT1.getBytes()); filteredOutput.write(BODYLC2.getBytes()); + filteredOutput.close(); } catch (IOException e) { fail("IO Exception"); } @@ -110,6 +113,7 @@ public class FilterTest extends TestCase { filteredOutput.write(BODY1.getBytes()); filteredOutput.write(CONTENT1.getBytes()); filteredOutput.write(BODY2.getBytes()); + filteredOutput.close(); } catch (IOException e) { fail("IO Exception"); } @@ -127,6 +131,7 @@ public class FilterTest extends TestCase { filteredOutput.write(HEAD2.getBytes()); filteredOutput.write(BODY1.getBytes()); filteredOutput.write(BODY2.getBytes()); + filteredOutput.close(); final String expected = HTML40 + HEAD1 + CONTENT_TYPE_UTF8 + HEAD2 + BODY1 + '\n' + CHINESE_CONTENT + '\n' + BODY2; assertEquals(expected, output.toString("UTF-8")); } catch (IOException e) { @@ -144,6 +149,7 @@ public class FilterTest extends TestCase { filteredOutput.write(HEAD2.getBytes()); filteredOutput.write(BODY1.getBytes()); filteredOutput.write(BODY2.getBytes()); + filteredOutput.close(); final String expected = HTML40 + HEAD1 + CONTENT_TYPE_ISO_8859_1 + HEAD2 + BODY1 + '\n' + CHINESE_ENTITY_CONTENT + '\n' + BODY2; assertEquals(expected, output.toString()); } catch (IOException e) { @@ -160,6 +166,7 @@ public class FilterTest extends TestCase { filteredOutput.write(HEAD2.getBytes()); filteredOutput.write(BODY1.getBytes()); filteredOutput.write(BODY2.getBytes()); + filteredOutput.close(); final String expected = HTML40 + HEAD1 + HEAD2 + BODY1 + '\n' + CHINESE_ENTITY_CONTENT + '\n' + BODY2; assertEquals(expected, output.toString()); } catch (IOException e) { diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/PluginsRootReplacement.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/PluginsRootReplacement.java index 8721e8471..4425cc1ac 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/PluginsRootReplacement.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/PluginsRootReplacement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. + * Copyright (c) 2009, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -151,6 +151,8 @@ public class PluginsRootReplacement extends TestCase { } String data = output.toString(); checkFilter(data, data); + input.close(); + output.close(); } } diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/TocZipTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/TocZipTest.java index 4b836370e..ad1a32e80 100644 --- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/TocZipTest.java +++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/TocZipTest.java @@ -60,7 +60,9 @@ public class TocZipTest extends TestCase { while(result != -1) { os.write(result); result = buffered.read(); - } + } + buffered.close(); + os.close(); return os.toString(); } |