Felix
  1. Felix
  2. FELIX-2834

@Validate method is called when the @Requires components are not validated yet

    Details

      Description

      Declare two components one that requires the other.
      Have an @Validate method.
      Depending on the declaration order in the metadata.xml, the component that requires the other may have acces to a component which has not been validated.

      Example:

      @Component
      class Component1
      {
      @Requires
      Component2 c2;

      @Validate
      public void init() {
      // this may cause an NullPointerException, as c2.usefullData is created in the @Validate method
      if (c2.usefullData.length()>0)

      { // Do something }

      }
      }

      @Component
      class Component2
      {
      String usefullData;
      @Validate
      public void init()

      { usefullData="ready"; }

      }

      If you declare this metadata.xml, the @Validate will fail:
      <ipojo>
      <instance component="Component1" />
      <instance component="Component2" />
      </ipojo>

      Changing the order of components in xml solves the problem, although I think the validation should be called only when the required components are validated.

        Activity

        Vincent Vandemeulebrouck created issue -
        Vincent Vandemeulebrouck made changes -
        Field Original Value New Value
        Labels callback metadata require validation
        Clement Escoffier made changes -
        Assignee Clement Escoffier [ clement.escoffier ]
        Clement Escoffier made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Won't Fix [ 2 ]
        Clement Escoffier made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Clement Escoffier
            Reporter:
            Vincent Vandemeulebrouck
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development