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