Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorAlena Laskavaia2008-11-12 15:13:34 +0000
committerAlena Laskavaia2008-11-12 15:13:34 +0000
commitc168610d2c8bc9879413b3b00f8bd6e90b49ce6a (patch)
treea552a0ac0aa4844462f1dae8d7f0cb13d6c0c044 /build
parent407f89f372e3cd609c019e193c7cf180f88575f2 (diff)
downloadorg.eclipse.cdt-c168610d2c8bc9879413b3b00f8bd6e90b49ce6a.tar.gz
org.eclipse.cdt-c168610d2c8bc9879413b3b00f8bd6e90b49ce6a.tar.xz
org.eclipse.cdt-c168610d2c8bc9879413b3b00f8bd6e90b49ce6a.zip
[252969] - applied patch to close streams
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/DefaultFortranDependencyCalculator.java24
1 files changed, 18 insertions, 6 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/DefaultFortranDependencyCalculator.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/DefaultFortranDependencyCalculator.java
index f7430211f13..13163bf69d9 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/DefaultFortranDependencyCalculator.java
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/DefaultFortranDependencyCalculator.java
@@ -40,8 +40,9 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen
*/
private String[] findUsedModuleNames(File file) {
ArrayList names = new ArrayList();
+ InputStream in = null;
try {
- InputStream in = new BufferedInputStream(new FileInputStream(file));
+ in = new BufferedInputStream(new FileInputStream(file));
Reader r = new BufferedReader(new InputStreamReader(in));
StreamTokenizer st = new StreamTokenizer(r);
st.commentChar('!');
@@ -62,9 +63,14 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen
}
}
}
- }
- catch (Exception e) {
+ } catch (Exception e) {
return new String[0];
+ } finally {
+ // ensure the input stream is closed or we can run out of fd's...
+ if (in != null)
+ try {
+ in.close();
+ } catch (IOException e) {/*don't care */}
}
return (String[]) names.toArray(new String[names.size()]);
}
@@ -74,8 +80,9 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen
*/
private String[] findModuleNames(File file) {
ArrayList names = new ArrayList();
+ InputStream in = null;
try {
- InputStream in = new BufferedInputStream(new FileInputStream(file));
+ in = new BufferedInputStream(new FileInputStream(file));
Reader r = new BufferedReader(new InputStreamReader(in));
StreamTokenizer st = new StreamTokenizer(r);
st.commentChar('!');
@@ -96,9 +103,14 @@ public class DefaultFortranDependencyCalculator implements IManagedDependencyGen
}
}
}
- }
- catch (Exception e) {
+ } catch (Exception e) {
return new String[0];
+ } finally {
+ // ensure the input stream is closed or we run out of fd's...
+ if (in != null)
+ try {
+ in.close();
+ } catch (IOException e) {/*don't care */}
}
return (String[]) names.toArray(new String[names.size()]);
}

Back to the top