]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Avoid with certain NPEs.
authorJeremias Maerki <jeremias@apache.org>
Mon, 1 Nov 2004 12:39:14 +0000 (12:39 +0000)
committerJeremias Maerki <jeremias@apache.org>
Mon, 1 Nov 2004 12:39:14 +0000 (12:39 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198119 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/render/rtf/TableAttributesConverter.java
src/java/org/apache/fop/render/rtf/TextAttributesConverter.java
src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java

index 8310f86bc5a0e94b2a0097a7f8ba9e94b3a6b21e..7ccc49ed500a54f7cbcf883dbae4e59bb9bb7d42 100644 (file)
@@ -119,10 +119,11 @@ public class TableAttributesConverter {
 
         // Cell background color
         ColorType color = fobj.getCommonBorderPaddingBackground().backgroundColor;
-        if (color.getAlpha() != 0
-               || color.getRed() != 0
-               || color.getGreen() != 0
-               || color.getBlue() != 0) {
+        if ((color != null) 
+                && (color.getAlpha() != 0
+                        || color.getRed() != 0
+                        || color.getGreen() != 0
+                        || color.getBlue() != 0)) {
             attrib.set(ITableAttributes.CELL_COLOR_BACKGROUND, color);
         }
 
index 004281416522f01c154b114faa600b8ee0474cdc..5df06ed1ce858c1c62ec589ee0efa5bf83266e02 100644 (file)
@@ -132,7 +132,7 @@ class TextAttributesConverter {
     private static void attrFont(CommonFont font, FOPRtfAttributes rtfAttr) {
         rtfAttr.set(RtfText.ATTR_FONT_FAMILY,
                 RtfFontManager.getInstance().getFontNumber(font.fontFamily));
-        rtfAttr.set("fs", font.fontSize);
+        rtfAttr.set(RtfText.ATTR_FONT_SIZE, font.fontSize);
 
         if (font.fontWeight.equals("bold") || font.fontWeight.equals("700")) {
             rtfAttr.set("b", 1);
@@ -230,10 +230,11 @@ class TextAttributesConverter {
            default here. Changing FOP's default to "white" causes problems in
            PDF output, so we will look for the default here & change it to
            "auto". */
-        if ((fopValue.getRed() == 0)
+        if ((fopValue == null)
+                || ((fopValue.getRed() == 0)
                 && (fopValue.getGreen() == 0)
                 && (fopValue.getBlue() == 0)
-                && (fopValue.getAlpha() == 0)) {
+                && (fopValue.getAlpha() == 0))) {
             return;
         } else {
             rtfColor = convertFOPColorToRTF(fopValue);
index 14ee7c5af4e8a8b9e6b006a726e5ee4b071e8ad0..681b075408144f7af662ae76ab0c083df2506fa7 100644 (file)
@@ -264,7 +264,7 @@ public class RtfTableRow extends RtfContainer implements ITableAttributes {
                     }
                 }
 
-                if (parentTable.isHighestRow(id)) {
+                if ((parentTable != null) && (parentTable.isHighestRow(id))) {
                     if (!cell.getRtfAttributes().isSet(ITableAttributes.CELL_BORDER_BOTTOM)) {
                         cell.getRtfAttributes().set(ITableAttributes.CELL_BORDER_BOTTOM,
                             (String)attrib.getValue(ITableAttributes.ROW_BORDER_BOTTOM));