Bug 98121 - [content type] Reporting file not found exception when resource is out of sync
Summary: [content type] Reporting file not found exception when resource is out of sync
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 RC2   Edit
Assignee: Rafael Chaves CLA
QA Contact:
URL:
Whiteboard:
Keywords: polish
Depends on:
Blocks:
 
Reported: 2005-06-02 11:01 EDT by Pascal Rapicault CLA
Modified: 2005-06-30 22:07 EDT (History)
1 user (show)

See Also:


Attachments
patch for org.eclipse.core.resources (1.99 KB, patch)
2005-06-02 11:57 EDT, Rafael Chaves CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Rapicault CLA 2005-06-02 11:01:11 EDT
Rafael knows the details.
I was running a build and generated a new script in the meantime. When the build
script was about to be opened by the editor, the file had been deleted by the
running build leaving the resource tree in an inconsistent state, which then
caused this problem.

java.io.FileNotFoundException: d:\tmp\97945\org.eclipse.core.tools\build.xml
(The system cannot find the file specified)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at
org.eclipse.core.internal.resources.ContentDescriptionManager$LazyFileInputStream.ensureOpened(ContentDescriptionManager.java:151)
	at
org.eclipse.core.internal.resources.ContentDescriptionManager$LazyFileInputStream.read(ContentDescriptionManager.java:160)
	at java.io.InputStream.read(InputStream.java:89)
	at
org.eclipse.core.internal.content.LazyInputStream.loadBlock(LazyInputStream.java:99)
	at
org.eclipse.core.internal.content.LazyInputStream.ensureAvailable(LazyInputStream.java:64)
	at org.eclipse.core.internal.content.LazyInputStream.read(LazyInputStream.java:119)
	at
org.eclipse.core.internal.content.TextContentDescriber.getByteOrderMark(TextContentDescriber.java:65)
	at
org.eclipse.core.internal.content.XMLContentDescriber.describe(XMLContentDescriber.java:35)
	at
org.eclipse.ant.internal.core.contentDescriber.AntBuildfileContentDescriber.describe(AntBuildfileContentDescriber.java:87)
	at org.eclipse.core.internal.content.ContentType.describe(ContentType.java:162)
	at
org.eclipse.core.internal.content.ContentTypeCatalog.collectMatchingByContents(ContentTypeCatalog.java:188)
	at
org.eclipse.core.internal.content.ContentTypeCatalog.internalFindContentTypesFor(ContentTypeCatalog.java:356)
	at
org.eclipse.core.internal.content.ContentTypeCatalog.internalFindContentTypesFor(ContentTypeCatalog.java:393)
	at
org.eclipse.core.internal.content.ContentTypeCatalog.getDescriptionFor(ContentTypeCatalog.java:302)
	at
org.eclipse.core.internal.content.ContentTypeCatalog.getDescriptionFor(ContentTypeCatalog.java:316)
	at
org.eclipse.core.internal.content.ContentTypeMatcher.getDescriptionFor(ContentTypeMatcher.java:87)
	at
org.eclipse.core.internal.resources.ContentDescriptionManager.readDescription(ContentDescriptionManager.java:394)
	at
org.eclipse.core.internal.resources.ContentDescriptionManager.getDescriptionFor(ContentDescriptionManager.java:333)
	at org.eclipse.core.internal.resources.File.getContentDescription(File.java:276)
	at org.eclipse.ui.ide.IDE.getContentType(IDE.java:960)
	at org.eclipse.ui.ide.IDE.getDefaultEditor(IDE.java:910)
	at org.eclipse.ui.ide.IDE.getEditorDescriptor(IDE.java:538)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:370)
	at org.eclipse.ui.ide.IDE.openEditor(IDE.java:334)
	at org.eclipse.ui.actions.OpenFileAction.openFile(OpenFileAction.java:98)
	at
org.eclipse.ui.actions.OpenSystemEditorAction.run(OpenSystemEditorAction.java:98)
	at
org.eclipse.ui.views.navigator.OpenActionGroup.runDefaultAction(OpenActionGroup.java:120)
	at
org.eclipse.ui.views.navigator.MainActionGroup.runDefaultAction(MainActionGroup.java:326)
	at
org.eclipse.ui.views.navigator.ResourceNavigator.handleOpen(ResourceNavigator.java:650)
	at
org.eclipse.ui.views.navigator.ResourceNavigator$6.open(ResourceNavigator.java:409)
	at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:741)
	at
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1038)
	at org.eclipse.core.runtime.Platform.run(Platform.java:775)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:148)
	at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:739)
	at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:968)
	at
org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1067)
	at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:243)
	at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:238)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:277)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:844)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2929)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2562)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1694)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1658)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:366)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:375)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:162)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
	at org.eclipse.core.launcher.Main.run(Main.java:973)
	at org.eclipse.core.launcher.Main.main(Main.java:948)




Thread [main] (Suspended (exception ResourceException))
	ContentDescriptionManager.readDescription(File) line: 397
	ContentDescriptionManager.getDescriptionFor(File, ResourceInfo) line: 333
	File.getContentDescription() line: 276
	IDE.getContentType(IFile) line: 960
	IDE.getDefaultEditor(IFile, boolean) line: 910
	IDE.getEditorDescriptor(IFile, boolean) line: 538
	IDE.openEditor(IWorkbenchPage, IFile, boolean, boolean) line: 370
	IDE.openEditor(IWorkbenchPage, IFile, boolean) line: 334
	OpenFileAction.openFile(IFile) line: 98
	OpenFileAction(OpenSystemEditorAction).run() line: 98
	OpenActionGroup.runDefaultAction(IStructuredSelection) line: 120
	MainActionGroup.runDefaultAction(IStructuredSelection) line: 326
	ResourceNavigator.handleOpen(OpenEvent) line: 650
	ResourceNavigator$6.open(OpenEvent) line: 409
	StructuredViewer$2.run() line: 741
	InternalPlatform.run(ISafeRunnable) line: 1038
	Platform.run(ISafeRunnable) line: 775
	JFaceUtil$1.run(ISafeRunnable) line: 44
	SafeRunnable.run(ISafeRunnable) line: 148
	TreeViewer(StructuredViewer).fireOpen(OpenEvent) line: 739
	TreeViewer(StructuredViewer).handleOpen(SelectionEvent) line: 968
	StructuredViewer$6.handleOpen(SelectionEvent) line: 1067
	OpenStrategy.fireOpenEvent(SelectionEvent) line: 243
	OpenStrategy.access$2(OpenStrategy, SelectionEvent) line: 238
	OpenStrategy$1.handleEvent(Event) line: 277
	EventTable.sendEvent(Event) line: 66
	Tree(Widget).sendEvent(Event) line: 844
	Display.runDeferredEvents() line: 2929
	Display.readAndDispatch() line: 2562
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 1694
	Workbench.runUI() line: 1658
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 366
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 143
	IDEApplication.run(Object) line: 103
	PlatformActivator$1.run(Object) line: 226
	EclipseStarter.run(Object) line: 375
	EclipseStarter.run(String[], Runnable) line: 162
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available
[native method]
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
	Method.invoke(Object, Object[]) line: 324
	Main.invokeFramework(String[], URL[]) line: 334
	Main.basicRun(String[]) line: 278
	Main.run(String[]) line: 973
	Main.main(String[]) line: 948
Comment 1 Rafael Chaves CLA 2005-06-02 11:57:56 EDT
Created attachment 22239 [details]
patch for org.eclipse.core.resources
Comment 2 Rafael Chaves CLA 2005-06-02 12:02:09 EDT
This patch fixes the problem. If the file does not exist anymore, the content
type detection process will see it as being empty.

I believe we should fix it as a polish item if time permits. DJ?
Comment 3 DJ Houghton CLA 2005-06-03 07:26:58 EDT
+1
Comment 4 Rafael Chaves CLA 2005-06-03 16:31:47 EDT
I was about to release this (even wrote a test for this scenario) when I
realized that we spec we fail if the contents of the file cannot be read. So I
think the current behavior is fine and we should not change it.

Man, I just spared an RC2 approval. Can I use it for another PR of my choice? Or
can I at least cash it?
Comment 5 DJ Houghton CLA 2005-06-06 09:45:45 EDT
Unfortuanatly bug approvals are like coupons... they carry the clause: Cannot be
redeemed for cash value. :-)