Community
Participate
Working Groups
Method getFeatureIncluded() in class org.eclipse.update.core.model.FeatureModel throws the following exception. java.lang.ClassCastException: java.lang.Object at org.eclipse.update.core.model.FeatureModel.getFeatureIncluded (FeatureModel.java:414) I tracked the problem down. The method getFeatureIncluded() is trying to cast an array of IncludedFeatureReferenceModel to IIncludedFeatureReference. Now the method comment shows that the method should return an array of IncludedFeatureReferenceModel not IIncludedFeatureReference.
In general, the update.core and update.core.model have leaked implementation details, they are not cleanly done, and you point to a perfect example of this. The question is: how did you get a class cast exception? Have you instantiated your own features?
I got the exception while call the method. I created the feature model using the following snippet. url = new URL(pathToFeatureXML); fmf = new FeatureModelFactory(); feature = fmf.parseFeature(url.openStream());
The model classes should be private, not API's, but the authors have probably not anticipated this usage when the package was designed. Feature creation happens via factory methods, you're not supposed to be instantiating model classes directly. For example, features downloaded from an update site are created using FeaturePackagedFactory.createFeature() and those already installed using FeatureExecutableFactory.createFeature() (don't ask me why the name sound French :-)
Can you confirm if the workaround I sent you works or not? Thanks!
The work around worked fine. Thanks again.
Thanks. I have lowered the severity to normal, if that's ok with you. I will add a disclaimer to the model classes, to cover our past mistakes, and hopefully fix them in a follow up release.
*** This bug has been marked as a duplicate of 110413 ***