fo:marker - unregisterMarker / resetMarker fails

Here should go questions about transforming XML with XSLT and FOP.
bubblez
Posts: 2
Joined: Thu Jan 26, 2006 6:12 pm

fo:marker - unregisterMarker / resetMarker fails

Post by bubblez » Thu Jan 26, 2006 6:22 pm

My question is about the following exception that comes up during the transformation:
java.lang.UnsupportedOperationException
at java.util.AbstractCollection.remove(Object e)
at org.apache.fop.layout.Page.unregisterMarker(Marker marker) in C:\work\alex
\nfop\layout\Page.java:line 261

I have got one page master and one page-master-sequence. in this sequence i draw many table-rows. depending on the type of the row, i use a different xsl template. And one of these templates has a marker in it (it is the chapterTitle-template). After drawing all chapters i want to draw other row-types, but with no marker in it. i think that the exception is thrown because a new page-sequence has began, but there is no marker in this new sequence. is that correct?

my marker looks like:
<fo:marker marker-class-name="headerLeft">
<fo:block font-style="italic" text-align="center" padding="0.2cm">
<xsl:value-of select="@chapterHeaderTitle"/>
</fo:block>
</fo:marker>

and the marker-retrieve in the static headercontent looks like:
<fo:retrieve-marker retrieve-class-name="headerLeft"
retrieve-position="last-starting-within-page"
retrieve-boundary="page-sequence"/>

So, what can i do, to avoid this exception?
Or can anybody explain what this means: 'unregister marker'?

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Re: fo:marker - unregisterMarker / resetMarker fails

Post by sorin_ristache » Fri Jan 27, 2006 6:59 pm

Hello,


bubblez wrote:java.lang.UnsupportedOperationException
at java.util.AbstractCollection.remove(Object e)
at org.apache.fop.layout.Page.unregisterMarker(Marker marker) in C:\work\alex
\nfop\layout\Page.java:line 261
Are you running your own Java application which includes the file Page.java and which uses Apache FOP ? What FOP version are you using ? In version 0.20.5 the org.apache.fop.layout.Page.unregisterMarker method calls markers.remove(marker) and markers is an ArrayList instance. In Java 1.5.0 ArrayList implements its own remove method which does not throw any exception. In Java 1.4.2 AbstractCollection.remove(Object) does not throw the exception directly but through AbstractList.remove(int). Is that the complete stacktrace ?

Regards,
Sorin

bubblez
Posts: 2
Joined: Thu Jan 26, 2006 6:12 pm

nfop built on fop 0.20.5

Post by bubblez » Tue Jan 31, 2006 9:57 am

hello,
I'm using the 'ApacheFop.Net.dll' which is a port from fop to .net. I downloaded the package: nfop-v1.1.0-fop-0.20.5.zip from http://nfop.sourceforge.net.
I'm running an Asp.Net application that uses this dll to convert xml data to FO using an xsl stylesheet.
My JRE version is jre1.5.0_06

The complete stacktrace is:
java.lang.UnsupportedOperationException
at java.util.AbstractCollection.remove(Object e)
at org.apache.fop.layout.Page.unregisterMarker(Marker marker) in C:\work\alex
\nfop\layout\Page.java:line 261
at org.apache.fop.fo.flow.Marker.resetMarker() in C:\work\alex\nfop\fo\flow\M
arker.java:line 152
at org.apache.fop.fo.FONode.resetMarker() in C:\work\alex\nfop\fo\FONode.java
:line 157
at org.apache.fop.fo.FONode.resetMarker() in C:\work\alex\nfop\fo\FONode.java
:line 157
at org.apache.fop.fo.flow.TableRow.resetMarker() in C:\work\alex\nfop\fo\flow
\TableRow.java:line 484
at org.apache.fop.fo.flow.TableRow.layout(Area area) in C:\work\alex\nfop\fo\
flow\TableRow.java:line 368
at org.apache.fop.fo.flow.AbstractTableBody.layout(Area area) in C:\work\alex
\nfop\fo\flow\AbstractTableBody.java:line 236
at org.apache.fop.fo.flow.Table.layout(Area area) in C:\work\alex\nfop\fo\flo
w\Table.java:line 302
at org.apache.fop.fo.flow.AbstractFlow.layout(Area area, Region region) in C:
\work\alex\nfop\fo\flow\AbstractFlow.java:line 154
at org.apache.fop.fo.flow.AbstractFlow.layout(Area area) in C:\work\alex\nfop
\fo\flow\AbstractFlow.java:line 110
at org.apache.fop.fo.pagination.PageSequence.makePage(AreaTree areaTree, Bool
ean isBlankPage, Page currentPage) in C:\work\alex\nfop\fo\pagination\PageSequen
ce.java:line 400
at org.apache.fop.fo.pagination.PageSequence.format(AreaTree areaTree) in C:\
work\alex\nfop\fo\pagination\PageSequence.java:line 338
at org.apache.fop.apps.StreamRenderer.render(PageSequence pageSequence) in C:
\work\alex\nfop\apps\StreamRenderer.java:line 262
at org.apache.fop.fo.FOTreeBuilder.endElement(String uri, String localName, S
tring rawName) in C:\work\alex\nfop\fo\FOTreeBuilder.java:line 223
at org.apache.xerces.parsers.AbstractSAXParser.endElement(QName element, Augm
entations augs) in C:\work\alex\nfop\xerces-2_0_2\src\org\apache\xerces\parsers\
AbstractSAXParser.java:line 579
at org.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(QName element,
Augmentations augs, Boolean isEmpty) in C:\work\alex\nfop\xerces-2_0_2\src\org\a
pache\xerces\impl\XMLNamespaceBinder.java:line 897
at org.apache.xerces.impl.XMLNamespaceBinder.endElement(QName element, Augmen
tations augs) in C:\work\alex\nfop\xerces-2_0_2\src\org\apache\xerces\impl\XMLNa
mespaceBinder.java:line 643
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(QName element,
Augmentations augs, Boolean isEmpty) in C:\work\alex\nfop\xerces-2_0_2\src\org\
apache\xerces\impl\dtd\XMLDTDValidator.java:line 1972
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(QName element, Augme
ntations augs) in C:\work\alex\nfop\xerces-2_0_2\src\org\apache\xerces\impl\dtd\
XMLDTDValidator.java:line 878
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.handleEndElement(QNa
me element, Boolean isEmpty) in C:\work\alex\nfop\xerces-2_0_2\src\org\apache\xe
rces\impl\XMLDocumentFragmentScannerImpl.java:line 1144
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement() in
C:\work\alex\nfop\xerces-2_0_2\src\org\apache\xerces\impl\XMLDocumentFragmentSca
nnerImpl.java:line 987
at org.apache.xerces.impl.FragmentContentDispatcher.dispatch(Boolean complete
) in C:\work\alex\nfop\xerces-2_0_2\src\org\apache\xerces\impl\XMLDocumentFragme
ntScannerImpl.java:line 1445
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Boolean
complete) in C:\work\alex\nfop\xerces-2_0_2\src\org\apache\xerces\impl\XMLDocum
entFragmentScannerImpl.java:line 333
at org.apache.xerces.parsers.DTDConfiguration.parse(Boolean complete) in C:\w
ork\alex\nfop\xerces-2_0_2\src\org\apache\xerces\parsers\DTDConfiguration.java:l
ine 524
at org.apache.xerces.parsers.DTDConfiguration.parse(XMLInputSource source) in
C:\work\alex\nfop\xerces-2_0_2\src\org\apache\xerces\parsers\DTDConfiguration.j
ava:line 580
at org.apache.xerces.parsers.XMLParser.parse(XMLInputSource inputSource) in C
:\work\alex\nfop\xerces-2_0_2\src\org\apache\xerces\parsers\XMLParser.java:line
154
at org.apache.xerces.parsers.AbstractSAXParser.parse(InputSource inputSource)
in C:\work\alex\nfop\xerces-2_0_2\src\org\apache\xerces\parsers\AbstractSAXPars
er.java:line 1169
at org.apache.fop.apps.Driver.render(XMLReader parser, InputSource source) in
C:\work\alex\nfop\apps\Driver.java:line 504
at org.apache.fop.apps.Driver.run()
java.lang.UnsupportedOperationException
at java.util.AbstractCollection.remove(Object e)
at org.apache.fop.layout.Page.unregisterMarker(Marker marker) in C:\work\alex
\nfop\layout\Page.java:line 261
at org.apache.fop.fo.flow.Marker.resetMarker() in C:\work\alex\nfop\fo\flow\M
arker.java:line 152
at org.apache.fop.fo.FONode.resetMarker() in C:\work\alex\nfop\fo\FONode.java
:line 157
at org.apache.fop.fo.FONode.resetMarker() in C:\work\alex\nfop\fo\FONode.java
:line 157
at org.apache.fop.fo.flow.TableRow.resetMarker() in C:\work\alex\nfop\fo\flow
\TableRow.java:line 484
at org.apache.fop.fo.flow.TableRow.layout(Area area) in C:\work\alex\nfop\fo\
flow\TableRow.java:line 368
at org.apache.fop.fo.flow.AbstractTableBody.layout(Area area) in C:\work\alex
\nfop\fo\flow\AbstractTableBody.java:line 236
at org.apache.fop.fo.flow.Table.layout(Area area) in C:\work\alex\nfop\fo\flo
w\Table.java:line 302
at org.apache.fop.fo.flow.AbstractFlow.layout(Area area, Region region) in C:
\work\alex\nfop\fo\flow\AbstractFlow.java:line 154
at org.apache.fop.fo.flow.AbstractFlow.layout(Area area) in C:\work\alex\nfop
\fo\flow\AbstractFlow.java:line 110
at org.apache.fop.fo.pagination.PageSequence.makePage(AreaTree areaTree, Bool
ean isBlankPage, Page currentPage) in C:\work\alex\nfop\fo\pagination\PageSequen
ce.java:line 400
at org.apache.fop.fo.pagination.PageSequence.format(AreaTree areaTree) in C:\
work\alex\nfop\fo\pagination\PageSequence.java:line 338
at org.apache.fop.apps.StreamRenderer.render(PageSequence pageSequence) in C:
\work\alex\nfop\apps\StreamRenderer.java:line 262
at org.apache.fop.fo.FOTreeBuilder.endElement(String uri, String localName, S
tring rawName) in C:\work\alex\nfop\fo\FOTreeBuilder.java:line 223
at org.apache.xerces.parsers.AbstractSAXParser.endElement(QName element, Augm
entations augs) in C:\work\alex\nfop\xerces-2_0_2\src\org\apache\xerces\parsers\
AbstractSAXParser.java:line 579
at org.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(QName element,
Augmentations augs, Boolean isEmpty) in C:\work\alex\nfop\xerces-2_0_2\src\org\a
pache\xerces\impl\XMLNamespaceBinder.java:line 897
at org.apache.xerces.impl.XMLNamespaceBinder.endElement(QName element, Augmen
tations augs) in C:\work\alex\nfop\xerces-2_0_2\src\org\apache\xerces\impl\XMLNa
mespaceBinder.java:line 643
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(QName element,
Augmentations augs, Boolean isEmpty) in C:\work\alex\nfop\xerces-2_0_2\src\org\
apache\xerces\impl\dtd\XMLDTDValidator.java:line 1972
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(QName element, Augme
ntations augs) in C:\work\alex\nfop\xerces-2_0_2\src\org\apache\xerces\impl\dtd\
XMLDTDValidator.java:line 878
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.handleEndElement(QNa
me element, Boolean isEmpty) in C:\work\alex\nfop\xerces-2_0_2\src\org\apache\xe
rces\impl\XMLDocumentFragmentScannerImpl.java:line 1144
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement() in
C:\work\alex\nfop\xerces-2_0_2\src\org\apache\xerces\impl\XMLDocumentFragmentSca
nnerImpl.java:line 987
at org.apache.xerces.impl.FragmentContentDispatcher.dispatch(Boolean complete
) in C:\work\alex\nfop\xerces-2_0_2\src\org\apache\xerces\impl\XMLDocumentFragme
ntScannerImpl.java:line 1445
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Boolean
complete) in C:\work\alex\nfop\xerces-2_0_2\src\org\apache\xerces\impl\XMLDocum
entFragmentScannerImpl.java:line 333
at org.apache.xerces.parsers.DTDConfiguration.parse(Boolean complete) in C:\w
ork\alex\nfop\xerces-2_0_2\src\org\apache\xerces\parsers\DTDConfiguration.java:l
ine 524
at org.apache.xerces.parsers.DTDConfiguration.parse(XMLInputSource source) in
C:\work\alex\nfop\xerces-2_0_2\src\org\apache\xerces\parsers\DTDConfiguration.j
ava:line 580
at org.apache.xerces.parsers.XMLParser.parse(XMLInputSource inputSource) in C
:\work\alex\nfop\xerces-2_0_2\src\org\apache\xerces\parsers\XMLParser.java:line
154
at org.apache.xerces.parsers.AbstractSAXParser.parse(InputSource inputSource)
in C:\work\alex\nfop\xerces-2_0_2\src\org\apache\xerces\parsers\AbstractSAXPars
er.java:line 1169
at org.apache.fop.apps.Driver.render(XMLReader parser, InputSource source) in
C:\work\alex\nfop\apps\Driver.java:line 504
at org.apache.fop.apps.Driver.run()

If i try to generate the pdf with the apache fop.bat version 0.20.5 it will work.

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Re: nfop built on fop 0.20.5

Post by sorin_ristache » Tue Jan 31, 2006 11:15 am

bubblez wrote:I'm using the 'ApacheFop.Net.dll' which is a port from fop to .net. I downloaded the package: nfop-v1.1.0-fop-0.20.5.zip from http://nfop.sourceforge.net.
I'm running an Asp.Net application that uses this dll to convert xml data to FO using an xsl stylesheet.

...

If i try to generate the pdf with the apache fop.bat version 0.20.5 it will work.
I think you should ask this on a .NET related forum.

Regards,
Sorin

Post Reply