[
https://issues.apache.org/jira/browse/GEODE-3982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16257526#comment-16257526
]
ASF GitHub Bot commented on GEODE-3982:
---------------------------------------
jhuynh1 closed pull request #1064: GEODE-3982: MemoryIndexStoreIterator should
not call GemFireCacheImpl
URL: https://github.com/apache/geode/pull/1064
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/MemoryIndexStore.java
b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/MemoryIndexStore.java
index 21f5a167ce..116262b1c4 100644
---
a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/MemoryIndexStore.java
+++
b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/MemoryIndexStore.java
@@ -612,7 +612,7 @@ public MemoryIndexStoreKey next() {
MemoryIndexStoreEntry currentEntry;
MemoryIndexStoreIterator(Map submap, Object indexKey, Collection
keysToRemove) {
- this(submap, indexKey, keysToRemove,
GemFireCacheImpl.getInstance().cacheTimeMillis());
+ this(submap, indexKey, keysToRemove, cache.cacheTimeMillis());
}
private MemoryIndexStoreIterator(Map submap, Object indexKey, Collection
keysToRemove,
diff --git
a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/MemoryIndexStoreJUnitTest.java
b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/MemoryIndexStoreJUnitTest.java
index cc8e3fd48c..873c67a4a2 100644
---
a/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/MemoryIndexStoreJUnitTest.java
+++
b/geode-core/src/test/java/org/apache/geode/cache/query/internal/index/MemoryIndexStoreJUnitTest.java
@@ -74,6 +74,12 @@ public void teardown() {
GemFireCacheImpl.setInstanceForTests(actualInstance);
}
+ @Test
+ public void createIteratorWhenCacheNulledWhenShuttingDownShouldNotThrowNPE()
{
+ GemFireCacheImpl.setInstanceForTests(null);
+ store.get("T");
+ }
+
@Test
public void testSizeOfStoreReturnsNumberOfKeysAndNotActualNumberOfValues() {
IntStream.range(0, 150).forEach(i -> {
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> MemoryIndexStoreIterator should not call GemFireCacheImpl.getInstance
> ---------------------------------------------------------------------
>
> Key: GEODE-3982
> URL: https://issues.apache.org/jira/browse/GEODE-3982
> Project: Geode
> Issue Type: Bug
> Components: querying
> Reporter: Jason Huynh
> Assignee: Jason Huynh
>
> This call should be removed from the constructor and instead be passed in.
> There is already a handle to the cache from the memory index store itself.
> The current call can also lead to an NPE when the cache is closing and query
> is executed.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)