if (_messages == null)
return null;
synchronized (this)
{
JexlContext jc = JexlHelper.createContext();
Expression msgExpression = null;
if (msgFilter != null && !msgFilter.trim().equals(""))
{
Log.debug("Get messages with filter: " + msgFilter);
msgExpression = ExpressionFactory.createExpression("log." + msgFilter);
}
List<MessageInfo> result = new ArrayList<MessageInfo>();
ListIterator<MessageInfo> it = iterate(false);
int i = 0;
while (it.hasPrevious() && i < maxMessages)
{
MessageInfo info = it.previous();
jc.getVars().put("log", info);
jc.getVars().put("message", info.getMessage());
if (msgExpression == null || ((Boolean) msgExpression.evaluate(jc)).booleanValue())
{
result.add(0, info);
i++;