DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22894>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22894

Single backslash not accepted in File param value

           Summary: Single backslash not accepted in File param value
           Product: Log4j
           Version: 1.2
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Configurator
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


If you enter a filepath with single backslashes, the backslashes will be 
ignored ( or converted to special characters such as newline or tab, depending 
on the character after the backslash ).  So, for example, a filepath of:

C:\MyDirectory\MyLog.txt

will end up as the file:

MyDirectoryMyLog.txt

in the current folder.  I looked at the log4j code and discovered that *all* 
parameter values are processed via the method 
org.apache.log4j.helpers.OptionConverter.convertSpecialChars().  This method 
treats backslashes as an escape character, to support such things as \t for tab 
and \n for newline.  A single backslash without an appropriate following 
character is quietly consumed.

Since tabs, newlines, and other special characters are not valid in filepaths, 
it would be nice if parameter values of type "File" were not processed via the 
convertSpecialChars() method.  Since double backslashes should be supported, 
too, for backward compatibility, I would suggest replacing the invocation of 
convertSpecialChars() with an invocation of a new method that simply replaces 
double backslashes with single backslashes, in the case where the param is of 
type "File".  In this way, both double backslashes and single backslashes would 
be supported in filenames.

Thanks,
Tom Caulkins
Sr. Systems Developer
SAS Institute Inc.
Cary, NC 27513

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to