From a29e0273333d07d173b1f0267baf7a781b73845a Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 29 Dec 2009 00:39:58 +0100 Subject: [PATCH] =?utf8?q?Don=E2=80=99t=20ignore=20exceptions=20when=20cre?= =?utf8?q?ating=20the=20payload=20stream=20but=20fail=20the=20insert.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/de/todesbaum/jsite/application/ProjectInserter.java | 7 ++++++- src/de/todesbaum/util/freenet/fcp2/ClientPutComplexDir.java | 7 +++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/de/todesbaum/jsite/application/ProjectInserter.java b/src/de/todesbaum/jsite/application/ProjectInserter.java index 597c237..c6d0f85 100644 --- a/src/de/todesbaum/jsite/application/ProjectInserter.java +++ b/src/de/todesbaum/jsite/application/ProjectInserter.java @@ -419,7 +419,12 @@ public class ProjectInserter implements FileScannerListener, Runnable { for (String filename : files) { FileEntry fileEntry = createFileEntry(filename, edition, containerFiles); if (fileEntry != null) { - putDir.addFileEntry(fileEntry); + try { + putDir.addFileEntry(fileEntry); + } catch (IOException ioe1) { + fireProjectInsertFinished(false, ioe1); + return; + } } } diff --git a/src/de/todesbaum/util/freenet/fcp2/ClientPutComplexDir.java b/src/de/todesbaum/util/freenet/fcp2/ClientPutComplexDir.java index 7b9115d..4be7528 100644 --- a/src/de/todesbaum/util/freenet/fcp2/ClientPutComplexDir.java +++ b/src/de/todesbaum/util/freenet/fcp2/ClientPutComplexDir.java @@ -90,8 +90,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 +116,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); -- 2.7.4