Error in FileUtils.copyUrlToFile

2k Views Asked by At

I am executing the below code to pull the .gz file from a URL to a local directory.For small files it goes through fine but for large files it downloads only part of it but does not fail. I get to know the error only when I try to UNZIP it. Can someone throw any light on this on what could be the reason.

public boolean downloadFilemethod(String filePath, String url, String 
decompressFilePath) { 
if (StringUtils.isNotBlank(filePath) && StringUtils.isNotBlank(url)) { 
try { 
FileUtils.copyURLToFile(new URL(url), new File(SRC_BASE_DIR + filePath), 
TIMEOUT_IN_MILLIS, TIMEOUT_IN_MILLIS); 
ingestmethod(filePath,decompressFilePath);   
downloadSuccess = true; 
} 
catch (MalformedURLException e) 
{ LOG.warn("some message"); } 
catch (IOException e) 
{ LOG.warn("some message); 
} 
}
return downloadSuccess 
}
0

There are 0 best solutions below