protected JournalEntity deserializeData(DatabaseEntry data) throws JournalException {
        DataInputStream in = new DataInputStream(new ByteArrayInputStream(data.getData()));
        JournalEntity ret = new JournalEntity();
        try {
            ret.readFields(in);
        } catch (Throwable t) {
            // bad data, will not retry
            String errMsg = String.format("fail to read journal entity key=%s, data=%s",
                    nextKey, data);
            LOG.error(errMsg, t);
            JournalException exception = new JournalException(ret.getOpCode(), errMsg);
            exception.initCause(t);
            throw exception;
        }
        return ret;
    }
@Test
    public void testDeserializeDataException() throws Exception {
        DataOutputBuffer buffer = new DataOutputBuffer(128);
        buffer.writeShort(OperationType.OP_HEARTBEAT_V2);
        // set an invalid json string, it will throw exception in deserializeData()
        Text.writeString(buffer, "aaa");
        DatabaseEntry entry = new DatabaseEntry();
        entry.setData(buffer.getData(), 0, buffer.getLength());

        try {
            BDBJournalCursor cursor = new BDBJournalCursor(null, null, 0, 0);
            JournalEntity entity = cursor.deserializeData(entry);
        } catch (JournalException e) {
            Assert.assertEquals(OperationType.OP_HEARTBEAT_V2, e.getOpCode());
        }
    }