X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fde%2Ftodesbaum%2Fjsite%2Fmain%2FConfiguration.java;h=cf4bca526a8938a92b4238448f92ba99267193ef;hb=bf46824a2aee4b6b7e4753a74f7cc6d7c9d6c20b;hp=64f3771f088dbc6c8ff3d1fe7c9f332c406c75f0;hpb=705ab7eee0d2b8194f6e8420ce3f588899f6da9a;p=jSite.git diff --git a/src/de/todesbaum/jsite/main/Configuration.java b/src/de/todesbaum/jsite/main/Configuration.java index 64f3771..cf4bca5 100644 --- a/src/de/todesbaum/jsite/main/Configuration.java +++ b/src/de/todesbaum/jsite/main/Configuration.java @@ -37,13 +37,13 @@ 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; /** - * @author David Roden <droden@gmail.com> - * @version $Id$ + * @author David ‘Bombe’ Roden <bombe@freenetproject.org> */ public class Configuration { @@ -99,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"); @@ -134,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; } @@ -241,7 +221,7 @@ public class Configuration { project.setLocalPath(projectNode.getNode("local-path").getValue()); project.setName(projectNode.getNode("name").getValue()); project.setPath(projectNode.getNode("path").getValue()); - if (project.getPath().indexOf("/") != -1) { + if ((project.getPath() != null) && (project.getPath().indexOf("/") != -1)) { project.setPath(project.getPath().replaceAll("/", "")); } project.setEdition(Integer.parseInt(projectNode.getNode("edition").getValue()));