Author: max.andersen(a)jboss.com
Date: 2009-03-09 08:56:52 -0400 (Mon, 09 Mar 2009)
New Revision: 14104
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java
Log:
fixed possible stream leakage for JBIDE-3632
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java 2009-03-09
11:47:59 UTC (rev 14103)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/Seam2ProjectCreator.java 2009-03-09
12:56:52 UTC (rev 14104)
@@ -160,14 +160,26 @@
if(getVersion() == SeamVersion.SEAM_2_1) {
Properties seamProperties = new Properties();
File testSeamPropertiesFile = new File(testSrcDir, "seam.properties");
+ FileInputStream inStream = null;
+ FileOutputStream out = null;
try {
- seamProperties.load(new FileInputStream(testSeamPropertiesFile));
+ inStream = new FileInputStream(testSeamPropertiesFile);
+ seamProperties.load(inStream);
seamProperties.setProperty("org.jboss.seam.core.init.debug",
"false"); //$NON-NLS-1$ //$NON-NLS-2$
- seamProperties.store(new FileOutputStream(testSeamPropertiesFile), "debug is
explicitly disabled in test to avoid JBIDE-3623");
+
+ out = new FileOutputStream(testSeamPropertiesFile);
+ seamProperties.store(out, "debug is explicitly disabled in test to avoid
JBIDE-3623");
} catch (FileNotFoundException e) {
SeamCorePlugin.getPluginLog().logError(e);
} catch (IOException e) {
SeamCorePlugin.getPluginLog().logError(e);
+ } finally {
+ if(inStream!=null) {
+ try { inStream.close(); } catch (IOException e) { /**ignore*/ }
+ }
+ if(out!=null) {
+ try { out.close(); } catch (IOException e) { /**ignore*/ }
+ }
}
}
Show replies by date