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 {
} 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");
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;
}
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()));