Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 334814

Summary: ClassCastException in org.eclipse.php.internal.core.documentModel.dom.ElementImplForPhp
Product: z_Archived Reporter: Yahor Radtsevich <yahorr>
Component: PDTAssignee: PHP Core <php.core-inbox>
Status: CLOSED FIXED QA Contact: Ilina Stefanova <ilina.s>
Severity: normal    
Priority: P3 CC: jacek.pospychala, kalin.a, yahorr, zhaozhongwei
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
ClassCastException stack trace
none
Patch for ElementImplForPhp.java jacek.pospychala: iplog+

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...