Bug 191880 Close the invalid library will lead the ClassCastException occurs and that error will lead some operation throw exceptions
Description: Close the invalid library will lead the ClassCastException occurs and that error will lead some operation such as insert a Create a datasource throw exceptions Build number: 2.2.0.v20070608-0630 Steps to reproduce: 1, Open the attache library file 2, Close that file 3, New a Data source in another report design file Expected result: After step2, the library is closed without exceptions After step3, the parameter can be created successfully without exceptions Actual result: After step2, ClassCastException occurs After step3, NPE throws out Error log: java.lang.ClassCastException: org.eclipse.gef.commands.CommandStack at org.eclipse.birt.report.designer.ui.editors.LibraryLayoutEditorFormPage.dispose(LibraryLayoutEditorFormPage.java:249) at org.eclipse.birt.report.designer.ui.editors.MultiPageReportEditor.dispose(MultiPageReportEditor.java:1010) at org.eclipse.birt.report.designer.ui.editors.IDEMultiPageReportEditor.dispose(IDEMultiPageReportEditor.java:432) at org.eclipse.birt.report.designer.ui.editors.ReportEditorProxy.dispose(ReportEditorProxy.java:133) NPE: java.lang.NullPointerException at org.eclipse.birt.report.designer.ui.editor.pages.xml.ReportXMLSourceEditorFormPage.reloadEditorInput(ReportXMLSourceEditorFormPage.java:514) at org.eclipse.birt.report.designer.ui.editor.pages.xml.ReportXMLSourceEditorFormPage.access$1(ReportXMLSourceEditorFormPage.java:509) at org.eclipse.birt.report.designer.ui.editor.pages.xml.ReportXMLSourceEditorFormPage$1.stackChanged(ReportXMLSourceEditorFormPage.java:408)
UI/org.eclipse.birt.report.designer.ui.lib/src/org/eclipse/birt/report/designer/ui/editors/LibraryLayoutEditorFormPage.java
/*******************************************************************************
 * Copyright (c) 2004 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/
package org.eclipse.birt.report.designer.ui.editors;
import org.eclipse.birt.report.designer.core.model.SessionHandleAdapter;
import org.eclipse.birt.report.designer.internal.ui.command.WrapperCommandStack;
import org.eclipse.birt.report.designer.internal.ui.util.UIUtil;
import org.eclipse.birt.report.designer.internal.ui.views.data.DataViewPage;
import org.eclipse.birt.report.designer.internal.ui.views.data.DataViewTreeViewerPage;
import org.eclipse.birt.report.designer.nls.Messages;
import org.eclipse.birt.report.designer.ui.ReportPlugin;
import org.eclipse.birt.report.designer.ui.views.attributes.AttributeViewPage;
import org.eclipse.birt.report.model.api.ModuleHandle;
import org.eclipse.birt.report.model.api.activity.ActivityStackEvent;
import org.eclipse.birt.report.model.api.activity.ActivityStackListener;
import org.eclipse.gef.GraphicalViewer;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;