Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-8122

DataByteArrayInputStreamTest.testNonAscii() is faulty

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • KahaDB
    • None

    Description

      It appears the unit test DataByteArrayInputStreamTest.testNonAscii() is faulty:

      1. It loops with while(Character.isDefined(test)), however the Unicode data has gaps, currently with Java 15 the first gap is the code point 888, Character.isDefined(888) == false.
        Therefore this test never tries any higher code points. Looping up to, including Character.MAX_CODE_POINT might be better.
      2. Based on the comment next to the variable test, it appears the author wanted to test supplementary code points as well, however by casting them to char when creating the String, they are cutting off code points > \uFFFF. It should instead convert the code point to a String like this:
        // Java 11
        String toTest = Character.toString(test);
        // Java < 11
        String toTest = String.valueOf(Character.toChars(test));
        

      Attachments

        Issue Links

          Activity

            People

              jbonofre Jean-Baptiste Onofré
              Marcono1234 Marcono1234
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: