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

PathElement.isAbsolute() return value changes after calling absoluteProperty()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • 8u60
    • javafx
    • x86_64
    • windows_7

    Backports

      Description

        FULL PRODUCT VERSION :
        JDK with the following version output

        java version "1.8.0_60"
        Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
        Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Windows 7 Enterprise SP1 (64-bit)

        A DESCRIPTION OF THE PROBLEM :
        When you call isAbsolute() on a newly created PathElement, it will return true. Then call absoluteProperty() on the PathElement. If we call isAbsolute() again, it now returns false. Since we did not attempt to modify the property, we would expect isAbsolute() to return the same value each time.

        -----------------------------

        Description of apparent cause:

        The code for the isAbsolute() method is as follows:

            public final boolean isAbsolute() {
                return absolute == null || absolute.get();
            }

        Since the absolute property is lazy-loaded, its initial value is null. This causes isAbsolute() to return true. Calling absoluteProperty() instantiates absolute. When we call isAbsolute() again, it returns the output of absolute.get(). The absolute property is an instance of BooleanPropertyBase. The default value for BooleanPropertyBase is false, so the value returned by isAbsolute() is now false.

        -----------------------------

        Proposed solution:

        When instantiating the absolute property, pass a value of 'true' into the BooleanPropertyBase constructor.


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Call PathElement.isAbsolute().
        Call PathElement.absoluteProperty().
        Call PathElement.isAbsolute().

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        First call to isAbsolute() should return true.
        Second call to isAbsolute() should return true.

        ACTUAL -
        First call to isAbsolute() returns true.
        Second call to isAbsolute() returns false.


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        void foo () {
            PathElement element = new VLineTo();
            boolean value1;
            boolean value2;
            
            value1 = element.isAbsolute(); // contains 'true'
            element.absoluteProperty(); // In actual application I'm adding a ChangeListener
            value2 = element.isAbsolute(); // contains 'false'
        }

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

        CUSTOMER SUBMITTED WORKAROUND :
        Call setAbsolute(isAbsolute()) before invoking absoluteProperty().


        Attachments

          Issue Links

            Activity

              People

                ekleyman Elina Kleyman (Inactive)
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: