mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 17:49:38 +02:00
Fixed concurrency issue with date formatter. SMACK-111
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@3180 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
38f7e5bba7
commit
d1cf9cd971
2 changed files with 12 additions and 4 deletions
|
@ -48,13 +48,17 @@ public class DelayInformationProvider implements PacketExtensionProvider {
|
|||
public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
|
||||
Date stamp = null;
|
||||
try {
|
||||
stamp = DelayInformation.UTC_FORMAT.parse(parser.getAttributeValue("", "stamp"));
|
||||
synchronized (DelayInformation.UTC_FORMAT) {
|
||||
stamp = DelayInformation.UTC_FORMAT.parse(parser.getAttributeValue("", "stamp"));
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
// Try again but assuming that the date follows JEP-82 format
|
||||
// (Jabber Date and Time Profiles)
|
||||
try {
|
||||
stamp = DelayInformation.NEW_UTC_FORMAT
|
||||
.parse(parser.getAttributeValue("", "stamp"));
|
||||
synchronized (DelayInformation.NEW_UTC_FORMAT) {
|
||||
stamp = DelayInformation.NEW_UTC_FORMAT
|
||||
.parse(parser.getAttributeValue("", "stamp"));
|
||||
}
|
||||
} catch (ParseException e1) {
|
||||
// Last attempt. Try parsing the date assuming that it does not include milliseconds
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue