Skip to content

Commit

Permalink
synchronize on parse and format calls of each simple date formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
bosborn committed Oct 2, 2017
1 parent bc21c60 commit daac655
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main/java/mil/nga/geopackage/db/DateConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ private DateConverter(String... formats) {
public String stringValue(Date date) {
String value = null;
if (date != null) {
value = formatters.get(0).format(date);
SimpleDateFormat sdf = formatters.get(0);
synchronized (sdf) {
value = sdf.format(date);
}
}
return value;
}
Expand All @@ -124,7 +127,9 @@ public Date dateValue(String date) {
ParseException exception = null;
for (SimpleDateFormat sdf : formatters) {
try {
value = sdf.parse(date);
synchronized (sdf) {
value = sdf.parse(date);
}
break;
} catch (ParseException e) {
if (exception == null) {
Expand Down

0 comments on commit daac655

Please sign in to comment.