} catch (UnsupportedMessageType e) { if (sessionID.getBeginString().compareTo(FixVersions.BEGINSTRING_FIX42) >= 0) { generateBusinessReject(message, BUSINESS_REJECT_UNSUPPORTED_MSG_TYPE); } else { generateReject(message, "Unsupported message type"); }
    public void next(Message message) throws FieldNotFound, RejectLogon, IncorrectDataFormat,            IncorrectTagValue, UnsupportedMessageType, IOException, InvalidMessage {        state.setConnected(true);        Date now = new Date();        if (!checkSessionTime(now)) {            reset();            if (!checkSessionTime(now)) {                return;            }        }        try {            String msgType = message.getHeader().getString(MsgType.FIELD);            String beginString = message.getHeader().getString(BeginString.FIELD);            if (!beginString.equals(sessionID.getBeginString())) {                throw new UnsupportedVersion();            }            if (dataDictionary != null) {                dataDictionary.validate(message);            }            if (msgType.equals(MsgType.LOGON)) {                nextLogon(message);            } else if (msgType.equals(MsgType.HEARTBEAT)) {                nextHeartBeat(message);            } else if (msgType.equals(MsgType.TEST_REQUEST)) {                nextTestRequest(message);            } else if (msgType.equals(MsgType.SEQUENCE_RESET)) {                nextSequenceRequest(message);            } else if (msgType.equals(MsgType.LOGOUT)) {                nextLogout(message);            } else if (msgType.equals(MsgType.RESEND_REQUEST)) {                nextResendRequest(message);            } else if (msgType.equals(MsgType.REJECT)) {                nextReject(message);            } else {                if (!verify(message)) {                    return;                }                state.incrNextTargetMsgSeqNum();            }        } catch (FieldException e) {            generateReject(message, e.getSessionRejectReason(), e.getField());        } catch (FieldNotFound e) {            generateReject(message, SessionRejectReason.REQUIRED_TAG_MISSING, e.field);        } catch (InvalidMessageType e) {            generateReject(message, SessionRejectReason.INVALID_MSGTYPE, 0);        } catch (InvalidMessage e) {            state.logEvent("Skipping invalid message: " + e.getMessage());        } catch (UnsupportedVersion e) {            String msgType = message.getHeader().getString(MsgType.FIELD);            if (msgType.equals(MsgType.LOGOUT)) {                nextLogout(message);            } else {                generateLogout("Incorrect BeginString");                state.incrNextTargetMsgSeqNum();                // 1d_InvalidLogonWrongBeginString.def appears to require                // a disconnect although the C++ didn't appear to be doing it.                // ???                disconnect();            }        } catch (IOException e) {            LogUtil.logThrowable(sessionID, "error processing message", e);        }        nextQueued();        next();    }