JDK-8229960 : Remove sun.nio.cs.map system property
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio.charsets
  • Affected Version: 9,11.0.5,14
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: windows
  • Submitted: 2019-08-21
  • Updated: 2020-01-15
  • Resolved: 2019-09-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 14
14 b14Fixed
Related Reports
CSR :  
Relates :  
Sub Tasks
JDK-8230725 :  
A existing charset mapping disappears when a new mapping is added by sun.nio.cs.map system property. 

For example, when a new mapping is added with giving the system property,

the available charsets and these aliases are changed as below.   

w/o -Dsun.nio.cs.map=Windows-31J/Shift_JIS 
  windows-31j -> [MS932, windows-932, csWindows31J] 
  Shift_JIS -> [shift_jis, x-sjis, sjis, shift-jis, ms_kanji, csShiftJIS] 

w/ -Dsun.nio.cs.map=Windows-31J/Shift_JIS 
  windows-31j -> [MS932, x-sjis, shift_jis, shift-jis, ms_kanji, windows-932, csWindows31J, csShiftJIS] 

The issue is reproducible in JDK 11 and 14, and not reproducible in the JDK 8u221.  
It is a regression from JDK 9.

URL: https://hg.openjdk.java.net/jdk/jdk/rev/931799bfbc10 User: naoto Date: 2019-09-10 19:56:48 +0000

Will remove the system property that was meant to ease the application to migrate to IANA definition.

The system property was to help migration to the IANA definition of ShiftJIS. Some customers weren't happy for this at the time so the property allowed them to use the MS932/Windows-31J definition until they could migrate to the IANA definition.

JDK-4556882 and JDK-4712786 have the history on this system property. It property allows for transition in the JDK 1.4.x time frame so surprising to hear that it is still used in 2019. The system property is still present in JDK 11 and there are tests for it but this code, and the VM initialization in particular, changed significantly in JDK 9.

The set of charsets in java.base is platform specific (configured in make/data/charsetmapping/stdcs-*). SJIS and MS932 are in java.base on both Windows and Linux. At some point we need to see if the undocumented sun.nio.cs.map property can be removed. It was added to support migration in the JDK 1.4.x time frame and should probably have been removed many years ago.

Please use Windows or Linux machines. It is not reproducible on Mac as well for some reason.