File's setReadOnly method [Also setWritable(false)] does not make a directory read-only on Windows. Instead, it sets the DOS readonly attribute that prevents the directory from being deleted.
This method should be investigated to see if the following are feasible:
1. Have these methods return false for directories (meaning they cannot make the directory readonly)
2. Have the method insert a deny entry at the top of the DACL to deny write access.
The simplest solution is for setReadOnly to return false when the file is a directory.