JDK 9 RFR of 8148023: File.createTempFile is not adhering to the contract regarding file name lengths
brian.burkhalter at oracle.com
Fri Dec 16 21:31:57 UTC 2016
Please review at your convenience.
The method was not adhering to the specification  and was creating long file names which caused failures on all platforms. The pertinent portion of the specification is:
"To create the new file, the prefix and the suffix may first be adjusted to fit the limitations of the underlying platform. If the prefix is too long then it will be truncated, but its first three characters will always be preserved. If the suffix is too long then it too will be truncated, but if it begins with a period character ('.') then the period and the first three characters following it will always be preserved. Once these adjustments have been made the name of the new file will be generated by concatenating the prefix, five or more internally-generated characters, and the suffix."
The code was updated to truncate the filename (leaf) portion of the path name to meet the platform file name component length constraints. The IO regression tests passed with this change on all platforms.
More information about the core-libs-dev