Mark Payne created NIFI-5618:
--------------------------------

             Summary: NullPointerException is thrown if attempting to view 
details of a Provenance Event on a node that is disconnected from cluster
                 Key: NIFI-5618
                 URL: https://issues.apache.org/jira/browse/NIFI-5618
             Project: Apache NiFi
          Issue Type: Bug
          Components: Core Framework
            Reporter: Mark Payne
            Assignee: Mark Payne


I have a cluster of 2 nodes. I disconnected one of the nodes, then did a 
Provenance Query. This returned the results correctly. However, when I tried to 
view the details of the provenance event, I got an error in the UI indicating 
that I should check my logs. User log has the following (partial) stack trace:
{code:java}
2018-09-20 15:16:36,049 ERROR [NiFi Web Server-177] 
o.a.nifi.web.api.config.ThrowableMapper An unexpected error has occurred: 
java.lang.NullPointerException. Returning Internal Server Error response.
java.lang.NullPointerException: null
at 
org.apache.nifi.web.api.ProvenanceEventResource.getProvenanceEvent(ProvenanceEventResource.java:299)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at 
org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:76)
at 
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:148)
at 
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:191)
at 
org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:200)
at 
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:103)
at 
org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:493)
at 
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:415)
at 
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:104)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:277)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:268)
at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
at org.glassfish.jersey.internal.Errors.process(Errors.java:268){code}
 

It appears to be due to the fact that since the node is disconnected, the 
clusterNodeId is not provided in the REST API call. So the following block of 
code:
{code:java}
final ClusterCoordinator coordinator = getClusterCoordinator();
if (coordinator != null) {
    final NodeIdentifier nodeId = coordinator.getNodeIdentifier(clusterNodeId);
    event.setClusterNodeAddress(nodeId.getApiAddress() + ":" + 
nodeId.getApiPort());
}{code}
results in calling coordinator.getNodeIdentifier(null), which returns null for 
the nodeId. We then call nodeId.getApiAddress(), throwing a NPE.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to