From 23b770464a4f6a336d65fbf9e92f067fedfe3993 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Sun, 23 Apr 2006 11:35:19 +0000 Subject: [PATCH] Bugfix: Fixed ClassCastException when retrieve-marker is used as a direct child if static-content in which case leading and trailing white space is not properly removed. Note: This is probably more a hack than anything else, but it fixes the problem for now. If anyone has a better solution, please feel free to improve. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@396256 13f79535-47bb-0310-9956-ffa450edef68 --- .../layoutmgr/StaticContentLayoutManager.java | 7 ++- status.xml | 5 ++ .../marker_white-space_static-content.xml | 53 +++++++++++++++++++ 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 test/layoutengine/standard-testcases/marker_white-space_static-content.xml diff --git a/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java index f6071da30..acbf43e0f 100644 --- a/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 The Apache Software Foundation. + * Copyright 1999-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. @@ -30,6 +30,7 @@ import org.apache.fop.fo.pagination.PageSequence; import org.apache.fop.fo.pagination.SideRegion; import org.apache.fop.fo.pagination.StaticContent; import org.apache.fop.layoutmgr.inline.InlineLevelLayoutManager; +import org.apache.fop.layoutmgr.inline.TextLayoutManager; import org.apache.fop.traits.MinOptMax; /** @@ -302,10 +303,12 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager { childLC.setWritingMode(context.getWritingMode()); LinkedList returnedList = null; + //The following is a HACK! Ignore leading and trailing white space + boolean ignore = curLM instanceof TextLayoutManager; if (!curLM.isFinished()) { returnedList = curLM.getNextKnuthElements(childLC, alignment); } - if (returnedList != null) { + if (returnedList != null && !ignore) { lm.wrapPositionElements(returnedList, returnList); } } diff --git a/status.xml b/status.xml index d3a081017..795b17582 100644 --- a/status.xml +++ b/status.xml @@ -27,6 +27,11 @@ + + Bugfix: Fixed ClassCastException when retrieve-marker is used as a direct child + if static-content in which case leading and trailing white space is not properly + removed. + Bugfix: Fixed OutOfMemoryException with long data URLs (RFC 2397). diff --git a/test/layoutengine/standard-testcases/marker_white-space_static-content.xml b/test/layoutengine/standard-testcases/marker_white-space_static-content.xml new file mode 100644 index 000000000..51e7a992d --- /dev/null +++ b/test/layoutengine/standard-testcases/marker_white-space_static-content.xml @@ -0,0 +1,53 @@ + + + + + +

+ This test is a regression check for a ClassCastException which occured because + white-space before and after a block in a marker wasn't removed when it's + copied into a static-contant element through retrieve-marker. The element list + returned contained InlineKnuthSequences which cause the ClassCastException in + wrapPositionElements(). +

+
+ + + + + + + + + + + + + + + x + + Blah blah + + + + + + + + +
-- 2.39.5