dion        2003/07/30 21:20:22

  Modified:    src/java/org/apache/maven/jelly/tags BaseTagSupport.java
  Log:
  Add a way of easily checking attributes for values
  
  Revision  Changes    Path
  1.6       +18 -0     maven/src/java/org/apache/maven/jelly/tags/BaseTagSupport.java
  
  Index: BaseTagSupport.java
  ===================================================================
  RCS file: /home/cvs/maven/src/java/org/apache/maven/jelly/tags/BaseTagSupport.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BaseTagSupport.java       27 Jul 2003 23:33:57 -0000      1.5
  +++ BaseTagSupport.java       31 Jul 2003 04:20:22 -0000      1.6
  @@ -56,6 +56,8 @@
    * ====================================================================
    */
   
  +import org.apache.commons.jelly.JellyTagException;
  +import org.apache.commons.jelly.MissingAttributeException;
   import org.apache.commons.jelly.TagSupport;
   import org.apache.maven.jelly.MavenJellyContext;
   import org.apache.maven.Maven;
  @@ -76,5 +78,21 @@
       public Maven getMaven()
       {
           return getMavenContext().getProject().getMaven();
  +    }
  +    
  +    /**
  +     * Check a given 'attribute' has a value and throw the corresponding
  +     * exception if it doesn't
  +     * 
  +     * @param attribute the attribute to check
  +     * @param message the message to pass in with the exception
  +     * @throws MissingAttributeException when the attribute is null
  +     */
  +    protected void checkAttribute(Object attribute, String message) throws 
JellyTagException
  +    {
  +        if (attribute == null)
  +        {
  +            throw new MissingAttributeException(message);
  +        }
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to