powered by Jive Software

Openfire 3.8.0 org.jivesoftware.util. XMPPDateTimeFormat.parseString

It may be a bug when initializing the two Matchers:

public synchronized Date parseString(String dateString) throws ParseException {

// Jacky Jia 2013.02.20

// should reverse the matchers

// Matcher xep82WoMillisMatcher = xep80DateTimePattern.matcher(dateString);

// Matcher xep82Matcher = xep80DateTimeWoMillisPattern.matcher(dateString);

Matcher xep82WoMillisMatcher = xep80DateTimeWoMillisPattern.matcher(dateString);

    Matcher xep82Matcher = xep80DateTimePattern.matcher(dateString);

// -----

if (xep82WoMillisMatcher.matches() || xep82Matcher.matches()) {

String rfc822Date;

// Convert the ISO 8601 time zone string to a RFC822 compatible format

// since SimpleDateFormat supports ISO8601 only with Java7 or higher

if (dateString.charAt(dateString.length() - 1) == ‘Z’) {

rfc822Date = dateString.replace(“Z”, “+0000”);

} else {

// If the time zone wasn’t specified with ‘Z’, then it’s in

// ISO8601 format (i.e. ‘(+|-)HH:mm’)

// RFC822 needs a similar format just without the colon (i.e.

// ‘(+|-)HHmm)’), so remove it

int lastColon = dateString.lastIndexOf(’:’);

rfc822Date = dateString.substring(0, lastColon) + dateString.substring(lastColon + 1);

}

if (xep82WoMillisMatcher.matches()) {

return dateTimeFormatWoMillies.parse(rfc822Date);

} else {

return dateTimeFormat.parse(rfc822Date);

}

} else {

// at last try with the legacy format

return dateTimeFormatOld.parse(dateString);

}

}

Hi

I had same problems. Working on it I found and fixed an error on:

src\java\org\jivesoftware\util\XMPPDateTimeFormat.java

changing:

ln 99: Matcher xep82WoMillisMatcher = xep80DateTimePattern.matcher(dateString);
ln 100: Matcher xep82Matcher = xep80DateTimeWoMillisPattern.matcher(dateString);

for

ln 99: Matcher xep82Matcher = xep80DateTimePattern.matcher(dateString);
ln100: Matcher xep82WoMillisMatcher = xep80DateTimeWoMillisPattern.matcher(dateString);

Best Regards

Marcelo

I believe this has been fixed in the nightly builds and will be released with 3.8.2. Please see OF-646 for additional details.