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

(str) Missing synchronization in java.lang.String#contentEquals(CharSequence)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 6u10
    • core-libs
    • b52
    • x86
    • windows_vista
    • Not verified

      FULL PRODUCT VERSION :
      java version "1.6.0_16"
      Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
      Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)

      A DESCRIPTION OF THE PROBLEM :
      java.lang.String#contentEquals(StringBuffer) synchronizes on the given StringBuffer. This is correct.

      java.lang.String#contentEquals(CharSequence) does not synchronize on StringBuffers. This is not correct.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Look at the source code.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      str.contentEquals((CharSequence) new StringBuffer()) should synchronize on the given StringBuffer.
      ACTUAL -
      str.contentEquals((CharSequence) new StringBuffer()) does not synchronize on the given StringBuffer.

      REPRODUCIBILITY :
      This bug can be reproduced always.

            jgish Jim Gish (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: