From 0123d73f009ae0bf018165f981eda16413129eae Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 23 Jun 2008 01:28:54 +0200 Subject: [PATCH] use Closer --- src/de/todesbaum/jsite/main/Configuration.java | 29 +++++--------------------- 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/src/de/todesbaum/jsite/main/Configuration.java b/src/de/todesbaum/jsite/main/Configuration.java index 100f175..cf4bca5 100644 --- a/src/de/todesbaum/jsite/main/Configuration.java +++ b/src/de/todesbaum/jsite/main/Configuration.java @@ -37,6 +37,7 @@ import java.util.Map.Entry; import de.todesbaum.jsite.application.FileOption; import de.todesbaum.jsite.application.Node; import de.todesbaum.jsite.application.Project; +import de.todesbaum.util.io.Closer; import de.todesbaum.util.io.StreamCopier; import de.todesbaum.util.xml.SimpleXML; import de.todesbaum.util.xml.XML; @@ -98,18 +99,8 @@ public class Configuration { } catch (FileNotFoundException e) { } catch (IOException e) { } finally { - if (fileInputStream != null) { - try { - fileInputStream.close(); - } catch (IOException ioe1) { - } - } - if (fileByteOutputStream != null) { - try { - fileByteOutputStream.close(); - } catch (IOException ioe1) { - } - } + Closer.close(fileInputStream); + Closer.close(fileByteOutputStream); } } rootNode = new SimpleXML("configuration"); @@ -133,18 +124,8 @@ public class Configuration { return true; } catch (IOException ioe1) { } finally { - if (configurationInputStream != null) { - try { - configurationInputStream.close(); - } catch (IOException ioe1) { - } - } - if (fileOutputStream != null) { - try { - fileOutputStream.close(); - } catch (IOException ioe1) { - } - } + Closer.close(configurationInputStream); + Closer.close(fileOutputStream); } return false; } -- 2.7.4