XSSFReader: tolerate missing comments file (#996)

This commit is contained in:
PJ Fanning 2026-01-14 21:06:26 +01:00 committed by GitHub
parent df2d5d62d9
commit fd4d143d44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -436,8 +436,16 @@ public class XSSFReader {
sheetPkg.getRelationshipsByType(XSSFRelation.SHEET_COMMENTS.getRelation());
if (!commentsList.isEmpty()) {
PackageRelationship comments = commentsList.getRelationship(0);
if (comments == null) {
LOGGER.warn("Failed to find sheet comments packageRelationship");
return null;
}
PackagePartName commentsName = PackagingURIHelper.createPartName(comments.getTargetURI());
PackagePart commentsPart = sheetPkg.getPackage().getPart(commentsName);
if (commentsPart == null) {
LOGGER.warn("Failed to find sheet comments: {}", commentsName);
return null;
}
return parseComments(commentsPart);
}
} catch (InvalidFormatException|IOException e) {