mbenson     2005/01/04 15:15:25

  Modified:    src/main/org/apache/tools/ant/types Description.java
  Log:
  Avoid NPE thrown when using oata.helper.ProjectHelperImpl .
  Reported by: Mark D. Hansen
  
  Revision  Changes    Path
  1.20      +7 -4      ant/src/main/org/apache/tools/ant/types/Description.java
  
  Index: Description.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/Description.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Description.java  9 Mar 2004 16:48:41 -0000       1.19
  +++ Description.java  4 Jan 2005 23:15:25 -0000       1.20
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2001-2004 The Apache Software Foundation
  + * Copyright  2001-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -65,7 +65,7 @@
       }
   
       /**
  -     * return the descriptions from all the targets of
  +     * Return the descriptions from all the targets of
        * a project.
        *
        * @param project the project to get the descriptions for.
  @@ -73,8 +73,11 @@
        *         the targets.
        */
       public static String getDescription(Project project) {
  -        StringBuffer description = new StringBuffer();
           Vector targets = (Vector) project.getReference("ant.targets");
  +        if (targets == null) {
  +            return null;
  +        }
  +        StringBuffer description = new StringBuffer();
           for (int i = 0; i < targets.size(); i++) {
               Target t = (Target) targets.elementAt(i);
               concatDescriptions(project, t, description);
  
  
  

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

Reply via email to