This is an automated email from the ASF dual-hosted git repository.
fanningpj pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git
The following commit(s) were added to refs/heads/trunk by this push:
new fd4d143d44 XSSFReader: tolerate missing comments file (#996)
fd4d143d44 is described below
commit fd4d143d4469f9b611a1c700e3dc121db288fdeb
Author: PJ Fanning <[email protected]>
AuthorDate: Wed Jan 14 21:06:26 2026 +0100
XSSFReader: tolerate missing comments file (#996)
---
.../main/java/org/apache/poi/xssf/eventusermodel/XSSFReader.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git
a/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/XSSFReader.java
b/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/XSSFReader.java
index de4dbb207c..f945b3457f 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/XSSFReader.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/XSSFReader.java
@@ -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) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]