Pivot
  1. Pivot
  2. PIVOT-813

BXML annotation should work for JavaBean properties

    Details

      Description

      Consider the following code:

      public class MyComponent extends Panel implements Bindable {

      @BXML
      private String field;

      public void setField(String field)

      { this.field = field; }

      public String getField()

      { return field; }

      // ...
      }

      Current behaviour: the BXML serializer attempts to set the private field directly, bypassing the public setter. This causes an exception, if the application runs as untrusted code, e.g. as an unsigned applet, because private field access is restricted.

      Desired behaviour: call the public setter if it exists, and fall back to setting the private field directly only if the setter hasn't been defined. This would be also consistent with other frameworks such as Hibernate or Spring, which use setters and getters to set and get property values.

      1. custom_panel.bxml.launch
        1.0 kB
        Sandro Martini
      2. pivot_813 - Applet.launch
        1 kB
        Sandro Martini

        Activity

        Piotr Kołaczkowski created issue -
        Piotr Kołaczkowski made changes -
        Field Original Value New Value
        Description Consider the following code:

        public class Bean {

          @BXML
          private String field;

          public void setField(String field) {
            this.field = field;
          }

          public String getField() {
            return field;
          }

          // ...
        }

        Current behaviour: the BXML serializer attempts to set the private field directly, bypassing the public setter. This causes an exception, if the application runs as untrusted code, e.g. as an unsigned applet, because private field access is restricted.

        Desired behaviour: call the public setter if it exists, and fall back to setting the private field directly only if the setter hasn't been defined. This would be also consistent with other frameworks such as Hibernate or Spring, which use setters and getters to set and get property values.
        Consider the following code:

        public class Bean implements Bindable {

          @BXML
          private String field;

          public void setField(String field) {
            this.field = field;
          }

          public String getField() {
            return field;
          }

          // ...
        }

        Current behaviour: the BXML serializer attempts to set the private field directly, bypassing the public setter. This causes an exception, if the application runs as untrusted code, e.g. as an unsigned applet, because private field access is restricted.

        Desired behaviour: call the public setter if it exists, and fall back to setting the private field directly only if the setter hasn't been defined. This would be also consistent with other frameworks such as Hibernate or Spring, which use setters and getters to set and get property values.
        Piotr Kołaczkowski made changes -
        Description Consider the following code:

        public class Bean implements Bindable {

          @BXML
          private String field;

          public void setField(String field) {
            this.field = field;
          }

          public String getField() {
            return field;
          }

          // ...
        }

        Current behaviour: the BXML serializer attempts to set the private field directly, bypassing the public setter. This causes an exception, if the application runs as untrusted code, e.g. as an unsigned applet, because private field access is restricted.

        Desired behaviour: call the public setter if it exists, and fall back to setting the private field directly only if the setter hasn't been defined. This would be also consistent with other frameworks such as Hibernate or Spring, which use setters and getters to set and get property values.
        Consider the following code:

        public class MyComponent extends Panel implements Bindable {

          @BXML
          private String field;

          public void setField(String field) {
            this.field = field;
          }

          public String getField() {
            return field;
          }

          // ...
        }

        Current behaviour: the BXML serializer attempts to set the private field directly, bypassing the public setter. This causes an exception, if the application runs as untrusted code, e.g. as an unsigned applet, because private field access is restricted.

        Desired behaviour: call the public setter if it exists, and fall back to setting the private field directly only if the setter hasn't been defined. This would be also consistent with other frameworks such as Hibernate or Spring, which use setters and getters to set and get property values.
        Hide
        Sandro Martini added a comment -

        This could be another great thing to have in 2.0.1 , if someone wants to fix it assign, otherwise I'll assign to me and fix (probably next week).

        Show
        Sandro Martini added a comment - This could be another great thing to have in 2.0.1 , if someone wants to fix it assign, otherwise I'll assign to me and fix (probably next week).
        Sandro Martini made changes -
        Fix Version/s 2.0.1 [ 12315951 ]
        Affects Version/s 2.0 [ 12313780 ]
        Affects Version/s 2.0.1 [ 12315951 ]
        Hide
        Noel Grandin added a comment -

        This is working for me. What exception did you see?

        Show
        Noel Grandin added a comment - This is working for me. What exception did you see?
        Hide
        Sandro Martini added a comment -

        If possible tomorrow I'll to put (under tests) a test application, with a simple test (like that described by Piotr, usign the @BXML annotation), taking as a sample SuggestionPopupTest .

        If someone has news in the meantime ...

        Show
        Sandro Martini added a comment - If possible tomorrow I'll to put (under tests) a test application, with a simple test (like that described by Piotr, usign the @BXML annotation), taking as a sample SuggestionPopupTest . If someone has news in the meantime ...
        Sandro Martini made changes -
        Assignee Sandro Martini [ smartini ]
        Hide
        Sandro Martini added a comment -

        Just committed CustomPanel.java and custom_panel.bxml, under tests, to start looking at this ... probably I'll need even a launch file to run them with appletviewer and see in a sandboxed environment what happens.

        Show
        Sandro Martini added a comment - Just committed CustomPanel.java and custom_panel.bxml, under tests, to start looking at this ... probably I'll need even a launch file to run them with appletviewer and see in a sandboxed environment what happens.
        Hide
        Sandro Martini added a comment -

        add sample eclipse launch files to run test classes both as a standalone application (no security manager) and with appletviewer (using a default security manager)

        Using these samples all is working in my environments, so I'm guessing the problem seen here, if it's still valid.
        Or if the problem is different, please give me more info.

        Tell me something.
        Thank you.

        Show
        Sandro Martini added a comment - add sample eclipse launch files to run test classes both as a standalone application (no security manager) and with appletviewer (using a default security manager) Using these samples all is working in my environments, so I'm guessing the problem seen here, if it's still valid. Or if the problem is different, please give me more info. Tell me something. Thank you.
        Sandro Martini made changes -
        Attachment custom_panel.bxml.launch [ 12503628 ]
        Attachment pivot_813 - Applet.launch [ 12503629 ]
        Hide
        Noel Grandin added a comment -

        Tested using Sandro's code and launch files, and as far as I can tell this is fixed.

        Please re-open with additional test cases if there is still a problem.

        Show
        Noel Grandin added a comment - Tested using Sandro's code and launch files, and as far as I can tell this is fixed. Please re-open with additional test cases if there is still a problem.
        Noel Grandin made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Sandro Martini
            Reporter:
            Piotr Kołaczkowski
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development