felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1513753 - /felix/trunk/configadmin/src/main/java/org/apache/felix/cm/file/FilePersistenceManager.java
Date Wed, 14 Aug 2013 07:52:19 GMT
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



Mime
View raw message