[slf4j-dev] [Bug 93] New: Small glitch/inconsistency in MessageFormatter.format(..) behaviour as well as testcase

bugzilla-daemon at pixie.qos.ch bugzilla-daemon at pixie.qos.ch
Tue Jul 29 17:29:05 CEST 2008


http://bugzilla.slf4j.org/show_bug.cgi?id=93

           Summary: Small glitch/inconsistency in
                    MessageFormatter.format(..) behaviour as well as
                    testcase
           Product: SLF4J
           Version: 1.5.x
          Platform: All
        OS/Version: Windows XP
            Status: NEW
          Severity: minor
          Priority: P1
         Component: Core API
        AssignedTo: dev at slf4j.org
        ReportedBy: joern at huxhorn.de


While I was reimplementing the formatting logic of MessageFormatter.format(..)
for Lilith I found something that is most likely a small glitch in the
implementation as well as the test.

I used all the slf4j testcases to verify my implementation and one of the tests
failed:

    result = MessageFormatter.format("Value {} is smaller than \\{", i1, i2);
    assertEquals("Value 1 is smaller than \\{", result);  

To be honest, I don't understand why this test does not fail.

The result that I would expect (and that my implementation produces) would be
"Value 1 is smaller than {" since the { is properly escaped by a \.

Another testcase that follows directly seems to indicate that an escaped
parameter start character should simply be printed, regardless if a } follows
or not.

    result = MessageFormatter.format("Value {} is smaller than \\{tail", i1,
i2);
    assertEquals("Value 1 is smaller than {tail", result);  

I can't see a reasonable semantic difference between an escaped { in the middle
or at the end of a message pattern.

So I'd suggest to change the aforementioned testcase to

    result = MessageFormatter.format("Value {} is smaller than \\{", i1, i2);
    assertEquals("Value 1 is smaller than {", result);  

and change the implementation accordingly.

I don't consider this as a big problem since it's a very, very special case,
i.e. it will only show up if the message pattern ends with an escaped {.


-- 
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the slf4j-dev mailing list