[
https://issues.apache.org/jira/browse/GEODE-4827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16413337#comment-16413337
]
ASF subversion and git services commented on GEODE-4827:
--------------------------------------------------------
Commit d79a2b2d62e76e9bf39063930ca421446b195444 in geode's branch
refs/heads/develop from [~nabarunnag]
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=d79a2b2 ]
GEODE-4827: null check for the cache. (#1646)
* While the servers are shutting down, getInstance may result in a null
cache.
* This may result in NPE.
* NULL checks are added.
> 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
> Fix For: 1.6.0
>
> Time Spent: 40m
> Remaining Estimate: 0h
>
> 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)