toolkit/test/accessibility/Options.java | 35 ++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)
New commits: commit 3c27e31628c49b927d2026176cac5a085bf0fe39 Author: Robert Antoni Buj i Gelonch <[email protected]> Date: Sun Oct 12 22:00:41 2014 +0200 accessibility: ensure that the stream is cleaned up before the method returns Change-Id: Ib46d24be831b5c9bda0582bd7064f34528e1d609 Reviewed-on: https://gerrit.libreoffice.org/11938 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Noel Grandin <[email protected]> diff --git a/toolkit/test/accessibility/Options.java b/toolkit/test/accessibility/Options.java index 5651928..3b9e537 100644 --- a/toolkit/test/accessibility/Options.java +++ b/toolkit/test/accessibility/Options.java @@ -19,6 +19,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; +import java.io.IOException; import java.util.Properties; /** Load from and save options into a file. @@ -69,24 +70,50 @@ class Options public void Load (String sBaseName) { + FileInputStream fis = null; try { - load (new FileInputStream (ProvideFile(sBaseName))); + fis = new FileInputStream (ProvideFile(sBaseName)); + load (fis); } - catch (java.io.IOException e) + catch (IOException e) { // Ignore a non-existing options file. } + finally + { + try + { + if (fis != null) + fis.close(); + } + catch (IOException ex) + { + } + } } public void Save (String sBaseName) { + FileOutputStream fos = null; try { - store (new FileOutputStream (ProvideFile(sBaseName)), null); + fos = new FileOutputStream (ProvideFile(sBaseName)); + store (fos, null); + } + catch (IOException e) + { } - catch (java.io.IOException e) + finally { + try + { + if (fos != null) + fos.close(); + } + catch (IOException ex) + { + } } } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
