Preferences service throws ClassCastException
---------------------------------------------
Key: FELIX-411
URL: https://issues.apache.org/jira/browse/FELIX-411
Project: Felix
Issue Type: Bug
Components: Preferences Service
Reporter: Angelo van der Sijpt
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]);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.