summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMarkus Duft2013-10-07 08:08:49 (EDT)
committer Markus Duft2013-10-14 07:29:41 (EDT)
commitc2b7195928e4aca6066867972d8b3d0de517a66d (patch)
treec9a17e250fe5053a051508372ca4862bafe90670
parentd2522a0f7c9e02542543ceb2225617b006f6f0de (diff)
downloadeclipse.platform.ui-c2b7195928e4aca6066867972d8b3d0de517a66d.zip
eclipse.platform.ui-c2b7195928e4aca6066867972d8b3d0de517a66d.tar.gz
eclipse.platform.ui-c2b7195928e4aca6066867972d8b3d0de517a66d.tar.bz2
Ensure ZIP file is closed in navigator testsrefs/changes/35/17335/2
Change-Id: I6f6b13cd016d080d34968350b7defa4e1146209c Signed-off-by: Markus Duft <markus.duft@salomon.at>
-rw-r--r--tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/util/ProjectUnzipUtil.java46
1 files changed, 25 insertions, 21 deletions
diff --git a/tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/util/ProjectUnzipUtil.java b/tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/util/ProjectUnzipUtil.java
index 4f6a10e..fd526ea 100644
--- a/tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/util/ProjectUnzipUtil.java
+++ b/tests/org.eclipse.ui.tests.navigator/src/org/eclipse/ui/tests/navigator/util/ProjectUnzipUtil.java
@@ -99,29 +99,33 @@ public class ProjectUnzipUtil {
} catch (IOException e1) {
throw e1;
}
- Enumeration entries = zipFile.entries();
- while (entries.hasMoreElements()) {
- ZipEntry entry = (ZipEntry) entries.nextElement();
- monitor.subTask(entry.getName());
- File aFile = computeLocation(entry.getName()).toFile();
- File parentFile = null;
- try {
- if (entry.isDirectory()) {
- aFile.mkdirs();
- } else {
- parentFile = aFile.getParentFile();
- if (!parentFile.exists())
- parentFile.mkdirs();
- if (!aFile.exists())
- aFile.createNewFile();
- copy(zipFile.getInputStream(entry), new FileOutputStream(aFile));
- if (entry.getTime() > 0)
- aFile.setLastModified(entry.getTime());
+ try {
+ Enumeration entries = zipFile.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = (ZipEntry) entries.nextElement();
+ monitor.subTask(entry.getName());
+ File aFile = computeLocation(entry.getName()).toFile();
+ File parentFile = null;
+ try {
+ if (entry.isDirectory()) {
+ aFile.mkdirs();
+ } else {
+ parentFile = aFile.getParentFile();
+ if (!parentFile.exists())
+ parentFile.mkdirs();
+ if (!aFile.exists())
+ aFile.createNewFile();
+ copy(zipFile.getInputStream(entry), new FileOutputStream(aFile));
+ if (entry.getTime() > 0)
+ aFile.setLastModified(entry.getTime());
+ }
+ } catch (IOException e) {
+ throw e;
}
- } catch (IOException e) {
- throw e;
+ monitor.worked(1);
}
- monitor.worked(1);
+ } finally {
+ zipFile.close();
}
}