mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
bug 302720: XmlUtil.serializeXml() does not close output stream locking
the file
This commit is contained in:
parent
6dd117ec5e
commit
eeef5ce247
1 changed files with 1 additions and 4 deletions
|
@ -16,7 +16,6 @@ import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
@ -266,8 +265,6 @@ public class XmlUtil {
|
||||||
if (!storeFile.exists()) {
|
if (!storeFile.exists()) {
|
||||||
storeFile.createNewFile();
|
storeFile.createNewFile();
|
||||||
}
|
}
|
||||||
OutputStream fileStream = new FileOutputStream(storeFile);
|
|
||||||
|
|
||||||
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
||||||
Transformer transformer = transformerFactory.newTransformer();
|
Transformer transformer = transformerFactory.newTransformer();
|
||||||
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
|
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
|
||||||
|
@ -279,7 +276,7 @@ public class XmlUtil {
|
||||||
StreamResult result = new StreamResult(new FileOutputStream(storeFile));
|
StreamResult result = new StreamResult(new FileOutputStream(storeFile));
|
||||||
transformer.transform(source, result);
|
transformer.transform(source, result);
|
||||||
|
|
||||||
fileStream.close();
|
result.getOutputStream().close();
|
||||||
ResourcesUtil.refreshWorkspaceFiles(uriLocation);
|
ResourcesUtil.refreshWorkspaceFiles(uriLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue