Author: rob.stryker(a)jboss.com
Date: 2009-11-23 12:03:30 -0500 (Mon, 23 Nov 2009)
New Revision: 18787
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/JBoss4xEarFacetInstallListener.java
Log:
JBIDE-5242 - fix npe for null runtime case
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/JBoss4xEarFacetInstallListener.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/JBoss4xEarFacetInstallListener.java 2009-11-23
16:34:27 UTC (rev 18786)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/JBoss4xEarFacetInstallListener.java 2009-11-23
17:03:30 UTC (rev 18787)
@@ -54,21 +54,23 @@
IProjectFacetActionEvent e = (IProjectFacetActionEvent)event;
IProjectFacet pf = e.getProjectFacet();
if( pf.getId().equals(IWTPConstants.FACET_EAR)) {
- String rtName = e.getProject().getPrimaryRuntime().getName();
- IRuntime rt = ServerCore.findRuntime(rtName);
- if( rt != null ) {
- String type = rt.getRuntimeType().getId();
- if( type.equals(AS_42) || type.equals(EAP_43)) {
- // Launch the op to create the ear application.xml file
- IVirtualComponent vc = ComponentCore.createComponent(e.getProject().getProject());
- IDataModel model = DataModelFactory.createDataModel(new
EarCreateDeploymentFilesDataModelProvider());
- model.setProperty(ICreateDeploymentFilesDataModelProperties.GENERATE_DD, vc);
- model.setProperty(ICreateDeploymentFilesDataModelProperties.TARGET_PROJECT,
e.getProject().getProject());
- IDataModelOperation op = model.getDefaultOperation();
- try {
- op.execute(new NullProgressMonitor(), null);
- } catch (ExecutionException e1) {
- // Ignore
+ if( e.getProject().getPrimaryRuntime() != null ) {
+ String rtName = e.getProject().getPrimaryRuntime().getName();
+ IRuntime rt = ServerCore.findRuntime(rtName);
+ if( rt != null ) {
+ String type = rt.getRuntimeType().getId();
+ if( type.equals(AS_42) || type.equals(EAP_43)) {
+ // Launch the op to create the ear application.xml file
+ IVirtualComponent vc = ComponentCore.createComponent(e.getProject().getProject());
+ IDataModel model = DataModelFactory.createDataModel(new
EarCreateDeploymentFilesDataModelProvider());
+ model.setProperty(ICreateDeploymentFilesDataModelProperties.GENERATE_DD, vc);
+ model.setProperty(ICreateDeploymentFilesDataModelProperties.TARGET_PROJECT,
e.getProject().getProject());
+ IDataModelOperation op = model.getDefaultOperation();
+ try {
+ op.execute(new NullProgressMonitor(), null);
+ } catch (ExecutionException e1) {
+ // Ignore
+ }
}
}
}