Commit 2a41d6f2 authored by Florian Schmaus's avatar Florian Schmaus Committed by flow

Use fine grained locking for Date/Time parsing until OF-609 is fixed.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13469 b35dd754-fafc-0310-a699-88a17e54d16e
parent 1cadaacd
...@@ -95,7 +95,7 @@ public class XMPPDateTimeFormat { ...@@ -95,7 +95,7 @@ public class XMPPDateTimeFormat {
* @return * @return
* @throws ParseException * @throws ParseException
*/ */
public synchronized Date parseString(String dateString) throws ParseException { public Date parseString(String dateString) throws ParseException {
Matcher xep82WoMillisMatcher = xep80DateTimePattern.matcher(dateString); Matcher xep82WoMillisMatcher = xep80DateTimePattern.matcher(dateString);
Matcher xep82Matcher = xep80DateTimeWoMillisPattern.matcher(dateString); Matcher xep82Matcher = xep80DateTimeWoMillisPattern.matcher(dateString);
...@@ -115,13 +115,19 @@ public class XMPPDateTimeFormat { ...@@ -115,13 +115,19 @@ public class XMPPDateTimeFormat {
} }
if (xep82WoMillisMatcher.matches()) { if (xep82WoMillisMatcher.matches()) {
return dateTimeFormatWoMillies.parse(rfc822Date); synchronized (dateTimeFormatWoMillies) {
return dateTimeFormatWoMillies.parse(rfc822Date);
}
} else { } else {
return dateTimeFormat.parse(rfc822Date); synchronized (dateTimeFormat) {
return dateTimeFormat.parse(rfc822Date);
}
} }
} else { } else {
// at last try with the legacy format // at last try with the legacy format
return dateTimeFormatOld.parse(dateString); synchronized (dateTimeFormatOld) {
return dateTimeFormatOld.parse(dateString);
}
} }
} }
...@@ -133,8 +139,10 @@ public class XMPPDateTimeFormat { ...@@ -133,8 +139,10 @@ public class XMPPDateTimeFormat {
* @return * @return
* @throws ParseException * @throws ParseException
*/ */
public synchronized Date parseOldDate(String dateStr) throws ParseException { public Date parseOldDate(String dateStr) throws ParseException {
return dateTimeFormatOld.parse(dateStr); synchronized (dateTimeFormatOld) {
return dateTimeFormatOld.parse(dateStr);
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment