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

Inconsistency with the COMMIT_ON_ACCEPT_CHANGES field (source code/javadoc)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 5.0
    • core-libs
    • b81
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.5.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
      Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      The field COMMIT_ON_ACCEPT_CHANGES is final in the online javadoc of CachedRowSet and in the binary version of java.

      Strangely, it is not final in the source code (src.zip).

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Change the value of COMMIT_ON_ACCEPT_CHANGES

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Modification of the value of the field.
      ACTUAL -
      Compilation error.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      AClass2.java:5: cannot assign a value to final variable COMMIT_ON_ACCEPT_CHANGES
          COMMIT_ON_ACCEPT_CHANGES = false;
          ^
      1 error

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.sql.rowset.CachedRowSet;

      public abstract class AClass2 implements CachedRowSet {
        static {
          COMMIT_ON_ACCEPT_CHANGES = false;
        }

        public static boolean getConstant() {
          return COMMIT_ON_ACCEPT_CHANGES;
        }
      }

      class Main {
        public static void main(String[] args) {
          System.out.println(AClass2.getConstant());
        }
      }

      ---------- END SOURCE ----------

            ahandasunw Amit Handa (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: