Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
The preferences admin throws a ClassCastException when writing its cache. The exception is
java.lang.ClassCastException: [Lorg.apache.felix.prefs.PreferencesImpl; cannot be cast to org.apache.felix.prefs.PreferencesImpl
at org.apache.felix.prefs.impl.PreferencesManager.save(PreferencesManager.java:179)
...
This seems to have to do with the implementation of PreferencesImpl: in its constructor, all preferences are loaded. The system preferences are stored,
61 this.systemTree = prefs[i];
but the user preferences are stored incorrectly:
63 this.trees.put(prefs[i].getDescription().getIdentifier(), prefs);
The full array of prefs is stored, not just prefs[i]; this causes the classcastexception.
A possible fix could be
63 this.trees.put(prefs[i].getDescription().getIdentifier(), prefs[i]);