Skip to content

Conversation

@delei
Copy link
Member

@delei delei commented Sep 5, 2025

Purpose of the pull request

Close #564

What's changed?

  • fix the NPE exception in the stream
  • ensure sheetNo is set for writeSheetHolder

Checklist

  • I have read the Contributor Guide.
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

@delei delei requested review from alaahong and removed request for jipengfei-jpf September 5, 2025 14:49
@alaahong alaahong requested a review from Copilot September 5, 2025 14:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a NullPointerException (NPE) in the WriteSheetWorkbookWriteHandler class that occurs when dealing with sheet operations. The fix ensures proper handling of null values in sheet number processing and guarantees that sheetNo is properly set for writeSheetHolder instances.

  • Added null filtering in the stream processing to prevent NPE when sorting sheet numbers
  • Enhanced sheet initialization to set sheetNo when it's null but the sheet exists
  • Added comprehensive test coverage for sheet creation using sheet names

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
WriteSheetWorkbookWriteHandler.java Added null filtering in stream processing to prevent NPE during sheet sorting
WriteContextImpl.java Enhanced initSheet method to set sheetNo when null but sheet exists
WriteSheetTest.java Added new test method to verify sheet creation with sheet names works correctly

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@psxjoy psxjoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@psxjoy psxjoy merged commit 651d2a4 into apache:main Sep 10, 2025
6 checks passed
@delei delei deleted the issue-564 branch September 10, 2025 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 使用fill功能时, 若第二个writeSheet没有赋值sheetNo, 报错空指针(仅1.3.0)

3 participants