Fixed bug 378040: Resource leak: 'fOutputStream' is not closed at this
location
diff --git a/org.eclipse.jdt.launching.ui.macosx/src/org/eclipse/jdt/internal/ui/macbundler/BundleBuilder.java b/org.eclipse.jdt.launching.ui.macosx/src/org/eclipse/jdt/internal/ui/macbundler/BundleBuilder.java
index 009e768..d47a0b1 100644
--- a/org.eclipse.jdt.launching.ui.macosx/src/org/eclipse/jdt/internal/ui/macbundler/BundleBuilder.java
+++ b/org.eclipse.jdt.launching.ui.macosx/src/org/eclipse/jdt/internal/ui/macbundler/BundleBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 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
@@ -72,11 +72,6 @@
}
private void createInfoPList(File contents_dir, File resources_dir, File java_dir, String launcher) throws IOException {
-
- File info= new File(contents_dir, "Info.plist"); //$NON-NLS-1$
- FileOutputStream fos= new FileOutputStream(info);
- BufferedOutputStream fOutputStream= new BufferedOutputStream(fos);
-
DocumentBuilder docBuilder= null;
DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
factory.setValidating(false);
@@ -161,6 +156,9 @@
}
}
+ File info= new File(contents_dir, "Info.plist"); //$NON-NLS-1$
+ FileOutputStream fos= new FileOutputStream(info);
+ BufferedOutputStream fOutputStream= new BufferedOutputStream(fos);
try {
// Write the document to the stream
Transformer transformer= TransformerFactory.newInstance().newTransformer();
@@ -176,6 +174,9 @@
} catch (TransformerException e) {
System.err.println("createInfoPList: could not transform to XML"); //$NON-NLS-1$
}
+ finally {
+ fOutputStream.close();
+ }
}
private void add(Element dict, String key, Element value) {