geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From YunFeng Ma <yunfeng...@yahoo.com>
Subject Re: svn commit: r682314 - /geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java
Date Tue, 05 Aug 2008 03:31:57 GMT
Thanks a lot, Jacek. I've updated the codes in rev682569.

-- Yun Feng

Jacek Laskowski wrote: 
On Mon, Aug 4, 2008 at 12:26 PM,  <yunfengma@apache.org> wrote:

Author: yunfengma
Date: Mon Aug  4 03:26:17 2008
New Revision: 682314

URL: http://svn.apache.org/viewvc?rev=682314&view=rev
Log:
GERONIMODEVTOOLS-457 Empty Web Container setting causes 'xml problem for web app' during deployment

Modified:
   geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java?rev=682314&r1=682313&r2=682314&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/main/java/org/apache/geronimo/st/core/jaxb/MarshallerListener.java
Mon Aug  4 03:26:17 2008
@@ -18,7 +18,10 @@

 import javax.xml.bind.Marshaller;

+import org.apache.geronimo.jee.naming.GbeanLocator;
+import org.apache.geronimo.jee.naming.Pattern;
 import org.apache.geronimo.jee.security.Security;
+import org.apache.geronimo.jee.web.WebApp;

 public class MarshallerListener extends Marshaller.Listener{

@@ -29,6 +32,30 @@
                       if (security.getRoleMappings() != null && security.getRoleMappings().getRole().size()
== 0) {
                               security.setRoleMappings(null);
                       }
+               } else if (source instanceof WebApp) {
+                       WebApp webapp = (WebApp)source;
+                       GbeanLocator gbeanlocator = webapp.getWebContainer();
+                       if (isEmpty(gbeanlocator.getGbeanLink()) && isEmpty(gbeanlocator.getPattern()))
{
+                               webapp.setWebContainer(null);
+                       }
+               }
+       }
+
+       private boolean isEmpty(Pattern pattern) {
+               if ( pattern == null ) {
+                       return true;
               }
+               if ( ( pattern.getGroupId() == null || pattern.getGroupId().trim().equals("")
) &&
+                        ( pattern.getArtifactId() == null || pattern.getArtifactId().trim().equals("")
) &&
+                        ( pattern.getModule() == null || pattern.getModule().trim().equals("")
) &&
+                        ( pattern.getName() == null || pattern.getName().trim().equals("")
) &&
+                        ( pattern.getVersion() == null || pattern.getVersion().trim().equals("")
) ) {


Wouldn't isEmpty(pattern.getGroupId())... do the trick? Or better

  private boolean isEmpty(Pattern pattern) {
    return isEmpty(pattern) || isEmpty(pattern.getGroupId()) || ...;
  }

?


+       private boolean isEmpty(String value) {
+               return (value == null || value.trim().equals(""));
       }
 }


Jacek


      
Mime
View raw message