pr #5476 issue #5475
@ -625,6 +625,11 @@ public class ResourcesService extends BaseService {
org.apache.dolphinscheduler.api.utils.FileUtils.copyFile(file, localFilename);
HadoopUtils.getInstance().copyLocalToHdfs(localFilename, hdfsFilename, true, true);
} catch (Exception e) {
try {
FileUtils.deleteFile(localFilename);
} catch (IOException ex) {
logger.error("delete local tmp file:{} error", localFilename, ex);
}
logger.error(e.getMessage(), e);
return false;
@ -398,7 +398,10 @@ public class FileUtils {
* @throws IOException in case deletion is unsuccessful
*/
public static void deleteFile(String filename) throws IOException {
org.apache.commons.io.FileUtils.forceDelete(new File(filename));
File file = new File(filename);
if (file.exists()) {
org.apache.commons.io.FileUtils.forceDelete(file);
/**