Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 58367 - Method in org.update.update.core throws an exception
Summary: Method in org.update.update.core throws an exception
Status: RESOLVED DUPLICATE of bug 110413
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Update (deprecated - use Eclipse>Equinox>p2) (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Update-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-13 16:18 EDT by William Mills CLA
Modified: 2006-06-23 13:31 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description William Mills CLA 2004-04-13 16:18:47 EDT
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.
Comment 1 Dorian Birsan CLA 2004-04-14 13:58:28 EDT
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?
Comment 2 William Mills CLA 2004-04-14 14:29:07 EDT
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());		

Comment 3 Dorian Birsan CLA 2004-04-14 14:39:05 EDT
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 :-)
Comment 4 Dorian Birsan CLA 2004-04-22 20:03:59 EDT
Can you confirm if the workaround I sent you works or not? Thanks!
Comment 5 William Mills CLA 2004-04-29 10:29:57 EDT
The work around worked fine.  Thanks again.
Comment 6 Dorian Birsan CLA 2004-04-29 11:00:21 EDT
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.
Comment 7 Branko Tripkovic CLA 2006-06-23 13:31:38 EDT

*** This bug has been marked as a duplicate of 110413 ***