Commit 9fd3bc101e51d9476688606e422b62b600d11bca
1 parent
a57805f1a8
Exists in
master
and in
6 other branches
update code
Showing 1 changed file with 4 additions and 3 deletions
platform-msg-generate/src/main/java/com/lyms/platform/msg/utils/DateUtils.java
View file @
9fd3bc1
... | ... | @@ -59,9 +59,9 @@ |
59 | 59 | */ |
60 | 60 | public static String getDateStr(Date date,String format) |
61 | 61 | { |
62 | + lock.lock(); | |
62 | 63 | try |
63 | 64 | { |
64 | - lock.lock(); | |
65 | 65 | dateFormat.applyPattern(format); |
66 | 66 | return dateFormat.format(date); |
67 | 67 | } |
68 | 68 | |
... | ... | @@ -97,8 +97,8 @@ |
97 | 97 | */ |
98 | 98 | public static Date formatDate(Date date,String format) |
99 | 99 | { |
100 | + lock.lock(); | |
100 | 101 | try { |
101 | - lock.lock(); | |
102 | 102 | dateFormat.applyPattern(format); |
103 | 103 | String time =dateFormat.format(date); |
104 | 104 | return dateFormat.parse(time); |
105 | 105 | |
... | ... | @@ -121,9 +121,10 @@ |
121 | 121 | */ |
122 | 122 | public static Date preaseDate(String dateStr,String format) |
123 | 123 | { |
124 | + | |
125 | + lock.lock(); | |
124 | 126 | try |
125 | 127 | { |
126 | - lock.lock(); | |
127 | 128 | dateFormat.applyPattern(format); |
128 | 129 | return dateFormat.parse(dateStr); |
129 | 130 | } catch (ParseException e) { |