Bug 327429 - Use Charset.name() instead of Charset.toString() to get the encoding
Summary: Use Charset.name() instead of Charset.toString() to get the encoding
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-11 06:18 EDT by Dani Megert CLA
Modified: 2010-10-26 06:52 EDT (History)
2 users (show)

See Also:


Attachments
Proposed fix (7.93 KB, patch)
2010-10-15 10:15 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 Dani Megert CLA 2010-10-11 06:18:59 EDT
HEAD.

One should not use Charset.toString() to get encoding. Instead Charset.name() should be used. This is important because toString() is not clearly specified and other JREs can return a different toString() value.

References I found:

org.eclipse.jdt.internal.compiler.apt.util.ArchiveFileObject.getCharContent(boolean)
org.eclipse.jdt.internal.compiler.apt.util.EclipseFileManager.getEndorsedDirsFrom(String)
org.eclipse.jdt.internal.compiler.apt.util.EclipseFileManager.getExtdirsFrom(String)
org.eclipse.jdt.internal.compiler.apt.util.EclipseFileManager.getPathsFrom(String)
org.eclipse.jdt.internal.compiler.apt.util.EclipseFileObject.getCharContent(boolean)
org.eclipse.jdt.internal.compiler.tool.ArchiveFileObject.getCharContent(boolean)
org.eclipse.jdt.internal.compiler.tool.EclipseFileManager.getEndorsedDirsFrom(String)
org.eclipse.jdt.internal.compiler.tool.EclipseFileManager.getExtdirsFrom(String)
org.eclipse.jdt.internal.compiler.tool.EclipseFileManager.getPathsFrom(String)
org.eclipse.jdt.internal.compiler.tool.EclipseFileObject.getCharContent(boolean)
Comment 1 Ayushman Jain CLA 2010-10-11 06:26:09 EDT
Satyam, please follow up. Thanks!
Comment 2 Olivier Thomann CLA 2010-10-15 10:01:32 EDT
I'll take care of this as I prefer that Satyam focuses on the APT issue.
Comment 3 Olivier Thomann CLA 2010-10-15 10:15:00 EDT
Released for 3.7M3.
Code inspection is required for verification.
Comment 4 Olivier Thomann CLA 2010-10-15 10:15:21 EDT
Created attachment 180960 [details]
Proposed fix
Comment 5 Dani Megert CLA 2010-10-26 06:52:14 EDT
Verified in I20101025-1800.