Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkchan2007-01-23 02:24:32 +0000
committerkchan2007-01-23 02:24:32 +0000
commit91732f311482706c115cbaac1d226e9f771e90cf (patch)
treebabac0d3aaffde87d7e747429e3036e12aa53a42
parent94dd5d8b129a55c5ee00d73116ac0749c182a12d (diff)
downloadwebtools.webservices-91732f311482706c115cbaac1d226e9f771e90cf.tar.gz
webtools.webservices-91732f311482706c115cbaac1d226e9f771e90cf.tar.xz
webtools.webservices-91732f311482706c115cbaac1d226e9f771e90cf.zip
[159458] Check for null server runtime and runtime type.
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ServerSelectionUtils.java24
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java5
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java15
-rw-r--r--bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java35
-rw-r--r--bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/ServerUtils.java65
5 files changed, 99 insertions, 45 deletions
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ServerSelectionUtils.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ServerSelectionUtils.java
index 0a472a29f..02886f136 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ServerSelectionUtils.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ServerSelectionUtils.java
@@ -10,6 +10,7 @@
* yyyymmdd bug Email and other contact information
* -------- -------- -----------------------------------------------------------
* 20060324 116750 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20070119 159458 mahutch@ca.ibm.com - Mark Hutchinson
*******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.ui.common;
@@ -25,6 +26,7 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.jst.ws.internal.consumption.common.IServerDefaulter;
import org.eclipse.jst.ws.internal.consumption.common.ServerInfo;
import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerCore;
@@ -72,14 +74,22 @@ public class ServerSelectionUtils
return null;
ArrayList compatibleServersList = new ArrayList();
- String runtimeId = runtime.getRuntimeType().getId();
- for (int i=0; i<servers.length; i++)
+ IRuntimeType runtimeType = runtime.getRuntimeType();
+ if (runtimeType != null)
{
- IServer server = (IServer)servers[i];
- String serverRuntimeId = server.getRuntime().getRuntimeType().getId();
- if (serverRuntimeId.equals(runtimeId))
- compatibleServersList.add(server);
-
+ String runtimeId = runtimeType.getId();
+ for (int i=0; i<servers.length; i++)
+ {
+ IServer server = (IServer)servers[i];
+ IRuntimeType runtimeType2 = server.getRuntime().getRuntimeType();
+ if (runtimeType2 != null)
+ {
+ String serverRuntimeId = runtimeType2.getId();
+ if (serverRuntimeId.equals(runtimeId))
+ compatibleServersList.add(server);
+ }
+
+ }
}
if (compatibleServersList.size()<1)
return null;
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java
index 8a1034fd3..b38af5c9f 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/common/ValidationUtils.java
@@ -18,6 +18,7 @@
* 20060427 126780 rsinha@ca.ibm.com - Rupam Kuehner
* 20060427 138058 joan@ca.ibm.com - Joan Haggarty
* 20060905 156230 kathy@ca.ibm.com - Kathy Chan, Handling projects with no target runtime
+ * 20070119 159458 mahutch@ca.ibm.com - Mark Hutchinson
*******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.ui.common;
@@ -72,6 +73,7 @@ import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.common.project.facet.core.VersionFormatException;
import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
import org.eclipse.wst.server.core.IServerType;
import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.ws.internal.parser.wsil.WebServicesParser;
@@ -554,7 +556,8 @@ public class ValidationUtils
{
org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = (org.eclipse.wst.common.project.facet.core.runtime.IRuntime)itr.next();
IRuntime sRuntime = FacetUtil.getRuntime(fRuntime);
- if (runtimeTypeId.equals(sRuntime.getRuntimeType().getId()))
+ IRuntimeType runtimeType = sRuntime.getRuntimeType();
+ if (runtimeType != null && runtimeTypeId.equals(runtimeType.getId()))
{
//found a match
return true;
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java
index 4e3f325ce..7c62335b8 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/widgets/runtime/ClientRuntimeSelectionWidgetDefaultingCommand.java
@@ -22,6 +22,7 @@
* 20060523 133714 joan@ca.ibm.com - Joan Haggarty
* 20060525 143843 joan@ca.ibm.com - Joan Haggarty
* 20060905 156230 kathy@ca.ibm.com - Kathy Chan, Handling projects with no target runtime
+ * 20070119 159458 mahutch@ca.ibm.com - Mark Hutchinson
*******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.ui.widgets.runtime;
@@ -70,6 +71,7 @@ import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerType;
import org.eclipse.wst.server.core.ServerCore;
@@ -655,12 +657,13 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends AbstractDataM
if (fRuntime != null)
{
//Get a server type that has the same runtime type.
- IRuntime sRuntime = FacetUtil.getRuntime(fRuntime);
+ IRuntime sRuntime = FacetUtil.getRuntime(fRuntime);
+ IRuntimeType sRuntimeType = sRuntime.getRuntimeType();
IServerType firstMatchingServerType = null;
for (int i=0; i<serverTypes.length; i++)
{
IServerType thisServerType = serverTypes[i];
- if (thisServerType.getRuntimeType().getId().equals(sRuntime.getRuntimeType().getId()))
+ if (sRuntimeType != null && thisServerType.getRuntimeType().getId().equals(sRuntimeType.getId()))
{
if (firstMatchingServerType == null)
{
@@ -693,7 +696,7 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends AbstractDataM
{
Set facetsClone = new HashSet();
facetsClone.addAll(facets);
- if (facetMatcher.getFacetsToAdd() != null)
+ if (facetMatcher != null && facetMatcher.getFacetsToAdd() != null)
{
Iterator itr = facetMatcher.getFacetsToAdd().iterator();
while (itr.hasNext())
@@ -732,7 +735,8 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends AbstractDataM
{
org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = (org.eclipse.wst.common.project.facet.core.runtime.IRuntime)runtimesItr.next();
IRuntime sRuntime = FacetUtil.getRuntime(fRuntime);
- if (thisServerType.getRuntimeType().getId().equals(sRuntime.getRuntimeType().getId()))
+ IRuntimeType sRuntimeType = sRuntime.getRuntimeType();
+ if (sRuntimeType != null && thisServerType.getRuntimeType().getId().equals(sRuntimeType.getId()))
{
serverType = thisServerType;
}
@@ -748,10 +752,11 @@ public class ClientRuntimeSelectionWidgetDefaultingCommand extends AbstractDataM
org.eclipse.wst.common.project.facet.core.runtime.IRuntime fRuntime = (org.eclipse.wst.common.project.facet.core.runtime.IRuntime) itr
.next();
IRuntime sRuntime = FacetUtil.getRuntime(fRuntime);
+ IRuntimeType sRuntimeType = sRuntime.getRuntimeType();
for (int i = 0; i < serverTypes.length; i++)
{
IServerType thisServerType = serverTypes[i];
- if (thisServerType.getRuntimeType().getId().equals(sRuntime.getRuntimeType().getId()))
+ if (sRuntimeType != null && thisServerType.getRuntimeType().getId().equals(sRuntimeType.getId()))
{
serverType = thisServerType;
break outer;
diff --git a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java
index 93e66e437..c0047b114 100644
--- a/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java
+++ b/bundles/org.eclipse.jst.ws.consumption.ui/src/org/eclipse/jst/ws/internal/consumption/ui/wsrt/WebServiceRuntimeExtensionUtils2.java
@@ -14,6 +14,7 @@
* 20060227 124392 rsinha@ca.ibm.com - Rupam Kuehner
* 20060324 116750 rsinha@ca.ibm.com - Rupam Kuehner
* 20060427 126780 rsinha@ca.ibm.com - Rupam Kuehner
+ * 20070119 159458 mahutch@ca.ibm.com - Mark Hutchinson
*******************************************************************************/
package org.eclipse.jst.ws.internal.consumption.ui.wsrt;
@@ -41,6 +42,7 @@ import org.eclipse.wst.command.internal.env.core.selection.SelectionListChoices;
import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerType;
import org.eclipse.wst.server.core.ServerCore;
@@ -258,11 +260,15 @@ public class WebServiceRuntimeExtensionUtils2
for (int i=0; i<serverTypeIds.length; i++)
{
IServerType serverType = ServerCore.findServerType(serverTypeIds[i]);
- String runtimeTypeId = serverType.getRuntimeType().getId();
- if (runtimeTypeId.equals(sRuntime.getRuntimeType().getId()))
+ IRuntimeType runtimeType = serverType.getRuntimeType();
+ if (runtimeType != null)
{
- supportedServerFactoryIds.add(serverTypeIds[i]);
- }
+ String runtimeTypeId = runtimeType.getId();
+ if (sRuntime != null && sRuntime.getRuntimeType() != null && runtimeTypeId.equals(sRuntime.getRuntimeType().getId()))
+ {
+ supportedServerFactoryIds.add(serverTypeIds[i]);
+ }
+ }
}
}
@@ -1646,16 +1652,25 @@ public class WebServiceRuntimeExtensionUtils2
IServerType st = sts[i];
for (int j=0; j<rts.length; j++)
{
+ if (st == null || st.getRuntimeType() == null) break;
org.eclipse.wst.server.core.IRuntime rt = rts[j];
// If the server type has the same runtime type as this runtime, add it to the list
String serverTypeRuntimeTypeId = st.getRuntimeType().getId();
- String runtimeRuntimeTypeId = rt.getRuntimeType().getId();
- if (serverTypeRuntimeTypeId.equals(runtimeRuntimeTypeId))
+
+ if (rt != null)
{
- if (!fids.contains(st.getId()))
- {
- fids.add(st.getId());
- }
+ IRuntimeType rtType = rt.getRuntimeType();
+ if (rtType != null)
+ {
+ String runtimeRuntimeTypeId = rtType.getId();
+ if (serverTypeRuntimeTypeId.equals(runtimeRuntimeTypeId))
+ {
+ if (!fids.contains(st.getId()))
+ {
+ fids.add(st.getId());
+ }
+ }
+ }
}
}
}
diff --git a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/ServerUtils.java b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/ServerUtils.java
index 4c1b8dc52..e079b36b9 100644
--- a/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/ServerUtils.java
+++ b/bundles/org.eclipse.jst.ws/src/org/eclipse/jst/ws/internal/common/ServerUtils.java
@@ -12,6 +12,7 @@
* 20060204 124408 rsinha@ca.ibm.com - Rupam Kuehner
* 20060330 124667 kathy@ca.ibm.com - Kathy Chan
* 20061004 159356 kathy@ca.ibm.com - Kathy Chan, Get correct module root URL based on server chosen
+ * 20070119 159458 mahutch@ca.ibm.com - Mark Hutchinson
*******************************************************************************/
package org.eclipse.jst.ws.internal.common;
@@ -433,11 +434,15 @@ public final class ServerUtils {
String serverRuntimeTypeId = serverType.getRuntimeType().getId();
for (int i = 0; i < runtimes.length; i++) {
IRuntime runtime = runtimes[i];
- String thisRuntimeTypeId = runtime.getRuntimeType().getId();
- if (thisRuntimeTypeId.equals(serverRuntimeTypeId) && !runtime.isStub()) {
- //Found an appropriate IRuntime that is not a stub
- nonStubRuntime = runtime;
- break;
+ IRuntimeType runtimeType = runtime.getRuntimeType();
+ if (runtimeType != null)
+ {
+ String thisRuntimeTypeId = runtimeType.getId();
+ if (thisRuntimeTypeId.equals(serverRuntimeTypeId) && !runtime.isStub()) {
+ //Found an appropriate IRuntime that is not a stub
+ nonStubRuntime = runtime;
+ break;
+ }
}
}
@@ -617,9 +622,13 @@ public final class ServerUtils {
List runtimes = Arrays.asList(ServerUtil.getRuntimes(moduleType, stJ2EEVersion));
for (int i = 0; i < runtimes.size(); i++) {
IRuntime runtime = (IRuntime) runtimes.get(i);
- String thisRuntimeTypeId = runtime.getRuntimeType().getId();
- if (thisRuntimeTypeId.equals(serverRuntimeTypeId) && !runtime.isStub()) {
- return runtime.getId();
+ IRuntimeType runtimeType = runtime.getRuntimeType();
+ if (runtimeType != null)
+ {
+ String thisRuntimeTypeId = runtimeType.getId();
+ if (thisRuntimeTypeId.equals(serverRuntimeTypeId) && !runtime.isStub()) {
+ return runtime.getId();
+ }
}
}
@@ -682,9 +691,13 @@ public final class ServerUtils {
List runtimes = Arrays.asList(ServerUtil.getRuntimes(earModuleType, stJ2EEVersion));
for (int i = 0; i < runtimes.size(); i++) {
IRuntime runtime = (IRuntime) runtimes.get(i);
- String thisId = runtime.getRuntimeType().getId();
- if (thisId.equals(runtimeTargetId))
- return true;
+ IRuntimeType runtimeType = runtime.getRuntimeType();
+ if (runtimeType != null)
+ {
+ String thisId = runtimeType.getId();
+ if (thisId.equals(runtimeTargetId))
+ return true;
+ }
}
return false;
@@ -707,9 +720,13 @@ public final class ServerUtils {
List runtimes = Arrays.asList(ServerUtil.getRuntimes(projectType, stJ2EEVersion));
for (int i = 0; i < runtimes.size(); i++) {
IRuntime runtime = (IRuntime) runtimes.get(i);
- String thisId = runtime.getRuntimeType().getId();
- if (thisId.equals(runtimeTargetId))
- return true;
+ IRuntimeType runtimeType = runtime.getRuntimeType();
+ if (runtimeType != null)
+ {
+ String thisId = runtimeType.getId();
+ if (thisId.equals(runtimeTargetId))
+ return true;
+ }
}
return false;
@@ -772,14 +789,18 @@ public final class ServerUtils {
for (int i = 0; i < runtimes.length; i++)
{
IRuntime runtime = runtimes[i];
- String thisRuntimeTypeId = runtime.getRuntimeType().getId();
- if (thisRuntimeTypeId.equals(serverRuntimeTypeId) && !runtime.isStub())
- {
- // Found an appropriate IRuntime that is not a stub
- //foundNonStubRuntime = true;
- nonStubRuntime = runtime;
- break;
- }
+ IRuntimeType runtimeType = runtime.getRuntimeType();
+ if (runtimeType != null)
+ {
+ String thisRuntimeTypeId = runtimeType.getId();
+ if (thisRuntimeTypeId.equals(serverRuntimeTypeId) && !runtime.isStub())
+ {
+ // Found an appropriate IRuntime that is not a stub
+ //foundNonStubRuntime = true;
+ nonStubRuntime = runtime;
+ break;
+ }
+ }
}
}

Back to the top