diff options
author | Robert Antoni Buj i Gelonch <robert.buj@gmail.com> | 2014-10-15 21:48:19 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-10-16 10:25:18 +0000 |
commit | bbd5a304112c57ac1b1357c93ba7bd8ed8973cfa (patch) | |
tree | 486ed529cd19a3050c476c5f5f54c3afab808ce9 /forms/qa | |
parent | d49eabcc56677553a6d5d9fe7cecc5a5eee1f9b6 (diff) |
java: ensure that the stream is cleaned up before the method returns
Change-Id: Id3efeda2fd66173ba2f5662eaacb3629da54573d
Reviewed-on: https://gerrit.libreoffice.org/11991
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'forms/qa')
-rw-r--r-- | forms/qa/integration/forms/FormControlTest.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/forms/qa/integration/forms/FormControlTest.java b/forms/qa/integration/forms/FormControlTest.java index d574640e3038..b7dacb7977bf 100644 --- a/forms/qa/integration/forms/FormControlTest.java +++ b/forms/qa/integration/forms/FormControlTest.java @@ -868,9 +868,17 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE { m_sImageURL = util.utils.getOfficeTempDir( m_orb ) + "image.gif"; - FileOutputStream aFile = new FileOutputStream( m_sImageURL ); - aFile.write( getSamplePicture() ); - aFile.close(); + FileOutputStream aFile = null; + try + { + aFile = new FileOutputStream( m_sImageURL ); + aFile.write( getSamplePicture() ); + } + finally + { + if ( aFile != null ) + aFile.close(); + } log.println( "created temporary image file: " + m_sImageURL ); // for later setting the url at the imaghe control, we need a real URL, no system path |