From eeef5ce247d1c2148cfa1895e3d1d4f40459d0da Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Fri, 12 Aug 2011 16:43:21 -0400 Subject: [PATCH] bug 302720: XmlUtil.serializeXml() does not close output stream locking the file --- .../utils/org/eclipse/cdt/internal/core/XmlUtil.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/XmlUtil.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/XmlUtil.java index 60fc7e4b295..f996e5e26c3 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/XmlUtil.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/XmlUtil.java @@ -16,7 +16,6 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.OutputStream; import java.net.URI; import javax.xml.parsers.DocumentBuilder; @@ -266,8 +265,6 @@ public class XmlUtil { if (!storeFile.exists()) { storeFile.createNewFile(); } - OutputStream fileStream = new FileOutputStream(storeFile); - TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$ @@ -279,7 +276,7 @@ public class XmlUtil { StreamResult result = new StreamResult(new FileOutputStream(storeFile)); transformer.transform(source, result); - fileStream.close(); + result.getOutputStream().close(); ResourcesUtil.refreshWorkspaceFiles(uriLocation); }