Uploaded image for project: 'QuickFIX/J'
  1. QuickFIX/J
  2. QFJ-642

SessionSettings getSessionProperties(Foo, true) merges the actual settings into the defaults

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.0, 1.5.1
    • Fix Version/s: 1.5.2
    • Component/s: Engine
    • Labels:
      None

      Description

      If you do the following in your code:

      Properties sessionProperties = sessionSettings.getSessionProperties(sessionID, true);

      Then after executing the previous statement, sessionSettings.getDefaultProperties() will return the original default properties MERGED WITH the session properties specified under the sessionID, which is completely wrong. The reason lies in SessionSettings.java (comments inlined):

      public Properties getSessionProperties(SessionID sessionID, boolean includeDefaults) throws ConfigError {
      final Properties p = sections.get(sessionID);
      if (p == null)

      { throw new ConfigError("Session not found"); }

      if (includeDefaults)

      { final Properties mergedProperties = sections.get(DEFAULT_SESSION_ID); // THIS RETURNS A REFERENCE, NOT A COPY!! mergedProperties.putAll(p); /// THAT IS COMPLETELY WRONG, AS THIS MODIFIES THE ORIGINAL MAP CONTENTS return mergedProperties; }

      else

      { return p; }

      }

      The proper solution would be to create a new Properties object and initialise it using the Properties object returned by sections.get().

        Attachments

          Activity

            People

            • Assignee:
              ldanesi Laurent Danesi
              Reporter:
              mvarga Mate Varga
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: