Bug 59030 - Nullpointer Exception while accessing table cell alignment
Summary: Nullpointer Exception while accessing table cell alignment
Alias: None
Product: POI
Classification: Unclassified
Component: XWPF (show other bugs)
Version: 3.14-dev
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2016-02-19 07:26 UTC by Prasadu
Modified: 2017-02-08 18:38 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Prasadu 2016-02-19 07:26:29 UTC
By Default, table cell doesn't have alignment details even though it is
considered as TOP alignment in MS-WORD. So which accessing cell alignment, the method XWPFTableCell.getVerticalAlignment() is throwing nullpointerException
Comment 1 Prasadu 2016-02-19 07:28:32 UTC
I already fixed. Please refer https://github.com/apache/poi/pull/30
Comment 2 Tim Allison 2016-02-19 15:51:20 UTC

Thank you for the pull request w/ test document.  I made a small modification to return "null" if nothing is specified.  I agree that the Word Application assumes TOP if alignment is not specified, but I'd like to keep the code closer to the xml.

If others disagree, we can change it back.

The mods you suggest do fix the NPE, and I've included your test and test docx.  Thank you!
Comment 3 Javen O'Neal 2017-02-08 18:38:56 UTC
Behavior changed to return default of XWPFVertAlign in r1746625.
Restored original behavior to return null if alignment is not set in r1782130 and r1782225.