Repository: karaf
Updated Branches:
  refs/heads/model_features 8fbce8a34 -> cd938d501 (forced update)


[KARAF-5298] Update storage when creating config


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/ae930b39
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/ae930b39
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/ae930b39

Branch: refs/heads/model_features
Commit: ae930b3922d5db7b383ffc217386c93716bfa9e8
Parents: b65801b
Author: Jean-Baptiste Onofré <jbono...@apache.org>
Authored: Thu Aug 10 07:39:13 2017 +0200
Committer: Jean-Baptiste Onofré <jbono...@apache.org>
Committed: Thu Aug 10 07:39:13 2017 +0200

----------------------------------------------------------------------
 .../karaf/config/core/impl/ConfigRepositoryImpl.java | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/ae930b39/config/src/main/java/org/apache/karaf/config/core/impl/ConfigRepositoryImpl.java
----------------------------------------------------------------------
diff --git 
a/config/src/main/java/org/apache/karaf/config/core/impl/ConfigRepositoryImpl.java
 
b/config/src/main/java/org/apache/karaf/config/core/impl/ConfigRepositoryImpl.java
index ac4e1e2..8ee9082 100644
--- 
a/config/src/main/java/org/apache/karaf/config/core/impl/ConfigRepositoryImpl.java
+++ 
b/config/src/main/java/org/apache/karaf/config/core/impl/ConfigRepositoryImpl.java
@@ -63,15 +63,12 @@ public class ConfigRepositoryImpl implements 
ConfigRepository {
     public void update(String pid, Dictionary<String, Object> properties) 
throws IOException {
         LOGGER.trace("Update configuration {}", pid);
         Configuration cfg = configAdmin.getConfiguration(pid, null);
-        if (storage != null) {
-            // Check, whether a file location is already provided.
-            if (properties.get(FILEINSTALL_FILE_NAME) == null) {
-                String cfgFileName = pid + ".cfg";
-                File cfgFile = new File(storage, cfgFileName);
-                properties.put(FILEINSTALL_FILE_NAME, 
cfgFile.getCanonicalFile().toURI().toString());
-            }
-        }
         cfg.update(properties);
+        try {
+            updateStorage(pid, properties);
+        } catch (Exception e) {
+            LOGGER.warn("Can't update cfg file", e);
+        }
     }
 
     /* (non-Javadoc)
@@ -212,7 +209,7 @@ public class ConfigRepositoryImpl implements 
ConfigRepository {
             }
             config.update(properties);
             String pid = config.getPid();
-//            updateStorage(pid, properties);
+            updateStorage(pid, properties);
             return pid;
         } catch (IOException e) {
             throw new UncheckedIOException(e);

Reply via email to