Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » IProject.build() internal Eclipse exception (for incremental build)
icon5.gif  IProject.build() internal Eclipse exception (for incremental build) [message #765654] Wed, 14 December 2011 13:17 Go to next message
Kivanc Muslu is currently offline Kivanc MusluFriend
Messages: 153
Registered: November 2010
Senior Member
Hi all,

I call IProject.build() incrementally to build some projects in the background in a plug-in. At this time, the auto-build is also selected in Eclipse. From time to time (non-deterministically), I get internal Eclipse exception traces like the following:

!SESSION 2011-12-14 05:03:26.819 -----------------------------------------------
eclipse.buildId=I20110613-1736
java.version=1.6.0_22
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.sdk.ide
Command-line arguments:  -product org.eclipse.sdk.ide -data C:\Users\Kivanc\Java-Projects\WS-QFS/../runtime-EclipseApplication -dev file:C:/Users/Kivanc/Java-Projects/WS-QFS/.metadata/.plugins/org.eclipse.pde.core/Quick Fix Scout/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog

!ENTRY org.eclipse.jdt.core 4 4 2011-12-14 05:03:32.231
!MESSAGE JavaBuilder handling CoreException
!STACK 1
org.eclipse.core.runtime.CoreException: Could not write file: C:\Users\Kivanc\Java-Projects\runtime-EclipseApplication\DO_NOT_DELETE_Speculation_GBP_567889\bin\GBP_MultipleInheritance.class.
	at org.eclipse.core.internal.filesystem.Policy.error(Policy.java:55)
	at org.eclipse.core.internal.filesystem.local.LocalFile.openOutputStream(LocalFile.java:391)
	at org.eclipse.core.internal.localstore.FileSystemResourceManager.write(FileSystemResourceManager.java:1101)
	at org.eclipse.core.internal.resources.File.internalSetContents(File.java:321)
	at org.eclipse.core.internal.resources.File.setContents(File.java:360)
	at org.eclipse.core.internal.resources.File.setContents(File.java:464)
	at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.writeClassFileContents(IncrementalImageBuilder.java:830)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.writeClassFile(AbstractImageBuilder.java:823)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.acceptResult(AbstractImageBuilder.java:187)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:508)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:364)
	at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.compile(IncrementalImageBuilder.java:329)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:301)
	at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.build(IncrementalImageBuilder.java:134)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildDeltas(JavaBuilder.java:265)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:193)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:394)
	at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
	at org.eclipse.core.internal.resources.Project.build(Project.java:114)
	at edu.washington.cs.util.eclipse.BuilderUtility.build(BuilderUtility.java:149)
	at edu.washington.cs.quickfix.speculation.calc.SpeculationCalculator.buildShadowProject(SpeculationCalculator.java:871)
	at edu.washington.cs.quickfix.speculation.calc.SpeculationCalculator.applyChange(SpeculationCalculator.java:533)
	at edu.washington.cs.quickfix.speculation.calc.SpeculationCalculator.processProposal(SpeculationCalculator.java:482)
	at edu.washington.cs.quickfix.speculation.calc.SpeculationCalculator.processCompilationError(SpeculationCalculator.java:408)
	at edu.washington.cs.quickfix.speculation.calc.SpeculationCalculator.processCompilationErrors(SpeculationCalculator.java:345)
	at edu.washington.cs.quickfix.speculation.calc.SpeculationCalculator.doSpeculativeAnalysis(SpeculationCalculator.java:321)
	at edu.washington.cs.quickfix.speculation.calc.SpeculationCalculator.doWork(SpeculationCalculator.java:248)
	at edu.washington.cs.threading.MortalThread.run(MortalThread.java:88)
Caused by: java.io.FileNotFoundException: C:\Users\Kivanc\Java-Projects\runtime-EclipseApplication\DO_NOT_DELETE_Speculation_GBP_567889\bin\GBP_MultipleInheritance.class (The requested operation cannot be performed on a file with a user-mapped section open)
	at java.io.FileOutputStream.open(Native Method)
	at java.io.FileOutputStream.<init>(Unknown Source)
	at org.eclipse.core.internal.filesystem.local.LocalFile.openOutputStream(LocalFile.java:382)
	... 36 more
!SUBENTRY 1 org.eclipse.core.filesystem 4 272 2011-12-14 05:03:32.232
!MESSAGE Could not write file: C:\Users\Kivanc\Java-Projects\runtime-EclipseApplication\DO_NOT_DELETE_Speculation_GBP_567889\bin\GBP_MultipleInheritance.class.
!STACK 0
java.io.FileNotFoundException: C:\Users\Kivanc\Java-Projects\runtime-EclipseApplication\DO_NOT_DELETE_Speculation_GBP_567889\bin\GBP_MultipleInheritance.class (The requested operation cannot be performed on a file with a user-mapped section open)
	at java.io.FileOutputStream.open(Native Method)
	at java.io.FileOutputStream.<init>(Unknown Source)
	at org.eclipse.core.internal.filesystem.local.LocalFile.openOutputStream(LocalFile.java:382)
	at org.eclipse.core.internal.localstore.FileSystemResourceManager.write(FileSystemResourceManager.java:1101)
	at org.eclipse.core.internal.resources.File.internalSetContents(File.java:321)
	at org.eclipse.core.internal.resources.File.setContents(File.java:360)
	at org.eclipse.core.internal.resources.File.setContents(File.java:464)
	at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.writeClassFileContents(IncrementalImageBuilder.java:830)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.writeClassFile(AbstractImageBuilder.java:823)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.acceptResult(AbstractImageBuilder.java:187)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:508)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:364)
	at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.compile(IncrementalImageBuilder.java:329)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:301)
	at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.build(IncrementalImageBuilder.java:134)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildDeltas(JavaBuilder.java:265)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:193)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:394)
	at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
	at org.eclipse.core.internal.resources.Project.build(Project.java:114)
	at edu.washington.cs.util.eclipse.BuilderUtility.build(BuilderUtility.java:149)
	at edu.washington.cs.quickfix.speculation.calc.SpeculationCalculator.buildShadowProject(SpeculationCalculator.java:871)
	at edu.washington.cs.quickfix.speculation.calc.SpeculationCalculator.applyChange(SpeculationCalculator.java:533)
	at edu.washington.cs.quickfix.speculation.calc.SpeculationCalculator.processProposal(SpeculationCalculator.java:482)
	at edu.washington.cs.quickfix.speculation.calc.SpeculationCalculator.processCompilationError(SpeculationCalculator.java:408)
	at edu.washington.cs.quickfix.speculation.calc.SpeculationCalculator.processCompilationErrors(SpeculationCalculator.java:345)
	at edu.washington.cs.quickfix.speculation.calc.SpeculationCalculator.doSpeculativeAnalysis(SpeculationCalculator.java:321)
	at edu.washington.cs.quickfix.speculation.calc.SpeculationCalculator.doWork(SpeculationCalculator.java:248)
	at edu.washington.cs.threading.MortalThread.run(MortalThread.java:88)


As one can see, the error initiates from IProject.build() call. Is this due to a clash between my incremental build call and Eclipse's auto-build. The error mentions about a .class file problem, however I cannot understand the actual underlying reason. Can this error be avoided?

By the way, I call incremental build as following:
    public static void build(IProject project)
    {
        try
        {
            project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
        }
        catch (CoreException e)
        {
            // Handle exception here...
        }
    }


Thanks in advance, best regards,
Re: IProject.build() internal Eclipse exception (for incremental build) [message #767884 is a reply to message #765654] Mon, 19 December 2011 06:24 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
This error means that some thread has opened this class file for reading and hence couldn't not write. Is there a reason that you want to force an incremental build? You may want to read http://www.eclipse.org/articles/Article-Builders/builders.html and especially the topic 'Interacting with background auto-build'
Re: IProject.build() internal Eclipse exception (for incremental build) [message #767887 is a reply to message #767884] Mon, 19 December 2011 06:32 Go to previous messageGo to next message
Kivanc Muslu is currently offline Kivanc MusluFriend
Messages: 153
Registered: November 2010
Senior Member
Hi Satyam,

Thanks for the response. I am changing a project in the background programmatically and before computing something I need to make sure that project is built and up to date. That is why I call an incremental build on that project only. Is there a better way to do what I need (maybe more structural way)?

Thanks,
Re: IProject.build() internal Eclipse exception (for incremental build) [message #767995 is a reply to message #767887] Mon, 19 December 2011 10:45 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
I guess you could call IResource#refreshLocal(), which could cause the delta managers to get triggered and in turn the builder should be invoked. To wait for the builder to finish you could use
Platform.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null)

Re: IProject.build() internal Eclipse exception (for incremental build) [message #768868 is a reply to message #767995] Wed, 21 December 2011 00:33 Go to previous messageGo to next message
Kivanc Muslu is currently offline Kivanc MusluFriend
Messages: 153
Registered: November 2010
Senior Member
Hi Satyam,

Note:I have edited the original message since I have found the solution for that question.

I have tried to join auto-builder and it just does not work (it imposes a ton of overhead that I cannot accept). So, I tried the following:
- I deactivate the auto-build before my analysis
- I do my analysis
and
- I reactivate the auto-build (if it was activated at the beginning.

My question: would this work?
I use the following code to deactivate auto-build:
IWorkspace workspace= ResourcesPlugin.getWorkspace();
IWorkspaceDescription desc= workspace.getDescription();
desc.setAutoBuilding(false);
workspace.setDescription(desc);


Let's say that at the moment of invocation, auto build was building my background project. Shall I invoke one more
Platform.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null)

just to be on the safe side? (I would prefer not due to performance penalty)

Thanks,

[Updated on: Wed, 21 December 2011 00:58]

Report message to a moderator

Re: IProject.build() internal Eclipse exception (for incremental build) [message #768936 is a reply to message #768868] Wed, 21 December 2011 04:50 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
I think you should call the join() to make sure that auto build is not running. You might not want the builder to interfere, but does your analysis regenerate or modify the class files. You may also want to consider adding your analysis as a builder.
Re: IProject.build() internal Eclipse exception (for incremental build) [message #775576 is a reply to message #768868] Fri, 06 January 2012 09:49 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 21.12.2011 01:33, Kivanc Muslu wrote:
> Hi Satyam,
> Thanks a lot for the help. After reading the document, I think I
> understand the problem better and I also think that it is due to the
> clash of my incremental build call and Eclipse auto build.
> I have one final question though. Is it possible to get whether the
> auto-build is activated for the workspace or not programmatically?
IWorkspaceDescription workspaceDesc=
getWorkspace().getDescription();
boolean isAutobuilding= workspaceDesc.isAutoBuilding();

You can also set that state via the description.

Dani
> Because, I guess if this is disabled, I still need to invoke
> incremental build on the background projects myself.
>
> Thanks,
Previous Topic:Varaiable and Expression View in Debug Perspective
Next Topic:space in java editor does now show properly
Goto Forum:
  


Current Time: Tue Apr 16 18:11:28 GMT 2024

Powered by FUDForum. Page generated in 0.12106 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top