Prevent NPE on XWPFTableCell.getWidth() when tcW is not set.#1185
Prevent NPE on XWPFTableCell.getWidth() when tcW is not set.#1185jaragunde wants to merge 1 commit into
Conversation
Returns -1 mirroring the behavior of XWPFTable.getWidth(), although getWidthDecimal() returns 0 in that case, for both XWPFTable and XWPFTableCell. The standard implies, in a roundabout way, that the value should default to 0 but -1 can be, and may have already been, used as a marker of "presence" by clients of the POI API.
|
@pjfanning I would like to know your opinion about returning -1 or 0 for Heads-up: I will still work a bit on this topic; while I was testing this I realized it's possible to crash with NPE if the tcW element of the cell is set but empty. |
|
@jaragunde I wouldn't favour changing the existing method to return -1 when it never did before. Breaks backward compatibility. Introduce a new method or overload this method but include a new param, maybe a boolean, to control whether -1 or an exception is thrown in the not set case. |
Returns -1 mirroring the behavior of XWPFTable.getWidth(), although getWidthDecimal() returns 0 in that case, for both XWPFTable and XWPFTableCell. The standard implies, in a roundabout way, that the value should default to 0 but -1 can be, and may have already been, used as a marker of "presence" by clients of the POI API.