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. pivot_813 - Applet.launch
        1 kB
        Sandro Martini
      2. custom_panel.bxml.launch
        1.0 kB
        Sandro Martini

        Activity

        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).
        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 ...
        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.
        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.

          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