aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>2015-05-15 22:30:19 +0200
committerPhilipp Wiesemann <philipp.wiesemann@arcor.de>2015-05-15 22:30:19 +0200
commit6034f344ef9a9915c96616de12cfc53ce17605d4 (patch)
tree6cf2f0ec365aa98c4487fe87d789b4a99f92a328 /core
parenta029fe88d1e4913ba665bf75bcbe44d2f81fb952 (diff)
downloadnanohttpd-6034f344ef9a9915c96616de12cfc53ce17605d4.tar.gz
Fix no warning in log if temp file was not deleted
The method delete() of interface TempFile should message a failed delete by throwing an Exception. For the default implementation DefaultTempFile no Exceptions were thrown because the used method delete() of File does not throw an Exception on failure but returns false instead. The problem was fixed by checking the return value and throwing an Exception for it.
Diffstat (limited to 'core')
-rw-r--r--core/src/main/java/fi/iki/elonen/NanoHTTPD.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/src/main/java/fi/iki/elonen/NanoHTTPD.java b/core/src/main/java/fi/iki/elonen/NanoHTTPD.java
index 0ba8184..c529e8a 100644
--- a/core/src/main/java/fi/iki/elonen/NanoHTTPD.java
+++ b/core/src/main/java/fi/iki/elonen/NanoHTTPD.java
@@ -386,7 +386,9 @@ public abstract class NanoHTTPD {
@Override
public void delete() throws Exception {
safeClose(this.fstream);
- this.file.delete();
+ if (!this.file.delete()) {
+ throw new Exception("could not delete temporary file");
+ }
}
@Override