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

MessageFormatter does not escape backslash correctly

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • 2.0.17
    • None
    • Core API
    • 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

            ceki Ceki Gülcü
            UNV Nikolay Yurchenko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: