src/solaris/classes/sun/nio/fs/UnixCopyFile.java
Print this page
@@ -235,11 +235,11 @@
int fo = -1;
try {
fo = open(target,
(O_WRONLY |
O_CREAT |
- O_TRUNC),
+ O_EXCL),
attrs.mode());
} catch (UnixException x) {
x.rethrowAsIOException(target);
}
@@ -433,14 +433,12 @@
} catch (UnixException x) {
// target is non-empty directory that can't be replaced.
if (targetAttrs.isDirectory() &&
(x.errno() == EEXIST || x.errno() == ENOTEMPTY))
{
- throw new FileAlreadyExistsException(
- source.getPathForExecptionMessage(),
- target.getPathForExecptionMessage(),
- x.getMessage());
+ throw new DirectoryNotEmptyException(
+ target.getPathForExecptionMessage());
}
x.rethrowAsIOException(target);
}
}
@@ -554,14 +552,12 @@
} catch (UnixException x) {
// target is non-empty directory that can't be replaced.
if (targetAttrs.isDirectory() &&
(x.errno() == EEXIST || x.errno() == ENOTEMPTY))
{
- throw new FileAlreadyExistsException(
- source.getPathForExecptionMessage(),
- target.getPathForExecptionMessage(),
- x.getMessage());
+ throw new DirectoryNotEmptyException(
+ target.getPathForExecptionMessage());
}
x.rethrowAsIOException(target);
}
}