[ 
https://issues.apache.org/jira/browse/GEODE-4827?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated GEODE-4827:
----------------------------------
    Labels: pull-request-available  (was: )

> Cq should not be added to the cq map if cq's base region is null
> ----------------------------------------------------------------
>
>                 Key: GEODE-4827
>                 URL: https://issues.apache.org/jira/browse/GEODE-4827
>             Project: Geode
>          Issue Type: Bug
>          Components: cq
>            Reporter: nabarun
>            Priority: Major
>              Labels: pull-request-available
>
> Currently while registering a cq if the cache is closing down , it throws an 
> exception. but we ignore the exception and continue adding the cq to the map.
> While processing the closing of cq it will ask for the cq's base region which 
> will be null. Thus ends with NPE because we end up calling methods on null 
> region.
> Solution:
> put the addition of the cq to the cqMap inside a if check for base region 
> {code:java}
>  void processRegisterCq(String serverCqName, ServerCQ ServerCQ, boolean 
> addToCqMap,
>       GemFireCacheImpl cache) {
>     ServerCQ cq = (ServerCQ) ServerCQ;
>     try {
>       CqService cqService = cache.getCqService();
>       cqService.start();
>       cq.setCqService(cqService);
>       CqStateImpl cqState = (CqStateImpl) cq.getState();
>       cq.setName(generateCqName(serverCqName));
>       cq.registerCq(null, null, cqState.getState());
>     } catch (Exception ex) {
>       // Change it to Info level.
>       logger.info("Error while initializing the CQs with FilterProfile for CQ 
> {}, Error : {}",
>           serverCqName, ex.getMessage(), ex);
>     }
>     if (logger.isDebugEnabled()) {
>       logger.debug("Adding CQ to remote members FilterProfile using name: 
> {}", serverCqName);
>     }
>     // The region's FilterProfile is accessed through CQ reference as the
>     // region is not set on the FilterProfile created for the peer nodes.
>     if (cq.getCqBaseRegion() != null) {
>       if (addToCqMap) {
>         this.cqs.put(serverCqName, cq);
>       }
>       FilterProfile pf = cq.getCqBaseRegion().getFilterProfile();
>       if (pf != null) {
>         pf.incCqCount();
>       }
>     }
>   }
> {code}



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

Reply via email to