Buggy code:
public class Tar extends MatchingTask { public static final String WARN = "warn" ; public static final String FAIL = "fail" ; public static final String TRUNCATE = "truncate" ; public static final String GNU = "gnu" ; public static final String OMIT = "omit" ; private String [ ] validModes = new String [ ] { Tar . WARN , Tar . FAIL , Tar . TRUNCATE , Tar . GNU , Tar . OMIT } ; File tarFile ; File baseDir ; String longFileMode = Tar . WARN ; Vector filesets = new Vector ( ) ; Vector fileSetFiles = new Vector ( ) ; private boolean longWarningGiven = false ; public Tar . TarFileSet createTarFileSet ( ) { } public void setTarfile ( File tarFile ) { } public void setBasedir ( File baseDir ) { } public void setLongfile ( String mode ) { } public void execute ( ) throws BuildException { if ( ( tarFile ) == null ) { throw new BuildException ( "tarfile<seq2seq4repair_space>attribute<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>set!" , location ) ; } if ( ( tarFile . exists ( ) ) && ( tarFile . isDirectory ( ) ) ) { throw new BuildException ( "tarfile<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>directory!" , location ) ; } if ( ( tarFile . exists ( ) ) && ( ! ( tarFile . canWrite ( ) ) ) ) { throw new BuildException ( "Can<seq2seq4repair_space>not<seq2seq4repair_space>write<seq2seq4repair_space>to<seq2seq4repair_space>the<seq2seq4repair_space>specified<seq2seq4repair_space>tarfile!" , location ) ; } if ( ( baseDir ) != null ) { if ( ! ( baseDir . exists ( ) ) ) { throw new BuildException ( "basedir<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>exist!" , location ) ; } Tar . TarFileSet mainFileSet = new Tar . TarFileSet ( fileset ) ; mainFileSet . setDir ( baseDir ) ; filesets . addElement ( mainFileSet ) ; } if ( ( filesets . size ( ) ) == 0 ) { throw new BuildException ( "You<seq2seq4repair_space>must<seq2seq4repair_space>supply<seq2seq4repair_space>either<seq2seq4repair_space>a<seq2seq4repair_space>basdir<seq2seq4repair_space>attribute<seq2seq4repair_space>or<seq2seq4repair_space>some<seq2seq4repair_space>nested<seq2seq4repair_space>filesets." , location ) ; } boolean upToDate = true ; for ( Enumeration e = filesets . elements ( ) ; e . hasMoreElements ( ) ; ) { Tar . TarFileSet fs = ( ( Tar . TarFileSet ) ( e . nextElement ( ) ) ) ; String [ ] files = fs . getFiles ( project ) ; if ( ! ( archiveIsUpToDate ( files ) ) ) { upToDate = false ; } for ( int i = 0 ; i < ( files . length ) ; ++ i ) { if ( tarFile . equals ( new File ( fs . getDir ( project ) , files [ i ] ) ) ) { throw new BuildException ( "A<seq2seq4repair_space>tar<seq2seq4repair_space>file<seq2seq4repair_space>cannot<seq2seq4repair_space>include<seq2seq4repair_space>itself" , location ) ; } } } if ( upToDate ) { log ( ( ( "Nothing<seq2seq4repair_space>to<seq2seq4repair_space>do:<seq2seq4repair_space>" + ( tarFile . getAbsolutePath ( ) ) ) + "<seq2seq4repair_space>is<seq2seq4repair_space>up<seq2seq4repair_space>to<seq2seq4repair_space>date." ) , MSG_INFO ) ; return ; } log ( ( "Building<seq2seq4repair_space>tar:<seq2seq4repair_space>" + ( tarFile . getAbsolutePath ( ) ) ) , MSG_INFO ) ; TarOutputStream tOut = null ; try { tOut = new TarOutputStream ( new FileOutputStream ( tarFile ) ) ; tOut . setDebug ( true ) ; if ( longFileMode . equalsIgnoreCase ( Tar . TRUNCATE ) ) { tOut . setLongFileMode ( LONGFILE_TRUNCATE ) ; } else if ( ( longFileMode . equalsIgnoreCase ( Tar . FAIL ) ) || ( longFileMode . equalsIgnoreCase ( Tar . OMIT ) ) ) { tOut . setLongFileMode ( LONGFILE_ERROR ) ; } else { tOut . setLongFileMode ( LONGFILE_GNU ) ; } longWarningGiven = false ; for ( Enumeration e = filesets . elements ( ) ; e . hasMoreElements ( ) ; ) { Tar . TarFileSet fs = ( ( Tar . TarFileSet ) ( e . nextElement ( ) ) ) ; String [ ] files = fs . getFiles ( project ) ; for ( int i = 0 ; i < ( files . length ) ; i ++ ) { <START_BUG> File f = new File ( baseDir , files [ i ] ) ; <END_BUG> String name = files [ i ] . replace ( File . separatorChar , '//' ) ; tarFile ( f , tOut , name , fs ) ; } } } catch ( IOException ioe ) { String msg = "Problem<seq2seq4repair_space>creating<seq2seq4repair_space>TAR:<seq2seq4repair_space>" + ( ioe . getMessage ( ) ) ; throw new BuildException ( msg , ioe , location ) ; } finally { if ( tOut != null ) { try { tOut . close ( ) ; } catch ( IOException e ) { } } } } protected void tarFile ( File file , TarOutputStream tOut , String vPath , Tar . TarFileSet tarFileSet ) throws IOException { } protected boolean archiveIsUpToDate ( String [ ] files ) { } public static class TarFileSet extends FileSet { private String [ ] files = null ; private int mode = 33188 ; private String userName = "" ; private String groupName = "" ; public TarFileSet ( FileSet fileset ) { } public TarFileSet ( ) { } public String [ ] getFiles ( Project p ) { } public void setMode ( String octalString ) { } public int getMode ( ) { } public void setUserName ( String userName ) { } public String getUserName ( ) { } public void setGroup ( String groupName ) { } public String getGroup ( ) { } } }

Fix:
File f = new File ( fs . getDir ( project ) , files [ i ] ) ;