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

InfinispanRepository Attempts to Remove Elements from an Immutable Set

    Details

      Description

      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

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                bcarothers Brian Carothers
                Reporter:
                bcarothers Brian Carothers
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: