[FIXED HUDSON-5313 HUDSON-5314] Applied a patch in 5314 to fix 5313.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@26274 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2010-01-23 00:38:36 +00:00
1 parent 531eeaf178
commit 693b60ba6f
1 file changed
+19 -2
@@ -258,8 +258,7 @@ final class RemoteClassLoader extends URLClassLoader {
private File makeResource(String name, byte[] image) throws IOException {
File tmpFile = File.createTempFile("hudson-remoting", "");
tmpFile.delete();
File tmpFile = createTempDir();
File resource = new File(tmpFile, name);
resource.getParentFile().mkdirs();
@@ -272,6 +271,24 @@ final class RemoteClassLoader extends URLClassLoader {
return resource;
}
private File createTempDir() throws IOException {
// work around sun bug 6325169 on windows
// see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6325169
int nRetry=0;
while (true) {
try {
File tmpFile = File.createTempFile("hudson-remoting", "");
tmpFile.delete();
tmpFile.mkdir();
return tmpFile;
} catch (IOException e) {
if (nRetry++ < 100)
continue;
throw e;
}
}
}
/**
* Prefetches the jar into this class loader.
*