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

Igor Ignatyev iignatyev at openjdk.java.net
Tue Oct 27 18:54:30 UTC 2020


> 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

Igor Ignatyev has updated the pull request incrementally with three additional commits since the last revision:

 - remove \n from MDTM response before parsing
 - added leading 0 to the test
 - use DateTimeFormatter instead of SimpleDateFormat

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/867/files
  - new: https://git.openjdk.java.net/jdk/pull/867/files/f684a9ce..a8e6d809

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=867&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=867&range=00-01

  Stats: 35 lines in 2 files changed: 2 ins; 17 del; 16 mod
  Patch: https://git.openjdk.java.net/jdk/pull/867.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/867/head:pull/867

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


More information about the net-dev mailing list