ctx = core.makeClient((short) 1, true, false).getFetchContext();
ctx.allowSplitfiles = true;
ctx.dontEnterImplicitArchives = false;
ctx.maxNonSplitfileRetries = -1;
ctx.maxSplitfileBlockRetries = -1;
blobBucket = new FileBucket(saveTo, false, false, false, false);
if(blobBucket.size() > 0) {
fetched = true;
cg = null;
tempFile = null;
} else {
// Write to temp file then rename.
// We do not want to rename unless we are sure we've finished the fetch.
File tmp;
try {
tmp = File.createTempFile(saveTo.getName(), NodeUpdateManager.TEMP_BLOB_SUFFIX, saveTo.getParentFile());
tmp.deleteOnExit(); // To be used sparingly, as it leaks, but safe enough here as it should only happen twice during a normal run.
} catch (IOException e) {
Logger.error(this, "Cannot create temp file so cannot fetch legacy jar "+uri+" : UOM from old versions will not work!");
cg = null;
fetched = false;
tempFile = null;
return;
}
tempFile = tmp;
cg = new ClientGetter(this,
uri, ctx, RequestStarter.IMMEDIATE_SPLITFILE_PRIORITY_CLASS,
null, new BinaryBlobWriter(new FileBucket(tempFile, false, false, false, false)));
fetched = false;
}
}