[HUDSON-8155] handled NoClassDefFoundError

This commit is contained in:
rseguy committed 2011-01-11 14:01:27 +01:00
1 parent 972a8cfe4f
commit c490e884bc
1 file changed
+16 -10
+16 -10
View File
@@ -1098,19 +1098,25 @@ public final class FilePath implements Serializable {
if(LIBC.chmod(f.getAbsolutePath(),mask)!=0) {
throw new IOException("Failed to chmod "+f+" : "+LIBC.strerror(Native.getLastError()));
}
} catch(UnsatisfiedLinkError e) { // HUDSON-8155: use Ant's chmod task on non-GNU C systems
if (!CHMOD_WARNED) {// only warn this once to avoid flooding the log
CHMOD_WARNED = true;
LOGGER.warning("GNU C Library not available: Using Ant's chmod task instead.");
}
Chmod chmodTask = new Chmod();
chmodTask.setProject(new Project());
chmodTask.setFile(f);
chmodTask.setPerm(Integer.toOctalString(mask));
chmodTask.execute();
} catch(NoClassDefFoundError e) { // cf. https://groups.google.com/group/hudson-dev/browse_thread/thread/6d16c3e8ea0dbc9?hl=fr
_chmodAnt(f, mask);
} catch(UnsatisfiedLinkError e2) { // HUDSON-8155: use Ant's chmod task on non-GNU C systems
_chmodAnt(f, mask);
}
}
private static void _chmodAnt(File f, int mask) {
if (!CHMOD_WARNED) { // only warn this once to avoid flooding the log
CHMOD_WARNED = true;
LOGGER.warning("GNU C Library not available: Using Ant's chmod task instead.");
}
Chmod chmodTask = new Chmod();
chmodTask.setProject(new Project());
chmodTask.setFile(f);
chmodTask.setPerm(Integer.toOctalString(mask));
chmodTask.execute();
}
private static boolean CHMOD_WARNED = false;
/**