Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-3868

NullPointerException when trying to retrieve bulletins if insufficient permissions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.2.0
    • 1.3.0
    • Core Framework
    • None

    Description

      If the user trying to retrieve bulletins doesn't have permissions to view a bulletin, a NullPointerException is thrown:

      2017-05-11 03:59:15,960 ERROR [NiFi Web Server-14020] 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.cluster.manager.BulletinMerger.lambda$mergeBulletins$0(BulletinMerger.java:79)
              at java.util.stream.Collectors.lambda$groupingBy$45(Collectors.java:907)
              at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
              at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
              at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
              at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
              at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
              at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
              at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
              at org.apache.nifi.cluster.manager.BulletinMerger.mergeBulletins(BulletinMerger.java:79)
              at org.apache.nifi.cluster.manager.ComponentEntityMerger.merge(ComponentEntityMerger.java:62)
              at org.apache.nifi.cluster.manager.ProcessGroupEntityMerger.merge(ProcessGroupEntityMerger.java:29)
              at org.apache.nifi.cluster.manager.ProcessGroupsEntityMerger.mergeProcessGroups(ProcessGroupsEntityMerger.java:37)
              at org.apache.nifi.cluster.coordination.http.endpoints.FlowMerger.mergeResponses(FlowMerger.java:153)
              at org.apache.nifi.cluster.coordination.http.endpoints.FlowMerger.mergeResponses(FlowMerger.java:46)
              at org.apache.nifi.cluster.coordination.http.endpoints.AbstractSingleDTOEndpoint.merge(AbstractSingleDTOEndpoint.java:48)
              at org.apache.nifi.cluster.coordination.http.StandardHttpResponseMapper.mapResponses(StandardHttpResponseMapper.java:188)
              at org.apache.nifi.cluster.coordination.http.replication.StandardAsyncClusterResponse.getMergedResponse(StandardAsyncClusterResponse.java:219)
              at org.apache.nifi.cluster.coordination.http.replication.StandardAsyncClusterResponse.awaitMergedResponse(StandardAsyncClusterResponse.java:236)
              at org.apache.nifi.web.api.ApplicationResource.replicateNodeResponse(ApplicationResource.java:994)
              at org.apache.nifi.web.api.ApplicationResource.replicate(ApplicationResource.java:962)
              at org.apache.nifi.web.api.ApplicationResource.replicate(ApplicationResource.java:946)
              at org.apache.nifi.web.api.ApplicationResource.replicate(ApplicationResource.java:921)
              at org.apache.nifi.web.api.FlowResource.getFlow(FlowResource.java:371)
              at sun.reflect.GeneratedMethodAccessor812.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
              at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
              at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
              at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
              at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
              at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
              at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
              at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
              at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
              at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)
              at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)
              at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
              at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
              at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
              at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558)
              at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:733)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
              at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841)
              at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634)
              at org.apache.nifi.web.filter.RequestLogger.doFilter(RequestLogger.java:66)
              at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)
              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
              at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
              at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
              at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
              at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
              at org.apache.nifi.web.security.NiFiAuthenticationFilter.doFilter(NiFiAuthenticationFilter.java:59)
              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
              at org.apache.nifi.web.security.NiFiAuthenticationFilter.doFilter(NiFiAuthenticationFilter.java:59)
              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
              at org.apache.nifi.web.security.NiFiAuthenticationFilter.authenticate(NiFiAuthenticationFilter.java:83)
              at org.apache.nifi.web.security.NiFiAuthenticationFilter.doFilter(NiFiAuthenticationFilter.java:57)
              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
              at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
              at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
              at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
              at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
              at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)
              at org.apache.nifi.web.filter.TimerFilter.doFilter(TimerFilter.java:51)
              at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1613)
              at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:541)
              at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
              at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
              at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
              at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1593)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
              at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1239)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
              at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:481)
              at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1562)
              at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
              at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1141)
              at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
              at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:118)
              at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:561)
              at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
              at org.eclipse.jetty.server.Server.handle(Server.java:564)
              at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
              at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
              at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
              at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
              at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:258)
              at org.eclipse.jetty.io.ssl.SslConnection$3.succeeded(SslConnection.java:147)
              at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
              at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
              at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:122)
              at org.eclipse.jetty.util.thread.strategy.ExecutingExecutionStrategy.invoke(ExecutingExecutionStrategy.java:58)
              at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:201)
              at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:133)
              at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
              at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
              at java.lang.Thread.run(Thread.java:748)
      

      This appears to be due to believing that the Bulletin will be set in the BulletinEntity, but DtoFactory creates a bulletin thus:

      public BulletinEntity createBulletinEntity(final BulletinDTO dto, final boolean canRead) {
              final BulletinEntity entity = new BulletinEntity();
              if (dto != null) {
                  entity.setId(dto.getId());
                  entity.setSourceId(dto.getSourceId());
                  entity.setGroupId(dto.getGroupId());
                  entity.setTimestamp(dto.getTimestamp());
                  entity.setNodeAddress(dto.getNodeAddress());
                  entity.setCanRead(canRead);
                  if (canRead) {
                      entity.setBulletin(dto);
                  }
              }
              return entity;
          }
      

      So the bulletin may not be populated

      Attachments

        Issue Links

          Activity

            People

              mcgilman Matt Gilman
              markap14 Mark Payne
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: