Bug 227941

Summary: org.eclipse.jdt.internal.compiler.batch.Main writes bad characters to an xml log file
Product: [Eclipse Project] JDT Reporter: SAKAIRI Takashi <sakairi>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Olivier_Thomann, philippe_mulet
Version: 3.3.1   
Target Milestone: 3.4 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix none

Description SAKAIRI Takashi CLA 2008-04-21 00:47:44 EDT
I called org.eclipse.jdt.internal.compiler.batch.Main.compile(String commandLine) method with "-log log.xml" option.

log.xml contains bad UTF-8 characters.

I modified several lines in
public void setLog(String logFileName) throws InvalidInputException.

* original
    this.log = new GenericXMLWriter(new FileOutputStream(logFileName, false), Util.LINE_SEPARATOR, true)

* modified
    try {
        this.log = new GenericXMLWriter(new OutputStreamWriter(new FileOutputStream(logFileName, false), "UTF-8"), Util.LINE_SEPARATOR, true);
    } catch (UnsupportedEncodingException e1) {
        e1.printStackTrace();		// TODO
    }

The modified code seems to work fine.
Comment 1 Olivier Thomann CLA 2008-04-21 08:53:44 EDT
Thanks for the patch.
Comment 2 Olivier Thomann CLA 2008-04-21 09:31:32 EDT
Created attachment 96845 [details]
Proposed fix

Complete patch
Comment 3 Olivier Thomann CLA 2008-04-21 09:35:28 EDT
Would you have a test case to add a regression case ?
The fix is ready to be released.
Comment 4 Olivier Thomann CLA 2008-04-21 11:00:27 EDT
Released for 3.4M7.
Takashi, could you please verify the fix with tomorrow's integration build ?
Thanks.
Comment 5 Olivier Thomann CLA 2008-04-21 23:40:05 EDT
Philippe, since the fix is trivial, ok to backport to 3.3 maintenance ?
Takashi is using 3.3.1 jar.
Comment 6 Kent Johnson CLA 2008-05-02 11:47:39 EDT
Verified by reading the code
Comment 7 Philipe Mulet CLA 2008-05-06 10:49:56 EDT
+1 for 3.3 backport
Comment 8 Olivier Thomann CLA 2008-06-02 10:35:02 EDT
Backported for 3.3 maintenance stream.