Details
-
Bug
-
Status: Closed
-
Resolution: Fixed
-
0.92
-
None
-
Operating System: Windows XP
Platform: PC
-
39607
Description
The changes in the class RtfTableRow between 0.91 and 0.92 now generate a
NullPointerException,
due to the variable tableBorderAttributes declared at line 189:
RtfAttributes tableBorderAttributes = getTable().getBorderAttributes();
being null when the code:
tableBorderAttributes.getValue(....) (line 209)
is called.
Example of java code which worked under 0.91 and doesn't work anymore:
// Start of class
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfFile;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow;
public class TestFop {
public static void main(String[] args) {
try
catch (IOException ioe)
{ ioe.printStackTrace(); } }
}
//End of class
Stacktrace when the code is executed:
Exception in thread "main" java.lang.NullPointerException
at
org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow.writeRowAndCellsDefintions(RtfTableRow.java:209)
at
org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow.writeRtfContent(RtfTableRow.java:142)
at org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement.writeRtf(RtfElement.java:85)
at
org.apache.fop.render.rtf.rtflib.rtfdoc.RtfContainer.writeRtfContent(RtfContainer.java:134)
at org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement.writeRtf(RtfElement.java:85)
at
org.apache.fop.render.rtf.rtflib.rtfdoc.RtfContainer.writeRtfContent(RtfContainer.java:134)
at org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement.writeRtf(RtfElement.java:85)
at
org.apache.fop.render.rtf.rtflib.rtfdoc.RtfContainer.writeRtfContent(RtfContainer.java:134)
at org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement.writeRtf(RtfElement.java:85)
at
org.apache.fop.render.rtf.rtflib.rtfdoc.RtfContainer.writeRtfContent(RtfContainer.java:134)
at org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement.writeRtf(RtfElement.java:85)
at org.apache.fop.render.rtf.rtflib.rtfdoc.RtfFile.flush(RtfFile.java:218)
at test.TestFop.main(TestFop.java:37)
Simple way to fix this:
add a test to check wether tableBorderAttributes is null.
(I will join the modified RtfTableRow.java later)