Skip to content

Prevent NullPointerException in XWPFTable.getWidthType().#912

Merged
pjfanning merged 1 commit intoapache:trunkfrom
jaragunde:table-width-null
Oct 1, 2025
Merged

Prevent NullPointerException in XWPFTable.getWidthType().#912
pjfanning merged 1 commit intoapache:trunkfrom
jaragunde:table-width-null

Conversation

@jaragunde
Copy link
Contributor

According to the spec in section "17.4.63 tblW (Preferred Table Width)", the element tblW is not compulsory and "If this element is omitted, then the cell width shall be of type auto."

We modify the getter to follow this behavior, preventing a NPE.

It implies a change of behavior in the situation when there is no tblPr, in that case it used to return NIL, but notice that this behavior was introduced in commit d4fc5cd and has never been part of a release.

According to the spec in section "17.4.63 tblW (Preferred Table Width)",
the element tblW is not compulsory and "If this element is omitted, then
the cell width shall be of type auto."

We modify the getter to follow this behavior, preventing a NPE.

It implies a change of behavior in the situation when there is no tblPr,
in that case it used to return NIL, but notice that this behavior was
introduced in commit d4fc5cd and has
never been part of a release.
Copy link
Member

@pjfanning pjfanning left a comment

Choose a reason for hiding this comment

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

lgtm - merged

@pjfanning pjfanning merged commit 79d1630 into apache:trunk Oct 1, 2025
1 check passed
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.

2 participants