Bug 227941 - org.eclipse.jdt.internal.compiler.batch.Main writes bad characters to an xml log file
Summary: org.eclipse.jdt.internal.compiler.batch.Main writes bad characters to an xml ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M7   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-21 00:47 EDT by SAKAIRI Takashi CLA
Modified: 2008-06-02 10:35 EDT (History)
2 users (show)

See Also:


Attachments
Proposed fix (3.90 KB, patch)
2008-04-21 09:31 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.