in pulsar-io/file/src/main/java/org/apache/pulsar/io/file/FileSourceConfig.java [125:168]
public void validate() {
if (StringUtils.isBlank(inputDirectory)) {
throw new IllegalArgumentException("Required property not set.");
} else if (Files.notExists(Paths.get(inputDirectory), LinkOption.NOFOLLOW_LINKS)) {
throw new IllegalArgumentException("Specified input directory does not exist");
} else if (!Files.isReadable(Paths.get(inputDirectory))) {
throw new IllegalArgumentException("Specified input directory is not readable");
} else if (Optional.ofNullable(keepFile).orElse(false) && !Files.isWritable(Paths.get(inputDirectory))) {
throw new IllegalArgumentException("You have requested the consumed files to be deleted, but the "
+ "source directory is not writeable.");
}
if (StringUtils.isNotBlank(fileFilter)) {
try {
Pattern.compile(fileFilter);
} catch (final PatternSyntaxException psEx) {
throw new IllegalArgumentException("Invalid Regex pattern provided for fileFilter");
}
}
if (minimumFileAge != null && Math.signum(minimumFileAge) < 0) {
throw new IllegalArgumentException("The property minimumFileAge must be non-negative");
}
if (maximumFileAge != null && Math.signum(maximumFileAge) < 0) {
throw new IllegalArgumentException("The property maximumFileAge must be non-negative");
}
if (minimumSize != null && Math.signum(minimumSize) < 0) {
throw new IllegalArgumentException("The property minimumSize must be non-negative");
}
if (maximumSize != null && Math.signum(maximumSize) < 0) {
throw new IllegalArgumentException("The property maximumSize must be non-negative");
}
if (pollingInterval != null && pollingInterval <= 0) {
throw new IllegalArgumentException("The property pollingInterval must be greater than zero");
}
if (numWorkers != null && numWorkers <= 0) {
throw new IllegalArgumentException("The property numWorkers must be greater than zero");
}
}