geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacek Laskowski" <ja...@laskowski.net.pl>
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 Mon, 04 Aug 2008 20:55:06 GMT
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

-- 
Jacek Laskowski
Notatnik Projektanta Java EE - http://www.JacekLaskowski.pl

Mime
View raw message