[QFJ-627] Starting a ThreadedSocketInitiator overwrites the default settings Created: 12/Aug/11  Updated: 13/Feb/14  Resolved: 13/Feb/14

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 1.5.0
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Thomas Wölfle Assignee: Laurent Danesi
Resolution: Duplicate Votes: 0
Labels: None
Environment:

kubuntu 11.04
jdk 1.6.0.26



 Description   

When starting an initiator via 'initiator.start()' the default section of the provided SessionSettings are overwitten in the method 'SessionSettings.getSessionProperties(SessionID, boolean) in line 175. This results in a corrupted session settings configuration. I.e. in case the default section defines a custom data dictionary 'default_dict', the first session section defines some other data dictionary 'dict1' and a second session section defines no data dictionary then the session properties for the second session will contain the 'dict1' data dictionary instead of the 'default_dict' data dictionary. This scenario can be reproduced with the following JUnit test:

package test;

import java.io.IOException;
import java.io.InputStream;
import java.io.StringBufferInputStream;
import java.util.Properties;

import org.junit.Test;

import quickfix.Application;
import quickfix.ApplicationAdapter;
import quickfix.ConfigError;
import quickfix.LogFactory;
import quickfix.MemoryStoreFactory;
import quickfix.MessageStoreFactory;
import quickfix.ScreenLogFactory;
import quickfix.SessionID;
import quickfix.SessionSettings;
import quickfix.ThreadedSocketAcceptor;
import quickfix.ThreadedSocketInitiator;
import quickfix.fix42.MessageFactory;

public class FIXSessionSettingsModificationTest {
@Test
public void testGetSessionProperties() throws ConfigError

{ final StringBuilder config = new StringBuilder(); config.append("[DEFAULT]\n"); config.append("DataDictionary=default_dict\n"); config.append("[SESSION]\n"); config.append("BeginString=FIX.4.2\n"); config.append("SenderCompID=senderCompID1\n"); config.append("TargetCompID=targetCompID1\n"); config.append("DataDictionary=dict1\n"); config.append("[SESSION]\n"); config.append("BeginString=FIX.4.2\n"); config.append("SenderCompID=senderCompID2\n"); config.append("TargetCompID=targetCompID2\n"); final StringBufferInputStream stream = new StringBufferInputStream(config.toString()); final SessionSettings sessionSettings = new SessionSettings(stream); final SessionID sessionID1 = new SessionID("FIX.4.2", "senderCompID1", "targetCompID1"); final SessionID sessionID2 = new SessionID("FIX.4.2", "senderCompID2", "targetCompID2"); final Properties session1Props = sessionSettings .getSessionProperties(sessionID1, true); final Properties session2Props = sessionSettings .getSessionProperties(sessionID2, true); assertEquals("Expected session 1 to use dictionary 'dict1'", "dict1", session1Props .get("DataDictionary")); assertEquals("Expected session 2 to use dictionary 'default_dict'", "default_dict", session2Props .get("DataDictionary")); }

}



 Comments   
Comment by Laurent Danesi [ 19/Oct/11 ]

Duplicates QFJ-642

Generated at Sun May 05 09:15:38 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.