From: David ‘Bombe’ Roden Date: Mon, 28 Dec 2009 23:39:58 +0000 (+0100) Subject: Don’t ignore exceptions when creating the payload stream but fail the insert. X-Git-Tag: 0.9~44 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=a29e0273333d07d173b1f0267baf7a781b73845a;p=jSite.git Don’t ignore exceptions when creating the payload stream but fail the insert. --- 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);