Author: dgolovin
Date: 2009-06-29 10:36:32 -0400 (Mon, 29 Jun 2009)
New Revision: 16248
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/browser/wtp/RunOnServerContext.java
trunk/profiler/plugins/org.jboss.tools.profiler.ui/src/org/jboss/tools/profiler/internal/ui/launchtabs/BaseBlock.java
Log:
catch (Exception e) blocks were replaced for particular exceptions
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/browser/wtp/RunOnServerContext.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/browser/wtp/RunOnServerContext.java 2009-06-29
14:04:57 UTC (rev 16247)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/browser/wtp/RunOnServerContext.java 2009-06-29
14:36:32 UTC (rev 16248)
@@ -15,10 +15,12 @@
import java.net.URL;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.ui.PartInitException;
import org.eclipse.ui.browser.IWebBrowser;
import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
import org.eclipse.wst.server.core.*;
@@ -102,7 +104,7 @@
try {
Object launchable = as[i].getLaunchable(server, resource);
if(launchable instanceof HttpLaunchable) return (HttpLaunchable)launchable;
- } catch (Exception e) {
+ } catch (CoreException e) {
WebModelPlugin.getPluginLog().logError(e);
}
}
@@ -122,18 +124,16 @@
return;
}
if(!checkUrl()) return;
- try {
- server.getModules();
- } catch (Exception e) {
- WebModelPlugin.getPluginLog().logError(e);
- }
+
+ server.getModules();
+
String launchMode = ILaunchManager.DEBUG_MODE.equals(server.getMode()) ?
ILaunchManager.DEBUG_MODE : ILaunchManager.RUN_MODE;
try {
Object launchable = new HttpLaunchable(new URL(lastRunUrl));
IClient[] clients = getClients(server, launchable, launchMode);
IClient client = clients[0];
client.launch(server, launchable, launchMode, server.getLaunch());
- } catch (Exception e) {
+ } catch (MalformedURLException e) {
WebModelPlugin.getPluginLog().logError(e);
runJustUrl();
}
@@ -164,7 +164,7 @@
} catch (MalformedURLException mue) {
ServiceDialog d = PreferenceModelUtilities.getPreferenceModel().getService();
d.showDialog(WebUIMessages.ERROR, NLS.bind(WebUIMessages.INCORRECT_URL,
mue.getMessage()), new String[]{WebUIMessages.OK}, null, ServiceDialog.ERROR);
//$NON-NLS-3$
- } catch (Exception e) {
+ } catch (PartInitException e) {
WebModelPlugin.getPluginLog().logError(e);
}
}
Modified:
trunk/profiler/plugins/org.jboss.tools.profiler.ui/src/org/jboss/tools/profiler/internal/ui/launchtabs/BaseBlock.java
===================================================================
---
trunk/profiler/plugins/org.jboss.tools.profiler.ui/src/org/jboss/tools/profiler/internal/ui/launchtabs/BaseBlock.java 2009-06-29
14:04:57 UTC (rev 16247)
+++
trunk/profiler/plugins/org.jboss.tools.profiler.ui/src/org/jboss/tools/profiler/internal/ui/launchtabs/BaseBlock.java 2009-06-29
14:36:32 UTC (rev 16248)
@@ -1,6 +1,7 @@
package org.jboss.tools.profiler.internal.ui.launchtabs;
import java.io.File;
+import java.io.IOException;
import org.eclipse.core.filesystem.URIUtil;
import org.eclipse.core.resources.IContainer;
@@ -108,24 +109,25 @@
.getStringVariableManager()
.performStringSubstitution(getLocation(), false);
File f = new File(path);
- if (f.exists())
+ if (f.exists()) {
Program.launch(f.getCanonicalPath());
- else
- MessageDialog.openWarning(JBossProfilerUiPlugin
- .getActiveWorkbenchShell(),
- isFile() ? Messages.BaseBlock_open_file : Messages.BaseBlock_open_directory,
- isFile() ? Messages.BaseBlock_file_not_found
- : Messages.BaseBlock_directory_not_found);
- } catch (Exception ex) {
- MessageDialog
- .openWarning(
- JBossProfilerUiPlugin
- .getActiveWorkbenchShell(),
- isFile() ? Messages.BaseBlock_open_file : Messages.BaseBlock_open_directory,
- isFile() ? Messages.BaseBlock_cannot_open_file
- : Messages.BaseBlock_cannot_open_directory);
+ } else {
+ openWarning();
+ }
+ } catch (CoreException ex) {
+ openWarning();
+ } catch (IOException ioex) {
+ openWarning();
}
}
+
+ private void openWarning() {
+ MessageDialog.openWarning(JBossProfilerUiPlugin
+ .getActiveWorkbenchShell(),
+ isFile() ? Messages.BaseBlock_open_file : Messages.BaseBlock_open_directory,
+ isFile() ? Messages.BaseBlock_file_not_found
+ : Messages.BaseBlock_directory_not_found);
+ }
});
}
Show replies by date