Author: dgolovin
Date: 2009-06-29 11:11:06 -0400 (Mon, 29 Jun 2009)
New Revision: 16252
Modified:
trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/tests/DefaultProviderTest.java
trunk/jst/plugins/org.jboss.tools.jst.web.tiles/src/org/jboss/tools/jst/web/tiles/model/helpers/TilesDefinitionSet.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/RemoveJavaSource.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/AddPageTemplateSupport.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/AddProjectTemplateResourcesStep.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/AddProjectTemplateVelocityStep.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/helpers/NewWebProjectHelper.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/version/ProjectVersions.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/OpenFileHyperLinkListener.java
Log:
catch (Exception e) blocks were replaced for particular exceptions
Modified:
trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/tests/DefaultProviderTest.java
===================================================================
---
trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/tests/DefaultProviderTest.java 2009-06-29
15:09:42 UTC (rev 16251)
+++
trunk/jmx/tests/org.jboss.tools.jmx.core.test/src/org/jboss/tools/jmx/core/tests/DefaultProviderTest.java 2009-06-29
15:11:06 UTC (rev 16252)
@@ -106,7 +106,7 @@
ExtensionManager.getProvider(DefaultConnectionProvider.PROVIDER_ID);
HashMap map = new HashMap();
map.put(DefaultConnectionProvider.ID, "Test Connection");
- map.put(DefaultConnectionProvider.URL,
"service:jmx:rmi:///jndi/rmi://localhost:9999" +
+ map.put(DefaultConnectionProvider.URL,
"service:jmx:rmi:///jndi/rmi://127.0.0.1:9999" +
"/jmxrmi");
map.put(DefaultConnectionProvider.USERNAME, "");
map.put(DefaultConnectionProvider.PASSWORD, "");
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/AddPageTemplateSupport.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/AddPageTemplateSupport.java 2009-06-29
15:09:42 UTC (rev 16251)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/AddPageTemplateSupport.java 2009-06-29
15:11:06 UTC (rev 16252)
@@ -127,17 +127,12 @@
if(pagePath == null) return null;
if(pagePath.equals(this.pagePath)) return selectedFile;
this.pagePath = pagePath;
- try {
- IResource r = ModelPlugin.getWorkspace().getRoot().findMember(new Path(pagePath));
- if(r instanceof IFile) {
- selectedFile = (IFile)r;
- } else {
- selectedFile = null;
- }
- } catch (Exception e) {
- WebModelPlugin.getPluginLog().logError(e);
+ IResource r = ModelPlugin.getWorkspace().getRoot().findMember(new Path(pagePath));
+ if(r instanceof IFile) {
+ selectedFile = (IFile)r;
+ } else {
selectedFile = null;
- }
+ }
return selectedFile;
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/AddProjectTemplateResourcesStep.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/AddProjectTemplateResourcesStep.java 2009-06-29
15:09:42 UTC (rev 16251)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/AddProjectTemplateResourcesStep.java 2009-06-29
15:11:06 UTC (rev 16252)
@@ -61,7 +61,7 @@
}
}
- void matchResources(IContainer r, Set included) throws Exception {
+ void matchResources(IContainer r, Set included) throws CoreException {
String path = r.getFullPath().toString();
if(!included.contains(path)) {
excludedResources.add(path);
@@ -89,7 +89,7 @@
excludedResources.clear();
try {
matchResources(root, list);
- } catch (Exception e) {
+ } catch (CoreException e) {
WebModelPlugin.getPluginLog().logError(e);
}
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/AddProjectTemplateVelocityStep.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/AddProjectTemplateVelocityStep.java 2009-06-29
15:09:42 UTC (rev 16251)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/handlers/AddProjectTemplateVelocityStep.java 2009-06-29
15:11:06 UTC (rev 16252)
@@ -39,19 +39,15 @@
root = p;
if(root == null || !root.isOpen()) return;
StringBuffer sb = new StringBuffer();
- try {
- IResource r = p.findMember("WebContent/WEB-INF/web.xml");
- if(r != null) {
- sb.append(r.getFullPath().toString());
- }
- r = p.findMember("ant/build.xml");
- if(r != null) {
- if(sb.length() > 0) sb.append(';');
- sb.append(r.getFullPath().toString());
- }
- } catch (Exception e) {
- WebModelPlugin.getPluginLog().logError(e);
+ IResource r = p.findMember("WebContent/WEB-INF/web.xml");
+ if(r != null) {
+ sb.append(r.getFullPath().toString());
}
+ r = p.findMember("ant/build.xml");
+ if(r != null) {
+ if(sb.length() > 0) sb.append(';');
+ sb.append(r.getFullPath().toString());
+ }
support.setAttributeValue(id, ATTR_NAME, sb.toString());
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/helpers/NewWebProjectHelper.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/helpers/NewWebProjectHelper.java 2009-06-29
15:09:42 UTC (rev 16251)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/helpers/NewWebProjectHelper.java 2009-06-29
15:11:06 UTC (rev 16252)
@@ -12,7 +12,10 @@
import java.io.File;
import java.io.FileFilter;
+import java.io.FileNotFoundException;
import java.io.FileReader;
+import java.io.IOException;
+import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -140,7 +143,7 @@
map.put(name.substring(0, ext.length()-1),
file.toURL().toString());
}
}
- } catch (Exception e) {
+ } catch (MalformedURLException e) {
WebModelPlugin.getPluginLog().logError(e);
}
}
@@ -157,21 +160,22 @@
File webXML = new File(location, "web.xml");
if(!webXML.isFile()) return modules;
try {
- WebAppConfig config = new WebAppConfig(webXML);
- Element[] servlets =
config.getServletsByClass("org.apache.struts.action.ActionServlet");
- for (int i = 0; i < servlets.length; i++) {
- Map<String,String> params =
config.getInitParamsAsMap(servlets[i]);
- Iterator<String> it = params.keySet().iterator();
- while (it.hasNext()) {
- String name = it.next();
- if (!name.startsWith("config/") &&
!name.equals("config")) continue;
- String value = params.get(name);
- modules.put(name.substring(6), value);
- }
- }
- } catch (Exception e) {
- WebModelPlugin.getPluginLog().logError(e);
- }
+ WebAppConfig config = new WebAppConfig(webXML);
+ Element[] servlets =
config.getServletsByClass("org.apache.struts.action.ActionServlet");
+ for (int i = 0; i < servlets.length; i++) {
+ Map<String,String> params = config.getInitParamsAsMap(servlets[i]);
+ Iterator<String> it = params.keySet().iterator();
+ while (it.hasNext()) {
+ String name = it.next();
+ if (!name.startsWith("config/") &&
!name.equals("config")) continue;
+ String value = params.get(name);
+ modules.put(name.substring(6), value);
+ }
+ }
+ } catch (FileNotFoundException e) {
+ WebModelPlugin.getPluginLog().logError(e);
+ }
+
return modules;
}
@@ -208,7 +212,7 @@
Class<?> c = WebAppConfig.class;
XMLEntityResolver.registerPublicEntity("-//Sun Microsystems, Inc.//DTD Web
Application 2.2//EN",
FileLocator.resolve(c.getResource("/meta/web-app_2_2.dtd")).toString());
XMLEntityResolver.registerPublicEntity("-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN",
FileLocator.resolve(c.getResource("/meta/web-app_2_3.dtd")).toString());
- } catch (Exception e) {
+ } catch (IOException e) {
WebModelPlugin.getPluginLog().logError(e);
}
}
@@ -220,11 +224,11 @@
public WebAppConfig() {
}
- public WebAppConfig(File confFile) throws Exception {
+ public WebAppConfig(File confFile) throws FileNotFoundException {
load(confFile);
}
- public void load(File confFile) throws Exception {
+ public void load(File confFile) throws FileNotFoundException {
conf = XMLUtil.getDocument(new FileReader(confFile));
webApp = conf.getDocumentElement();
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/version/ProjectVersions.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/version/ProjectVersions.java 2009-06-29
15:09:42 UTC (rev 16251)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/project/version/ProjectVersions.java 2009-06-29
15:11:06 UTC (rev 16252)
@@ -10,16 +10,22 @@
******************************************************************************/
package org.jboss.tools.jst.web.project.version;
-import java.io.*;
-import java.util.*;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
import org.eclipse.osgi.util.NLS;
-import org.w3c.dom.*;
-import org.jboss.tools.common.model.util.*;
+import org.jboss.tools.common.model.util.XMLUtil;
+import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.jst.web.WebModelPlugin;
import org.jboss.tools.jst.web.messages.xpl.WebUIMessages;
import org.jboss.tools.jst.web.project.handlers.AddVersionSupport;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
public abstract class ProjectVersions {
protected String descriptorFileName;
@@ -41,7 +47,7 @@
public String getPath() {
try {
return new File(path).getCanonicalPath().replace('\\', '/');
- } catch (Exception e) {
+ } catch (IOException e) {
WebModelPlugin.getPluginLog().logError(e);
return path;
}
@@ -66,7 +72,7 @@
String[] errors = XMLUtil.getXMLErrors(reader, false);
errorMessage = (errors == null || errors.length == 0) ?
NLS.bind(WebUIMessages.CANNOT_PARSE_PROJECT_VERSIONS_DESCRIPTORFILE,
file.getAbsolutePath())
: NLS.bind(WebUIMessages.CANNOT_PARSE_PROJECT_VERSIONS_DESCRIPTORFILE,
file.getAbsolutePath()) + ":\n" + errors[0]; //$NON-NLS-1$
- } catch (Exception exc) {
+ } catch (IOException exc) {
WebModelPlugin.getPluginLog().logError(exc);
errorMessage = NLS.bind(WebUIMessages.CANNOT_READ_PROJECT_VERSIONS_DESCRIPTORFILE,
file.getAbsolutePath());
}
@@ -102,7 +108,7 @@
}
try {
return f.getCanonicalPath().replace('\\', '/');
- } catch (Exception e) {
+ } catch (IOException e) {
WebModelPlugin.getPluginLog().logError(e);
return f.getAbsolutePath().replace('\\', '/');
}
@@ -112,7 +118,7 @@
if(document == null) return;
try {
XModelObjectLoaderUtil.serialize(document.getDocumentElement(),
file.getAbsolutePath());
- } catch (Exception e) {
+ } catch (IOException e) {
WebModelPlugin.getPluginLog().logError(e);
}
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.tiles/src/org/jboss/tools/jst/web/tiles/model/helpers/TilesDefinitionSet.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.tiles/src/org/jboss/tools/jst/web/tiles/model/helpers/TilesDefinitionSet.java 2009-06-29
15:09:42 UTC (rev 16251)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.tiles/src/org/jboss/tools/jst/web/tiles/model/helpers/TilesDefinitionSet.java 2009-06-29
15:11:06 UTC (rev 16252)
@@ -124,11 +124,7 @@
if(!removed.isEmpty() || !added.isEmpty()) {
ITilesDefinitionSetListener[] ls = listeners.toArray(new
ITilesDefinitionSetListener[0]);
for (int i = 0; i < ls.length; i++) {
- try {
- ls[i].definitionsChanged(removed, added);
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError(e);
- }
+ ls[i].definitionsChanged(removed, added);
}
}
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/RemoveJavaSource.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/RemoveJavaSource.java 2009-06-29
15:09:42 UTC (rev 16251)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/operation/RemoveJavaSource.java 2009-06-29
15:11:06 UTC (rev 16252)
@@ -14,11 +14,11 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
-import org.jboss.tools.jst.web.WebModelPlugin;
import org.jboss.tools.jst.web.ui.WebUiPlugin;
public class RemoveJavaSource {
@@ -42,7 +42,7 @@
for (int i = 0; i < rs.length; i++) {
try {
if(rs[i] != null) rs[i].delete(true, null);
- } catch (Exception ce) {
+ } catch (CoreException ce) {
WebUiPlugin.getPluginLog().logError(ce);
}
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/OpenFileHyperLinkListener.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/OpenFileHyperLinkListener.java 2009-06-29
15:09:42 UTC (rev 16251)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/OpenFileHyperLinkListener.java 2009-06-29
15:11:06 UTC (rev 16252)
@@ -7,6 +7,7 @@
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.xml.type.AnyType;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
@@ -50,7 +51,7 @@
try {
IResource resource = SmooksUIUtils.getResource((EObject) model);
SmooksUIUtils.openFile(path, resource.getProject(), editorID);
- } catch (Exception e1) {
+ } catch (PartInitException e1) {
}
}