RFR: 8255405: sun/net/ftp/imp/FtpClient uses SimpleDateFormat in not thread-safe manner [v2]

Igor Ignatyev iignatyev at openjdk.java.net
Wed Oct 28 23:57:49 UTC 2020


On Wed, 28 Oct 2020 12:52:41 GMT, Rahul Yadav <ryadav at openjdk.org> wrote:

>> src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java line 1770:
>> 
>>> 1768:         try {
>>> 1769:             var d = LocalDateTime.parse(s, RFC3659_DATETIME_FORMAT);
>>> 1770:             result = Date.from(d.atZone(ZoneOffset.systemDefault()).toInstant());
>> 
>> Should this be ZoneOffset.UTC rather than System default? I thought the date returned by the server were supposed to be in GMT.
>
> ZoneOffset.UTC should return GMT as was the case with SimpleDateFormat before the changes.

right,  thanks for spotting that! I don't know what I was thinking when used `systemDefault` here and when was also got tricked by my own test ��

-------------

PR: https://git.openjdk.java.net/jdk/pull/867


More information about the net-dev mailing list