{"action":"created","comment":{"url":"https://api.github.com/repos/sonatype/nexus-oss/pulls/comments/35678216","id":35678216,"diff_hunk":"@@ -0,0 +1,106 @@\n+/*\n+ * Sonatype Nexus (TM) Open Source Version\n+ * Copyright (c) 2008-present Sonatype, Inc.\n+ * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.\n+ *\n+ * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,\n+ * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.\n+ *\n+ * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. \"Sonatype\" and \"Sonatype Nexus\" are trademarks\n+ * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the\n+ * Eclipse Foundation. All other trademarks are the property of their respective owners.\n+ */\n+package org.apache.shiro.nexus;\n+\n+import java.util.ArrayList;\n+import java.util.Collection;\n+import java.util.Collections;\n+import java.util.HashSet;\n+import java.util.Iterator;\n+import java.util.Set;\n+\n+import javax.cache.Cache.Entry;\n+\n+import org.sonatype.sisu.goodies.common.ComponentSupport;\n+\n+import org.apache.shiro.cache.Cache;\n+\n+import static com.google.common.base.Preconditions.checkNotNull;\n+\n+/**\n+ * Shiro {@link javax.cache.Cache} to {@link Cache} adapter.\n+ *\n+ * @since 3.0\n+ */\n+public class ShiroJCacheAdapter<K, V>\n+  extends ComponentSupport\n+  implements Cache<K, V>\n+{\n+  private final javax.cache.Cache<K, V> cache;\n+\n+  private final String name;\n+\n+  public ShiroJCacheAdapter(final javax.cache.Cache<K, V> cache) {\n+    this.cache = checkNotNull(cache);\n+    this.name = cache.getName();\n+  }\n+\n+  @Override\n+  public V get(final K key) {\n+    return cache.get(key);\n+  }\n+\n+  @Override\n+  public V put(final K key, final V value) {\n+    return cache.getAndPut(key, value);\n+  }\n+\n+  @Override\n+  public V remove(final K key) {\n+    return cache.getAndRemove(key);\n+  }\n+\n+  // NOTE: This appears unused in Shiro, but used by NX\n+  @Override\n+  public void clear() {\n+    cache.clear();\n+  }\n+\n+  // NOTE: This appears unused in Shiro.\n+  @Override\n+  public int size() {\n+    int size = 0;\n+    Iterator<Entry<K, V>> iter = cache.iterator();","path":"components/nexus-security/src/main/java/org/apache/shiro/nexus/ShiroJCacheAdapter.java","position":73,"original_position":73,"commit_id":"3c6a3187fd75c0586b1d862ff486a1e746f783c3","original_commit_id":"3c6a3187fd75c0586b1d862ff486a1e746f783c3","user":{"login":"kellyrob99","id":76356,"avatar_url":"https://avatars.githubusercontent.com/u/76356?v=3","gravatar_id":"","url":"https://api.github.com/users/kellyrob99","html_url":"https://github.com/kellyrob99","followers_url":"https://api.github.com/users/kellyrob99/followers","following_url":"https://api.github.com/users/kellyrob99/following{/other_user}","gists_url":"https://api.github.com/users/kellyrob99/gists{/gist_id}","starred_url":"https://api.github.com/users/kellyrob99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kellyrob99/subscriptions","organizations_url":"https://api.github.com/users/kellyrob99/orgs","repos_url":"https://api.github.com/users/kellyrob99/repos","events_url":"https://api.github.com/users/kellyrob99/events{/privacy}","received_events_url":"https://api.github.com/users/kellyrob99/received_events","type":"User","site_admin":false},"body":"Iterables.size() would simplify here","created_at":"2015-07-28T17:54:56Z","updated_at":"2015-07-28T17:54:56Z","html_url":"https://github.com/sonatype/nexus-oss/pull/1594#discussion_r35678216","pull_request_url":"https://api.github.com/repos/sonatype/nexus-oss/pulls/1594","_links":{"self":{"href":"https://api.github.com/repos/sonatype/nexus-oss/pulls/comments/35678216"},"html":{"href":"https://github.com/sonatype/nexus-oss/pull/1594#discussion_r35678216"},"pull_request":{"href":"https://api.github.com/repos/sonatype/nexus-oss/pulls/1594"}}},"pull_request":{"url":"https://api.github.com/repos/sonatype/nexus-oss/pulls/1594","id":40630138,"html_url":"https://github.com/sonatype/nexus-oss/pull/1594","diff_url":"https://github.com/sonatype/nexus-oss/pull/1594.diff","patch_url":"https://github.com/sonatype/nexus-oss/pull/1594.patch","issue_url":"https://api.github.com/repos/sonatype/nexus-oss/issues/1594","number":1594,"state":"open","locked":false,"title":"Ehcache 2.10 bundle and JCache integration","user":{"login":"jdillon","id":20114,"avatar_url":"https://avatars.githubusercontent.com/u/20114?v=3","gravatar_id":"","url":"https://api.github.com/users/jdillon","html_url":"https://github.com/jdillon","followers_url":"https://api.github.com/users/jdillon/followers","following_url":"https://api.github.com/users/jdillon/following{/other_user}","gists_url":"https://api.github.com/users/jdillon/gists{/gist_id}","starred_url":"https://api.github.com/users/jdillon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdillon/subscriptions","organizations_url":"https://api.github.com/users/jdillon/orgs","repos_url":"https://api.github.com/users/jdillon/repos","events_url":"https://api.github.com/users/jdillon/events{/privacy}","received_events_url":"https://api.github.com/users/jdillon/received_events","type":"User","site_admin":false},"body":"Creates an OSGI bundle of ehcache 2.10 (latest release).\r\nUpdates NX usage to use JCache api to allow for easier switching between backends.\r\nAdapts Shiro cache to use JCache","created_at":"2015-07-23T01:50:17Z","updated_at":"2015-07-28T17:54:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"87ea77802b58e5999b1f967de46b26625f330871","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sonatype/nexus-oss/pulls/1594/commits","review_comments_url":"https://api.github.com/repos/sonatype/nexus-oss/pulls/1594/comments","review_comment_url":"https://api.github.com/repos/sonatype/nexus-oss/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sonatype/nexus-oss/issues/1594/comments","statuses_url":"https://api.github.com/repos/sonatype/nexus-oss/statuses/3c6a3187fd75c0586b1d862ff486a1e746f783c3","head":{"label":"sonatype:ehcache-bundle","ref":"ehcache-bundle","sha":"3c6a3187fd75c0586b1d862ff486a1e746f783c3","user":{"login":"sonatype","id":44938,"avatar_url":"https://avatars.githubusercontent.com/u/44938?v=3","gravatar_id":"","url":"https://api.github.com/users/sonatype","html_url":"https://github.com/sonatype","followers_url":"https://api.github.com/users/sonatype/followers","following_url":"https://api.github.com/users/sonatype/following{/other_user}","gists_url":"https://api.github.com/users/sonatype/gists{/gist_id}","starred_url":"https://api.github.com/users/sonatype/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sonatype/subscriptions","organizations_url":"https://api.github.com/users/sonatype/orgs","repos_url":"https://api.github.com/users/sonatype/repos","events_url":"https://api.github.com/users/sonatype/events{/privacy}","received_events_url":"https://api.github.com/users/sonatype/received_events","type":"Organization","site_admin":false},"repo":{"id":10146961,"name":"nexus-oss","full_name":"sonatype/nexus-oss","owner":{"login":"sonatype","id":44938,"avatar_url":"https://avatars.githubusercontent.com/u/44938?v=3","gravatar_id":"","url":"https://api.github.com/users/sonatype","html_url":"https://github.com/sonatype","followers_url":"https://api.github.com/users/sonatype/followers","following_url":"https://api.github.com/users/sonatype/following{/other_user}","gists_url":"https://api.github.com/users/sonatype/gists{/gist_id}","starred_url":"https://api.github.com/users/sonatype/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sonatype/subscriptions","organizations_url":"https://api.github.com/users/sonatype/orgs","repos_url":"https://api.github.com/users/sonatype/repos","events_url":"https://api.github.com/users/sonatype/events{/privacy}","received_events_url":"https://api.github.com/users/sonatype/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sonatype/nexus-oss","description":"Sonatype Nexus OSS","fork":false,"url":"https://api.github.com/repos/sonatype/nexus-oss","forks_url":"https://api.github.com/repos/sonatype/nexus-oss/forks","keys_url":"https://api.github.com/repos/sonatype/nexus-oss/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sonatype/nexus-oss/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sonatype/nexus-oss/teams","hooks_url":"https://api.github.com/repos/sonatype/nexus-oss/hooks","issue_events_url":"https://api.github.com/repos/sonatype/nexus-oss/issues/events{/number}","events_url":"https://api.github.com/repos/sonatype/nexus-oss/events","assignees_url":"https://api.github.com/repos/sonatype/nexus-oss/assignees{/user}","branches_url":"https://api.github.com/repos/sonatype/nexus-oss/branches{/branch}","tags_url":"https://api.github.com/repos/sonatype/nexus-oss/tags","blobs_url":"https://api.github.com/repos/sonatype/nexus-oss/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sonatype/nexus-oss/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sonatype/nexus-oss/git/refs{/sha}","trees_url":"https://api.github.com/repos/sonatype/nexus-oss/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sonatype/nexus-oss/statuses/{sha}","languages_url":"https://api.github.com/repos/sonatype/nexus-oss/languages","stargazers_url":"https://api.github.com/repos/sonatype/nexus-oss/stargazers","contributors_url":"https://api.github.com/repos/sonatype/nexus-oss/contributors","subscribers_url":"https://api.github.com/repos/sonatype/nexus-oss/subscribers","subscription_url":"https://api.github.com/repos/sonatype/nexus-oss/subscription","commits_url":"https://api.github.com/repos/sonatype/nexus-oss/commits{/sha}","git_commits_url":"https://api.github.com/repos/sonatype/nexus-oss/git/commits{/sha}","comments_url":"https://api.github.com/repos/sonatype/nexus-oss/comments{/number}","issue_comment_url":"https://api.github.com/repos/sonatype/nexus-oss/issues/comments{/number}","contents_url":"https://api.github.com/repos/sonatype/nexus-oss/contents/{+path}","compare_url":"https://api.github.com/repos/sonatype/nexus-oss/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sonatype/nexus-oss/merges","archive_url":"https://api.github.com/repos/sonatype/nexus-oss/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sonatype/nexus-oss/downloads","issues_url":"https://api.github.com/repos/sonatype/nexus-oss/issues{/number}","pulls_url":"https://api.github.com/repos/sonatype/nexus-oss/pulls{/number}","milestones_url":"https://api.github.com/repos/sonatype/nexus-oss/milestones{/number}","notifications_url":"https://api.github.com/repos/sonatype/nexus-oss/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sonatype/nexus-oss/labels{/name}","releases_url":"https://api.github.com/repos/sonatype/nexus-oss/releases{/id}","created_at":"2013-05-18T20:48:57Z","updated_at":"2015-07-28T02:41:36Z","pushed_at":"2015-07-28T17:49:01Z","git_url":"git://github.com/sonatype/nexus-oss.git","ssh_url":"git@github.com:sonatype/nexus-oss.git","clone_url":"https://github.com/sonatype/nexus-oss.git","svn_url":"https://github.com/sonatype/nexus-oss","homepage":"http://links.sonatype.com/products/nexus/oss/home","size":896560,"stargazers_count":169,"watchers_count":169,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":108,"mirror_url":null,"open_issues_count":12,"forks":108,"open_issues":12,"watchers":169,"default_branch":"master"}},"base":{"label":"sonatype:master","ref":"master","sha":"2bb4fc920824d1eade910b531faea2772fc9e9e1","user":{"login":"sonatype","id":44938,"avatar_url":"https://avatars.githubusercontent.com/u/44938?v=3","gravatar_id":"","url":"https://api.github.com/users/sonatype","html_url":"https://github.com/sonatype","followers_url":"https://api.github.com/users/sonatype/followers","following_url":"https://api.github.com/users/sonatype/following{/other_user}","gists_url":"https://api.github.com/users/sonatype/gists{/gist_id}","starred_url":"https://api.github.com/users/sonatype/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sonatype/subscriptions","organizations_url":"https://api.github.com/users/sonatype/orgs","repos_url":"https://api.github.com/users/sonatype/repos","events_url":"https://api.github.com/users/sonatype/events{/privacy}","received_events_url":"https://api.github.com/users/sonatype/received_events","type":"Organization","site_admin":false},"repo":{"id":10146961,"name":"nexus-oss","full_name":"sonatype/nexus-oss","owner":{"login":"sonatype","id":44938,"avatar_url":"https://avatars.githubusercontent.com/u/44938?v=3","gravatar_id":"","url":"https://api.github.com/users/sonatype","html_url":"https://github.com/sonatype","followers_url":"https://api.github.com/users/sonatype/followers","following_url":"https://api.github.com/users/sonatype/following{/other_user}","gists_url":"https://api.github.com/users/sonatype/gists{/gist_id}","starred_url":"https://api.github.com/users/sonatype/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sonatype/subscriptions","organizations_url":"https://api.github.com/users/sonatype/orgs","repos_url":"https://api.github.com/users/sonatype/repos","events_url":"https://api.github.com/users/sonatype/events{/privacy}","received_events_url":"https://api.github.com/users/sonatype/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sonatype/nexus-oss","description":"Sonatype Nexus OSS","fork":false,"url":"https://api.github.com/repos/sonatype/nexus-oss","forks_url":"https://api.github.com/repos/sonatype/nexus-oss/forks","keys_url":"https://api.github.com/repos/sonatype/nexus-oss/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sonatype/nexus-oss/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sonatype/nexus-oss/teams","hooks_url":"https://api.github.com/repos/sonatype/nexus-oss/hooks","issue_events_url":"https://api.github.com/repos/sonatype/nexus-oss/issues/events{/number}","events_url":"https://api.github.com/repos/sonatype/nexus-oss/events","assignees_url":"https://api.github.com/repos/sonatype/nexus-oss/assignees{/user}","branches_url":"https://api.github.com/repos/sonatype/nexus-oss/branches{/branch}","tags_url":"https://api.github.com/repos/sonatype/nexus-oss/tags","blobs_url":"https://api.github.com/repos/sonatype/nexus-oss/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sonatype/nexus-oss/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sonatype/nexus-oss/git/refs{/sha}","trees_url":"https://api.github.com/repos/sonatype/nexus-oss/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sonatype/nexus-oss/statuses/{sha}","languages_url":"https://api.github.com/repos/sonatype/nexus-oss/languages","stargazers_url":"https://api.github.com/repos/sonatype/nexus-oss/stargazers","contributors_url":"https://api.github.com/repos/sonatype/nexus-oss/contributors","subscribers_url":"https://api.github.com/repos/sonatype/nexus-oss/subscribers","subscription_url":"https://api.github.com/repos/sonatype/nexus-oss/subscription","commits_url":"https://api.github.com/repos/sonatype/nexus-oss/commits{/sha}","git_commits_url":"https://api.github.com/repos/sonatype/nexus-oss/git/commits{/sha}","comments_url":"https://api.github.com/repos/sonatype/nexus-oss/comments{/number}","issue_comment_url":"https://api.github.com/repos/sonatype/nexus-oss/issues/comments{/number}","contents_url":"https://api.github.com/repos/sonatype/nexus-oss/contents/{+path}","compare_url":"https://api.github.com/repos/sonatype/nexus-oss/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sonatype/nexus-oss/merges","archive_url":"https://api.github.com/repos/sonatype/nexus-oss/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sonatype/nexus-oss/downloads","issues_url":"https://api.github.com/repos/sonatype/nexus-oss/issues{/number}","pulls_url":"https://api.github.com/repos/sonatype/nexus-oss/pulls{/number}","milestones_url":"https://api.github.com/repos/sonatype/nexus-oss/milestones{/number}","notifications_url":"https://api.github.com/repos/sonatype/nexus-oss/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sonatype/nexus-oss/labels{/name}","releases_url":"https://api.github.com/repos/sonatype/nexus-oss/releases{/id}","created_at":"2013-05-18T20:48:57Z","updated_at":"2015-07-28T02:41:36Z","pushed_at":"2015-07-28T17:49:01Z","git_url":"git://github.com/sonatype/nexus-oss.git","ssh_url":"git@github.com:sonatype/nexus-oss.git","clone_url":"https://github.com/sonatype/nexus-oss.git","svn_url":"https://github.com/sonatype/nexus-oss","homepage":"http://links.sonatype.com/products/nexus/oss/home","size":896560,"stargazers_count":169,"watchers_count":169,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":108,"mirror_url":null,"open_issues_count":12,"forks":108,"open_issues":12,"watchers":169,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sonatype/nexus-oss/pulls/1594"},"html":{"href":"https://github.com/sonatype/nexus-oss/pull/1594"},"issue":{"href":"https://api.github.com/repos/sonatype/nexus-oss/issues/1594"},"comments":{"href":"https://api.github.com/repos/sonatype/nexus-oss/issues/1594/comments"},"review_comments":{"href":"https://api.github.com/repos/sonatype/nexus-oss/pulls/1594/comments"},"review_comment":{"href":"https://api.github.com/repos/sonatype/nexus-oss/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sonatype/nexus-oss/pulls/1594/commits"},"statuses":{"href":"https://api.github.com/repos/sonatype/nexus-oss/statuses/3c6a3187fd75c0586b1d862ff486a1e746f783c3"}}}}