You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by jb...@apache.org on 2021/10/21 12:49:05 UTC
[felix-dev] branch master updated: [FELIX-6419] Check if
ConfigAdmin service is there to avoid NPE
This is an automated email from the ASF dual-hosted git repository.
jbonofre 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 5786b59 [FELIX-6419] Check if ConfigAdmin service is there to avoid NPE
new 781561d Merge pull request #107 from jbonofre/FELIX-6419
5786b59 is described below
commit 5786b598429988a2d00a453a1408d3fc5884f275
Author: Jean-Baptiste Onofré <jb...@apache.org>
AuthorDate: Mon Oct 18 14:05:22 2021 +0200
[FELIX-6419] Check if ConfigAdmin service is there to avoid NPE
---
.../felix/fileinstall/internal/ConfigInstaller.java | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java
index 20e3361..cf0a4b5 100644
--- a/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java
+++ b/fileinstall/src/main/java/org/apache/felix/fileinstall/internal/ConfigInstaller.java
@@ -157,16 +157,15 @@ public class ConfigInstaller implements ArtifactInstaller, ConfigurationListener
this, null);
try
{
- Configuration[] configs = getConfigurationAdmin().listConfigurations(null);
- if (configs != null)
- {
- for (Configuration config : configs)
- {
- Dictionary<?,?> dict = config.getProperties();
- String fileName = dict != null ? (String) dict.get( DirectoryWatcher.FILENAME ) : null;
- if (fileName != null)
- {
- pidToFile.put(config.getPid(), fileName);
+ if (getConfigurationAdmin() != null) {
+ Configuration[] configs = getConfigurationAdmin().listConfigurations(null);
+ if (configs != null) {
+ for (Configuration config : configs) {
+ Dictionary<?, ?> dict = config.getProperties();
+ String fileName = dict != null ? (String) dict.get(DirectoryWatcher.FILENAME) : null;
+ if (fileName != null) {
+ pidToFile.put(config.getPid(), fileName);
+ }
}
}
}