Buggy code:
private TextView mExtraStatus ; private TextView mExtraPercent ; public interface OnWorkerThreadFinishedListener { public void onWorkerThreadComplete ( int type , ArrayList < String > results ) { } } public void setExtraViews ( ProgressBar pb , TextView status , TextView percent ) { } public EventHandler ( FileManager filemanager ) { } public void setOnWorkerThreadFinishedListener ( EventHandler . OnWorkerThreadFinishedListener e ) { } public static CharSequence getResourceString ( Context mContext , int ... resIds ) { } public void deleteFile ( final List < OpenPath > path , final Context mContext ) { } public void startSearch ( final OpenPath base , final Context mContext ) { } public void renameFile ( final String path , boolean isFolder , Context mContext ) { } public void createNewFolder ( final String directory , Context mContext ) { } public void sendFile ( final List < OpenPath > path , final Context mContext ) { } public void copyFile ( OpenPath source , OpenPath destPath , Context mContext ) { } public void copyFile ( List < OpenPath > files , OpenPath newPath , Context mContext ) { } public void cutFile ( List < OpenPath > files , OpenPath newPath , Context mContext ) { } public void searchFile ( OpenPath dir , String query , Context mContext ) { } public void zipFile ( OpenPath into , List < OpenPath > files , Context mContext ) { } public void zipFile ( OpenPath into , OpenPath [ ] files , Context mContext ) { } public void unzipFile ( final OpenPath into , final OpenPath file , final Context mContext ) { } public void unZipFileTo ( OpenPath zipFile , OpenPath toDir , Context mContext ) { } private class BackgroundWork extends AsyncTask < OpenPath , Integer , Integer > { private static final int BACKGROUND_NOTIFICATION_ID = 123 ; private final int mType ; private final Context mContext ; private final String [ ] mInitParams ; private final OpenPath mIntoPath ; private final NotificationManager mNotifier ; private ProgressDialog mPDialog ; private Notification mNote = null ; private ArrayList < String > mSearchResults = null ; private boolean isDownload = false ; public BackgroundWork ( int type , Context context , OpenPath intoPath , String ... params ) { } protected void onPreExecute ( ) { } public void searchDirectory ( OpenPath dir , String pattern , ArrayList < String > aList ) { } protected Integer doInBackground ( OpenPath ... params ) { } private Boolean copyToDirectory ( OpenPath old , OpenPath intoDir , int total ) throws IOException { Logger . LogDebug ( ( ( ( ( "Trying<seq2seq4repair_space>to<seq2seq4repair_space>copy<seq2seq4repair_space>[" + ( old . getPath ( ) ) ) + "]<seq2seq4repair_space>to<seq2seq4repair_space>[" ) + ( intoDir . getPath ( ) ) ) + "]..." ) ) ; if ( old . getPath ( ) . equals ( intoDir . getPath ( ) ) ) { return false ; } OpenPath newDir = intoDir ; if ( old . isDirectory ( ) ) { newDir = newDir . getChild ( old . getName ( ) ) ; if ( ( ! ( newDir . exists ( ) ) ) && ( ! ( newDir . mkdir ( ) ) ) ) { Logger . LogWarning ( "Couldn't<seq2seq4repair_space>create<seq2seq4repair_space>initial<seq2seq4repair_space>destination<seq2seq4repair_space>file." ) ; } } byte [ ] data = new byte [ FileManager . BUFFER ] ; int read = 0 ; if ( ( ( old . isDirectory ( ) ) && ( newDir . isDirectory ( ) ) ) && ( newDir . canWrite ( ) ) ) { OpenPath [ ] files = old . list ( ) ; for ( OpenPath file : files ) total += ( ( int ) ( file . length ( ) ) ) ; for ( int i = 0 ; i < ( files . length ) ; i ++ ) if ( ! ( copyToDirectory ( files [ i ] , newDir , total ) ) ) { Logger . LogWarning ( ( ( "Couldn't<seq2seq4repair_space>copy<seq2seq4repair_space>" + ( files [ i ] . getName ( ) ) ) + "." ) ) ; return false ; } return true ; } else if ( ( ( old . isFile ( ) ) && ( newDir . isDirectory ( ) ) ) && ( newDir . canWrite ( ) ) ) { OpenPath newFile = newDir . getChild ( old . getName ( ) ) ; <START_BUG> if ( newFile . equals ( old ) ) { <END_BUG> Logger . LogWarning ( "Old<seq2seq4repair_space>=<seq2seq4repair_space>new" ) ; return false ; } Logger . LogDebug ( ( ( "Creating<seq2seq4repair_space>File<seq2seq4repair_space>[" + ( newFile . getPath ( ) ) ) + "]..." ) ) ; if ( ( ! ( newDir . exists ( ) ) ) && ( ! ( newFile . mkdir ( ) ) ) ) { Logger . LogWarning ( "Couldn't<seq2seq4repair_space>create<seq2seq4repair_space>initial<seq2seq4repair_space>destination<seq2seq4repair_space>file." ) ; return false ; } int size = ( ( int ) ( old . length ( ) ) ) ; int pos = 0 ; BufferedInputStream i_stream = null ; BufferedOutputStream o_stream = null ; boolean success = false ; try { Logger . LogDebug ( ( "Writing<seq2seq4repair_space>" + ( newFile . getPath ( ) ) ) ) ; i_stream = new BufferedInputStream ( old . getInputStream ( ) ) ; o_stream = new BufferedOutputStream ( newFile . getOutputStream ( ) ) ; while ( ( read = i_stream . read ( data , 0 , BUFFER ) ) != ( - 1 ) ) { o_stream . write ( data , 0 , read ) ; pos += FileManager . BUFFER ; publishProgress ( pos , size ) ; } o_stream . flush ( ) ; i_stream . close ( ) ; o_stream . close ( ) ; success = true ; } catch ( FileNotFoundException e ) { Logger . LogError ( "Couldn't<seq2seq4repair_space>find<seq2seq4repair_space>file<seq2seq4repair_space>to<seq2seq4repair_space>copy." , e ) ; } catch ( IOException e ) { Logger . LogError ( "IOException<seq2seq4repair_space>copying<seq2seq4repair_space>file." , e ) ;

Fix:
if ( newFile . getPath ( ) . equals ( old . getPath ( ) ) ) {