[
https://issues.apache.org/jira/browse/NIFI-7275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17231554#comment-17231554
]
Mark Bean commented on NIFI-7275:
---------------------------------
I believe this may be intended (or at least desired) behavior. This allows for
property-specific initialization to take place. When a property is changed in a
running NiFi, onPropertyModified will take care of any such initialization or
customization in the class. However, on NiFi startup, this type of
initialization will not have been performed yet. Running onPropertyModified
before enabling ensures it takes place as if the changes were made on an
already-running NiFi.
> onPropertyModified() called before @OnEnabled for controller services on nifi
> startup
> -------------------------------------------------------------------------------------
>
> Key: NIFI-7275
> URL: https://issues.apache.org/jira/browse/NIFI-7275
> Project: Apache NiFi
> Issue Type: Bug
> Affects Versions: 1.10.0
> Reporter: Nissim Shiman
> Priority: Major
>
> On nifi startup, the onPropertyModified() [1] is run for each property of a
> controller service.
> This is run before the ControllerService methods annotated with @OnEnabled
> [2] are run.
> So, when onPropertyModified() references properties that are initialized in
> the method with @OnEnabled, a java.lang.NullPointerException occurs
> [1]
> https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/components/ConfigurableComponent.java#L68
> [2]
> https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/annotation/lifecycle/OnEnabled.java#L67
--
This message was sent by Atlassian Jira
(v8.3.4#803005)