Buggy code:
public static void write ( final File file , final CharSequence data , final Charset encoding ) throws IOException { } public static void write ( final File file , final CharSequence data , final String encoding ) throws IOException { } public static void write ( final File file , final CharSequence data , final Charset encoding , final boolean append ) throws IOException { } public static void write ( final File file , final CharSequence data , final String encoding , final boolean append ) throws IOException { } public static void writeByteArrayToFile ( final File file , final byte [ ] data ) throws IOException { } public static void writeByteArrayToFile ( final File file , final byte [ ] data , final boolean append ) throws IOException { } public static void writeByteArrayToFile ( final File file , final byte [ ] data , final int off , final int len ) throws IOException { } public static void writeByteArrayToFile ( final File file , final byte [ ] data , final int off , final int len , final boolean append ) throws IOException { } public static void writeLines ( final File file , final String encoding , final Collection < ? > lines ) throws IOException { } public static void writeLines ( final File file , final String encoding , final Collection < ? > lines , final boolean append ) throws IOException { } public static void writeLines ( final File file , final Collection < ? > lines ) throws IOException { } public static void writeLines ( final File file , final Collection < ? > lines , final boolean append ) throws IOException { } public static void writeLines ( final File file , final String encoding , final Collection < ? > lines , final String lineEnding ) throws IOException { } public static void writeLines ( final File file , final String encoding , final Collection < ? > lines , final String lineEnding , final boolean append ) throws IOException { } public static void writeLines ( final File file , final Collection < ? > lines , final String lineEnding ) throws IOException { } public static void writeLines ( final File file , final Collection < ? > lines , final String lineEnding , final boolean append ) throws IOException { } public static void forceDelete ( final File file ) throws IOException { } public static void forceDeleteOnExit ( final File file ) throws IOException { } private static void deleteDirectoryOnExit ( final File directory ) throws IOException { } private static void cleanDirectoryOnExit ( final File directory ) throws IOException { } public static void forceMkdir ( final File directory ) throws IOException { } public static void forceMkdirParent ( final File file ) throws IOException { } public static long sizeOf ( final File file ) { } public static BigInteger sizeOfAsBigInteger ( final File file ) { } public static long sizeOfDirectory ( final File directory ) { } public static BigInteger sizeOfDirectoryAsBigInteger ( final File directory ) { } private static void checkDirectory ( final File directory ) { } public static boolean isFileNewer ( final File file , final File reference ) { } public static boolean isFileNewer ( final File file , final Date date ) { } public static boolean isFileNewer ( final File file , final long timeMillis ) { } public static boolean isFileOlder ( final File file , final File reference ) { } public static boolean isFileOlder ( final File file , final Date date ) { } public static boolean isFileOlder ( final File file , final long timeMillis ) { } public static long checksumCRC32 ( final File file ) throws IOException { } public static Checksum checksum ( final File file , final Checksum checksum ) throws IOException { } public static void moveDirectory ( final File srcDir , final File destDir ) throws IOException { if ( srcDir == null ) { throw new NullPointerException ( "Source<seq2seq4repair_space>must<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>null" ) ; } if ( destDir == null ) { throw new NullPointerException ( "Destination<seq2seq4repair_space>must<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>null" ) ; } if ( ! ( srcDir . exists ( ) ) ) { throw new FileNotFoundException ( ( ( "Source<seq2seq4repair_space>'" + srcDir ) + "'<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>exist" ) ) ; } if ( ! ( srcDir . isDirectory ( ) ) ) { throw new IOException ( ( ( "Source<seq2seq4repair_space>'" + srcDir ) + "'<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>a<seq2seq4repair_space>directory" ) ) ; } if ( destDir . exists ( ) ) { throw new FileExistsException ( ( ( "Destination<seq2seq4repair_space>'" + destDir ) + "'<seq2seq4repair_space>already<seq2seq4repair_space>exists" ) ) ; } final boolean rename = srcDir . renameTo ( destDir ) ; if ( ! rename ) { <START_BUG> if ( destDir . getCanonicalPath ( ) . startsWith ( ( ( srcDir . getCanonicalPath ( ) ) + ( File . pathSeparator ) ) ) ) { <END_BUG> throw new IOException ( ( ( ( "Cannot<seq2seq4repair_space>move<seq2seq4repair_space>directory:<seq2seq4repair_space>" + srcDir ) + "<seq2seq4repair_space>to<seq2seq4repair_space>a<seq2seq4repair_space>subdirectory<seq2seq4repair_space>of<seq2seq4repair_space>itself:<seq2seq4repair_space>" ) + destDir ) ) ; } FileUtils . copyDirectory ( srcDir , destDir ) ; FileUtils . deleteDirectory ( srcDir ) ; if ( srcDir . exists ( ) ) { throw new IOException ( ( ( ( ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>delete<seq2seq4repair_space>original<seq2seq4repair_space>directory<seq2seq4repair_space>'" + srcDir ) + "'<seq2seq4repair_space>after<seq2seq4repair_space>copy<seq2seq4repair_space>to<seq2seq4repair_space>'" ) + destDir ) + "'" ) ) ; } } } public static void moveDirectoryToDirectory ( final File src , final File destDir , final boolean createDestDir ) throws IOException { } public static void moveFile ( final File srcFile , final File destFile ) throws IOException { } public static void moveFileToDirectory ( final File srcFile , final File destDir , final boolean createDestDir ) throws IOException { } public static void moveToDirectory ( final File src , final File destDir , final boolean createDestDir ) throws IOException { } public static boolean isSymlink ( final File file ) throws IOException { } }

Fix:
if ( destDir . getCanonicalPath ( ) . startsWith ( ( ( srcDir . getCanonicalPath ( ) ) + ( File . separator ) ) ) ) {