Bug 327429

Summary: Use Charset.name() instead of Charset.toString() to get the encoding
Product: [Eclipse Project] JDT Reporter: Dani Megert <daniel_megert>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, Olivier_Thomann
Version: 3.6   
Target Milestone: 3.7 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix none

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.