Bug 7035 - New builder - builder does not close all JARs
Summary: New builder - builder does not close all JARs
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: 2.0 M2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-12-18 07:41 EST by Philipe Mulet CLA
Modified: 2002-01-11 08:56 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2001-12-18 07:41:53 EST
Build 20011211 + Jdtcore HEAD

When running the JavaModel tests, we get complaints that some libraries could 
not be removed:

WARNING: deleteFile(File) could not delete: c:\temp\comptest\1008679035369
\Minimal Jar\Minimal.zip
WARNING: deleteFile(File) could not delete: c:\temp\comptest\1008679035369
\Minimal Jar
WARNING: deleteFile(File) could not delete: c:\temp\comptest\1008679035369
WARNING: deleteFile(File) could not delete: c:\temp\comptest


By adding some tracing code inside ClasspathJar (alloc and cleanup), we can see 
that some ClasspathJar never get properly cleaned up:

OPEN - ClasspathJar: c:/temp/comptest/1008679035369/Compiler/lib/classes.zip
CLOSE - ClasspathJar: c:/temp/comptest/1008679035369/Compiler/lib/classes.zip
OPEN - ClasspathJar: c:/temp/comptest/1008679035369/CodeAssist/lib/classes.zip
CLOSE - ClasspathJar: c:/temp/comptest/1008679035369/CodeAssist/lib/classes.zip
OPEN - ClasspathJar: C:/JDK/classes.zip
CLOSE - ClasspathJar: C:/JDK/classes.zip
OPEN - ClasspathJar: c:/temp/comptest/1008679035369/Minimal Jar/Minimal.zip
CLOSE - ClasspathJar: c:/temp/comptest/1008679035369/Minimal Jar/Minimal.zip
OPEN - ClasspathJar: c:/temp/comptest/1008679035369/Compiler/lib/classes.zip
CLOSE - ClasspathJar: c:/temp/comptest/1008679035369/Compiler/lib/classes.zip
OPEN - ClasspathJar: 
c:/temp/comptest/1008679035369/JavaSearch/AbortCompilation.jar
OPEN - ClasspathJar: c:/temp/comptest/1008679035369/Minimal Jar/Minimal.zip
OPEN - ClasspathJar: c:/temp/comptest/1008679035369/JavaSearch/MyJar.jar
CLOSE - ClasspathJar: 
c:/temp/comptest/1008679035369/JavaSearch/AbortCompilation.jar
CLOSE - ClasspathJar: c:/temp/comptest/1008679035369/Minimal Jar/Minimal.zip
CLOSE - ClasspathJar: c:/temp/comptest/1008679035369/JavaSearch/MyJar.jar
OPEN - ClasspathJar: c:/temp/comptest/1008679035369/Compiler/lib/classes.zip
CLOSE - ClasspathJar: c:/temp/comptest/1008679035369/Compiler/lib/classes.zip
OPEN - ClasspathJar: c:/temp/comptest/1008679035369/Minimal Jar/Minimal.zip
OPEN - ClasspathJar: C:/JDK/classes.zip
CLOSE - ClasspathJar: C:/JDK/classes.zip
OPEN - ClasspathJar: c:/temp/comptest/1008679035369/Minimal Jar/Minimal.zip
CLOSE - ClasspathJar: c:/temp/comptest/1008679035369/Minimal Jar/Minimal.zip
OPEN - ClasspathJar: c:/temp/comptest/1008679035369/Compiler/lib/classes.zip
CLOSE - ClasspathJar: c:/temp/comptest/1008679035369/Compiler/lib/classes.zip
OPEN - ClasspathJar: c:/temp/comptest/1008679035369/Minimal Jar/Minimal.zip
CLOSE - ClasspathJar: c:/temp/comptest/1008679035369/Minimal Jar/Minimal.zip
OPEN - ClasspathJar: c:/temp/comptest/1008679035369/Minimal Jar/Minimal.zip
OPEN - ClasspathJar: c:/temp/comptest/1008679035369/Minimal Jar/Minimal.zip
Comment 1 Philipe Mulet CLA 2001-12-18 07:44:53 EST
There are 3 occurrences of JAR left open:

...
OPEN - ClasspathJar: c:/temp/comptest/1008679035369/Minimal Jar/Minimal.zip
...
OPEN - ClasspathJar: c:/temp/comptest/1008679035369/Minimal Jar/Minimal.zip
OPEN - ClasspathJar: c:/temp/comptest/1008679035369/Minimal Jar/Minimal.zip
Comment 2 Philipe Mulet CLA 2001-12-18 09:24:23 EST
After moving the location cleanup code to the JavaBuilder#cleanup method 
(rather than on the build state), I get the exact same behavior (trace + 
warning).

I think though that it should be the JavaBuilder responsibility to cleanup the 
locations, given it created them.

Comment 3 Philipe Mulet CLA 2001-12-18 09:40:56 EST
Trace for opening was mislocated (not in the actual open code, but in the 
allocator). 

By moving the #clearLastState() invocation inside catch blocks, I get it to 
work ok (no more complaints). I also got it to work somewhat by moving the 
#cleanup() call before the #clearLastState()... behavior could be explainable 
if #clearLastState() could thrown any exception, but the implementation does 
not look like it does.
Comment 4 Philipe Mulet CLA 2001-12-18 10:08:41 EST
Checked that by resuming the old builder, no warning is dumped.
Comment 5 Philipe Mulet CLA 2001-12-18 12:26:29 EST
Ok, problem is understood. It comes from the fact that builder environment is 
never reinitialized when used outside the Java builder (e.g. for evaluation 
purpose). 

Changed the implementation to define INameEnvironment.cleanup() (invoked from 
batch compiler, evaluation support and Java builder) - used to be called 
IEnvironment.reset(), but it was somewhat wrongly indicating that the name 
environment was re-usable, which isn't true.
Comment 6 Philipe Mulet CLA 2001-12-18 12:48:35 EST
Fixed