@@ -36,6 +36,7 @@ public class MessageSessionUtils {
3636 public static Message parse (Session session , String messageString ) throws InvalidMessage {
3737 final String beginString = MessageUtils .getStringField (messageString , BeginString .FIELD );
3838 final String msgType = MessageUtils .getMessageType (messageString );
39+ final boolean isLogon = MessageUtils .isLogonMsgType (msgType );
3940 final MessageFactory messageFactory = session .getMessageFactory ();
4041 final DataDictionaryProvider ddProvider = session .getDataDictionaryProvider ();
4142 final ApplVerID applVerID ;
@@ -44,17 +45,20 @@ public static Message parse(Session session, String messageString) throws Invali
4445 final quickfix .Message message ;
4546 final DataDictionary payloadDictionary ;
4647
47- if (!MessageUtils .isAdminMessage (msgType ) || MessageUtils . isLogon ( messageString ) ) {
48+ if (!MessageUtils .isAdminMessage (msgType ) || isLogon ) {
4849 if (FixVersions .BEGINSTRING_FIXT11 .equals (beginString )) {
49- applVerID = getApplVerID (session , messageString );
50+ applVerID = getApplVerID (session , messageString , isLogon );
5051 } else {
5152 applVerID = MessageUtils .toApplVerID (beginString );
5253 }
53- final DataDictionary applicationDataDictionary = ddProvider == null ? null : ddProvider
54- .getApplicationDataDictionary (applVerID );
55- payloadDictionary = MessageUtils .isAdminMessage (msgType )
56- ? sessionDataDictionary
57- : applicationDataDictionary ;
54+
55+ if (isLogon ) {
56+ payloadDictionary = sessionDataDictionary ;
57+ } else { // we got an app message
58+ final DataDictionary applicationDataDictionary = ddProvider == null ? null : ddProvider
59+ .getApplicationDataDictionary (applVerID );
60+ payloadDictionary = applicationDataDictionary ;
61+ }
5862 } else {
5963 applVerID = null ;
6064 payloadDictionary = sessionDataDictionary ;
@@ -70,7 +74,7 @@ public static Message parse(Session session, String messageString) throws Invali
7074 return message ;
7175 }
7276
73- private static ApplVerID getApplVerID (Session session , String messageString )
77+ private static ApplVerID getApplVerID (Session session , String messageString , boolean isLogon )
7478 throws InvalidMessage {
7579 ApplVerID applVerID = null ;
7680
@@ -83,7 +87,7 @@ private static ApplVerID getApplVerID(Session session, String messageString)
8387 applVerID = session .getTargetDefaultApplicationVersionID ();
8488 }
8589
86- if (applVerID == null && MessageUtils . isLogon ( messageString ) ) {
90+ if (applVerID == null && isLogon ) {
8791 final String defaultApplVerIdString = MessageUtils .getStringField (messageString ,
8892 DefaultApplVerID .FIELD );
8993 if (defaultApplVerIdString != null ) {
0 commit comments