in webindex/modules/data/src/main/java/webindex/data/spark/IndexEnv.java [251:276]
public static List<String> getPathsRange(String ccPaths, String range) {
if (!(new File(ccPaths).exists())) {
log.error("CC paths file {} does not exist", ccPaths);
System.exit(1);
}
int start = 0;
int end = 0;
try {
start = Integer.parseInt(range.split("-")[0]);
end = Integer.parseInt(range.split("-")[1]);
} catch (NumberFormatException e) {
log.error("Invalid range: {}", range);
System.exit(1);
}
if (start > end) {
log.error("Invalid range: {}", range);
System.exit(1);
}
try (Stream<String> lines = Files.lines(Paths.get(ccPaths))) {
return lines.skip(start).limit(end - start + 1).collect(Collectors.toList());
} catch (IOException e) {
log.error("Failed to read CC paths file {}", ccPaths, e);
System.exit(1);
}
return Collections.emptyList();
}