Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 334814 - ClassCastException in org.eclipse.php.internal.core.documentModel.dom.ElementImplForPhp
Summary: ClassCastException in org.eclipse.php.internal.core.documentModel.dom.Element...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: PHP Core CLA
QA Contact: Ilina Stefanova CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-19 11:54 EST by Yahor Radtsevich CLA
Modified: 2020-05-14 11:18 EDT (History)
4 users (show)

See Also:


Attachments
ClassCastException stack trace (4.41 KB, text/plain)
2011-01-19 11:54 EST, Yahor Radtsevich CLA
no flags Details
Patch for ElementImplForPhp.java (424 bytes, patch)
2011-01-19 11:57 EST, Yahor Radtsevich CLA
jacek.pospychala: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yahor Radtsevich CLA 2011-01-19 11:54:33 EST
Created attachment 187132 [details]
ClassCastException stack trace

To understand what I am talking about, look at the line 91 in ElementImplForPhp.java from org.eclipse.php.core.

There is an incorrect implementation of the interface method
org.eclipse.wst.sse.core.internal.provisional.INodeNotifier.getExistingAdapter(Object type)
in the class
org.eclipse.php.internal.core.documentModel.dom.ElementImplForPhp .

While the interface does not impose any constraints on the type of the parameter 'type', the implementation in ElementImplForPhp.getExistingAdapter assumes, that 'type' parameter has 'Class' type. No type checking is added. On some workspaces it may lead to ClassCastException. As an example I have attached a stack trace when PDT is used along with JBoss Tools.
Comment 1 Yahor Radtsevich CLA 2011-01-19 11:57:22 EST
Created attachment 187133 [details]
Patch for ElementImplForPhp.java

A patch is attached. It just adds instanceof checking before the class casting.
Comment 2 Zhongwei Zhao CLA 2011-01-19 22:19:27 EST
hi Yahor,
thanks,the patch has been applied:)
Comment 3 Kalin CLA 2011-08-02 09:37:14 EDT
Closing...