Produced by Araxis Merge on 4/2/2019 9:49:04 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | JLV_JLV 2_7_2_0_0.zip\JLV_Src\VistaDataService\src\main\java\gov\va\med\vds\das\beans | DateDeserializer.java | Wed Mar 20 21:45:54 2019 UTC |
2 | JLV_JLV 2_7_2_0_0.zip\JLV_Src\VistaDataService\src\main\java\gov\va\med\vds\das\beans | DateDeserializer.java | Tue Apr 2 13:35:49 2019 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 186 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | package go v.va.med.v ds.das.bea ns; | |
2 | ||
3 | /** | |
4 | * Created by DNS on 1/19/2 017. | |
5 | */ | |
6 | ||
7 | import jav a.io.IOExc eption; | |
8 | import jav a.text.Par seExceptio n; | |
9 | import jav a.text.Sim pleDateFor mat; | |
10 | import jav a.util.Arr ays; | |
11 | import jav a.util.Dat e; | |
12 | import jav a.util.Loc ale; | |
13 | ||
14 | import com .fasterxml .jackson.c ore.JsonPa rseExcepti on; | |
15 | import com .fasterxml .jackson.c ore.JsonPa rser; | |
16 | import com .fasterxml .jackson.c ore.JsonPr ocessingEx ception; | |
17 | import com .fasterxml .jackson.d atabind.De serializat ionContext ; | |
18 | import com .fasterxml .jackson.d atabind.de ser.std.St dDeseriali zer; | |
19 | import org .apache.co mmons.lang 3.StringUt ils; | |
20 | import org .slf4j.Log ger; | |
21 | import org .slf4j.Log gerFactory ; | |
22 | ||
23 | public cla ss DateDes erializer extends St dDeseriali zer<Date> { | |
24 | privat e static f inal Logge r LOGGER = LoggerFac tory.getLo gger(DateD eserialize r.class); | |
25 | ||
26 | privat e static f inal Strin g[] DATE_F ORMATS = n ew String[ ]{ | |
27 | "yyyyMMd dHHmmss.SS SZ", | |
28 | "yyyyMMd dHHmmssZ", | |
29 | "yyyyMMd dHHmmss.SS S", | |
30 | "yyyyMMd d.HHmmss", | |
31 | "yyyyMMd d.hhmmss", | |
32 | "yyyy-MM -dd'T'HH:m m:ssZ", | |
33 | "yyyy-MM -dd'T'HH:m m:ssZZ", | |
34 | "yyyy-MM -dd'T'hh:m m:ssXXX", | |
35 | "yyyy-MM -dd'T'hh:m m:ss.SSSZ" , | |
36 | "yyyy-MM -dd HH:mm: ss", | |
37 | "dd-MMM- yyyy@HHmm" , | |
38 | "yyyy-MM -dd", | |
39 | "MM/dd/y y", | |
40 | "MMM dd yyyy hh:mm a", | |
41 | "MMM dd, yyyy HH:m m:ss", | |
42 | "MMM dd, yyyy@HH:m m", | |
43 | "MMM dd, yyyy", | |
44 | "dd MMM yyyy", | |
45 | "ddMMMyy @HHmm", | |
46 | "yyyyMMd dhhmmssZ", | |
47 | "yyyyMMd dHHmmss", | |
48 | "yyyyMMd dHHmm", | |
49 | "yyyyMMd dhhmm", | |
50 | "ddMMMyy ", | |
51 | "yyyyMMd d" | |
52 | }; | |
53 | ||
54 | public DateDeser ializer() { | |
55 | th is(null); | |
56 | } | |
57 | ||
58 | public DateDeser ializer(Cl ass<?> vc) { | |
59 | su per(vc); | |
60 | } | |
61 | ||
62 | @Overr ide | |
63 | public Date dese rialize(Js onParser j sonparser, Deseriali zationCont ext contex t) | |
64 | throws I OException , JsonProc essingExce ption { | |
65 | fo r (String format : D ATE_FORMAT S) { | |
66 | try { | |
67 | retu rn new Sim pleDateFor mat(format , Locale.U S).parse(j sonparser. getText()) ; | |
68 | } catch (ParseExce ption e) { | |
69 | //Do nothing | |
70 | LOGG ER.debug(" Cannot Par se date fo r deserial ize"); | |
71 | } | |
72 | } | |
73 | re turn null; | |
74 | } | |
75 | ||
76 | public static Da te getDate (String da teStr) { | |
77 | Da te retValu e = null; | |
78 | fo r (String format : D ATE_FORMAT S) { | |
79 | if(Strin gUtils.isN otEmpty(da teStr)) { | |
80 | try { | |
81 | retValue = new Simpl eDateForma t(format, Locale.US) .parse(dat eStr); | |
82 | } ca tch (Parse Exception e) { | |
83 | //do nothi ng | |
84 | LOGGER.deb ug("Cannot Parse dat e for getD ate() : " + dateStr) ; | |
85 | } | |
86 | } | |
87 | if(retVa lue != nul l) | |
88 | retu rn retValu e; | |
89 | } | |
90 | re turn retVa lue; | |
91 | } | |
92 | ||
93 | ||
94 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.