Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2014-08-19 07:39:12 -0400
committerIgor Fedorenko2014-08-19 07:39:12 -0400
commit0aa9f04be346fda6d1b4b2d60127f65ae3609e19 (patch)
tree2a8abd1c5731f33130f954b5fad5e2bc1821dd63 /org.eclipse.m2e.core
parent601873ec322a27fdf1b785e00592b8db2e8892af (diff)
downloadm2e-core-0aa9f04be346fda6d1b4b2d60127f65ae3609e19.tar.gz
m2e-core-0aa9f04be346fda6d1b4b2d60127f65ae3609e19.tar.xz
m2e-core-0aa9f04be346fda6d1b4b2d60127f65ae3609e19.zip
441257 fixed NPE evicting cached MavenProject instancesmilestones/1.6/1.6.0.20140823-1318
Change-Id: If4c9d2ea013b910155b60384de1e5323894d49d4 Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
Diffstat (limited to 'org.eclipse.m2e.core')
-rw-r--r--org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/ProjectCachePlunger.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/ProjectCachePlunger.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/ProjectCachePlunger.java
index 69d18c4b..4b9fbbea 100644
--- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/ProjectCachePlunger.java
+++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/ProjectCachePlunger.java
@@ -21,7 +21,6 @@ import org.slf4j.LoggerFactory;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
-import org.eclipse.aether.RepositoryCache;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.repository.RepositoryPolicy;
@@ -54,16 +53,18 @@ abstract class ProjectCachePlunger<Key> {
}
public Set<File> removeProject(File pom, boolean forceDependencyUpdate) {
- RepositorySystemSession session = MavenExecutionContext.getThreadContext().getRepositorySession();
- RepositoryCache sessionCache = session.getCache();
-
+ MavenExecutionContext context = MavenExecutionContext.getThreadContext();
+ RepositorySystemSession session = context != null ? context.getRepositorySession() : null;
+ if(forceDependencyUpdate && session == null) {
+ throw new IllegalArgumentException();
+ }
final Set<File> affectedProjects = new HashSet<>();
for(Key cacheKey : projectKeys.removeAll(pom)) {
keyProjects.remove(cacheKey, pom);
if(forceDependencyUpdate && RepositoryPolicy.UPDATE_POLICY_ALWAYS.equals(session.getUpdatePolicy())
- && sessionCache.get(session, cacheKey) == null) {
- sessionCache.put(session, cacheKey, Boolean.TRUE);
+ && session.getCache().get(session, cacheKey) == null) {
+ session.getCache().put(session, cacheKey, Boolean.TRUE);
for(File affectedPom : keyProjects.removeAll(cacheKey)) {
affectedProjects.add(affectedPom);
projectKeys.remove(affectedPom, cacheKey);

Back to the top