ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework Condition.java
Date Tue, 22 Jan 2002 11:46:30 GMT
donaldp     02/01/22 03:46:30

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/framework
                        Condition.java
  Log:
  Bring condition into line with Ant2 thinking - make it check the value of condition - not
just for its existance
  
  Revision  Changes    Path
  1.9       +21 -18    jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Condition.java
  
  Index: Condition.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Condition.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Condition.java	20 Jan 2002 17:32:56 -0000	1.8
  +++ Condition.java	22 Jan 2002 11:46:30 -0000	1.9
  @@ -9,11 +9,10 @@
   
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  -import org.apache.avalon.excalibur.property.PropertyException;
  -import org.apache.avalon.excalibur.property.PropertyUtil;
   import org.apache.avalon.framework.component.Component;
  -import org.apache.avalon.framework.context.Context;
   import org.apache.avalon.framework.context.ContextException;
  +import org.apache.myrmidon.api.TaskContext;
  +import org.apache.myrmidon.api.TaskException;
   
   /**
    * Class representing a condition.
  @@ -45,35 +44,39 @@
           return m_isIfCondition;
       }
   
  -    public boolean evaluate( final Context context )
  +    public boolean evaluate( final TaskContext context )
           throws ContextException
       {
           boolean result = false;
   
           try
           {
  -            final Object resolved =
  -                PropertyUtil.resolveProperty( getCondition(), context, false );
  -
  +            final Object resolved = context.resolveValue( getCondition() );
               if( null != resolved )
               {
                   final Object object = context.get( resolved );
  -                //TODO: Do more than just check for presence????????????
  -
  -                //true as object present
  -                result = true;
  +                final String string = object.toString();
  +                if( null == string || string.equals( "false" ) )
  +                {
  +                    result = false;
  +                }
  +                else
  +                {
  +                    result = true;
  +                }
               }
           }
  -        catch( final ContextException ce )
  +        catch( final TaskException te )
           {
               result = false;
           }
  -        catch( final PropertyException pe )
  -        {
  -            final String message = REZ.getString( "condition.no-resolve.error", m_condition
);
  -            throw new ContextException( message, pe );
  -        }
  -
  +        /*
  +                catch( final PropertyException pe )
  +                {
  +                    final String message = REZ.getString( "condition.no-resolve.error",
m_condition );
  +                    throw new ContextException( message, pe );
  +                }
  +        */
           if( !m_isIfCondition )
           {
               result = !result;
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message