Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-1192

InfinispanRepository Attempts to Remove Elements from an Immutable Set

XMLWordPrintable

      At about line 117 of InfinispanRepository, the code does this:

      // Remove all cache names that are not valid workspaces ...
      if (!nonWorkspaceCacheNames.isEmpty()) cacheNames.removeAll(nowWorkspaceCacheNames);

      But cacheNames is returned (earlier in the method) from one of the two CacheManager implementations and turns out to be immutable, making the removeAll method throw an UnsupportedOperationException. The fix is:

      // Remove all cache names that are not valid workspaces ...
      if (!nonWorkspaceCacheNames.isEmpty())

      { // the returned set from CacheContainer#getCacheNames() is immutable cacheNames = new HashSet<String>(cacheNames); cacheNames.removeAll(nonWorkspaceCacheNames); }

      I had a test case that triggered it, but forgot to save it off. Here's a reference to the ISPN source code though that documents the immutability of the returned value:

      https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/manager/EmbeddedCacheManager.java#L164

              bcarothers_jira Brian Carothers (Inactive)
              bcarothers_jira Brian Carothers (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: