You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2006/05/18 16:00:12 UTC
svn commit: r407553 - in /xmlgraphics/fop/trunk:
src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/ test/java/org/apache/fop/
test/java/org/apache/fop/render/rtf/
Author: jeremias
Date: Thu May 18 07:00:11 2006
New Revision: 407553
URL: http://svn.apache.org/viewvc?rev=407553&view=rev
Log:
Bugzilla #39607:
Bugfix for NPE in RTF library.
Submitted by: Julien Aymé <julien.ayme.at.gmail.com>
Added:
xmlgraphics/fop/trunk/test/java/org/apache/fop/render/rtf/Bug39607TestCase.java (with props)
xmlgraphics/fop/trunk/test/java/org/apache/fop/render/rtf/RichTextFormatTestSuite.java (with props)
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java
xmlgraphics/fop/trunk/test/java/org/apache/fop/StandardTestSuite.java
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java?rev=407553&r1=407552&r2=407553&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfTableRow.java Thu May 18 07:00:11 2006
@@ -198,36 +198,38 @@
// 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));
+ }
}
}
Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/StandardTestSuite.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/StandardTestSuite.java?rev=407553&r1=407552&r2=407553&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/StandardTestSuite.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/StandardTestSuite.java Thu May 18 07:00:11 2006
@@ -19,6 +19,7 @@
package org.apache.fop;
import org.apache.fop.render.pdf.PDFAConformanceTestCase;
+import org.apache.fop.render.rtf.RichTextFormatTestSuite;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -39,6 +40,7 @@
suite.addTest(BasicDriverTestSuite.suite());
suite.addTest(UtilityCodeTestSuite.suite());
suite.addTest(new TestSuite(PDFAConformanceTestCase.class));
+ suite.addTest(RichTextFormatTestSuite.suite());
//$JUnit-END$
return suite;
}
Added: xmlgraphics/fop/trunk/test/java/org/apache/fop/render/rtf/Bug39607TestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/render/rtf/Bug39607TestCase.java?rev=407553&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/render/rtf/Bug39607TestCase.java (added)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/render/rtf/Bug39607TestCase.java Thu May 18 07:00:11 2006
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.rtf;
+
+import java.io.StringWriter;
+
+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;
+
+import junit.framework.TestCase;
+
+/**
+ * Test for http://issues.apache.org/bugzilla/show_bug.cgi?id=39607
+ */
+public class Bug39607TestCase extends TestCase {
+
+ /**
+ * Test for the NPE describes in bug 39607
+ * @throws Exception If an error occurs
+ */
+ public void testForNPE() throws Exception {
+ StringWriter writer = new StringWriter();
+ RtfFile f = new RtfFile(writer);
+
+ RtfDocumentArea doc = f.startDocumentArea();
+
+ RtfSection section = doc.newSection();
+
+ RtfParagraph paragraph = section.newParagraph();
+ paragraph.newText("Testing fop - rtf module - class RtfTableRow");
+ paragraph.close();
+
+ RtfTable table = section.newTable(null);
+ RtfTableRow row = table.newTableRow();
+ row.newTableCell(2000).newParagraph().newText("blah");
+ row.newTableCell(5000).newParagraph().newText("doubleBlah");
+ row.close();
+ table.close();
+ section.close();
+ doc.close();
+ f.flush();
+ }
+
+}
Propchange: xmlgraphics/fop/trunk/test/java/org/apache/fop/render/rtf/Bug39607TestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: xmlgraphics/fop/trunk/test/java/org/apache/fop/render/rtf/RichTextFormatTestSuite.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/render/rtf/RichTextFormatTestSuite.java?rev=407553&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/render/rtf/RichTextFormatTestSuite.java (added)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/render/rtf/RichTextFormatTestSuite.java Thu May 18 07:00:11 2006
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.render.rtf;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Test suite for FOP's RTF library.
+ */
+public class RichTextFormatTestSuite {
+
+ /**
+ * Builds the test suite
+ * @return the test suite
+ */
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "Test suite for RTF library");
+ //$JUnit-BEGIN$
+ suite.addTest(new TestSuite(Bug39607TestCase.class));
+ //$JUnit-END$
+ return suite;
+ }
+}
Propchange: xmlgraphics/fop/trunk/test/java/org/apache/fop/render/rtf/RichTextFormatTestSuite.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org