Commit 227fab7b authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Synchronized access to SimpleDateFormat. JM-360


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1746 b35dd754-fafc-0310-a699-88a17e54d16e
parent 52f90a43
......@@ -67,7 +67,9 @@ public class HistoryRequest {
if (history.attribute("since") != null) {
try {
// parse utc into Date
this.since = formatter.parse(history.attributeValue("since"));
synchronized (formatter) {
this.since = formatter.parse(history.attributeValue("since"));
}
}
catch(ParseException pe) {
Log.error("Error parsing date from history management", pe);
......@@ -170,7 +172,11 @@ public class HistoryRequest {
delayInformation = message.getChildElement("x", "jabber:x:delay");
try {
// Get the date when the historic message was sent
Date delayedDate = delayedFormatter.parse(delayInformation.attributeValue("stamp"));
Date delayedDate = null;
synchronized (delayedFormatter) {
delayedDate = delayedFormatter
.parse(delayInformation.attributeValue("stamp"));
}
if (getSince() != null && delayedDate.before(getSince())) {
// Stop collecting history since we have exceded a limit
break;
......
......@@ -37,9 +37,12 @@
String d = input.substring(0,19);
// try to parse it
try {
Date date = formatter.parse(d);
StringBuffer buf = new StringBuffer(input.length());
buf.append("<span class=\"date\" title=\"").append(formatter.format(date)).append("\">");
synchronized (formatter) {
Date date = formatter.parse(d);
buf.append("<span class=\"date\" title=\"").append(formatter.format(date))
.append("\">");
}
buf.append(d).append("</span>");
buf.append(input.substring(19,input.length()));
return buf.toString();
......
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