Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2013-03-09 19:30:44 -0500
committerIgor Fedorenko2013-03-09 19:30:49 -0500
commit48001098b5051cd19a516c73eaceee263d36c70a (patch)
treee82fe6338bdb6eaf1c3de3327123c980dcb695a8
parentcb6a0383fcd3423df165371fa4e528e124f1839f (diff)
downloadm2e-core-48001098b5051cd19a516c73eaceee263d36c70a.tar.gz
m2e-core-48001098b5051cd19a516c73eaceee263d36c70a.tar.xz
m2e-core-48001098b5051cd19a516c73eaceee263d36c70a.zip
fixed NPE in NexusIndexManager#identify
also optimized #getAllIndexes(), which used to return the same IIndex multiple times. Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java
index 5737d9ae..941d48bd 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/nexus/NexusIndexManager.java
@@ -297,6 +297,9 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
protected IndexedArtifactFile identify(IRepository repository, File file) throws CoreException {
try {
IndexingContext context = getIndexingContext(repository);
+ if(context == null) {
+ return null;
+ }
ArtifactInfo artifactInfo = identify(file, Collections.singleton(context));
return artifactInfo == null ? null : getIndexedArtifactFile(artifactInfo);
} catch(IOException ex) {
@@ -810,16 +813,16 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
indexes.add(getWorkspaceIndex());
indexes.add(getLocalIndex());
+ LinkedHashSet<ArtifactRepositoryRef> repositories = new LinkedHashSet<ArtifactRepositoryRef>();
for(IMavenProjectFacade facade : projectManager.getProjects()) {
- LinkedHashSet<ArtifactRepositoryRef> repositories = new LinkedHashSet<ArtifactRepositoryRef>();
repositories.addAll(facade.getArtifactRepositoryRefs());
repositories.addAll(facade.getPluginArtifactRepositoryRefs());
+ }
- for(ArtifactRepositoryRef repositoryRef : repositories) {
- IRepository repository = repositoryRegistry.getRepository(repositoryRef);
- if(repository != null) {
- indexes.add(getIndex(repository));
- }
+ for(ArtifactRepositoryRef repositoryRef : repositories) {
+ IRepository repository = repositoryRegistry.getRepository(repositoryRef);
+ if(repository != null) {
+ indexes.add(getIndex(repository));
}
}

Back to the top