ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Antlib.java Definer.java
Date Fri, 01 Aug 2003 08:34:00 GMT
peterreilly    2003/08/01 01:34:00

  Modified:    src/main/org/apache/tools/ant/taskdefs Antlib.java
                        Definer.java
  Log:
  Fix location when error occurs in running antlib
  
  Revision  Changes    Path
  1.5       +14 -25    ant/src/main/org/apache/tools/ant/taskdefs/Antlib.java
  
  Index: Antlib.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Antlib.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Antlib.java	25 Jul 2003 08:59:39 -0000	1.4
  +++ Antlib.java	1 Aug 2003 08:34:00 -0000	1.5
  @@ -101,33 +101,21 @@
                   "Unable to find " + antlibUrl, ex);
           }
           // Should be safe to parse
  -        try {
  -            ProjectHelper2 parser = new ProjectHelper2();
  -            UnknownElement ue =
  -                parser.parseUnknownElement(project, antlibUrl);
  -            // Check name is "antlib"
  -            if (!(ue.getTag().equals(TAG))) {
  -                throw new BuildException(
  -                    "Unexpected tag " + ue.getTag() + " expecting "
  -                    + TAG, ue.getLocation());
  -            }
  -            Antlib antlib = new Antlib();
  -            antlib.setProject(project);
  -            antlib.setLocation(ue.getLocation());
  -            antlib.init();
  -            ue.configure(antlib);
  -            return antlib;
  -        } catch (BuildException ex) {
  -            Location location = ex.getLocation();
  -            if (location == null) {
  -                throw ex;
  -            }
  +        ProjectHelper2 parser = new ProjectHelper2();
  +        UnknownElement ue =
  +            parser.parseUnknownElement(project, antlibUrl);
  +        // Check name is "antlib"
  +        if (!(ue.getTag().equals(TAG))) {
               throw new BuildException(
  -                "Error in "
  -                + System.getProperty("line.separator")
  -                + location.toString()
  -                + " " + ex.getMessage());
  +                "Unexpected tag " + ue.getTag() + " expecting "
  +                + TAG, ue.getLocation());
           }
  +        Antlib antlib = new Antlib();
  +        antlib.setProject(project);
  +        antlib.setLocation(ue.getLocation());
  +        antlib.init();
  +        ue.configure(antlib);
  +        return antlib;
       }
   
   
  @@ -173,6 +161,7 @@
           for (Iterator i = tasks.iterator(); i.hasNext();) {
               UnknownElement ue = (UnknownElement) i.next();
               ue.maybeConfigure();
  +            setLocation(ue.getLocation());
               Task t = ue.getTask();
               if (t == null) {
                   continue;
  
  
  
  1.40      +5 -5      ant/src/main/org/apache/tools/ant/taskdefs/Definer.java
  
  Index: Definer.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Definer.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- Definer.java	24 Jul 2003 13:48:45 -0000	1.39
  +++ Definer.java	1 Aug 2003 08:34:00 -0000	1.40
  @@ -408,14 +408,14 @@
               antlib.setClassLoader(classLoader);
               antlib.perform();
           } catch (BuildException ex) {
  -            Location location = ex.getLocation();
  -            if (location == null) {
  +            Location exLocation = ex.getLocation();
  +            if (exLocation == null) {
                   throw ex;
               }
               throw new BuildException(
  -                "Error in "
  +                "Error executing antlib"
                   + System.getProperty("line.separator")
  -                + getLocation().toString()
  +                + exLocation.toString()
                   + " " + ex.getMessage());
           }
       }
  @@ -474,7 +474,7 @@
           definerSet = true;
           this.name = name;
       }
  -
  +    
       /**
        * Returns the classname of the object we are defining.
        * May be <code>null</code>.
  
  
  

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


Mime
View raw message