Kaydet (Commit) 3c27e316 authored tarafından Robert Antoni Buj i Gelonch's avatar Robert Antoni Buj i Gelonch Kaydeden (comit) Noel Grandin

accessibility: ensure that the stream is cleaned up before the method returns

Change-Id: Ib46d24be831b5c9bda0582bd7064f34528e1d609
Reviewed-on: https://gerrit.libreoffice.org/11938Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Tested-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst edb6783c
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties; import java.util.Properties;
/** Load from and save options into a file. /** Load from and save options into a file.
...@@ -69,25 +70,51 @@ class Options ...@@ -69,25 +70,51 @@ class Options
public void Load (String sBaseName) public void Load (String sBaseName)
{ {
FileInputStream fis = null;
try 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. // Ignore a non-existing options file.
} }
finally
{
try
{
if (fis != null)
fis.close();
}
catch (IOException ex)
{
}
}
} }
public void Save (String sBaseName) public void Save (String sBaseName)
{ {
FileOutputStream fos = null;
try try
{ {
store (new FileOutputStream (ProvideFile(sBaseName)), null); fos = new FileOutputStream (ProvideFile(sBaseName));
store (fos, null);
} }
catch (java.io.IOException e) catch (IOException e)
{ {
} }
finally
{
try
{
if (fos != null)
fos.close();
}
catch (IOException ex)
{
}
}
} }
private Options () private Options ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment