Author: scolebourne Date: Mon Dec 4 16:12:58 2006 New Revision: 482423 URL: http://svn.apache.org/viewvc?view=rev&rev=482423 Log: IO-100 - FileUtils.touch now throws an exception if it fails
Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java Modified: jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt URL: http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt?view=diff&rev=482423&r1=482422&r2=482423 ============================================================================== --- jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt (original) +++ jakarta/commons/proper/io/trunk/RELEASE-NOTES.txt Mon Dec 4 16:12:58 2006 @@ -22,6 +22,7 @@ Source compatible - Yes Semantic compatible - Yes + Check the bug fixes section for semantic bug fixes Deprecations from 1.2 @@ -55,6 +56,11 @@ - Fixed resource leak leading to 'Too many open files' error - Previously did not destroy Process instances (as JDK Javadoc is so poor) - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4801027 + +- FileUtils.touch [IO-100] + - The touch method previously gave no indication when the file could not + be touched successfully (such as due to access restrictions) - it now + throws an IOException if the last modified date cannot be changed - FileCleaner - This now handles the situation where an error occurs when deleting the file Modified: jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java?view=diff&rev=482423&r1=482422&r2=482423 ============================================================================== --- jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java (original) +++ jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java Mon Dec 4 16:12:58 2006 @@ -133,6 +133,9 @@ * Implements the same behaviour as the "touch" utility on Unix. It creates * a new file with size 0 or, if the file exists already, it is opened and * closed without modifying it, but updating the file date and time. + * <p> + * NOTE: As from v1.3, this method throws an IOException if the last + * modified date of the file cannot be set * * @param file the File to touch * @throws IOException If an I/O problem occurs @@ -143,7 +146,7 @@ IOUtils.closeQuietly(out); } boolean success = file.setLastModified(System.currentTimeMillis()); - if(!success) { + if (!success) { throw new IOException("Unable to set the last modification time for " + file); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]