You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2020/11/11 10:31:42 UTC

[felix-dev] branch master updated: FELIX-6308 : Revert changes

This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git


The following commit(s) were added to refs/heads/master by this push:
     new 5758834  FELIX-6308 : Revert changes
5758834 is described below

commit 5758834a59339f7995c6d8a7b010ec1568a695b1
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Nov 11 11:31:20 2020 +0100

    FELIX-6308 : Revert changes
---
 configadmin/changelog.txt                                    |  1 -
 .../org/apache/felix/cm/file/FilePersistenceManager.java     | 12 ++++++------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/configadmin/changelog.txt b/configadmin/changelog.txt
index 9ecf1d6..bbd927e 100644
--- a/configadmin/changelog.txt
+++ b/configadmin/changelog.txt
@@ -2,7 +2,6 @@ Changes in 1.9.20
 -----------------
 ** Bug
     * [FELIX-6354] : IllegalStateException on shutdown
-    * [FELIX-6308] : Bad File Descriptor while persisting service configuration
     * [FELIX-5690] : ConfigurationHandler should support ignoring whitespace between property key/equal sign & equal sign/property value
 
 
diff --git a/configadmin/src/main/java/org/apache/felix/cm/file/FilePersistenceManager.java b/configadmin/src/main/java/org/apache/felix/cm/file/FilePersistenceManager.java
index bffffc5..9ae602d 100644
--- a/configadmin/src/main/java/org/apache/felix/cm/file/FilePersistenceManager.java
+++ b/configadmin/src/main/java/org/apache/felix/cm/file/FilePersistenceManager.java
@@ -728,17 +728,17 @@ public class FilePersistenceManager implements PersistenceManager
             File cfgDir = cfgFile.getParentFile();
             cfgDir.mkdirs();
 
+            // write the configuration to a temporary file
+            tmpFile = File.createTempFile( cfgFile.getName(), TMP_EXT, cfgDir );
+            try(OutputStream out = new FileOutputStream( tmpFile )) {
+                ConfigurationHandler.write( out, props );
+            }
+
             // after writing the file, rename it but ensure, that no other
             // might at the same time open the new file
             // see load(File)
             synchronized ( this )
             {
-                // write the configuration to a temporary file
-                tmpFile = File.createTempFile( cfgFile.getName(), TMP_EXT, cfgDir );
-                try(OutputStream out = new FileOutputStream( tmpFile )) {
-                    ConfigurationHandler.write( out, props );
-                }
-
                 // make sure the cfg file does not exists (just for sanity)
                 if ( cfgFile.exists() )
                 {