OpenBankProject / OpenBankProject/OBP-API
Dont use Simple
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 1.7k
- Forks
- 482
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 15
Description
There are some SimpleDateFormat object used in concurrency environment. take the follow code as example. it should no be used in concurrency environment, especially in Utils object.
package code.api.util
import ...
object APIUtil extends MdcLoggable {
val DateWithDay = "yyyy-MM-dd"
val DateWithDay2 = "yyyyMMdd"
val DateWithDay3 = "dd/MM/yyyy"
val DateWithMinutes = "yyyy-MM-dd'T'HH:mm'Z'"
val DateWithSeconds = "yyyy-MM-dd'T'HH:mm:ss'Z'"
val DateWithMs = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
val DateWithMsRollback = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
val DateWithDayFormat = new SimpleDateFormat(DateWithDay)
val DateWithSecondsFormat = new SimpleDateFormat(DateWithSeconds)
val DateWithMsFormat = new SimpleDateFormat(DateWithMs)
val DateWithMsRollbackFormat = new SimpleDateFormat(DateWithMsRollback)
...
The reason is just in the java documentation:

So please find all SimpleDateFormat those not be this usage: created in method body, and not escape from method body.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Search the repository for SimpleDateFormat usages, starting with instances stored outside method bodies, especially in utility objects. Inspect each occurrence for whether the formatter can escape the method scope. Done means all unsafe shared usages have been addressed while method-local usages remain valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, scala
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100