{"action":"created","comment":{"url":"https://api.github.com/repos/sonatype/nexus-oss/pulls/comments/23194580","id":23194580,"diff_hunk":"@@ -0,0 +1,114 @@\n+/*\n+ * Sonatype Nexus (TM) Open Source Version\n+ * Copyright (c) 2008-2015 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.sonatype.nexus.index.mindexer;\n+\n+import java.io.File;\n+import java.io.IOException;\n+\n+import javax.inject.Inject;\n+import javax.inject.Named;\n+import javax.inject.Singleton;\n+\n+import org.sonatype.nexus.proxy.LocalStorageException;\n+import org.sonatype.nexus.proxy.NoSuchRepositoryException;\n+import org.sonatype.nexus.proxy.ResourceStoreRequest;\n+import org.sonatype.nexus.proxy.attributes.AttributeStorage;\n+import org.sonatype.nexus.proxy.attributes.Attributes;\n+import org.sonatype.nexus.proxy.item.RepositoryItemUid;\n+import org.sonatype.nexus.proxy.item.StorageFileItem;\n+import org.sonatype.nexus.proxy.maven.MavenProxyRepository;\n+import org.sonatype.nexus.proxy.registry.RepositoryRegistry;\n+import org.sonatype.nexus.proxy.repository.Repository;\n+import org.sonatype.nexus.proxy.storage.local.fs.DefaultFSLocalRepositoryStorage;\n+\n+import com.google.common.base.Strings;\n+import org.apache.maven.index.ArtifactContext;\n+import org.apache.maven.index.DefaultArtifactContextProducer;\n+import org.apache.maven.index.context.IndexingContext;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+import static com.google.common.base.Preconditions.checkNotNull;\n+\n+/**\n+ * NX enhanced {@link DefaultArtifactContextProducer} that gets missing SHA1 hashes from NX.\n+ *\n+ * @since 2.11\n+ */\n+@Named(\"default\")\n+@Singleton\n+public class NexusArtifactContextProducer\n+    extends DefaultArtifactContextProducer\n+{\n+  private final Logger log;\n+\n+  private final RepositoryRegistry repositoryRegistry;\n+\n+  @Inject\n+  public NexusArtifactContextProducer(final RepositoryRegistry repositoryRegistry) {\n+    this.log = LoggerFactory.getLogger(getClass());\n+    this.repositoryRegistry = checkNotNull(repositoryRegistry);\n+  }\n+\n+  @Override\n+  public ArtifactContext getArtifactContext(final IndexingContext context, final File file) {\n+    final ArtifactContext ac = super.getArtifactContext(context, file);\n+    if (ac != null && ac.getArtifactInfo().sha1 == null) {\n+      // special case for proxies\n+      String itemPath = file.getPath();\n+      try {\n+        // NOTE: MI supports Maven2 repositories only, so if this line does not throw,","path":"plugins/indexer/nexus-indexer-lucene-plugin/src/main/java/org/sonatype/nexus/index/mindexer/NexusArtifactContextProducer.java","position":70,"original_position":70,"commit_id":"5d8545ab43edab94ef3f2b2643a7a16010c40a3b","original_commit_id":"5d8545ab43edab94ef3f2b2643a7a16010c40a3b","user":{"login":"mcculls","id":145851,"avatar_url":"https://avatars.githubusercontent.com/u/145851?v=3","gravatar_id":"","url":"https://api.github.com/users/mcculls","html_url":"https://github.com/mcculls","followers_url":"https://api.github.com/users/mcculls/followers","following_url":"https://api.github.com/users/mcculls/following{/other_user}","gists_url":"https://api.github.com/users/mcculls/gists{/gist_id}","starred_url":"https://api.github.com/users/mcculls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcculls/subscriptions","organizations_url":"https://api.github.com/users/mcculls/orgs","repos_url":"https://api.github.com/users/mcculls/repos","events_url":"https://api.github.com/users/mcculls/events{/privacy}","received_events_url":"https://api.github.com/users/mcculls/received_events","type":"User","site_admin":false},"body":"Maven Indexer","created_at":"2015-01-19T23:46:08Z","updated_at":"2015-01-19T23:46:08Z","html_url":"https://github.com/sonatype/nexus-oss/pull/961#discussion_r23194580","pull_request_url":"https://api.github.com/repos/sonatype/nexus-oss/pulls/961","_links":{"self":{"href":"https://api.github.com/repos/sonatype/nexus-oss/pulls/comments/23194580"},"html":{"href":"https://github.com/sonatype/nexus-oss/pull/961#discussion_r23194580"},"pull_request":{"href":"https://api.github.com/repos/sonatype/nexus-oss/pulls/961"}}},"pull_request":{"url":"https://api.github.com/repos/sonatype/nexus-oss/pulls/961","id":27506163,"html_url":"https://github.com/sonatype/nexus-oss/pull/961","diff_url":"https://github.com/sonatype/nexus-oss/pull/961.diff","patch_url":"https://github.com/sonatype/nexus-oss/pull/961.patch","issue_url":"https://api.github.com/repos/sonatype/nexus-oss/issues/961","number":961,"state":"open","locked":false,"title":"NEXUS-6246: Checksum search fails after repair index task is run","user":{"login":"cstamas","id":45165,"avatar_url":"https://avatars.githubusercontent.com/u/45165?v=3","gravatar_id":"","url":"https://api.github.com/users/cstamas","html_url":"https://github.com/cstamas","followers_url":"https://api.github.com/users/cstamas/followers","following_url":"https://api.github.com/users/cstamas/following{/other_user}","gists_url":"https://api.github.com/users/cstamas/gists{/gist_id}","starred_url":"https://api.github.com/users/cstamas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cstamas/subscriptions","organizations_url":"https://api.github.com/users/cstamas/orgs","repos_url":"https://api.github.com/users/cstamas/repos","events_url":"https://api.github.com/users/cstamas/events{/privacy}","received_events_url":"https://api.github.com/users/cstamas/received_events","type":"User","site_admin":false},"body":"Reason is that MI context producer will find no hashes in proxies\r\nas NX is changed to store those in attributes. Adding an override\r\ncontent producer that hints hashes getting them from NX in case\r\nof M2 proxy repositories.\r\n\r\nIssue\r\nhttps://issues.sonatype.org/browse/NEXUS-6246\r\n\r\nCI\r\nhttp://bamboo.s/browse/NX-OSSF493","created_at":"2015-01-16T13:47:48Z","updated_at":"2015-01-19T23:46:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"11817996b59f928324eebec6d280437cefc7c211","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sonatype/nexus-oss/pulls/961/commits","review_comments_url":"https://api.github.com/repos/sonatype/nexus-oss/pulls/961/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/961/comments","statuses_url":"https://api.github.com/repos/sonatype/nexus-oss/statuses/5d8545ab43edab94ef3f2b2643a7a16010c40a3b","head":{"label":"sonatype:nexus-2.11.x-NEXUS-6246-proxy-reindex","ref":"nexus-2.11.x-NEXUS-6246-proxy-reindex","sha":"5d8545ab43edab94ef3f2b2643a7a16010c40a3b","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-01-19T23:28:59Z","pushed_at":"2015-01-19T23:29:07Z","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":820568,"stargazers_count":123,"watchers_count":123,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":72,"mirror_url":null,"open_issues_count":16,"forks":72,"open_issues":16,"watchers":123,"default_branch":"master"}},"base":{"label":"sonatype:nexus-2.11.x","ref":"nexus-2.11.x","sha":"a3bbf3d40c35ca71c28a11fe6f2becd88ba2c69a","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-01-19T23:28:59Z","pushed_at":"2015-01-19T23:29:07Z","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":820568,"stargazers_count":123,"watchers_count":123,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":72,"mirror_url":null,"open_issues_count":16,"forks":72,"open_issues":16,"watchers":123,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sonatype/nexus-oss/pulls/961"},"html":{"href":"https://github.com/sonatype/nexus-oss/pull/961"},"issue":{"href":"https://api.github.com/repos/sonatype/nexus-oss/issues/961"},"comments":{"href":"https://api.github.com/repos/sonatype/nexus-oss/issues/961/comments"},"review_comments":{"href":"https://api.github.com/repos/sonatype/nexus-oss/pulls/961/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/961/commits"},"statuses":{"href":"https://api.github.com/repos/sonatype/nexus-oss/statuses/5d8545ab43edab94ef3f2b2643a7a16010c40a3b"}}}}