Bug 527229 - Make sure that jobs return valid status Change-Id: I1179d9ad1e9884b8408a3bf399db633a16d4bd33 Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
diff --git a/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/J2EELaunchableClient.java b/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/J2EELaunchableClient.java index cd6f908..4b30dda 100644 --- a/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/J2EELaunchableClient.java +++ b/plugins/org.eclipse.jst.server.core/src/org/eclipse/jst/server/core/internal/J2EELaunchableClient.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2011 IBM Corporation and others. + * Copyright (c) 2005, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,6 +11,7 @@ package org.eclipse.jst.server.core.internal; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.ILaunch; import org.eclipse.jst.server.core.JndiLaunchable; import org.eclipse.wst.server.core.IServer; @@ -33,6 +34,6 @@ if (Trace.FINEST) { Trace.trace(Trace.STRING_FINEST, "JNDI client launched"); } - return null; + return Status.OK_STATUS; } }
diff --git a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Client.java b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Client.java index 4a703e3..96e10aa 100644 --- a/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Client.java +++ b/plugins/org.eclipse.wst.server.core/servercore/org/eclipse/wst/server/core/internal/Client.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2011 IBM Corporation and others. + * Copyright (c) 2003, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,6 +12,7 @@ import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.ILaunch; import org.eclipse.wst.server.core.IServer; @@ -120,8 +121,8 @@ if (Trace.SEVERE) { Trace.trace(Trace.STRING_SEVERE, "Error calling delegate " + toString(), e); } + return new Status(IStatus.ERROR, ServerPlugin.PLUGIN_ID, e.getMessage(), e); } - return null; } /**
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/LaunchClientJob.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/LaunchClientJob.java index d312641..8917683 100644 --- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/LaunchClientJob.java +++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/LaunchClientJob.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2011 IBM Corporation and others. + * Copyright (c) 2005, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -100,13 +100,19 @@ } try { resultingStatus[0] = client.launch(server, launchable[0], launchMode, server.getLaunch()); - if (resultingStatus[0] != null && resultingStatus[0].getSeverity() == IStatus.ERROR) + if (resultingStatus[0] != null && resultingStatus[0].getSeverity() == IStatus.ERROR) { EclipseUtil.openError(null, resultingStatus[0]); + } else if (resultingStatus[0] == null) { + resultingStatus[0] = Status.OK_STATUS; + } } catch (Exception e) { if (Trace.SEVERE) { Trace.trace(Trace.STRING_SEVERE, "Server client failed", e); } + if (resultingStatus[0] == null) { + resultingStatus[0] = new Status(IStatus.ERROR, ServerUIPlugin.PLUGIN_ID, e.getMessage(), e); + } } } });
diff --git a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/WebLaunchableClient.java b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/WebLaunchableClient.java index 3bb05a7..933900b 100644 --- a/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/WebLaunchableClient.java +++ b/plugins/org.eclipse.wst.server.ui/serverui/org/eclipse/wst/server/ui/internal/WebLaunchableClient.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2011 IBM Corporation and others. + * Copyright (c) 2003, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,6 +11,7 @@ package org.eclipse.wst.server.ui.internal; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.ILaunch; import org.eclipse.ui.browser.IWebBrowser; import org.eclipse.ui.browser.IWorkbenchBrowserSupport; @@ -37,11 +38,12 @@ IWorkbenchBrowserSupport browserSupport = ServerUIPlugin.getInstance().getWorkbench().getBrowserSupport(); IWebBrowser browser = browserSupport.createBrowser(IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR, null, null, null); browser.openURL(http.getURL()); + return Status.OK_STATUS; } catch (Exception e) { if (Trace.SEVERE) { Trace.trace(Trace.STRING_SEVERE, "Error opening browser", e); } + return new Status(IStatus.ERROR, ServerUIPlugin.PLUGIN_ID, e.getMessage(), e); } - return null; } } \ No newline at end of file
diff --git a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/impl/TestClientDelegate.java b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/impl/TestClientDelegate.java index 81f3269..b982ed6 100644 --- a/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/impl/TestClientDelegate.java +++ b/tests/org.eclipse.wst.server.core.tests/src/org/eclipse/wst/server/core/tests/impl/TestClientDelegate.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. + * Copyright (c) 2005,2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,10 +7,12 @@ * * Contributors: * IBM Corporation - Initial API and implementation + * Karsten Thoms <karsten.thoms@itemis.de> - Bug#527229 *******************************************************************************/ package org.eclipse.wst.server.core.tests.impl; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.ILaunch; import org.eclipse.wst.server.core.IServer; import org.eclipse.wst.server.core.model.ClientDelegate; @@ -21,6 +23,6 @@ } public IStatus launch(IServer server, Object launchable, String launchMode, ILaunch launch) { - return null; + return Status.OK_STATUS; } } \ No newline at end of file