提交 0552f5ad 编写于 作者: J Jesse Glick

[JENKINS-13202] 646154f1 refinement: resolveSymlink is documented to return...

[JENKINS-13202] 646154f1 refinement: resolveSymlink is documented to return null, not throw an exception, when called on a regular file.
上级 a8d93977
......@@ -61,6 +61,9 @@ Upcoming changes</a>
<li class=bug>
Build records were broken if timezone was changed while running.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-15816">issue 15816</a>)
<li class=bug>
Symlink detection refinement on Java 7.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-13202">issue 13202</a>)
<li class='major bug'>
Displaying massive test suite results could bring down Jenkins.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-15818">issue 15818</a>)
......
......@@ -1110,6 +1110,13 @@ public class Util {
if (x2 instanceof UnsupportedOperationException) {
return null; // no symlinks on this platform
}
try {
if (Class.forName("java.nio.file.NotLinkException").isInstance(x2)) {
return null;
}
} catch (ClassNotFoundException x3) {
assert false : x3; // should be Java 7+ here
}
if (x2 instanceof IOException) {
throw (IOException) x2;
}
......
......@@ -171,6 +171,7 @@ public class UtilTest {
File d = Util.createTempDir();
try {
new FilePath(new File(d, "a")).touch(0);
assertNull(Util.resolveSymlink(new File(d, "a")));
Util.createSymlink(d,"a","x", l);
assertEquals("a",Util.resolveSymlink(new File(d,"x")));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册