Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2011-04-20 14:49:18 -0400
committerIgor Fedorenko2011-04-20 14:49:18 -0400
commitb8efa251e9cd9b2c65c9a02d781578b9b96b3d5c (patch)
tree2d82bc276fcf4e7ec8b64a40f259c90525378fae
parentc7b31bae8fd0b8a11fe0acba9ada8bbf426fd689 (diff)
downloadm2e-core-b8efa251e9cd9b2c65c9a02d781578b9b96b3d5c.tar.gz
m2e-core-b8efa251e9cd9b2c65c9a02d781578b9b96b3d5c.tar.xz
m2e-core-b8efa251e9cd9b2c65c9a02d781578b9b96b3d5c.zip
342301 - NPE when m2e tries to download sources
IRepositoryRegistry is updated by maven project and settings change events. Other threads may get null repository instances while registry is being updated as a response to one of the callback events. Added null check to protect from NPE should this happen. Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/NexusIndexManager.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/NexusIndexManager.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/NexusIndexManager.java
index 0839230f..cab8419b 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/NexusIndexManager.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/index/NexusIndexManager.java
@@ -793,7 +793,9 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
for(ArtifactRepositoryRef repositoryRef : repositories) {
IRepository repository = repositoryRegistry.getRepository(repositoryRef);
- indexes.add(getIndex(repository));
+ if(repository != null) {
+ indexes.add(getIndex(repository));
+ }
}
} else {
for(IRepository repository : repositoryRegistry.getRepositories(IRepositoryRegistry.SCOPE_SETTINGS)) {
@@ -816,7 +818,9 @@ public class NexusIndexManager implements IndexManager, IMavenProjectChangedList
for(ArtifactRepositoryRef repositoryRef : repositories) {
IRepository repository = repositoryRegistry.getRepository(repositoryRef);
- indexes.add(getIndex(repository));
+ if(repository != null) {
+ indexes.add(getIndex(repository));
+ }
}
}

Back to the top