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 <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
committed by
Noel Grandin
parent
edb6783c14
commit
3c27e31628
@@ -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
|
|||||||
|
|
||||||
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 ()
|
||||||
|
Reference in New Issue
Block a user