Buggy code:
public class MimeMail extends Task { private boolean failOnError = true ; private String from = null ; private String mailhost = "localhost" ; private String message = null ; private File messageFile = null ; private String toList = null ; protected String ccList = null ; protected String bccList = null ; private String subject = null ; private Vector filesets = new Vector ( ) ; private String messageMimeType = "text//plain" ; public MimeMail ( ) { } private static void addRecipients ( MimeMessage msg , Message . RecipientType recipType , String addrUserName , String addrList ) throws MessagingException , TaskException { } public void setBccList ( String bccList ) { } public void setCcList ( String ccList ) { } public void setFailOnError ( boolean failOnError ) { } public void setFrom ( String from ) { } public void setMailhost ( String mailhost ) { } public void setMessage ( String message ) { } public void setMessageFile ( File messageFile ) { } public void setMessageMimeType ( String type ) { } public void setSubject ( String subject ) { } public void setToList ( String toList ) { } public void addFileset ( FileSet set ) { } public void doMail ( ) throws MessagingException , AddressException , TaskException { Properties props = new Properties ( ) ; props . put ( "mail.smtp.host" , mailhost ) ; Session sesh = Session . getDefaultInstance ( props , null ) ; MimeMessage msg = new MimeMessage ( sesh ) ; log ( ( "message<seq2seq4repair_space>sender:<seq2seq4repair_space>" + ( from ) ) , MSG_VERBOSE ) ; msg . setFrom ( new InternetAddress ( from ) ) ; MimeMail . addRecipients ( msg , TO , "To" , toList ) ; MimeMail . addRecipients ( msg , CC , "Cc" , ccList ) ; MimeMail . addRecipients ( msg , BCC , "Bcc" , bccList ) ; if ( ( subject ) != null ) { log ( ( "subject:<seq2seq4repair_space>" + ( subject ) ) , MSG_VERBOSE ) ; msg . setSubject ( subject ) ; } MimeMultipart attachments = new MimeMultipart ( ) ; if ( ( messageFile ) != null ) { int size = ( ( int ) ( messageFile . length ( ) ) ) ; byte [ ] data = new byte [ size ] ; try { FileInputStream inStream = new FileInputStream ( messageFile ) ; inStream . read ( data ) ; inStream . close ( ) ; message = new String ( data ) ; } catch ( IOException e ) { throw new TaskException ( "Error" , e ) ; } } if ( ( message ) != null ) { MimeBodyPart textbody = new MimeBodyPart ( ) ; textbody . setContent ( message , messageMimeType ) ; attachments . addBodyPart ( textbody ) ; } for ( int i = 0 ; i < ( filesets . size ( ) ) ; i ++ ) { FileSet fs = ( ( FileSet ) ( filesets . elementAt ( i ) ) ) ; if ( fs != null ) { <START_BUG> DirectoryScanner ds = fs . getDirectoryScanner ( project ) ; <END_BUG> String [ ] dsfiles = ds . getIncludedFiles ( ) ; File baseDir = ds . getBasedir ( ) ; for ( int j = 0 ; j < ( dsfiles . length ) ; j ++ ) { File file = new File ( baseDir , dsfiles [ j ] ) ; MimeBodyPart body ; body = new MimeBodyPart ( ) ; if ( ( ! ( file . exists ( ) ) ) || ( ! ( file . canRead ( ) ) ) ) { throw new TaskException ( ( ( "File<seq2seq4repair_space>\"" + ( file . getAbsolutePath ( ) ) ) + "\"<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>exist<seq2seq4repair_space>or<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>readable." ) ) ; } log ( ( ( ( ( "Attaching<seq2seq4repair_space>" + ( file . toString ( ) ) ) + "<seq2seq4repair_space>-<seq2seq4repair_space>" ) + ( file . length ( ) ) ) + "<seq2seq4repair_space>bytes" ) , MSG_VERBOSE ) ; FileDataSource fileData = new FileDataSource ( file ) ; DataHandler fileDataHandler = new DataHandler ( fileData ) ; body . setDataHandler ( fileDataHandler ) ; body . setFileName ( file . getName ( ) ) ; attachments . addBodyPart ( body ) ; } } } msg . setContent ( attachments ) ; getLogger ( ) . info ( "sending<seq2seq4repair_space>email<seq2seq4repair_space>" ) ; Transport . send ( msg ) ; } public void execute ( ) throws TaskException { } public void validate ( ) { } }

Fix:
DirectoryScanner ds = fs . getDirectoryScanner ( getProject ( ) ) ;