[ http://issues.apache.org/jira/browse/FELIX-109?page=all ]
Felix Meschberger updated FELIX-109: ------------------------------------ Attachment: ComponentMetadata_fm_20060830.diff The problem is that the ComponentMetadata.addProperty method feeds an internal Properties instance with the registered property name and value while the ComponentMetadata.validate() assuems the keys to be PropertyMetadata instances. I propse the attached fix, which is implemented as follows: addProperty: feeds a list with the PropertyMetadata instances validate: iterates the PropertyMetadata list, validates each entry and fills a Hashtable with the validated property name and value getProperties: now returns a Dictionary (which is the Hashtable filled by validate) The choice of using a Hashtable instead of a Properties instance is, that the service property values need not be String objects, while the Properties object assumes String values. > java.lang.ClassCastException when the component descriptor contains > <property> elements > --------------------------------------------------------------------------------------- > > Key: FELIX-109 > URL: http://issues.apache.org/jira/browse/FELIX-109 > Project: Felix > Issue Type: Bug > Components: Declarative Services > Affects Versions: 0.8.0 > Environment: WinXP, Sun JDK 1.5 > Reporter: Didier DONSEZ > Attachments: ComponentMetadata_fm_20060830.diff > > > There is a bug in org.apache.felix.scr > when the component descriptor contains <property> elements > java.lang.ClassCastException: java.lang.String > at > org.apache.felix.scr.ComponentMetadata.validate(ComponentMetadata.java:254) > at org.apache.felix.scr.XmlHandler.endElement(XmlHandler.java:175) > at > org.apache.felix.scr.parser.KXml2SAXParser.parseXML(KXml2SAXParser.java:72) > at > org.apache.felix.scr.GenericActivator.initialize(GenericActivator.java:148) > at > org.apache.felix.scr.GenericActivator.start(GenericActivator.java:99) > at org.apache.felix.framework.Felix._startBundle(Felix.java:1349) > at org.apache.felix.framework.Felix.startBundle(Felix.java:1283) > at > org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:765) > at > org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:206) > at java.lang.Thread.run(Thread.java:595) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira