diff --git a/src/main/java/eu/openaire/urls_controller/services/BulkImportServiceImpl.java b/src/main/java/eu/openaire/urls_controller/services/BulkImportServiceImpl.java index db8ef43..1c214a6 100644 --- a/src/main/java/eu/openaire/urls_controller/services/BulkImportServiceImpl.java +++ b/src/main/java/eu/openaire/urls_controller/services/BulkImportServiceImpl.java @@ -449,7 +449,7 @@ public class BulkImportServiceImpl implements BulkImportService { public List getFileLocationsInsideDir(String directory) { List fileLocations = null; - try ( Stream walkStream = Files.find(Paths.get(directory), Integer.MAX_VALUE, (filePath, fileAttr) -> fileAttr.isRegularFile()) ) + try ( Stream walkStream = Files.find(Paths.get(directory), 20, (filePath, fileAttr) -> fileAttr.isRegularFile()) ) // In case we ever include other type-of-Files inside the same directory, we need to add this filter: "&& !filePath.toString().endsWith("name.ext")" { fileLocations = walkStream.map(Path::toString).collect(Collectors.toList()); @@ -471,9 +471,8 @@ public class BulkImportServiceImpl implements BulkImportService { md5 = DatatypeConverter.printHexBinary(md5MD.digest()).toLowerCase(); } catch (Exception e) { logger.error("Error when getting the MD5-hash for: " + string, e); - return null; } - return md5; + return md5; // It may be null. } @@ -487,7 +486,7 @@ public class BulkImportServiceImpl implements BulkImportService { id = id.toLowerCase(); String idMd5Hash = getMD5Hash(id); - if ( idMd5Hash == null ) + if ( idMd5Hash == null ) // The error is logged inside. return null; return (datasourcePrefix + "::" + idMd5Hash);