Bug 221904 - Java Model Exception while trying to open *.class file
Summary: Java Model Exception while trying to open *.class file
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M7   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-07 14:47 EST by Artur Ruszczynski CLA
Modified: 2008-04-29 04:45 EDT (History)
2 users (show)

See Also:


Attachments
PI used in to reproduce this defect (68.01 KB, application/binary)
2008-03-07 14:47 EST, Artur Ruszczynski CLA
no flags Details
Proposed fix and regression test (3.81 KB, patch)
2008-04-06 13:14 EDT, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Artur Ruszczynski CLA 2008-03-07 14:47:22 EST
Created attachment 91926 [details]
PI used in to reproduce this defect

Build ID: 3.2.2

Steps To Reproduce:
This defect happens in [the IBM Product Based on Eclispe] - please contact me for details.

1. Import supplied PI file (import SlotMachine_v2 module only)
2. Open Physical Resources view
3. Expand SlotMachine_v2-->brg and double-click to open PayOutBR.class file


More information:
Defect Description:
The editor opens but it displays big Error icon and the following message: "Unable to create this part due to an internal error. Reason for the failure: operation not supported for specified element type(s): <project root> [in SlotMachine_v2]".
There is [Details >>] button available. Clicking it shows the following exception (which is also loggend in Error Log):

Java Model Exception: Java Model Status [Operation not supported for specified element type(s):<project root> [in SlotMachine_v2]]
	at org.eclipse.jdt.internal.core.ClassFile.getBuffer(Unknown Source)
	at org.eclipse.jdt.internal.core.ClassFile.getSourceRange(Unknown Source)
	at org.eclipse.jdt.internal.ui.javaeditor.ClassFileEditor.probeInputForSource(Unknown Source)
	at org.eclipse.jdt.internal.ui.javaeditor.ClassFileEditor.doSetInput(Unknown Source)
	at org.eclipse.ui.texteditor.AbstractTextEditor$17.run(Unknown Source)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(Unknown Source)
	at org.eclipse.jface.operation.ModalContext.run(Unknown Source)
	at org.eclipse.jface.window.ApplicationWindow$1.run(Unknown Source)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(Unknown Source)
	at org.eclipse.jface.window.ApplicationWindow.run(Unknown Source)
	at org.eclipse.ui.internal.WorkbenchWindow.run(Unknown Source)
	at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(Unknown Source)
	at org.eclipse.ui.texteditor.AbstractTextEditor.init(Unknown Source)
	at org.eclipse.ui.internal.EditorManager.createSite(Unknown Source)
	at org.eclipse.ui.internal.EditorReference.createPartHelper(Unknown Source)
	at org.eclipse.ui.internal.EditorReference.createPart(Unknown Source)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(Unknown Source)
	at org.eclipse.ui.internal.PartPane.setVisible(Unknown Source)
	at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(Unknown Source)
	at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(Unknown Source)
	at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(Unknown Source)
	at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(Unknown Source)
	at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(Unknown Source)
	at org.eclipse.ui.internal.PartStack.setSelection(Unknown Source)
	at org.eclipse.ui.internal.PartStack.showPart(Unknown Source)
	at org.eclipse.ui.internal.PartStack.add(Unknown Source)
	at org.eclipse.ui.internal.EditorStack.add(Unknown Source)
	at org.eclipse.ui.internal.PartStack.add(Unknown Source)
	at org.eclipse.ui.internal.EditorStack.add(Unknown Source)
	at org.eclipse.ui.internal.EditorSashContainer.addEditor(Unknown Source)
	at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(Unknown Source)
	at org.eclipse.ui.internal.EditorAreaHelper.addEditor(Unknown Source)
	at org.eclipse.ui.internal.EditorManager.createEditorTab(Unknown Source)
	at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(Unknown Source)
	at org.eclipse.ui.internal.EditorManager.openEditor(Unknown Source)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(Unknown Source)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(Unknown Source)
	at org.eclipse.ui.internal.WorkbenchPage.access$10(Unknown Source)
	at org.eclipse.ui.internal.WorkbenchPage$9.run(Unknown Source)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(Unknown Source)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(Unknown Source)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(Unknown Source)
	at org.eclipse.ui.ide.IDE.openEditor(Unknown Source)
	at org.eclipse.ui.ide.IDE.openEditor(Unknown Source)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(Unknown Source)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(Unknown Source)
	at org.eclipse.jdt.internal.ui.actions.OpenActionUtil.open(Unknown Source)
	at org.eclipse.jdt.ui.actions.OpenAction.run(Unknown Source)
	at org.eclipse.jdt.ui.actions.OpenAction.run(Unknown Source)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(Unknown Source)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(Unknown Source)
	at org.eclipse.jdt.internal.ui.navigator.OpenAndExpand.run(Unknown Source)
	at org.eclipse.ui.actions.RetargetAction.run(Unknown Source)
	at [1 line hidden - pelase ask me for details]
	at org.eclipse.jface.viewers.StructuredViewer$2.run(Unknown Source)
	at org.eclipse.core.runtime.SafeRunner.run(Unknown Source)
	at org.eclipse.core.runtime.Platform.run(Unknown Source)
	at org.eclipse.ui.internal.JFaceUtil$1.run(Unknown Source)
	at org.eclipse.jface.util.SafeRunnable.run(Unknown Source)
	at org.eclipse.jface.viewers.StructuredViewer.fireOpen(Unknown Source)
	at org.eclipse.jface.viewers.StructuredViewer.handleOpen(Unknown Source)
	at org.eclipse.ui.navigator.CommonViewer.handleOpen(Unknown Source)
	at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(Unknown Source)
	at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(Unknown Source)
	at org.eclipse.jface.util.OpenStrategy.access$2(Unknown Source)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(Unknown Source)
	at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
	at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Unknown Source)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Unknown Source)
	at org.eclipse.ui.internal.Workbench.runUI(Unknown Source)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Unknown Source)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(Unknown Source)
	at org.eclipse.ui.internal.ide.IDEApplication.run(Unknown Source)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(Unknown Source)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(Unknown Source)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(Unknown Source)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(Unknown Source)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.core.launcher.Main.invokeFramework(Unknown Source)
	at org.eclipse.core.launcher.Main.basicRun(Unknown Source)
	at org.eclipse.core.launcher.Main.run(Unknown Source)
	at org.eclipse.core.launcher.Main.main(Unknown Source)


This is the note sent by one of our developers:

"I imported the PI and saw the same behaviour.  I also tried opening that file from the base resource navigator, and I saw the same behaviour.  So, I'm concluding this is not specific to [the IBM Product Based on Eclipse].  The stack trace also suggests that behaviour is being caused by JDT.  Note that you are opening the .class file and not the .java.  I can open the .java file for that class without issue."
Comment 1 Jerome Lanneluc CLA 2008-04-05 04:38:42 EDT
Unfortunately I don't have access to the builder referenced by these projects and thus the .class file doesn't exist. Can you please attach a project with the .class file that has been generated?
Comment 2 Jerome Lanneluc CLA 2008-04-05 05:04:40 EDT
Actually I was able to reproduce using a plain Eclipse SDk following these steps:
1. Start a new workspace
2. Create a Java project using the project as a source folder
3. New > Class > X > OK
4. Uncheck Project > Build automatically
5. Open Navigator view
6. Delete X.java
7. Double-click X.class to open it in an editor
Observe: You get the exception reported above
Comment 3 Jerome Lanneluc CLA 2008-04-06 13:14:18 EDT
Created attachment 94997 [details]
Proposed fix and regression test
Comment 4 Jerome Lanneluc CLA 2008-04-06 13:17:09 EDT
Fix and test released for 3.4M7.

Please let me know if this fix needs to be backported to a maintenance stream.
Comment 5 Maxime Daniel CLA 2008-04-29 04:45:27 EDT
Verified for 3.4 M7 using build I20080427-2000 (and the steps of comment #2).