Integrated: 8255405: sun/net/ftp/imp/FtpClient uses SimpleDateFormat in not thread-safe manner

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


On Mon, 26 Oct 2020 16:51:25 GMT, Igor Ignatyev <iignatyev at openjdk.org> wrote:

> Hi all,
> 
> could you please review this small and trivial fix?
> 
> `sun/net/ftp/imp/FtpClient::dateFormats` is an array of `SimpleDateFormat` which are shared among all instances of `FtpClient`. the fact that `SimpleDateFormat` isn't thread-safe renders`FtpClient` to be non-thread-safe as well. the patch makes the only usage of `dateFormats` array, `parseRfc3659TimeValue` method, `synchronized`.
> 
> the problem was reported in #776
> 
> Thanks,
> -- Igor

This pull request has now been integrated.

Changeset: 7e305ad1
Author:    Igor Ignatyev <iignatyev at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/7e305ad1
Stats:     37 lines in 2 files changed: 4 ins; 16 del; 17 mod

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

Reviewed-by: chegar, ryadav, dfuchs

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

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


More information about the net-dev mailing list