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

(bf) XXXBuffer:compareTo method is not working as expected

XMLWordPrintable

    • b01
    • b07
    • Verified

      I believe the recent changes as part of (JDK-8193085) in these areas caused the below tests failures in JCK.
      api/java_nio/ByteBuffer/index.html#TplMethods: ByteBuffer2078
      api/java_nio/CharBuffer/index.html#Methods:CharBuffer2030
      api/java_nio/DoubleBuffer/index.html#Methods:DoubleBuffer2030
      api/java_nio/FloatBuffer/index.html#Methods: FloatBuffer2030
      api/java_nio/IntBuffer/index.html#Methods: IntBuffer2030
      api/java_nio/LongBuffer/index.html#Methods: LongBuffer2030
      api/java_nio/ShortBuffer/index.html#Methods: ShortBuffer2030

      I believe it's a typo in the code :

      int i = BufferMismatch.mismatch(this, this.position(),
                                              that, that.position(),
                                              Math.min(this.remaining(), that.remaining()));
              if (i >= 0) {
                  return compare(this.get(this.position() + i), that.get(this.position() + i));

      Where that.get(that.position() ) instead of that.get(this.position())

            psandoz Paul Sandoz
            kganapureddy Krushnareddy Ganapureddy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: