From 03f65a7b8b6d294cff0a6888b466e72da83fead2 Mon Sep 17 00:00:00 2001 From: Glenn Adams Date: Wed, 11 Apr 2012 21:29:51 +0000 Subject: [PATCH] Bugzilla #52763: Support list-block in marker, thus preventing NPE. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1325016 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/fo/flow/AbstractRetrieveMarker.java | 25 ++++-- status.xml | 3 + .../standard-testcases/markers_9.xml | 78 +++++++++++++++++++ 3 files changed, 100 insertions(+), 6 deletions(-) create mode 100644 test/layoutengine/standard-testcases/markers_9.xml diff --git a/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java b/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java index 51ae7441d..62c821504 100644 --- a/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java +++ b/src/java/org/apache/fop/fo/flow/AbstractRetrieveMarker.java @@ -103,17 +103,30 @@ public abstract class AbstractRetrieveMarker extends FObjMixed { pList, newPropertyList); addChildTo(newChild, newParent); - if (newChild.getNameId() == FO_TABLE) { + switch ( newChild.getNameId() ) { + case FO_TABLE: Table t = (Table) child; cloneSubtree(t.getColumns().iterator(), - newChild, marker, newPropertyList); + newChild, marker, newPropertyList); cloneSingleNode(t.getTableHeader(), - newChild, marker, newPropertyList); + newChild, marker, newPropertyList); cloneSingleNode(t.getTableFooter(), - newChild, marker, newPropertyList); + newChild, marker, newPropertyList); + cloneSubtree(child.getChildNodes(), + newChild, marker, newPropertyList); + break; + case FO_LIST_ITEM: + ListItem li = (ListItem) child; + cloneSingleNode(li.getLabel(), + newChild, marker, newPropertyList); + cloneSingleNode(li.getBody(), + newChild, marker, newPropertyList); + break; + default: + cloneSubtree(child.getChildNodes(), + newChild, marker, newPropertyList); + break; } - cloneSubtree(child.getChildNodes(), newChild, - marker, newPropertyList); } else if (child instanceof FOText) { FOText ft = (FOText) newChild; ft.bind(parentPropertyList); diff --git a/status.xml b/status.xml index c6b3e22f9..9cb50efbd 100644 --- a/status.xml +++ b/status.xml @@ -62,6 +62,9 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> + + Support list-block in marker, thus preventing NPE. + Must use unqualified (local name) when reporting invalid child error. diff --git a/test/layoutengine/standard-testcases/markers_9.xml b/test/layoutengine/standard-testcases/markers_9.xml new file mode 100644 index 000000000..65eb8bbf0 --- /dev/null +++ b/test/layoutengine/standard-testcases/markers_9.xml @@ -0,0 +1,78 @@ + + + + + +

+ This test checks markers containing list-block. Seel also bug 52763. +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + A + + + BODY A + + + + + B + + + BODY B + + + + + + + + + + + + + + + + + +
-- 2.39.5