Bug 200674 - [Forms] FormEditor.commitPages() throws ClassCastException
Summary: [Forms] FormEditor.commitPages() throws ClassCastException
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: User Assistance (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M2   Edit
Assignee: Adam Archer CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
: 211627 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-08-21 08:59 EDT by Kim Sullivan CLA
Modified: 2007-11-30 14:47 EST (History)
3 users (show)

See Also:


Attachments
patch (857 bytes, patch)
2007-08-27 14:55 EDT, Adam Archer CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kim Sullivan CLA 2007-08-21 08:59:18 EDT
The FormEditor.commitPages() does a premature class cast, which makes it fail on mixed form:
	protected void commitPages(boolean onSave) {
		if (pages != null) {
			for (int i = 0; i < pages.size(); i++) {
				Object page = (IFormPage)pages.get(i); //<-- HERE IS THE PREMATURE CAST
				if (page instanceof IFormPage) {
					IFormPage fpage = (IFormPage)page;
					IManagedForm mform = fpage.getManagedForm();
					if (mform != null && mform.isDirty())
						mform.commit(onSave);
				}
			}
		}	
	}
	
The cast seems unncecessary anyway, since the page variable is an Object, and is checked for the proper type on the next line via instanceof.
Comment 1 Adam Archer CLA 2007-08-27 14:55:31 EDT
Created attachment 77060 [details]
patch

Dejan, this one is zero risk. It can be released.
Comment 2 Dejan Glozic CLA 2007-08-28 11:19:33 EDT
Released into HEAD.
Comment 3 Adam Archer CLA 2007-11-30 14:47:44 EST
*** Bug 211627 has been marked as a duplicate of this bug. ***