RFR: 8255078: sun/net/ftp/imp/FtpClient$MLSxParser uses wrong datetime format [v3]

Daniel Fuchs dfuchs at openjdk.java.net
Tue Oct 27 10:37:26 UTC 2020


On Mon, 26 Oct 2020 14:29:00 GMT, Igor Ignatyev <iignatyev at openjdk.org> wrote:

>> src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java line 1777:
>> 
>>> 1775:     }
>>> 1776: 
>>> 1777:     private static Date parseRfc3659TimeValue(String s) {
>> 
>> Shouldn't this method be synchronized because `SimpleDateFormat` is not thread-safe, but instances are stored in the static field `dateFormats`?
>> (Note though that this issue existed before as well)
>
> thanks @Marcono1234, it indeed needs to be `synchronized`, I'll take care of fixing that.

@iignatev if you decide to log a followup a better alternative might be to use [DateTimeFormatter](https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/time/format/DateTimeFormatter.html)

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

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


More information about the net-dev mailing list