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 20:58:06 UTC

svn commit: r407614 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java test/layoutengine/disabled-testcases.xml test/layoutengine/standard-testcases/table-cell_empty_area_with_marker.xml

Author: jeremias
Date: Thu May 18 11:58:05 2006
New Revision: 407614

URL: http://svn.apache.org/viewvc?rev=407614&view=rev
Log:
Bugfix: NullPointerException in AreaAdditionUtil in a table-cell spanning multiple pages and with a marker.
Note: This is a hack to avoid the NPE. A problem remains. The markers will not be added if the first/last conditions cannot be determined.

Added:
    xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_empty_area_with_marker.xml   (with props)
Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java
    xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java?rev=407614&r1=407613&r2=407614&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java Thu May 18 11:58:05 2006
@@ -85,6 +85,13 @@
                 // pos was created by this LM, so it must be ignored
             }
         }
+        if (firstPos == null) {
+            return; //Nothing to do, return early
+            //TODO This is a hack to avoid an NPE in the code block below.
+            //If there's no firstPos/lastPos there's currently no way to
+            //correctly determine first and last conditions. The Iterator
+            //doesn't give us that info.
+        }
         
         if (bslm != null && bslm.markers != null) {
             bslm.getCurrentPV().addMarkers(bslm.markers, true, 

Modified: xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml?rev=407614&r1=407613&r2=407614&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml (original)
+++ xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml Thu May 18 11:58:05 2006
@@ -330,6 +330,11 @@
     <reference>http://issues.apache.org/bugzilla/show_bug.cgi?id=39560</reference>
   </testcase>
   <testcase>
+    <name>table-cell empty area with marker.xml</name>
+    <file>table-cell_empty_area_with_marker.xml</file>
+    <description>A table-cell producing an empty area does currently not add any markers to a page. See TODO entry in AreaAdditionUtil.</description>
+  </testcase>
+  <testcase>
     <name>Border conditionality on table</name>
     <file>table_border-width_conditionality.xml</file>
     <description>The code should be ok, but the test case uses shorthands and therefore

Added: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_empty_area_with_marker.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_empty_area_with_marker.xml?rev=407614&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_empty_area_with_marker.xml (added)
+++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_empty_area_with_marker.xml Thu May 18 11:58:05 2006
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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$ -->
+<testcase>
+  <info>
+    <p>
+      This test checks long table-cells with markers. This is a regression check for a bug
+      reported on fop-users.
+    </p>
+  </info>
+  <fo>
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+      <fo:layout-master-set>
+        <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
+          <fo:region-body margin-top="0.5in"/>
+          <fo:region-before extent="0.5in"/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:page-sequence master-reference="normal" font-size="20pt">
+        <fo:static-content flow-name="xsl-region-before">
+          <fo:block text-align="end" background-color="yellow">
+            Marker: <fo:retrieve-marker retrieve-class-name="somemarker" retrieve-boundary="page" retrieve-position="last-ending-within-page"/>
+          </fo:block>
+        </fo:static-content>
+        <fo:flow flow-name="xsl-region-body">
+          <fo:table table-layout="fixed" width="100%">
+            <fo:table-column column-width="2in" number-columns-repeated="3"/>
+            <fo:table-body>
+              <fo:table-row>
+                <fo:table-cell background-color="orange">
+                  <!-- This marker caused a NPE in AreaAdditionUtil while painting the empty cell on the second page. -->
+                  <fo:marker marker-class-name="somemarker">Blah!</fo:marker>
+                  <fo:block>cell1</fo:block>
+                </fo:table-cell>
+                <fo:table-cell>
+                  <fo:block>cell2</fo:block>
+                  <fo:block>cell2</fo:block>
+                  <fo:block>cell2</fo:block>
+                  <fo:block>cell2</fo:block>
+                  <fo:block>cell2</fo:block>
+                  <fo:block>cell2</fo:block>
+                  <fo:block>cell2</fo:block>
+                  <fo:block>cell2</fo:block>
+                  <fo:block>cell2</fo:block>
+                  <fo:block>cell2</fo:block>
+                  <fo:block>cell2</fo:block>
+                  <fo:block>cell2</fo:block>
+                  <fo:block>cell2</fo:block>
+                  <fo:block>cell2</fo:block>
+                  <fo:block>cell2</fo:block>
+                  <fo:block>cell2</fo:block>
+                  <fo:block>cell2</fo:block>
+                </fo:table-cell>
+                <fo:table-cell>
+                  <fo:block>cell3</fo:block>
+                </fo:table-cell>
+              </fo:table-row>
+            </fo:table-body>
+          </fo:table>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
+  </fo>
+  <checks>
+    <eval expected="2" xpath="count(//pageViewport)"/>
+    <eval expected="Marker: Blah!" xpath="//pageViewport[@nr=1]//regionBefore"/>
+    <eval expected="Marker: Blah!" xpath="//pageViewport[@nr=2]//regionBefore"/>
+  </checks>
+</testcase>

Propchange: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_empty_area_with_marker.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-cell_empty_area_with_marker.xml
------------------------------------------------------------------------------
    svn:keywords = Id



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org