Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[Dltk-dev] Bug? .buildpath file is needed before it is written

Hi all,

Here is a weird situation I encountered. I have inherited the first
two DLTK New Project wizard pages. When I finish the wizard directly
from the first page I get the exception at the bottom of my email
(This happens 2 out of 3 times when I want to create a project). This
means that this "non-deterministic" behavior is caused bu a
Job/Runner/Operation/Thread that needs to access the ".buildpath"
file.

My debugging showed that this problem disappears if there is a
Thread.sleep(1000) between the following two lines in the
ProjectWizardSecondPage.java file.

init(DLTKCore.create(fCurrProject), entries, false);
Thread.sleep(1000); // my code
configureScriptProject(new SubProgressMonitor(monitor, 30)); // create

This means that the init(), and further up the stack, the
BuildpathsBlock.init(), have enough time finish the asynchronous job
on this file.

If I stop the execution after the sleep call, The ".buildpath" file is
still not created but the exception does not occur anymore (maybe it
release the resource, or smth like that).

Can you give me some hint on how can I get rid of this error?

Thanks!

Below is the stack trace of the encountered exception:

org.eclipse.core.internal.resources.ResourceException: Resource
'/4/.buildpath' is not local.
	at org.eclipse.core.internal.resources.Resource.checkLocal(Resource.java:329)
	at org.eclipse.core.internal.resources.File.getContents(File.java:297)
	at org.eclipse.dltk.internal.core.util.Util.getResourceContentsAsByteArray(Util.java:347)
	at org.eclipse.dltk.internal.core.ScriptProject.getSharedProperty(ScriptProject.java:1394)
	at org.eclipse.dltk.internal.core.ScriptProject.readBuildpathFile(ScriptProject.java:1089)
	at org.eclipse.dltk.internal.core.ScriptProject.readBuildpathFile(ScriptProject.java:1078)
	at org.eclipse.dltk.internal.core.ScriptProject.getRawBuildpath(ScriptProject.java:1060)
	at org.eclipse.dltk.internal.core.ScriptProject.getRawBuildpath(ScriptProject.java:1042)
	at org.eclipse.dltk.internal.corext.buildpath.BuildpathModifier.getBuildpathEntryFor(BuildpathModifier.java:973)
	at org.eclipse.dltk.internal.corext.buildpath.BuildpathModifier.isSourceFolder(BuildpathModifier.java:1134)
	at org.eclipse.dltk.internal.corext.buildpath.RemoveFromBuildpathOperation.isValid(RemoveFromBuildpathOperation.java:95)
	at org.eclipse.dltk.internal.ui.wizards.buildpath.newsourcepage.BuildpathModifierAction.isValid(BuildpathModifierAction.java:85)
	at org.eclipse.dltk.internal.ui.wizards.buildpath.newsourcepage.DialogPackageExplorerActionGroup.changeEnableState(DialogPackageExplorerActionGroup.java:690)
	at org.eclipse.dltk.internal.ui.wizards.buildpath.newsourcepage.DialogPackageExplorerActionGroup.getAvailableActions(DialogPackageExplorerActionGroup.java:672)
	at org.eclipse.dltk.internal.ui.wizards.buildpath.newsourcepage.DialogPackageExplorerActionGroup.internalSetContext(DialogPackageExplorerActionGroup.java:440)
	at org.eclipse.dltk.internal.ui.wizards.buildpath.newsourcepage.DialogPackageExplorerActionGroup.setContext(DialogPackageExplorerActionGroup.java:412)
	at org.eclipse.dltk.internal.ui.wizards.buildpath.newsourcepage.DialogPackageExplorer.selectionChanged(DialogPackageExplorer.java:414)
	at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:162)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.runtime.Platform.run(Platform.java:880)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:160)
	at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2062)
	at org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:1638)
	at org.eclipse.jface.viewers.TreeViewer.setSelection(TreeViewer.java:1104)
	at org.eclipse.jface.viewers.Viewer.setSelection(Viewer.java:392)
	at org.eclipse.dltk.internal.ui.wizards.buildpath.newsourcepage.DialogPackageExplorer.setInput(DialogPackageExplorer.java:349)
	at org.eclipse.dltk.internal.ui.wizards.buildpath.newsourcepage.NewSourceContainerWorkbookPage.init(NewSourceContainerWorkbookPage.java:98)
	at org.eclipse.dltk.ui.wizards.BuildpathsBlock.doUpdateUI(BuildpathsBlock.java:317)
	at org.eclipse.dltk.ui.wizards.BuildpathsBlock$2.run(BuildpathsBlock.java:307)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3800)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3425)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.block(ModalContext.java:173)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:382)
	at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:934)
	at org.eclipse.dltk.ui.wizards.NewElementWizard.performFinish(NewElementWizard.java:130)
...
...


-- 
MSc Gabriel Petrovay
MCSA, MCDBA, MCAD
Mobile: +41(0)787978034


Back to the top