diff --git a/core/src/main/java/hudson/Util.java b/core/src/main/java/hudson/Util.java index 853e09d9b2..e4a4bc8a40 100644 --- a/core/src/main/java/hudson/Util.java +++ b/core/src/main/java/hudson/Util.java @@ -252,6 +252,15 @@ public class Util { */ @IgnoreJRERequirement private static void makeWritable(File f) { + // try JDK6-way of doing it. + try { + if (f.setWritable(true)) { + return; + } + } catch (NoSuchMethodError e) { + // not JDK6 + } + // try chmod. this becomes no-op if this is not Unix. try { Chmod chmod = new Chmod(); @@ -263,13 +272,6 @@ public class Util { LOGGER.log(Level.INFO,"Failed to chmod "+f,e); } - // also try JDK6-way of doing it. - try { - f.setWritable(true); - } catch (NoSuchMethodError e) { - // not JDK6 - } - try {// try libc chmod POSIX posix = PosixAPI.get(); String path = f.getAbsolutePath();