nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalFile.java | 29 ++++++---- xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/PluginFactoryImpl.java | 7 ++ 2 files changed, 27 insertions(+), 9 deletions(-)
New commits: commit 88bfc90de9bf03c8dbce9f26de079a9fd1d83146 Author: Robert Antoni Buj i Gelonch <robert....@gmail.com> Date: Mon Oct 13 00:11:59 2014 +0200 nlpsolver: ensure that the stream is cleaned up before the method returns Change-Id: I081194d802bd835285bdc37fbef55f229f1185dc Reviewed-on: https://gerrit.libreoffice.org/11940 Reviewed-by: Noel Grandin <noelgran...@gmail.com> Tested-by: Noel Grandin <noelgran...@gmail.com> diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalFile.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalFile.java index 36e4ebb..913ee64 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalFile.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalFile.java @@ -87,9 +87,14 @@ public class GlobalFile { */ public static void saveStringToFile(String inStr, String fileStr) throws Exception{ new File(new File(fileStr).getParent()).mkdirs(); - FileOutputStream pspOutputStream = new FileOutputStream(new File(fileStr)); - pspOutputStream.write(inStr.getBytes()); - pspOutputStream.close(); + FileOutputStream pspOutputStream = null; + try { + pspOutputStream = new FileOutputStream(new File(fileStr)); + pspOutputStream.write(inStr.getBytes()); + } finally { + if (pspOutputStream != null) + pspOutputStream.close(); + } } /** @@ -100,12 +105,18 @@ public class GlobalFile { */ public static String getStringFromFile(String fileStr) throws Exception { String getStr = null; - FileInputStream pspInputStream = new FileInputStream(fileStr); - byte[] pspFileBuffer = new byte[pspInputStream.available()]; - pspInputStream.read(pspFileBuffer); - pspInputStream.close(); - getStr = new String(pspFileBuffer); - return(getStr); + FileInputStream pspInputStream = null; + try { + pspInputStream = new FileInputStream(fileStr); + byte[] pspFileBuffer = new byte[pspInputStream.available()]; + pspInputStream.read(pspFileBuffer); + + getStr = new String(pspFileBuffer); + } finally { + if (pspInputStream != null) + pspInputStream.close(); + } + return getStr; } /** commit e77235e87ef8554ba38ce4454f2f99bd62dd5824 Author: Robert Antoni Buj i Gelonch <robert....@gmail.com> Date: Sun Oct 12 22:17:53 2014 +0200 xmerge: ensure that the stream is cleaned up before the method returns Change-Id: I377ae1a7b71c207313ad3468a51b1ab06b9fffd5 Reviewed-on: https://gerrit.libreoffice.org/11939 Reviewed-by: Noel Grandin <noelgran...@gmail.com> Tested-by: Noel Grandin <noelgran...@gmail.com> diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/PluginFactoryImpl.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/PluginFactoryImpl.java index c89fb72..cae4e76 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/PluginFactoryImpl.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/xslt/PluginFactoryImpl.java @@ -147,6 +147,13 @@ public final class PluginFactoryImpl extends PluginFactory } catch (Exception e) { // It is okay for the property file to not exist. + } finally { + try { + if (is != null) { + is.close(); + } + } catch (IOException ex) { + } } return ext; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits