MALICIOUS_CODE EI_EXPOSE_REP Medium

后端 未结 5 2113
灰色年华
灰色年华 2020-12-31 03:21

I run findbugs against all of my code and only tackle the top stuff. I finally got the top stuff resolved and now am looking at the details. I have a simple entity, say a us

5条回答
  •  萌比男神i
    2020-12-31 03:40

    I'd prefer to store Date as Long in EpochTime format and use that for persisting across my application layers. That does not need any extra overriding of Lombok getters. Finally while providing the response, I can have an util function which will convert the epoch timestamp to a date and then return it as a string. May be do something like below ::

    private String Epoch_to_ISO8601(Long savedTimeStamp) {
    Date passedDate = new Date(savedTimeStamp);
    String ISO8601_date =
        DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssX")
            .withZone(ZoneOffset.UTC)
            .format(passedDate.toInstant());
    return ISO8601_date;
    

    }

提交回复
热议问题