diff options
author | cbateman | 2007-04-18 20:23:59 +0000 |
---|---|---|
committer | cbateman | 2007-04-18 20:23:59 +0000 |
commit | 1c755f740b60aa0886bd80c38a794323b1d7493a (patch) | |
tree | da33cd08a50826e87a8922b7b2260a340817cb6a | |
parent | 3d33b39e180279c89ea6ba1600636b791b0e3182 (diff) | |
download | webtools.jsf-1c755f740b60aa0886bd80c38a794323b1d7493a.tar.gz webtools.jsf-1c755f740b60aa0886bd80c38a794323b1d7493a.tar.xz webtools.jsf-1c755f740b60aa0886bd80c38a794323b1d7493a.zip |
Added check that projects are accessible before trying to read properties. If not accessible, the call will throw an unnecessary exception.
-rw-r--r-- | jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryRegistryUtil.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryRegistryUtil.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryRegistryUtil.java index f57c46ebc..271787f68 100644 --- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryRegistryUtil.java +++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryRegistryUtil.java @@ -380,6 +380,11 @@ public class JSFLibraryRegistryUtil { */ public static boolean doesProjectHaveV1JSFLibraries(IProject iproject) { + if (iproject == null || !iproject.isAccessible()) + { + return false; // won't be able to get reading on a null or closed project + } + try { Object compLib = iproject.getPersistentProperty(new QualifiedName(JSFLibraryConfigProjectData.QUALIFIEDNAME, JSFUtils.PP_JSF_COMPONENT_LIBRARIES)); @@ -389,13 +394,13 @@ public class JSFLibraryRegistryUtil { { return true; } - return false; } catch(CoreException ce) { JSFCorePlugin.log(ce, "Error checking age of project"); - return false; } + // by default, fall through to false + return false; } /** @@ -409,8 +414,11 @@ public class JSFLibraryRegistryUtil { { IProject project = it.next(); try { - project.setPersistentProperty(new QualifiedName(JSFLibraryConfigProjectData.QUALIFIEDNAME, JSFUtils.PP_JSF_COMPONENT_LIBRARIES), null); - project.setPersistentProperty(new QualifiedName(JSFLibraryConfigProjectData.QUALIFIEDNAME, JSFUtils.PP_JSF_IMPLEMENTATION_LIBRARIES), null); + if (project.isAccessible()) + { + project.setPersistentProperty(new QualifiedName(JSFLibraryConfigProjectData.QUALIFIEDNAME, JSFUtils.PP_JSF_COMPONENT_LIBRARIES), null); + project.setPersistentProperty(new QualifiedName(JSFLibraryConfigProjectData.QUALIFIEDNAME, JSFUtils.PP_JSF_IMPLEMENTATION_LIBRARIES), null); + } } catch (CoreException e) { JSFCorePlugin.log(e, "Error removing JSF library persistent property"); } |