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

[AC] AttributedCharacterIterator methods works wrong (run with respect differs from spec)

XMLWordPrintable

    • b123
    • generic, x86
    • generic, windows_xp
    • Verified

      1. Methods getRunStart, getRunLimit works wrong (or spec is incorrect).
      See example in attach (it big to show it there)
      Try to uncomment string in example:
      a) replace attrString.addAttribute(attrs[0], obj, 11, 20);
      to it's analog (from spec, because value doesn't change)
              attrString.addAttribute(attrs[0], obj, 11, 15);
              attrString.addAttribute(attrs[0], obj, 15, 20);
      note, that result will differ from real changing values as next
              attrString.addAttribute(attrs[0], obj, 11, 15);
              attrString.addAttribute(attrs[0], new String("$"), 15, 20);
      b) add (from spec nothing changes)
              attrString.addAttribute(attrs[2], null, 40, 45);

      2.
      Difference between situation when Attribute is not defined (no such key), and
      is defined with value == null is unclear and is not same to all methods.
      The result of all method excluding
      public Object getAttribute(AttributedCharacterIterator.Attribute attribute)
      will differ for null values and no values.
      But this differnce can't be checked with getAttribute.
      I've added shorter version of example.

      The problem is that implementation could consider equal attributes as different
      and report incorrect boundaries. According to spec it does not matter how you add attributes
      for method getRunLimit and getRunStart.

      These two string accorsing to spec should be
      attrString.addAttribute(attrs[0], obj, 11, 15);
      attrString.addAttribute(attrs[0], obj, 15, 20);
      equal ot this
      attrString.addAttribute(attrs[0], obj, 11, 20);
      however it does not. (The 15 should not be any boundary)
      You could change variants in tests and check results.

            okutsu Masayoshi Okutsu
            lmesnik Leonid Mesnik
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: