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

"Zero" x,y springs passed to SpringLayout.Constraints constructor are not returned from getters

    Details

    • Subcomponent:
    • Resolved In Build:
      b138
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      Tests that iterate over different input values for SpringLayout.Constraints revealed inconsistency between passed x,y springs and values returned from getY() and getX() methods in a border case.
      Please see the following minimized code sample:
      ---
      import javax.swing.*;

      public class VeryMinimized {

          public static void main(String[] args) {
              final Spring y = Spring.constant(0, 0, 0);
              final Spring x = Spring.constant(0, 0, 0);
              SpringLayout.Constraints constraints =
                      new SpringLayout.Constraints(
                              x,
                              y,
                              Spring.constant(0, 0, 0),
                              Spring.constant(0, 0, 0));
              constraints.setConstraint(SpringLayout.SOUTH, Spring.constant(0, 0, 0));
              constraints.setConstraint(SpringLayout.EAST, Spring.constant(0, 0, 0));
              if (constraints.getY() != y) {
                  System.out.println(
                          "The y component is wrong. \n" +
                          "Expected: \"" + y + "\"\nReturned: \"" + constraints.getY() + "\""
                  );
              }
              if (constraints.getX() != x) {
                  System.out.println(
                          "The x component is wrong. \n" +
                          "Expected: \"" + x + "\"\nReturned: \"" + constraints.getX() + "\""
                  );
              }
          }
      }
      ---
      The output will be like the following:

      The y component is wrong.
      Expected: "StaticSpring [0, 0, 0]"
      Returned: "CompoundSpring of StaticSpring [0, 0, 0] and javax.swing.Spring$NegativeSpring@e0e1c6"
      The x component is wrong.
      Expected: "StaticSpring [0, 0, 0]"
      Returned: "CompoundSpring of StaticSpring [0, 0, 0] and javax.swing.Spring$NegativeSpring@6ca1c"

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

      JCK-runtime-7 b03
      JDK 7 b30
      Solaris 10 amd (jck)

      http://moonblade.russia.sun.com/set/java/jck/qa-results/jck/7/ea/b03/results/qac/m002_b30_failed_c1/solaris-amd64-080723150835/execdata/jtwork/report/filtered/newFailedTestCases.html

      The following tests fail:

      api/javax_swing/SpringLayout/Constraints/index.html#SetGet[Constraints0011]
      api/javax_swing/SpringLayout/Constraints/index.html#SetGet[Constraints0009]

        Attachments

          Activity

            People

            • Assignee:
              alexp Alexander Potochkin (Inactive)
              Reporter:
              dbessono Dmitry Bessonov
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: