republique-et-canton-de-geneve / chvote-1-0

The Geneva electronic vote system, version 1.
https://republique-et-canton-de-geneve.github.io/chvote-1-0
GNU Affero General Public License v3.0
744 stars 67 forks source link

Avoid using java.text.SimpleDateFormat #24

Closed nremond closed 7 years ago

nremond commented 7 years ago

It's preferable as the class is not thread-safe, cf: https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#synchronization.

chvote-etat-de-geneve commented 7 years ago

Hello,

Thank you for your pull request. As we are using Java 8, we would prefer to use java.time.format.DateTimeFormatter over joda time.

That being said, OutputFilesPattern instances are never involved in multi-threaded contexts, so using SimpleDateFormat is not an immediate problem. It could arise if the class is badly used in future developments.

nremond commented 7 years ago

OK, I can migrate that code to Java 8

nremond commented 7 years ago

What do you think of that? I migrated the code to only use java.time package

chvote-etat-de-geneve commented 7 years ago

Thanks for this PR, it looks good. If you'd be willing to change those fields' names, we'll gladly merge it!

nremond commented 7 years ago

Done and rebased everything in a single commit.

chvote-etat-de-geneve commented 7 years ago

Merged, thank you!