Author: fbricon
Date: 2012-03-19 04:19:21 -0400 (Mon, 19 Mar 2012)
New Revision: 39606
Modified:
trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/MavenJSFActivator.java
trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/utils/xpl/JSFAppConfigUtils.java
Log:
JBIDE-11078 : catch and log exceptions in
JSFAppConfigUtils.getConfigFilesFromContextParam(...)
Modified:
trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/MavenJSFActivator.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/MavenJSFActivator.java 2012-03-19
07:43:52 UTC (rev 39605)
+++
trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/MavenJSFActivator.java 2012-03-19
08:19:21 UTC (rev 39606)
@@ -67,8 +67,7 @@
}
public static void log(Throwable e) {
- IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e);
- getDefault().getLog().log(status);
+ log(e.getLocalizedMessage(), e);
}
public static void log(String message) {
@@ -76,6 +75,11 @@
getDefault().getLog().log(status);
}
+ public static void log(String message, Throwable e) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, e);
+ getDefault().getLog().log(status);
+ }
+
public IDataModel createJSFDataModel(IFacetedProject fproj, IProjectFacetVersion
facetVersion) {
IDataModel config = (IDataModel) new JSFFacetInstallDataModelProvider().create();
LibraryInstallDelegate libraryDelegate = new LibraryInstallDelegate(fproj,
facetVersion);
Modified:
trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/utils/xpl/JSFAppConfigUtils.java
===================================================================
---
trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/utils/xpl/JSFAppConfigUtils.java 2012-03-19
07:43:52 UTC (rev 39605)
+++
trunk/maven/plugins/org.jboss.tools.maven.jsf/src/org/jboss/tools/maven/jsf/utils/xpl/JSFAppConfigUtils.java 2012-03-19
08:19:21 UTC (rev 39606)
@@ -73,15 +73,22 @@
public static List<String> getConfigFilesFromContextParam(IProject project) {
List<String> filesList = Collections.emptyList();
if (ModuleCoreNature.isFlexibleProject(project)) {
- IModelProvider provider = ModelProviderManager.getModelProvider(project);
- if (provider != null) {
- Object webAppObj = provider.getModelObject();
- if (webAppObj != null){
- if (webAppObj instanceof WebApp)
- filesList = getConfigFilesForJ2EEApp(project);
- else if (webAppObj instanceof org.eclipse.jst.javaee.web.WebApp)
- filesList = getConfigFilesForJEEApp((org.eclipse.jst.javaee.web.WebApp)webAppObj);
+ try {
+ IModelProvider provider = ModelProviderManager.getModelProvider(project);
+ if (provider != null) {
+ Object webAppObj = provider.getModelObject();
+ if (webAppObj != null){
+ if (webAppObj instanceof WebApp)
+ filesList = getConfigFilesForJ2EEApp(project);
+ else if (webAppObj instanceof org.eclipse.jst.javaee.web.WebApp)
+ filesList =
getConfigFilesForJEEApp((org.eclipse.jst.javaee.web.WebApp)webAppObj);
+ }
}
+ } catch (Exception e) {
+ //Fix for JBIDE-11078 : in extremely rare cases,
+ //a NPE can be thrown if no IModelProvider is found for project
+ //At this point that error shouldn't block the user so we just log it
+ MavenJSFActivator.log("Could not read web.xml", e); //$NON-NLS-1$
}
}
return filesList;
Show replies by date