ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Available.java
Date Mon, 07 Jan 2002 15:01:13 GMT
bodewig     02/01/07 07:01:13

  Modified:    src/main/org/apache/tools/ant/taskdefs Available.java
  Log:
  Improve logging when <available> is being used as a condition.
  
  Revision  Changes    Path
  1.31      +18 -4     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Available.java
  
  Index: Available.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Available.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- Available.java	7 Dec 2001 07:16:56 -0000	1.30
  +++ Available.java	7 Jan 2002 15:01:13 -0000	1.31
  @@ -84,6 +84,7 @@
       private Path classpath;
       private AntClassLoader loader;
       private String value = "true";
  +    private boolean isTask = false;
   
       public void setClasspath(Path classpath) {
           createClasspath().append(classpath);
  @@ -155,6 +156,7 @@
               throw new BuildException("property attribute is required", location);
           }
   
  +        isTask = true;
           if (eval()) {
               String lSep = System.getProperty("line.separator");
               if (null != project.getProperty(property)) {
  @@ -165,6 +167,7 @@
               }
               this.project.setProperty(property, value);
           }
  +        isTask = false;
       }
   
       public boolean eval() throws BuildException {
  @@ -183,27 +186,38 @@
               this.loader = new AntClassLoader(project, classpath);
           }
   
  +        String appendix = "";
  +        if (isTask) {
  +            appendix = " to set property " + property;
  +        } else {
  +            setTaskName("available");
  +        }
  +
           if ((classname != null) && !checkClass(classname)) {
  -            log("Unable to load class " + classname + " to set property " + property, Project.MSG_VERBOSE);
  +            log("Unable to load class " + classname + appendix, Project.MSG_VERBOSE);
               return false;
           }
   
           if ((file != null) && !checkFile()) {
               if (type != null) {
  -                log("Unable to find " + type + " " + file + " to set property " + property,
Project.MSG_VERBOSE);
  +                log("Unable to find " + type + " " + file + appendix, Project.MSG_VERBOSE);
               } else {
  -                log("Unable to find " + file + " to set property " + property, Project.MSG_VERBOSE);
  +                log("Unable to find " + file + appendix, Project.MSG_VERBOSE);
               }
               return false;
           }
   
           if ((resource != null) && !checkResource(resource)) {
  -            log("Unable to load resource " + resource + " to set property " + property,
Project.MSG_VERBOSE);
  +            log("Unable to load resource " + resource + appendix, Project.MSG_VERBOSE);
               return false;
           }
   
           if (loader != null) {
               loader.cleanup();
  +        }
  +
  +        if (!isTask) {
  +            setTaskName(null);
           }
   
           return true;
  
  
  

--
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