DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18563>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18563

Inherited project field not initialised in custom implementations of 
FileSelector

           Summary: Inherited project field not initialised in custom
                    implementations of FileSelector
           Product: Ant
           Version: 1.5.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Core
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The project field inherited from ProjectComponent by BaseExtendSelector is 
never set when a user makes use of the <custom> tag for selectors, thus making 
the owning Project instance inaccessible from within custom selectors.

Have my own candidate fix for 1.5.2 source. Applied same fix to CVS tip which 
yields following CVS diff:

RCS 
file: /home/cvspublic/ant/src/main/org/apache/tools/ant/types/selectors/ExtendSe
lector.java,v
retrieving revision 1.6
diff -c -r1.6 ExtendSelector.java
*** ExtendSelector.java 10 Feb 2003 14:14:35 -0000      1.6
--- ExtendSelector.java 1 Apr 2003 12:06:55 -0000
***************
*** 106,111 ****
--- 106,114 ----
                      AntClassLoader.initializeClass(c);
                  }
                  dynselector = (FileSelector) c.newInstance();
+                 if (dynselector instanceof ProjectComponent) {
+                     ((ProjectComponent)dynselector).setProject(getProject());
+                 }
              }
              catch (ClassNotFoundException cnfexcept) {
                  setError("Selector " + classname +

although perhaps using reflexion to get at a method with a signature the same 
as setProject() would be more suitable, to avoid type dependency on 
ProjectComponent, since otherwise implementers of FileSelector would be 
constrained to work from subclasses of ProjectComponent.

Reply via email to