mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
XSSFReader: tolerate missing comments file (#996)
This commit is contained in:
parent
df2d5d62d9
commit
fd4d143d44
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user