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 2021/02/25 10:59:57 UTC
[felix-dev] branch master updated: FELIX-6386 : Unable to read
persisted state from state.ser
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 532788d FELIX-6386 : Unable to read persisted state from state.ser
532788d is described below
commit 532788d81e2f63f487b2da98678d7b5df13a3126
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Feb 25 11:59:47 2021 +0100
FELIX-6386 : Unable to read persisted state from state.ser
---
configurator/pom.xml | 2 +-
.../apache/felix/configurator/impl/model/Config.java | 20 +++++++++++++++++++-
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/configurator/pom.xml b/configurator/pom.xml
index da59ea0..64005b8 100644
--- a/configurator/pom.xml
+++ b/configurator/pom.xml
@@ -111,7 +111,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.cm.json</artifactId>
- <version>1.0.0</version>
+ <version>1.0.6</version>
<scope>provided</scope>
</dependency>
<dependency>
diff --git a/configurator/src/main/java/org/apache/felix/configurator/impl/model/Config.java b/configurator/src/main/java/org/apache/felix/configurator/impl/model/Config.java
index 30fa956..2e8c634 100644
--- a/configurator/src/main/java/org/apache/felix/configurator/impl/model/Config.java
+++ b/configurator/src/main/java/org/apache/felix/configurator/impl/model/Config.java
@@ -22,6 +22,8 @@ import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Hashtable;
import java.util.List;
public class Config implements Serializable, Comparable<Config> {
@@ -62,7 +64,7 @@ public class Config implements Serializable, Comparable<Config> {
this.pid = pid;
this.ranking = ranking;
this.bundleId = bundleId;
- this.properties = properties;
+ this.properties = this.getPrivateCopyOf(properties);
this.policy = policy;
}
@@ -87,6 +89,22 @@ public class Config implements Serializable, Comparable<Config> {
}
/**
+ * Copy given Dictionary
+ */
+ private Dictionary<String, Object> getPrivateCopyOf(final Dictionary<String, Object> input) {
+ if ( input == null ) {
+ return null;
+ }
+
+ final Dictionary<String, Object> result = new Hashtable<>();
+ final Enumeration<String> e = input.keys();
+ while(e.hasMoreElements()) {
+ final String key = e.nextElement();
+ result.put(key, input.get(key));
+ }
+ return result;
+ }
+ /**
* Deserialize the object
* - read version id
* - deserialize fields