You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by fm...@apache.org on 2013/08/14 09:52:19 UTC

svn commit: r1513753 - /felix/trunk/configadmin/src/main/java/org/apache/felix/cm/file/FilePersistenceManager.java

Author: fmeschbe
Date: Wed Aug 14 07:52:18 2013
New Revision: 1513753

URL: http://svn.apache.org/r1513753
Log:
FELIX-4165 Check the return value of the file deletion
  and throw IOException if the delete failed

Modified:
    felix/trunk/configadmin/src/main/java/org/apache/felix/cm/file/FilePersistenceManager.java

Modified: felix/trunk/configadmin/src/main/java/org/apache/felix/cm/file/FilePersistenceManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/configadmin/src/main/java/org/apache/felix/cm/file/FilePersistenceManager.java?rev=1513753&r1=1513752&r2=1513753&view=diff
==============================================================================
--- felix/trunk/configadmin/src/main/java/org/apache/felix/cm/file/FilePersistenceManager.java (original)
+++ felix/trunk/configadmin/src/main/java/org/apache/felix/cm/file/FilePersistenceManager.java Wed Aug 14 07:52:18 2013
@@ -631,7 +631,12 @@ public class FilePersistenceManager impl
                 // make sure the cfg file does not exists (just for sanity)
                 if ( cfgFile.exists() )
                 {
-                    cfgFile.delete();
+                    // FELIX-4165: detect failure to delete old file
+                    if ( !cfgFile.delete() )
+                    {
+                        throw new IOException( "Cannot remove old file '" + cfgFile + "'; changes in '" + tmpFile
+                            + "' cannot be persisted at this time" );
+                    }
                 }
 
                 // rename the temporary file to the new file