ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant BuildFileTest.java
Date Mon, 06 Jan 2003 13:58:31 GMT
conor       2003/01/06 05:58:31

  Modified:    src/main/org/apache/tools/ant/taskdefs Definer.java
               src/testcases/org/apache/tools/ant BuildFileTest.java
  Added:       src/etc/testcases/core/loaderref loaderref.xml
               src/etc/testcases/core/loaderref/src Task1.java
  Log:
  Check if loaderrefs are valid before casting them.
  
  Reported By: 	Jeroen Breedveld
  
  Revision  Changes    Path
  1.1                  jakarta-ant/src/etc/testcases/core/loaderref/loaderref.xml
  
  Index: loaderref.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <project name="loaderref-test" default="help">
  
    <property name="src.dir" value="src"/>
    <property name="classes.dir" value="classes"/>
  
    <target name="help">
      <echo>
  This build file is intended to be used for testing Ant
      </echo>
    </target>
  
    <target name="clean">
      <delete dir="${classes.dir}"/>
    </target>
  
    <target name="compile">
      <mkdir dir="${classes.dir}"/>
      <javac srcdir="${src.dir}" destdir="${classes.dir}"/>
    </target>
  
    <target name="testbadref" depends="compile" >
      <taskdef loaderref="loaderref-test"
               classname="Test1"
               classpath="${classes.dir}"/>
    </target>
  
  </project>
  
  
  
  1.1                  jakarta-ant/src/etc/testcases/core/loaderref/src/Task1.java
  
  Index: Task1.java
  ===================================================================
  import org.apache.tools.ant.Task;
  
  public class Task1 extends Task {
  }
  
  
  
  
  1.24      +8 -3      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Definer.java
  
  Index: Definer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Definer.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -w -u -r1.23 -r1.24
  --- Definer.java	29 Dec 2002 05:56:26 -0000	1.23
  +++ Definer.java	6 Jan 2003 13:58:31 -0000	1.24
  @@ -287,6 +287,11 @@
           if (loaderId != null) {
               Object reusedLoader = getProject().getReference(loaderId);
               if (reusedLoader != null) {
  +                if (!(reusedLoader instanceof ClassLoader)) {
  +                    throw new BuildException("The specified loader id " +
  +                        loaderId + " does not reference a class loader");
  +                }
  +
                   return (ClassLoader)reusedLoader;
                   //if (reusedLoader instanceof AntClassLoader) {
                   //    return (AntClassLoader)reusedLoader;
  
  
  
  1.17      +48 -49    jakarta-ant/src/testcases/org/apache/tools/ant/BuildFileTest.java
  
  Index: BuildFileTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/BuildFileTest.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -w -u -r1.16 -r1.17
  --- BuildFileTest.java	9 Sep 2002 08:21:39 -0000	1.16
  +++ BuildFileTest.java	6 Jan 2003 13:58:31 -0000	1.17
  @@ -305,7 +305,6 @@
        *
        *@param  target target to run
        *@param  cause  information string to reader of report
  -     *@param  msg    the message value of the build exception we are waiting for
        *@param  contains  substring of the build exception to look for
        */
       protected void expectBuildExceptionContaining(String target, String cause, String contains)
{ 
  
  
  

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