IBM JDK does not support some String.format specifiers
------------------------------------------------------

                 Key: JRUBY-3997
                 URL: http://jira.codehaus.org/browse/JRUBY-3997
             Project: JRuby
          Issue Type: Bug
          Components: HelpWanted, IBM/Other VM
            Reporter: Charles Oliver Nutter
            Assignee: Thomas E Enebo
             Fix For: JRuby 1.4


There's some cases, used by TimeOutputFormatter, that IBM's JDK's String.format 
does not appear to support. here's the failures from CI:

{noformat}
    [junit] Testcase: 
testFormatPaddingBlank(org.jruby.util.TimeOutputFormatterTest):   Caused an 
ERROR
    [junit] Mismatched Convertor =s, Flags= #
    [junit] java.util.FormatFlagsConversionMismatchException: Mismatched 
Convertor =s, Flags= #
    [junit]     at java.util.Formatter$Transformer.transformFromString(Unknown 
Source)
    [junit]     at java.util.Formatter$Transformer.transform(Unknown Source)
    [junit]     at java.util.Formatter.format(Unknown Source)
    [junit]     at java.util.Formatter.format(Unknown Source)
    [junit]     at java.lang.String.format(String.java:1961)
    [junit]     at 
org.jruby.util.TimeOutputFormatter.padding(TimeOutputFormatter.java:88)
    [junit]     at 
org.jruby.util.TimeOutputFormatter.format(TimeOutputFormatter.java:79)
    [junit]     at 
org.jruby.util.TimeOutputFormatterTest.testFormatPaddingBlank(TimeOutputFormatterTest.java:54)
    [junit] 
    [junit] 
    [junit] Testcase: 
testFormatPaddingZeros(org.jruby.util.TimeOutputFormatterTest):   Caused an 
ERROR
    [junit] Mismatched Convertor =s, Flags= #
    [junit] java.util.FormatFlagsConversionMismatchException: Mismatched 
Convertor =s, Flags= #
    [junit]     at java.util.Formatter$Transformer.transformFromString(Unknown 
Source)
    [junit]     at java.util.Formatter$Transformer.transform(Unknown Source)
    [junit]     at java.util.Formatter.format(Unknown Source)
    [junit]     at java.util.Formatter.format(Unknown Source)
    [junit]     at java.lang.String.format(String.java:1961)
    [junit]     at 
org.jruby.util.TimeOutputFormatter.padding(TimeOutputFormatter.java:88)
    [junit]     at 
org.jruby.util.TimeOutputFormatter.format(TimeOutputFormatter.java:79)
    [junit]     at 
org.jruby.util.TimeOutputFormatterTest.testFormatPaddingZeros(TimeOutputFormatterTest.java:59)
    [junit] 
    [junit] 
    [junit] Testcase: 
testFormatPaddingBlankAndUpperCase(org.jruby.util.TimeOutputFormatterTest):     
  Caused an ERROR
    [junit] Mismatched Convertor =s, Flags= #
    [junit] java.util.FormatFlagsConversionMismatchException: Mismatched 
Convertor =s, Flags= #
    [junit]     at java.util.Formatter$Transformer.transformFromString(Unknown 
Source)
    [junit]     at java.util.Formatter$Transformer.transform(Unknown Source)
    [junit]     at java.util.Formatter.format(Unknown Source)
    [junit]     at java.util.Formatter.format(Unknown Source)
    [junit]     at java.lang.String.format(String.java:1961)
    [junit]     at 
org.jruby.util.TimeOutputFormatter.padding(TimeOutputFormatter.java:88)
    [junit]     at 
org.jruby.util.TimeOutputFormatter.format(TimeOutputFormatter.java:79)
    [junit]     at 
org.jruby.util.TimeOutputFormatterTest.testFormatPaddingBlankAndUpperCase(TimeOutputFormatterTest.java:69)
    [junit] 
    [junit] 
    [junit] Testcase: 
testPaddingWithoutFormat(org.jruby.util.TimeOutputFormatterTest): Caused an 
ERROR
    [junit] Mismatched Convertor =s, Flags= #
    [junit] java.util.FormatFlagsConversionMismatchException: Mismatched 
Convertor =s, Flags= #
    [junit]     at java.util.Formatter$Transformer.transformFromString(Unknown 
Source)
    [junit]     at java.util.Formatter$Transformer.transform(Unknown Source)
    [junit]     at java.util.Formatter.format(Unknown Source)
    [junit]     at java.util.Formatter.format(Unknown Source)
    [junit]     at java.lang.String.format(String.java:1961)
    [junit]     at 
org.jruby.util.TimeOutputFormatter.padding(TimeOutputFormatter.java:88)
    [junit]     at 
org.jruby.util.TimeOutputFormatter.format(TimeOutputFormatter.java:79)
    [junit]     at 
org.jruby.util.TimeOutputFormatterTest.testPaddingWithoutFormat(TimeOutputFormatterTest.java:74)
    [junit] 
    [junit] 
    [junit] Testcase: 
testPaddingZeroFirstOption(org.jruby.util.TimeOutputFormatterTest):       
Caused an ERROR
    [junit] Mismatched Convertor =s, Flags= #
    [junit] java.util.FormatFlagsConversionMismatchException: Mismatched 
Convertor =s, Flags= #
    [junit]     at java.util.Formatter$Transformer.transformFromString(Unknown 
Source)
    [junit]     at java.util.Formatter$Transformer.transform(Unknown Source)
    [junit]     at java.util.Formatter.format(Unknown Source)
    [junit]     at java.util.Formatter.format(Unknown Source)
    [junit]     at java.lang.String.format(String.java:1961)
    [junit]     at 
org.jruby.util.TimeOutputFormatter.padding(TimeOutputFormatter.java:88)
    [junit]     at 
org.jruby.util.TimeOutputFormatter.format(TimeOutputFormatter.java:79)
    [junit]     at 
org.jruby.util.TimeOutputFormatterTest.testPaddingZeroFirstOption(TimeOutputFormatterTest.java:79)
    [junit] 
    [junit] 
    [junit] Testcase: 
testPaddingBlankFirstOption(org.jruby.util.TimeOutputFormatterTest):      
Caused an ERROR
    [junit] Mismatched Convertor =s, Flags= #
    [junit] java.util.FormatFlagsConversionMismatchException: Mismatched 
Convertor =s, Flags= #
    [junit]     at java.util.Formatter$Transformer.transformFromString(Unknown 
Source)
    [junit]     at java.util.Formatter$Transformer.transform(Unknown Source)
    [junit]     at java.util.Formatter.format(Unknown Source)
    [junit]     at java.util.Formatter.format(Unknown Source)
    [junit]     at java.lang.String.format(String.java:1961)
    [junit]     at 
org.jruby.util.TimeOutputFormatter.padding(TimeOutputFormatter.java:88)
    [junit]     at 
org.jruby.util.TimeOutputFormatter.format(TimeOutputFormatter.java:79)
    [junit]     at 
org.jruby.util.TimeOutputFormatterTest.testPaddingBlankFirstOption(TimeOutputFormatterTest.java:84)
    [junit] 
    [junit] 
    [junit] Testcase: 
testPaddingWithUpperCase(org.jruby.util.TimeOutputFormatterTest): Caused an 
ERROR
    [junit] Mismatched Convertor =s, Flags= #
    [junit] java.util.FormatFlagsConversionMismatchException: Mismatched 
Convertor =s, Flags= #
    [junit]     at java.util.Formatter$Transformer.transformFromString(Unknown 
Source)
    [junit]     at java.util.Formatter$Transformer.transform(Unknown Source)
    [junit]     at java.util.Formatter.format(Unknown Source)
    [junit]     at java.util.Formatter.format(Unknown Source)
    [junit]     at java.lang.String.format(String.java:1961)
    [junit]     at 
org.jruby.util.TimeOutputFormatter.padding(TimeOutputFormatter.java:88)
    [junit]     at 
org.jruby.util.TimeOutputFormatter.format(TimeOutputFormatter.java:79)
    [junit]     at 
org.jruby.util.TimeOutputFormatterTest.testPaddingWithUpperCase(TimeOutputFormatterTest.java:89)
{noformat}

Seems to trace back to the String.format call in this method:

{noformat}
    private String padding(String sequence, String padder) {
        if (formatter != null && formatter.contains("-")) return sequence;

        if (sequence != null && sequence.length() < totalPadding) {
            String format = String.format("%1$#" + totalPadding + "s", 
sequence);
            if ("0".equals(padder)) {
                format = format.substring(0, 
format.indexOf(sequence)).replaceAll(" ", "0") + sequence;
            }
            return format;
        }
        return sequence;
    }
{noformat}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to