[QFJ-331] SessionSettings variables remove \ during replacement Created: 08/Aug/08  Updated: 09/Sep/08  Resolved: 08/Sep/08

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 1.3.1, 1.3.2
Fix Version/s: None

Type: Bug Priority: Default
Reporter: Jacob Northey Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

Given the following Session Settings and system property fix.home=C:\fix\home. The value resolves to C:fixhome/logs instead of the expected C:\fix\home/logs.

[DEFAULT]
...
FileLogPath=$

{fix.home}

/logs
...

To fix this add the following line to the SessionSettings.java file (after line 563):

if (variableValue != null)

{ variableValue = variableValue.replaceAll("\\\\", "\\\\\\\\"); //this is the new line m.appendReplacement(buffer, variableValue); }

 Comments   
Comment by Steve Bate [ 08/Sep/08 ]

System properties should be provided with a valid Java string (either escaped backslashes or a Java path). The problem with replacing all backslashes is that a valid Java string might already have a backslash for some other reason and the replacement would modify the string in an undesirable way.

Comment by Jacob Northey [ 09/Sep/08 ]

Unfortunately most system properties are defined with a single backslash and are unusable in configuration files. For instance the system properties user.home and user.dir cannot be used because of this. I do realize that there is an issue with breaking existing implementations. However, it seems to have more upside allowing existing system properties to be used than to break the few existing implementations which use the properties in question, considering the fix for existing implementations is to remove a single backslash. If there is a better way to work around this (without overriding system properties) I would be satisfied.

Generated at Tue May 14 13:03:43 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.