public static void checkCopyToOK ( Resource source , Resource target ) throws IOException { if ( ! source . isFile ( ) ) { if ( source . isDirectory ( ) ) throw new IOException ( "can't copy [" + source . getPath ( ) + "] to [" + target . getPath ( ) + "], source is a directory" ) ; throw new IOException ( "can't copy [" + source . getPath ( ) + "] to [" + target . getPath ( ) + "], source file does not exist" ) ; } else if ( target . isDirectory ( ) ) { throw new IOException ( "can't copy [" + source . getPath ( ) + "] to [" + target . getPath ( ) + "], target is a directory" ) ; } }
check if copying a file is ok with the rules for the Resource interface to not change this rules .