Fix calculation of project size.
[jSite.git] / src / de / todesbaum / util / freenet / fcp2 / ClientPutComplexDir.java
index 7b9115d..d72f2c1 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * todesbaum-lib -
- * Copyright (C) 2006 David Roden
+ * jSite - ClientPutComplexDir.java - Copyright © 2006–2012 David Roden
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -38,7 +37,7 @@ import de.todesbaum.util.io.Closer;
  * @author David Roden <droden@gmail.com>
  * @version $Id$
  */
-public class ClientPutComplexDir extends ClientPutDir {
+public class ClientPutComplexDir extends ClientPutDir<ClientPutComplexDir> {
 
        /** The file entries of this directory. */
        private List<FileEntry> fileEntries = new ArrayList<FileEntry>();
@@ -90,8 +89,10 @@ public class ClientPutComplexDir extends ClientPutDir {
         *
         * @param fileEntry
         *            The file entry to add to the directory
+        * @throws IOException
+        *             if an I/O error occurs when creating the payload stream
         */
-       public void addFileEntry(FileEntry fileEntry) {
+       public void addFileEntry(FileEntry fileEntry) throws IOException {
                if (fileEntry instanceof DirectFileEntry) {
                        if (payloadFile == null) {
                                try {
@@ -114,7 +115,8 @@ public class ClientPutComplexDir extends ClientPutDir {
                                        payloadOutputStream.flush();
                                        fileEntries.add(fileEntry);
                                } catch (IOException ioe1) {
-                                       /* hmm, ignore? */
+                                       payloadFile.delete();
+                                       throw ioe1;
                                } finally {
                                        Closer.close(payloadOutputStream);
                                        Closer.close(payloadInputStream);