{
final int limit = buffer.limit();
if (limit >= FormatDescriptionLogEvent.LOG_EVENT_HEADER_LEN)
{
LogHeader header = new LogHeader(buffer,
context.getFormatDescription());
final int len = header.getEventLen();
if (limit >= len)
{
LogEvent event;
/* Checking binary-log's header */
if (handleSet.get(header.getType()))
{
buffer.limit(len);
try
{
/* Decoding binary-log to event */
event = decode(buffer, header, context);
}
catch (IOException e)
{
if (logger.isWarnEnabled())
logger.warn("Decoding "
+ LogEvent.getTypeName(header.getType())
+ " failed from: "
+ context.getLogPosition(), e);
throw e;
}
finally