in commons-email2-javax/src/main/java/org/apache/commons/mail2/javax/resolver/DataSourcePathResolver.java [93:112]
public DataSource resolve(final String resourceLocation, final boolean isLenient) throws IOException {
Path file;
DataSource result = null;
if (!isCid(resourceLocation)) {
file = Paths.get(resourceLocation);
if (!file.isAbsolute()) {
file = getBaseDir() != null ? getBaseDir().resolve(resourceLocation) : Paths.get(resourceLocation);
}
if (Files.exists(file)) {
result = new PathDataSource(file, FileTypeMap.getDefaultFileTypeMap(), options);
} else if (!isLenient) {
throw new IOException("Cant resolve the following file resource :" + file.toAbsolutePath());
}
}
return result;
}