Uploaded image for project: 'SLF4J'
  1. SLF4J
  2. SLF4J-452

MessageFormatter does not escape backslash correctly

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 1.8.0-beta5
    • Component/s: Core API
    • Labels:
      None

      Description

      As a fix for -SLF4J-52- rudimentary escape syntax was added. Though it isn't correct.

      Now MessageFormatter.arrayFormat() checks only for 2 cases: escaped curly brace ("\{" - put raw "{" into log output) and double escaped curly brace ("\\{" - put raw "\" into log output and use "{" as parameter start).

      But this is incomplete. There may be any number of backslashes:

      • Triple escaped: "\\\{" - put "\" and "{" into log output, no parameter start
      • Quadruple escaped: "\\\\{" - put "\" and "\" into log output, use "{" as parameter start
      • Pentaple escaped: "\\\\\{" - put "\", "\" and "{" into log output, no parameter start
      • And so on

      So even if only check slash escaping before opening curly brace, you must check number of slashes. If the number is odd, curly brace is escaped, if number is even, only backslashes are escaped but not the curly brace.

        Attachments

          Activity

            People

            • Assignee:
              ceki Ceki Gülcü
              Reporter:
              UNV Nikolay Yurchenko
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: