diff --git a/changelog.html b/changelog.html index 83f01f9389..b8e107178b 100644 --- a/changelog.html +++ b/changelog.html @@ -61,6 +61,9 @@ Upcoming changes
  • Build records were broken if timezone was changed while running. (issue 15816) +
  • + Symlink detection refinement on Java 7. + (issue 13202)
  • Displaying massive test suite results could bring down Jenkins. (issue 15818) diff --git a/core/src/main/java/hudson/Util.java b/core/src/main/java/hudson/Util.java index a93ef736d0..4f15ec7786 100644 --- a/core/src/main/java/hudson/Util.java +++ b/core/src/main/java/hudson/Util.java @@ -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; } diff --git a/core/src/test/java/hudson/UtilTest.java b/core/src/test/java/hudson/UtilTest.java index 8461ee2ee7..4d5cb0fee1 100644 --- a/core/src/test/java/hudson/UtilTest.java +++ b/core/src/test/java/hudson/UtilTest.java @@ -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")));