Author: snjeza
Date: 2011-01-15 15:24:11 -0500 (Sat, 15 Jan 2011)
New Revision: 28269
Modified:
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java
Log:
JBIDE-8101
https://issues.jboss.org/browse/JBIDE-8101
Modified:
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java
===================================================================
---
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java 2011-01-15
19:42:34 UTC (rev 28268)
+++
trunk/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java 2011-01-15
20:24:11 UTC (rev 28269)
@@ -159,7 +159,7 @@
}
private static void createJBossServer(File asLocation, int index, String name, String
runtimeName) {
- if (!asLocation.isDirectory() || index==-1) {
+ if (asLocation == null || !asLocation.isDirectory() || index==-1) {
return;
}
IPath jbossAsLocationPath = new Path(asLocation.getAbsolutePath());
@@ -167,7 +167,7 @@
IServer[] servers = ServerCore.getServers();
for (int i = 0; i < servers.length; i++) {
IRuntime runtime = servers[i].getRuntime();
- if(runtime != null && runtime.getLocation().equals(jbossAsLocationPath)) {
+ if(runtime != null && runtime.getLocation() != null &&
runtime.getLocation().equals(jbossAsLocationPath)) {
return;
}
}
@@ -175,8 +175,11 @@
IRuntime runtime = null;
IRuntime[] runtimes = ServerCore.getRuntimes();
for (int i = 0; i < runtimes.length; i++) {
- if (runtimes[0].getLocation().equals(jbossAsLocationPath)) {
- runtime = runtimes[0].createWorkingCopy();
+ if (runtimes[i] == null || runtimes[i].getLocation() == null) {
+ continue;
+ }
+ if (runtimes[i].getLocation().equals(jbossAsLocationPath)) {
+ runtime = runtimes[i].createWorkingCopy();
break;
}
}