channel = fos.getChannel();
try {
stObj.getBlob().transferTo(channel);
} catch (IOException ioe) {
throw new StorageException(ioe.getMessage() + " for " + target.getAbsolutePath());
} finally {
try {
if(channel != null) {
channel.close();
}
} catch (IOException ioe) {
throw new StorageException(ioe.getMessage() + " for " + target.getAbsolutePath());
}
}
} catch (FileNotFoundException ioe) {
throw new StorageException(ioe.getMessage() + " for " + target.getAbsolutePath());
} finally {
IOUtils.closeQuietly(fos);
}
// rename to final position. This will fail if another GWC also wrote this