in src/main/java/org/apache/sling/fsprovider/internal/parser/ContentFileParserUtil.java [87:106]
public static ContentElement parse(File file, ContentType contentType) {
if (!file.exists()) {
return null;
}
try {
switch (contentType) {
case JSON:
return parse(JSON_PARSER, file, JSON_PARSER_OPTIONS);
case XML:
return parse(XML_PARSER, file, DEFAULT_PARSER_OPTIONS);
case JCR_XML:
return parse(JCR_XML_PARSER, file, DEFAULT_PARSER_OPTIONS);
default:
throw new IllegalArgumentException("Unexpected content type: " + contentType);
}
} catch (Throwable ex) {
log.warn("Error parsing content from " + file.getPath(), ex);
}
return null;
}