Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8272616

Strange code in java.text.DecimalFormat#applyPattern

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b12

      Description

      DecimalFormat.java contains following at line 3404
      https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/text/DecimalFormat.java#L3404

      {code}
      } else if (ch == QUOTE) {
          // A quote outside quotes indicates either the
          // opening quote or two quotes, which is a quote
          // literal. That is, we have the first quote in 'do'
          // or o''clock.
          if (ch == QUOTE) {
              if ((pos+1) < pattern.length() &&
                  pattern.charAt(pos+1) == QUOTE) {
                  ++pos;
                  affix.append("''"); // o''clock
              } else {
                  inQuote = true; // 'do'
              }
              continue;
          }
      {code}

      It seems that the second condition is always true.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              aturbanov Andrey Turbanov
              Reporter:
              aturbanov Andrey Turbanov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: