Bug 12000 - Main.compile does not close log file
Summary: Main.compile does not close log file
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-20 21:00 EST by Jed Anderson CLA
Modified: 2002-03-25 11:23 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 Jed Anderson CLA 2002-03-20 21:00:26 EST
Build: 20020319

On line 230 of org.eclipse.jdt.internal.compiler.batch.Main.compile(String[])
the out stream is flushed.  But if a log file was specified, it needs to be closed.

I have tested replacing:

} finally {
   out.flush();
}

with:

} finally {
   if (log != null) {
      out.close();
   } else {
      out.flush();
   }
}

An it appears to fix my test case.  I tried to boil my test case down, but I
couldn't get a reproducable one.  You may not want to waste your time on this
test case.

A close approximation of my test case is the following:

1. New PDE project, test.
2. Create a new Java file.
3. Put an error in the java file.
4. Right-click on the plugin.xml and select "Create Plug-in JARs".
5. When the ant dialog comes up select test.jar and testsrc.zip, click Finish.
6. Refresh local on the test project.
7. Delete the test.jar.bin.log file, sometimes you get errors.
Comment 1 Olivier Thomann CLA 2002-03-21 14:05:40 EST
I think ideally the right code is:
   out.flush();
   if (log != null) {
      out.close();
   }
Comment 2 Olivier Thomann CLA 2002-03-25 11:21:11 EST
Fixed and released in HEAD.
Comment 3 Olivier Thomann CLA 2002-03-25 11:23:58 EST
Fixed.