You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2017/08/10 05:39:37 UTC

karaf git commit: [KARAF-5298] Update storage when creating config

Repository: karaf
Updated Branches:
  refs/heads/master b65801b63 -> ae930b392


[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/master
Commit: ae930b3922d5db7b383ffc217386c93716bfa9e8
Parents: b65801b
Author: Jean-Baptiste Onofré <jb...@apache.org>
Authored: Thu Aug 10 07:39:13 2017 +0200
Committer: Jean-Baptiste Onofré <jb...@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);