From 63c96bcd1d6be31678b9fb8a0caeb5dc5268a2a3 Mon Sep 17 00:00:00 2001 From: Martin Ritchie Date: Mon, 9 Mar 2009 16:00:18 +0000 Subject: Removed false positive return from FU.delete(). Delete mirrors functionality provided by java.io. Attempting to delete an non-existent file returns false. The caller must handle this correctly. If client provides a null value then the call will throw a NPE which is a valid java response. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@751720 13f79535-47bb-0310-9956-ffa450edef68 --- .../test/java/org/apache/qpid/util/FileUtilsTest.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'java/common/src/test') diff --git a/java/common/src/test/java/org/apache/qpid/util/FileUtilsTest.java b/java/common/src/test/java/org/apache/qpid/util/FileUtilsTest.java index 76d39200c1..94e7e20a86 100644 --- a/java/common/src/test/java/org/apache/qpid/util/FileUtilsTest.java +++ b/java/common/src/test/java/org/apache/qpid/util/FileUtilsTest.java @@ -287,9 +287,23 @@ public class FileUtilsTest extends TestCase assertTrue("File exists", !test.exists()); assertFalse("File is a directory", test.isDirectory()); - assertTrue("Unable to delete",FileUtils.delete(test,true)); + assertTrue("Delete Succeeded ", !FileUtils.delete(test, true)); } + public void testDeleteNull() + { + try + { + FileUtils.delete(null, true); + fail("Delete with null value should throw NPE."); + } + catch (NullPointerException npe) + { + // expected path + } + } + + /** * Given two lists of File arrays ensure they are the same length and all entries in Before are in After * -- cgit v1.2.1