It's been sitting around for about 2 months right now...If someone can take
a look at the patch/code & get it committed I'd appreciate it - I hate
running custom-compiled jars.

https://issues.apache.org/bugzilla/show_bug.cgi?id=55731

Simply put the logic of using StringBuilder was completely flawed - any
time you sb. deleteCharAt, you change the original length of the
stringbuilder string, but the loop kept the original character index.

if you look farther below the original DateFormatter.java you can see it's
using the same i--; logic I used for the patch:

        // Now, handle the other aspects like
        //  quoting and scientific notation
        for(int i = 0; i < sb.length(); i++) {
           char c = sb.charAt(i);
            // remove quotes and back slashes
            if (c == '\\' || c == '"') {
                sb.deleteCharAt(i);
                i--;

            // for scientific/engineering notation
            } else if (c == '+' && i > 0 && sb.charAt(i - 1) == 'E') {
                sb.deleteCharAt(i);
                i--;
            }
        }

Thanks,

Eric

Reply via email to