You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by sh...@apache.org on 2008/03/28 16:46:07 UTC

svn commit: r642269 - /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/CommonGeneralSection.java

Author: shivahr
Date: Fri Mar 28 08:46:05 2008
New Revision: 642269

URL: http://svn.apache.org/viewvc?rev=642269&view=rev
Log:
Fix NPE thrown while editing geronimo-application.xml

Modified:
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/CommonGeneralSection.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/CommonGeneralSection.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/CommonGeneralSection.java?rev=642269&r1=642268&r2=642269&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/CommonGeneralSection.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/sections/CommonGeneralSection.java Fri Mar 28 08:46:05 2008
@@ -27,6 +27,7 @@
 import org.apache.geronimo.jee.deployment.Dependency;
 import org.apache.geronimo.jee.deployment.Environment;
 import org.apache.geronimo.jee.deployment.ObjectFactory;
+import org.apache.geronimo.jee.application.Application;
 import org.apache.geronimo.jee.connector.Connector;
 import org.apache.geronimo.st.ui.CommonMessages;
 import org.apache.geronimo.st.ui.sections.AbstractSectionPart;
@@ -304,25 +305,29 @@
 	// Need to support both WebApp and Connector 
 	//
 	private Environment getEnvironment(boolean create) {
-		
 		Environment type = null;
 		Object plan = getPlan().getValue();
-		if ( WebApp.class.isInstance( plan ) ) {
-			type = ((WebApp)plan).getEnvironment();
+		if (WebApp.class.isInstance(plan)) {
+			type = ((WebApp) plan).getEnvironment();
 			if (type == null && create) {
-                type = getDeploymentObjectFactory().createEnvironment();
-                ((WebApp)plan).setEnvironment( type );
+				type = getDeploymentObjectFactory().createEnvironment();
+				((WebApp) plan).setEnvironment(type);
 			}
-		}
-		if ( Connector.class.isInstance( plan ) ) {
-			type = ((Connector)plan).getEnvironment();
+		} else if (Connector.class.isInstance(plan)) {
+			type = ((Connector) plan).getEnvironment();
 			if (type == null && create) {
-                type = getDeploymentObjectFactory().createEnvironment();
-                ((Connector)plan).setEnvironment( type );
+				type = getDeploymentObjectFactory().createEnvironment();
+				((Connector) plan).setEnvironment(type);
+			}
+		} else if (Application.class.isInstance(plan)) {
+			type = ((Application) plan).getEnvironment();
+			if (type == null && create) {
+				type = getDeploymentObjectFactory().createEnvironment();
+				((Application) plan).setEnvironment(type);
 			}
 		}
-        return type;
-		
+		// TODO add support for open-ejb & app-client clients
+		return type;
 	}
 	
 	private Dependencies getDependencies(boolean create) {