From f16ef429a49fa9ab4520e28d470d76c58967792b Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Thu, 18 May 2006 14:00:11 +0000 Subject: Bugzilla #39607: Bugfix for NPE in RTF library. Submitted by: Julien Aymé MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@407553 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java | 50 +++++++++++----------- 1 file changed, 26 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java index 681ab9a82..25e14d3e9 100644 --- a/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java +++ b/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java @@ -198,36 +198,38 @@ public class RtfTableRow extends RtfContainer implements ITableAttributes { // Adjust the cell's display attributes so the table's/row's borders // are drawn properly. - // get border attributes from table - if (index == 0) { - if (!rtfcell.getRtfAttributes().isSet(ITableAttributes.CELL_BORDER_LEFT)) { - rtfcell.getRtfAttributes().set(ITableAttributes.CELL_BORDER_LEFT, - (RtfAttributes) tableBorderAttributes.getValue( - ITableAttributes.CELL_BORDER_LEFT)); + if (tableBorderAttributes != null) { + // get border attributes from table + if (index == 0) { + String border = ITableAttributes.CELL_BORDER_LEFT; + if (!rtfcell.getRtfAttributes().isSet(border)) { + rtfcell.getRtfAttributes().set(border, + (RtfAttributes) tableBorderAttributes.getValue(border)); + } } - } - if (index == this.getChildCount() - 1) { - if (!rtfcell.getRtfAttributes().isSet(ITableAttributes.CELL_BORDER_RIGHT)) { - rtfcell.getRtfAttributes().set(ITableAttributes.CELL_BORDER_RIGHT, - (RtfAttributes) tableBorderAttributes.getValue( - ITableAttributes.CELL_BORDER_RIGHT)); + if (index == this.getChildCount() - 1) { + String border = ITableAttributes.CELL_BORDER_RIGHT; + if (!rtfcell.getRtfAttributes().isSet(border)) { + rtfcell.getRtfAttributes().set(border, + (RtfAttributes) tableBorderAttributes.getValue(border)); + } } - } - if (isFirstRow()) { - if (!rtfcell.getRtfAttributes().isSet(ITableAttributes.CELL_BORDER_TOP)) { - rtfcell.getRtfAttributes().set(ITableAttributes.CELL_BORDER_TOP, - (RtfAttributes) (RtfAttributes) tableBorderAttributes.getValue( - ITableAttributes.CELL_BORDER_TOP)); + if (isFirstRow()) { + String border = ITableAttributes.CELL_BORDER_TOP; + if (!rtfcell.getRtfAttributes().isSet(border)) { + rtfcell.getRtfAttributes().set(border, + (RtfAttributes) tableBorderAttributes.getValue(border)); + } } - } - if ((parentTable != null) && (parentTable.isHighestRow(id))) { - if (!rtfcell.getRtfAttributes().isSet(ITableAttributes.CELL_BORDER_BOTTOM)) { - rtfcell.getRtfAttributes().set(ITableAttributes.CELL_BORDER_BOTTOM, - (RtfAttributes) tableBorderAttributes.getValue( - ITableAttributes.CELL_BORDER_BOTTOM)); + if ((parentTable != null) && (parentTable.isHighestRow(id))) { + String border = ITableAttributes.CELL_BORDER_BOTTOM; + if (!rtfcell.getRtfAttributes().isSet(border)) { + rtfcell.getRtfAttributes().set(border, + (RtfAttributes) tableBorderAttributes.getValue(border)); + } } } -- cgit v1.2.3