Fixes IndexOutOfBoundsException in Call History, prevents the gui from crashing in any exceptions coming from contact list filters and adds some logs in order to better analyze the situation, which provoked the exception in first place.

cusax-fix
Yana Stamcheva 15 years ago
parent 082a191d14
commit d394dde366

@ -407,10 +407,40 @@ else if(propName.equals(STRUCTURE_NAMES[8]))
final int callPeerCount = callPeerIDs == null ? 0 : callPeerIDs.size();
for (int i = 0; i < callPeerCount; i++)
{
// As we iterate over the CallPeer IDs we could not be sure that
// for some reason the start or end call list could result in
// different size lists, so we check this first.
Date callPeerStartValue = null;
Date callPeerEndValue = null;
if (i < callPeerStart.size())
{
callPeerStartValue
= new Date(Long.parseLong(callPeerStart.get(i)));
}
else
{
callPeerStartValue = result.getStartTime();
if (logger.isTraceEnabled())
logger.trace(
"Call history start time list different from ids list: "
+ hr.toString());
}
if (i < callPeerEnd.size())
{
callPeerEndValue
= new Date(Long.parseLong(callPeerEnd.get(i)));
}
else
{
callPeerEndValue = result.getEndTime();
}
CallPeerRecordImpl cpr =
new CallPeerRecordImpl(callPeerIDs.get(i),
new Date(Long.parseLong(callPeerStart.get(i))),
new Date(Long.parseLong(callPeerEnd.get(i))));
callPeerStartValue,
callPeerEndValue);
// if there is no record about the states (backward compability)
if (callPeerStates != null)

@ -9,7 +9,6 @@
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.service.protocol.*;

@ -1112,7 +1112,19 @@ public void run()
if (currentFilter == null || !currentFilter.equals(filter))
currentFilter = filter;
currentFilter.applyFilter(filterQuery);
// If something goes wrong in our filters, we don't want the
// whole gui to crash.
try
{
currentFilter.applyFilter(filterQuery);
}
catch (Throwable t)
{
if (logger.isInfoEnabled())
logger.info(
"One of our contact list filters has crashed.",
t);
}
}
synchronized (this)

@ -100,4 +100,20 @@ public long getTimeInMillis()
{
return (timestamp == null) ? 0 : timestamp.getTime();
}
/**
* Returns the String representation of this HistoryRecord.
*
* @return the String representation of this HistoryRecord
*/
public String toString()
{
String s = "History Record: ";
for (int i = 0; i < propertyNames.length; i++)
{
s += propertyNames[i] + "=" + propertyValues[i] + "\n";
}
return s;
}
}

Loading…
Cancel
Save