Document that setLastModified sets time of symlink target

Due to Java bug JDK-8220793 [1] Java cannot set timestamps of a symlink
but only of the symlink target. This bug was fixed in Java 13. Since we
don't have a use case to set the timestamp of the symlink itself simply
document the current behavior of setLastModified methods.


[1] https://bugs.openjdk.java.net/browse/JDK-8220793

Change-Id: Ibc28c1702a1b9845602bd257606fbd44803a43fb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2020-08-17 14:23:29 +02:00
parent 4f3161d3cc
commit f39f848c99
2 changed files with 10 additions and 4 deletions

View File

@ -1080,8 +1080,9 @@ public Instant lastModifiedInstant(File f) {
}
/**
* Set the last modified time of a file system object. If the OS/JRE support
* symbolic links, the link is modified, not the target,
* Set the last modified time of a file system object.
* <p>
* For symlinks it sets the modified time of the link target.
*
* @param f
* a {@link java.io.File} object.
@ -1097,8 +1098,9 @@ public void setLastModified(File f, long time) throws IOException {
}
/**
* Set the last modified time of a file system object. If the OS/JRE support
* symbolic links, the link is modified, not the target,
* Set the last modified time of a file system object.
* <p>
* For symlinks it sets the modified time of the link target.
*
* @param p
* a {@link Path} object.

View File

@ -710,6 +710,8 @@ static BasicFileAttributes fileAttributes(File file) throws IOException {
}
/**
* Set the last modified time of a file system object.
*
* @param file
* @param time
* @throws IOException
@ -720,6 +722,8 @@ static void setLastModified(File file, long time) throws IOException {
}
/**
* Set the last modified time of a file system object.
*
* @param path
* @param time
* @throws IOException