Skip to content

Commit 13ba493

Browse files
author
Hong Fang Han
committed
GERONIMODEVTOOLS-774 java.lang.NullPointerException error happened for web application automatically redeploying after renamed the name of the project. Thanks Yi Xiao for the patch.
git-svn-id: https://svn.apache.org/repos/asf/geronimo/devtools/eclipse-plugin/branches/2.1@1203087 13f79535-47bb-0310-9956-ffa450edef68
1 parent ec684cf commit 13ba493

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/GeronimoServerBehaviourDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ protected void doRemoved(IModule module) throws Exception {
668668
doFail(status, Messages.UNDEPLOY_FAIL);
669669
}
670670

671-
ModuleArtifactMapper.getInstance().removeEntry(getServer(), module.getProject());
671+
ModuleArtifactMapper.getInstance().removeEntry(getServer(), module);
672672

673673
Trace.tracePoint("Exit ", "GeronimoServerBehaviourDelegate.doRemoved");
674674
}

plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/ModuleArtifactMapper.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,27 @@ public void addEntry(IServer server, IProject project, String configId) {
7373
artifactEntries.put(project.getName(), configId);
7474
}
7575

76-
public void removeEntry(IServer server, IProject project) {
76+
public void removeEntry(IServer server, IModule module) {
7777

7878
if (!SocketUtil.isLocalhost(server.getHost()))
7979
return;
8080

8181
File runtimeLoc = server.getRuntime().getLocation().toFile();
8282
Map artifactEntries = (Map) serverEntries.get(runtimeLoc);
8383
if (artifactEntries != null) {
84-
artifactEntries.remove(project.getName());
84+
artifactEntries.remove(module.getName());
8585
}
8686
}
8787

8888
public String resolve(IServer server, IModule module) {
8989
Map artifactEntries = (Map) serverEntries.get(server.getRuntime().getLocation().toFile());
90-
if (artifactEntries != null) {
91-
return (String) artifactEntries.get(module.getProject().getName());
90+
if (artifactEntries != null && module != null) {
91+
if (module.getProject() != null) {
92+
return (String) artifactEntries.get(module.getProject()
93+
.getName());
94+
} else {
95+
return (String) artifactEntries.get(module.getName());
96+
}
9297
}
9398
return null;
9499
}

0 commit comments

Comments
 (0)