Copilot commented on code in PR #3405:
URL: https://github.com/apache/tika/pull/3405#discussion_r4359930970
##########
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/ooxml/XSSFExcelExtractorDecorator.java:
##########
@@ -1084,19 +1088,10 @@ public void cell(String cellRef, String formattedValue,
}
}
- /**
- * Bridge for POI's {@link SheetContentsHandler} interface, used by the
- * XLSB (binary) path via {@link
org.apache.poi.xssf.binary.XSSFBSheetHandler}.
- */
+ @Override
+ @Deprecated
public void cell(String cellRef, String formattedValue, XSSFComment
comment) {
- XSSFCommentsShim.CommentData commentData = null;
- if (comment != null) {
- String text = comment.getString() != null ?
- comment.getString().getString() : "";
- commentData = new XSSFCommentsShim.CommentData(
- comment.getAuthor(), text);
- }
- cell(cellRef, formattedValue, commentData);
+ cell(cellRef, formattedValue, (Comment) comment);
}
Review Comment:
This method is now annotated `@Deprecated` but no longer explains why it
exists or what callers should migrate to. Please add a brief deprecation note
(e.g., POI API change: use `cell(String, String,
org.apache.poi.ss.usermodel.Comment)`), and optionally whether/when it will be
removed.
##########
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-microsoft-module/src/main/java/org/apache/tika/parser/microsoft/ooxml/XSSFExcelExtractorDecorator.java:
##########
@@ -1114,6 +1109,22 @@ public void headerFooter(String text, boolean isHeader,
String tagName) {
public void endSheet() {
// no-op — satisfies both TikaSheetContentsHandler and
SheetContentsHandler
}
+
+ /**
+ * Bridge for POI's {@link SheetContentsHandler} interface, used by the
+ * XLSB (binary) path via {@link
org.apache.poi.xssf.binary.XSSFBSheetHandler}.
+ */
+ @Override
+ public void cell(String cellReference, String formattedValue, Comment
comment) {
+ XSSFCommentsShim.CommentData commentData = null;
+ if (comment != null) {
+ String text = comment.getString() != null ?
+ comment.getString().getString() : "";
Review Comment:
This calls `comment.getString()` twice. Store the rich text value in a local
variable and reuse it to avoid duplicate calls and make the logic easier to
read.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]