Author: scabanovich
Date: 2008-04-10 12:38:29 -0400 (Thu, 10 Apr 2008)
New Revision: 7493
Modified:
trunk/common/plugins/org.jboss.tools.common.model/resources/meta/filesystems.meta
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/generation/JavaPropertyGenerator.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/DefaultSpecialHandler.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/MetaLibLoader.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/MetaResourceLoader.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/key/KeyLoader.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsRenameListener.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/MountFileSystemHandler.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/MappedEntityRecognizer.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ResourceMarkers.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ClassPathUpdateWizard.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseJavaUtil.java
Log:
JBIDE-893
Modified:
trunk/common/plugins/org.jboss.tools.common.model/resources/meta/filesystems.meta
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/resources/meta/filesystems.meta 2008-04-10
16:35:24 UTC (rev 7492)
+++
trunk/common/plugins/org.jboss.tools.common.model/resources/meta/filesystems.meta 2008-04-10
16:38:29 UTC (rev 7493)
@@ -16,6 +16,7 @@
<PAIR name="htm$5"
value="org.jboss.tools.common.model.loaders.impl.MappedEntityRecognizer"/>
<PAIR name="html$5"
value="org.jboss.tools.common.model.loaders.impl.MappedEntityRecognizer"/>
<PAIR name="java$5"
value="org.jboss.tools.common.model.loaders.impl.MappedEntityRecognizer"/>
+ <PAIR name="jsf$5"
value="org.jboss.tools.common.model.loaders.impl.MappedEntityRecognizer"/>
<PAIR name="properties$5"
value="org.jboss.tools.common.model.loaders.impl.MappedEntityRecognizer"/>
<PAIR name="txt$5"
value="org.jboss.tools.common.model.loaders.impl.MappedEntityRecognizer"/>
<PAIR name="xhtml$5"
value="org.jboss.tools.common.model.loaders.impl.MappedEntityRecognizer"/>
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/generation/JavaPropertyGenerator.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/generation/JavaPropertyGenerator.java 2008-04-10
16:35:24 UTC (rev 7492)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/java/generation/JavaPropertyGenerator.java 2008-04-10
16:38:29 UTC (rev 7493)
@@ -74,12 +74,13 @@
}
static IMethod findGetter(IType type, String methodName) {
+ if(type == null || methodName == null) return null;
try {
IMethod[] ms = type.getMethods();
for (int i = 0; i < ms.length; i++) {
if(ms[i].getElementName().equals(methodName) &&
ms[i].getParameterNames().length == 0) return ms[i];
}
- } catch (Exception e) {
+ } catch (JavaModelException e) {
return null;
}
@@ -136,7 +137,7 @@
IBuffer buf = null;
try {
buf = cu.getBuffer();
- } catch (Exception e) {
+ } catch (JavaModelException e) {
ModelPlugin.getPluginLog().logError(e);
}
if (buf == null) {
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/DefaultSpecialHandler.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/DefaultSpecialHandler.java 2008-04-10
16:35:24 UTC (rev 7492)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/DefaultSpecialHandler.java 2008-04-10
16:38:29 UTC (rev 7493)
@@ -29,7 +29,7 @@
public static SpecialWizardSupport createSpecialWizardSupport(String id) {
try {
return
(SpecialWizardSupport)ModelFeatureFactory.getInstance().createFeatureInstance(id);
- } catch (Exception e) {
+ } catch (ClassCastException e) {
ModelPlugin.getDefault().getLog().log(new Status(Status.ERROR, ModelPlugin.PLUGIN_ID,
Status.OK, "Model warning: Cannot load special wizard support " + id +
".",e));
return null;
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/MetaLibLoader.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/MetaLibLoader.java 2008-04-10
16:35:24 UTC (rev 7492)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/MetaLibLoader.java 2008-04-10
16:38:29 UTC (rev 7493)
@@ -41,7 +41,7 @@
try {
Class<?> c = MetaLibLoader.class;
XMLEntityResolver.registerPublicEntity(DOC_PUBLICID, c,
"/meta/meta.dtd");
- } catch (Exception e) {
+ } catch (IOException e) {
ModelPlugin.getPluginLog().logError(e);
}
}
@@ -57,17 +57,13 @@
public void load(XModelMetaDataImpl meta) {
this.meta = meta;
- try {
- Map<String,URL> resources = MetaResourceLoader.getMetaResources();
- Iterator<String> it = resources.keySet().iterator();
- while(it.hasNext()) {
- String path = it.next();
- URL url = resources.get(path);
- load(path, url);
- }
- } catch (Exception t) {
- ModelPlugin.getPluginLog().logError("Error in loading meta model
resources", t);
- }
+ Map<String,URL> resources = MetaResourceLoader.getMetaResources();
+ Iterator<String> it = resources.keySet().iterator();
+ while(it.hasNext()) {
+ String path = it.next();
+ URL url = resources.get(path);
+ load(path, url);
+ }
// long t = System.currentTimeMillis();
for (int i = 0; i < metarefs.size(); i++) {
@@ -92,12 +88,13 @@
}
void load(String name, URL url) {
+ if(url == null) return;
// long t = System.currentTimeMillis();
InputStream stream = null;
try {
stream = url.openStream();
stream = new BufferedInputStream(stream, 16384);
- } catch (Exception e) {
+ } catch (IOException e) {
ModelPlugin.getPluginLog().logError("MetaLoader: Cannot read resource " +
url.toString());
return;
}
@@ -106,10 +103,8 @@
//XMLUtil.getElement(stream);
if(g == null) {
ModelPlugin.getPluginLog().logInfo("Corrupted meta resource " + name);
- } else try {
+ } else {
load0(g, name, url.toString());
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError(e);
}
// long dt = - t + (t = System.currentTimeMillis());
@@ -125,7 +120,7 @@
ModelPlugin.getPluginLog().logInfo(errors[i]);
}
}
- } catch (Exception e) {
+ } catch (IOException e) {
ModelPlugin.getPluginLog().logError(e);
}
// dt = - t + (t = System.currentTimeMillis());
@@ -138,11 +133,7 @@
Parser p = new Parser();
p.documentElement = root;
p.current = root;
- try {
- p.parse(stream);
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError(e);
- }
+ p.parse(stream);
Element g = p.documentElement;
g = XMLUtilities.getUniqueChild(g, "XModelEntityGroup");
p.documentElement.removeChild(g);
@@ -219,10 +210,13 @@
public void parse(org.xml.sax.InputSource is) {
XMLReader parser = createParser();
+ if(parser == null) return;
try {
parser.parse(is);
- } catch (Exception e) {
+ } catch (SAXException e) {
ModelPlugin.getPluginLog().logError(e);
+ } catch (IOException e) {
+ ModelPlugin.getPluginLog().logError(e);
}
}
@@ -232,7 +226,7 @@
try {
parserInstance =
XMLReaderFactory.createXMLReader(DEFAULT_SAX_PARSER_CLASS_NAME);
- } catch (Exception e) {
+ } catch (SAXException e) {
return null;
}
@@ -246,7 +240,7 @@
try {
parserInstance.setProperty(ENTITY_RESOLVER_PROPERTY_ID, new
XMLEntityResolverImpl());
- } catch (Exception e1) {
+ } catch (SAXException e1) {
CommonPlugin.getPluginLog().logError( e1.getMessage()+"", e1);
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/MetaResourceLoader.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/MetaResourceLoader.java 2008-04-10
16:35:24 UTC (rev 7492)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/MetaResourceLoader.java 2008-04-10
16:38:29 UTC (rev 7493)
@@ -37,18 +37,13 @@
URL url = bundle.getResource(path);
if(url != null) {
resources.put(path, url);
-// if(ModelPlugin.isDebugEnabled()) {
-// ModelPlugin.log("Loaded meta resource " + path + ".");
-// }
} else {
if(ModelPlugin.isDebugEnabled()) {
ModelPlugin.getPluginLog().logInfo("Warning: meta resource " + path +
" not found.");
}
}
- } catch (Exception e) {
- if(ModelPlugin.isDebugEnabled()) {
- ModelPlugin.getPluginLog().logError("Warning: meta resource " + path +
" not found.");
- }
+ } catch (IllegalStateException e) {
+ ModelPlugin.getPluginLog().logError("MetaResourceLoader warning: meta resource
" + path + " not found.");
}
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/key/KeyLoader.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/key/KeyLoader.java 2008-04-10
16:35:24 UTC (rev 7492)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/key/KeyLoader.java 2008-04-10
16:38:29 UTC (rev 7493)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.meta.key;
+import java.io.IOException;
import java.net.URL;
import java.util.*;
import org.eclipse.core.runtime.*;
@@ -25,18 +26,18 @@
Iterator<URL> it = set.iterator();
if(!it.hasNext()) return keys;
while(it.hasNext()) {
- URL url = (URL)it.next();
+ URL url = it.next();
+ Properties p = new Properties();
try {
- Properties p = new Properties();
p.load(url.openConnection().getInputStream());
- Enumeration ks = p.keys();
- while(ks.hasMoreElements()) {
- String k = (String)ks.nextElement();
- keys.setProperty(k, p.getProperty(k));
- }
- } catch (Exception e) {
+ } catch (IOException e) {
ModelPlugin.getPluginLog().logError("KeyLoader:load" + url);
}
+ Enumeration ks = p.keys();
+ while(ks.hasMoreElements()) {
+ String k = (String)ks.nextElement();
+ keys.setProperty(k, p.getProperty(k));
+ }
}
return keys;
}
@@ -57,15 +58,9 @@
URL url = bundle.getResource(path);
if(url != null) {
resources.add(url);
- } else {
- if(ModelPlugin.isDebugEnabled()) {
- ModelPlugin.getPluginLog().logInfo("Warning: meta resource " + path +
" not found.");
- }
}
- } catch (Exception e) {
- if(ModelPlugin.isDebugEnabled()) {
- ModelPlugin.getPluginLog().logInfo("Warning: meta resource " + path +
" not found.");
- }
+ } catch (IllegalStateException e) {
+ ModelPlugin.getPluginLog().logInfo("KeyLoader: Plugin " +
es[i].getNamespaceIdentifier() + " is uninstalled");
}
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java 2008-04-10
16:35:24 UTC (rev 7492)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileAnyImpl.java 2008-04-10
16:38:29 UTC (rev 7493)
@@ -200,8 +200,10 @@
if(!n2.equals(n1)) {
try {
f.move(new Path(f.getParent().getFullPath() + "/" + toFileName(this)),
true, null);
- } catch (Exception e) {
+ } catch (OperationCanceledException e) {
super.set(attr, n1);
+ } catch (CoreException e) {
+ super.set(attr, n1);
}
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsImpl.java 2008-04-10
16:35:24 UTC (rev 7492)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsImpl.java 2008-04-10
16:38:29 UTC (rev 7493)
@@ -77,10 +77,9 @@
status = OV_RUNNING;
try {
updateOverlappedInternal();
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError(e);
+ } finally {
+ overlapper = null;
}
- overlapper = null;
}
public String getId() {
@@ -266,16 +265,7 @@
} else {
doUpdate();
}
-// if(request > 0 && usage < 5) {
-// usage++;
-// request = 0;
-// ModelPlugin.log("run " + usage);
-// run();
-// } else {
-/// synchronized(this) {
- if(this == currentUpdate) currentUpdate = null;
-/// }
-// }
+ if(this == currentUpdate) currentUpdate = null;
}
}
@@ -288,29 +278,23 @@
if(b) {
XModelObjectLoaderUtil.getObjectLoader(FileSystemsImpl.this).update(FileSystemsImpl.this);
}
- } catch (Exception e) {
+ } catch (XModelException e) {
ModelPlugin.getPluginLog().logError(e);
}
if(saveRequested) {
try {
XModelObjectLoaderUtil.getObjectLoader(FileSystemsImpl.this).save(FileSystemsImpl.this);
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError(e);
} finally {
saveRequested = false;
+ isUpdating = false;
}
}
isUpdating = false;
}
private boolean isOpenProject() {
- try {
- IProject p = (IProject)getModel().getProperties().get("project");
- return p != null && p.isOpen();
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError(e);
- return false;
- }
+ IProject p = (IProject)getModel().getProperties().get("project");
+ return p != null && p.isAccessible() && p.isOpen();
}
private IContributorResourceAdapter contributorResourceAdapter = null;
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java 2008-04-10
16:35:24 UTC (rev 7492)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsLoader.java 2008-04-10
16:38:29 UTC (rev 7493)
@@ -67,11 +67,7 @@
updateLibs(object);
removeMissingJarSystems(object);
updateSrcs(object);
- try {
- ((FileSystemsImpl)object).updateOverlapped();
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError(e);
- }
+ ((FileSystemsImpl)object).updateOverlapped();
return b;
}
@@ -83,11 +79,7 @@
auto.load(object.getModel());
updateLibs(object);
_updateSrcs(object);
- try {
- ((FileSystemsImpl)object).updateOverlapped();
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError(e);
- }
+ ((FileSystemsImpl)object).updateOverlapped();
return;
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsRenameListener.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsRenameListener.java 2008-04-10
16:35:24 UTC (rev 7492)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemsRenameListener.java 2008-04-10
16:38:29 UTC (rev 7493)
@@ -25,8 +25,8 @@
static {
try {
contribution =
(Contribution)ModelFeatureFactory.getInstance().createFeatureInstance("org.jboss.tools.jst.web.project.FileSystemsRenameListenerContribution");
- } catch (Exception e) {
- //ignore
+ } catch (ClassCastException e) {
+ ModelPlugin.getPluginLog().logError(e);
}
}
XModelObject fileSystems;
@@ -90,20 +90,10 @@
private IPath getLocation(IPath path) {
if(path.segmentCount() > 1) {
- IFolder folder = null;
- try {
- folder = ModelPlugin.getWorkspace().getRoot().getFolder(path);
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError("FileSystemsRenameListener:getLocation:
Cannot find folder " + path);
- }
+ IFolder folder = ModelPlugin.getWorkspace().getRoot().getFolder(path);
return folder == null ? null : folder.getLocation();
} else {
- IProject project = null;
- try {
- project = ModelPlugin.getWorkspace().getRoot().getProject(path.segments()[0]);
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError("FileSystemsRenameListener:getLocation:
Cannot find project " + path);
- }
+ IProject project =
ModelPlugin.getWorkspace().getRoot().getProject(path.segments()[0]);
return project == null ? null : project.getLocation();
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/MountFileSystemHandler.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/MountFileSystemHandler.java 2008-04-10
16:35:24 UTC (rev 7492)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/MountFileSystemHandler.java 2008-04-10
16:38:29 UTC (rev 7493)
@@ -12,6 +12,7 @@
import java.util.*;
import java.io.*;
+
import org.jboss.tools.common.meta.action.*;
import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
import org.jboss.tools.common.model.*;
@@ -63,8 +64,8 @@
private String canonize(String location, XModel model) {
try {
location = XModelObjectUtil.expand(location, model, null);
- return (new File(location).getCanonicalPath()).replace('\\',
'/');
- } catch (Exception e) {
+ return location == null ? null : (new
File(location).getCanonicalPath()).replace('\\', '/');
+ } catch (IOException e) {
return location;
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/MappedEntityRecognizer.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/MappedEntityRecognizer.java 2008-04-10
16:35:24 UTC (rev 7492)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/MappedEntityRecognizer.java 2008-04-10
16:38:29 UTC (rev 7493)
@@ -22,6 +22,7 @@
map.put("flow", "FileFlow");
map.put("jspx", "FileJSP");
map.put("jspf", "FileJSP");
+ map.put("jsf", "FileHTML");
}
public String getEntityName(String ext, String body) {
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java 2008-04-10
16:35:24 UTC (rev 7492)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java 2008-04-10
16:38:29 UTC (rev 7493)
@@ -88,9 +88,10 @@
}
private int parsePriority(String s) {
+ if(s == null) return 10;
try {
return (s.length() == 0) ? 0 : Integer.parseInt(s);
- } catch (Exception e) {
+ } catch (NumberFormatException e) {
return 10;
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ResourceMarkers.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ResourceMarkers.java 2008-04-10
16:35:24 UTC (rev 7492)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/ResourceMarkers.java 2008-04-10
16:38:29 UTC (rev 7493)
@@ -97,12 +97,12 @@
if(dms == null) return;
ms = dms.toArray(new IMarker[0]);
for (int i = 0; i < ms.length; i++) ms[i].delete();
- } catch (Exception e) {
+ } catch (CoreException e) {
ModelPlugin.getPluginLog().logError(e);
}
}
- public static void updateLocation(IMarker marker, int location, int start, int end)
throws Exception {
+ public static void updateLocation(IMarker marker, int location, int start, int end)
throws CoreException {
if(location >= 0 && marker.getAttribute(IMarker.LINE_NUMBER, -1) !=
location) {
marker.setAttribute(IMarker.LINE_NUMBER, location);
}
@@ -124,7 +124,7 @@
ms[i].setAttribute("path", path);
}
return ms[i];
- } catch (Exception e) {
+ } catch (CoreException e) {
//ignore
continue;
}
@@ -167,7 +167,7 @@
public void run(IProgressMonitor monitor) throws CoreException {
try {
for (int i = 0; i < ms.length; i++) ms[i].delete();
- } catch (Exception e) {
+ } catch (CoreException e) {
//ignore
}
}
@@ -184,19 +184,20 @@
ArrayList<IMarker> l = null;
try {
IMarker[] ms = r.findMarkers(null, false, 1);
- for (int i = 0; i < ms.length; i++) {
+ if(ms != null) for (int i = 0; i < ms.length; i++) {
if(isOwnedMarker(ms[i])) {
if(l == null) l = new ArrayList<IMarker>();
l.add(ms[i]);
}
}
- } catch (Exception e) {
+ } catch (CoreException e) {
//ignore
}
return (l == null) ? null : l.toArray(new IMarker[0]);
}
- protected boolean isOwnedMarker(IMarker m) throws Exception {
+ protected boolean isOwnedMarker(IMarker m) throws CoreException {
+ if(m == null) return false;
String _type = m.getType();
if(_type == null) return true;
if(_type.startsWith("org.jboss.tools.")) {
@@ -240,8 +241,7 @@
if(r == null) return;
try {
IMarker[] ms = r.findMarkers(ResourceMarkers.JST_WEB_PROBLEM, true, 1);
- for (int i = 0; i < ms.length; i++) {
-// String type = ms[i].getType();
+ if(ms != null) for (int i = 0; i < ms.length; i++) {
String path = ms[i].getAttribute("path", null);
if(path == null) continue;
XModelObject o = file.getModel().getByPath(path);
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ClassPathUpdateWizard.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ClassPathUpdateWizard.java 2008-04-10
16:35:24 UTC (rev 7492)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ClassPathUpdateWizard.java 2008-04-10
16:38:29 UTC (rev 7493)
@@ -12,6 +12,7 @@
import java.util.*;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.jboss.tools.common.meta.action.SpecialWizard;
import org.jboss.tools.common.model.XModel;
@@ -34,7 +35,7 @@
public int execute() {
try {
u.execute();
- } catch (Exception e) {
+ } catch (CoreException e) {
ModelPlugin.getPluginLog().logError(e);
}
return 0;
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseJavaUtil.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseJavaUtil.java 2008-04-10
16:35:24 UTC (rev 7492)
+++
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseJavaUtil.java 2008-04-10
16:38:29 UTC (rev 7493)
@@ -25,32 +25,30 @@
}
public static String getMemberTypeAsString(IField f) {
+ if(f == null) return null;
try {
String typeName = new
String(Signature.toCharArray(f.getTypeSignature().toCharArray()));
return resolveType(f.getDeclaringType(), typeName);
- } catch (Exception e) {
+ } catch (JavaModelException e) {
ModelPlugin.getPluginLog().logError(e);
}
return null;
}
public static String getMemberTypeAsString(IMethod m) {
+ if(m == null) return null;
try {
return resolveTypeAsString(m.getDeclaringType(), m.getReturnType());
- } catch (Exception e) {
+ } catch (JavaModelException e) {
ModelPlugin.getPluginLog().logError(e);
}
return null;
}
public static String resolveTypeAsString(IType type, String typeName) {
- try {
- typeName = new String(Signature.toCharArray(typeName.toCharArray()));
- return resolveType(type, typeName);
- } catch (Exception e) {
- ModelPlugin.getPluginLog().logError(e);
- }
- return null;
+ if(type == null || typeName == null) return null;
+ typeName = new String(Signature.toCharArray(typeName.toCharArray()));
+ return resolveType(type, typeName);
}
static String NULL = ";;;";
@@ -114,6 +112,7 @@
}
private static String __resolveType(IType type, String typeName) {
+ if(type == null || typeName == null) return null;
try {
String resolvedArray[][] = type.resolveType(typeName);
// resolvedArray == null for primitive types
@@ -122,7 +121,7 @@
for (int i = 0; i < resolvedArray[0].length; i++)
typeName += (!"".equals(typeName) ? "." : "") +
resolvedArray[0][i];
return typeName;
- } catch (Exception e) {
+ } catch (JavaModelException e) {
ModelPlugin.getPluginLog().logError(e);
}
return null;