private void renameFile ( File source , File target ) { if ( ! source . exists ( ) ) { // don't do anything if the source file doesn't exist return ; } if ( target . exists ( ) ) { target . delete ( ) ; } boolean rc = source . renameTo ( target ) ; if ( ! rc ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , getFileName ( ) + ": Unable to rename " + source + " to " + target ) ; } } }
Rename the source file into the target file deleting the target if necessary .