Commit 7f6c487f authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Improved error message.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3666 b35dd754-fafc-0310-a699-88a17e54d16e
parent 84a1a9a4
...@@ -59,7 +59,7 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene ...@@ -59,7 +59,7 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene
private static final String DELETE_OFFLINE_MESSAGE = private static final String DELETE_OFFLINE_MESSAGE =
"DELETE FROM jiveOffline WHERE username=? AND creationDate=?"; "DELETE FROM jiveOffline WHERE username=? AND creationDate=?";
private Cache sizeCache; private Cache<String, Integer> sizeCache;
private FastDateFormat dateFormat; private FastDateFormat dateFormat;
/** /**
...@@ -82,9 +82,8 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene ...@@ -82,9 +82,8 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene
public OfflineMessageStore() { public OfflineMessageStore() {
super("Offline Message Store"); super("Offline Message Store");
dateFormat = FastDateFormat.getInstance("yyyyMMdd'T'HH:mm:ss", TimeZone.getTimeZone("UTC")); dateFormat = FastDateFormat.getInstance("yyyyMMdd'T'HH:mm:ss", TimeZone.getTimeZone("UTC"));
String cacheName = "Offline Message Size"; sizeCache = CacheManager.initializeCache("Offline Message Size", "offlinemessage",
CacheManager.initializeCache(cacheName, "offlinemessage", 1024*100, JiveConstants.HOUR*12); 1024 * 100, JiveConstants.HOUR * 12);
sizeCache = CacheManager.getCache(cacheName);
} }
/** /**
...@@ -139,7 +138,7 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene ...@@ -139,7 +138,7 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene
// Update the cached size if it exists. // Update the cached size if it exists.
if (sizeCache.containsKey(username)) { if (sizeCache.containsKey(username)) {
int size = (Integer)sizeCache.get(username); int size = sizeCache.get(username);
size += msgXML.length(); size += msgXML.length();
sizeCache.put(username, size); sizeCache.put(username, size);
} }
...@@ -190,7 +189,7 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene ...@@ -190,7 +189,7 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene
} }
} }
catch (Exception e) { catch (Exception e) {
Log.error(LocaleUtils.getLocalizedString("admin.error"), e); Log.error("Error retrieving offline messages of username: " + username, e);
} }
finally { finally {
// Return the sax reader to the pool // Return the sax reader to the pool
...@@ -237,7 +236,8 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene ...@@ -237,7 +236,8 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene
rs.close(); rs.close();
} }
catch (Exception e) { catch (Exception e) {
Log.error(LocaleUtils.getLocalizedString("admin.error"), e); Log.error("Error retrieving offline messages of username: " + username +
" creationDate: " + creationDate, e);
} }
finally { finally {
// Return the sax reader to the pool // Return the sax reader to the pool
...@@ -267,7 +267,7 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene ...@@ -267,7 +267,7 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene
removeUsernameFromSizeCache(username); removeUsernameFromSizeCache(username);
} }
catch (Exception e) { catch (Exception e) {
Log.error(LocaleUtils.getLocalizedString("admin.error"), e); Log.error("Error deleting offline messages of username: " + username, e);
} }
finally { finally {
try { if (pstmt != null) { pstmt.close(); } } try { if (pstmt != null) { pstmt.close(); } }
...@@ -307,7 +307,8 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene ...@@ -307,7 +307,8 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene
removeUsernameFromSizeCache(username); removeUsernameFromSizeCache(username);
} }
catch (Exception e) { catch (Exception e) {
Log.error(LocaleUtils.getLocalizedString("admin.error"), e); Log.error("Error deleting offline messages of username: " + username +
" creationDate: " + creationDate, e);
} }
finally { finally {
try { if (pstmt != null) { pstmt.close(); } } try { if (pstmt != null) { pstmt.close(); } }
...@@ -327,7 +328,7 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene ...@@ -327,7 +328,7 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene
public int getSize(String username) { public int getSize(String username) {
// See if the size is cached. // See if the size is cached.
if (sizeCache.containsKey(username)) { if (sizeCache.containsKey(username)) {
return (Integer)sizeCache.get(username); return sizeCache.get(username);
} }
int size = 0; int size = 0;
Connection con = null; Connection con = null;
......
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