Blob Blame History Raw
--- org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java.orig	2012-07-20 13:31:11.000000000 +0100
+++ org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java	2012-07-20 14:30:19.000000000 +0100
@@ -244,9 +244,9 @@
       }
 
       synchronized(getIndexLock(repository)) {
-        ArtifactInfo artifactInfo = getIndexer().identify(query, Collections.singleton(getIndexingContext(repository)));
-        if(artifactInfo != null) {
-          return getIndexedArtifactFile(artifactInfo);
+        Collection<ArtifactInfo> artifactInfo = getIndexer().identify(query, Collections.singleton(getIndexingContext(repository)));
+        if(!artifactInfo.isEmpty()) {
+	    return getIndexedArtifactFile((ArtifactInfo)artifactInfo.toArray()[0]);
         }
       }
     } catch(Exception ex) {
@@ -287,8 +287,8 @@
 
   public IndexedArtifactFile identify(File file) throws CoreException {
     try {
-      ArtifactInfo artifactInfo = getIndexer().identify(file);
-      return artifactInfo == null ? null : getIndexedArtifactFile(artifactInfo);
+      Collection<ArtifactInfo> artifactInfo = getIndexer().identify(file);
+      return artifactInfo.isEmpty() ? null : getIndexedArtifactFile((ArtifactInfo)artifactInfo.toArray()[0]);
     } catch(IOException ex) {
       throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, -1,
           Messages.NexusIndexManager_error_search, ex));
@@ -1272,7 +1272,7 @@
 
       Query q = getIndexer().constructQuery(MAVEN.SHA1, encode(digest), SearchType.EXACT);
 
-      return getIndexer().identify(q, contexts);
+      return getIndexer().identify(q, contexts).isEmpty() ? null : (ArtifactInfo)getIndexer().identify(q, contexts).toArray()[0];
 
     } catch(NoSuchAlgorithmException ex) {
       throw new IOException("Unable to calculate digest");