DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22408>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22408

Nullpointer Exception when using units in svg:use

           Summary: Nullpointer Exception when using units in svg:use
           Product: Fop
           Version: 0.20.5
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: svg
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Hello,

I'm trying to render the follwing code using FOP 0.20.5 (Platform is Win2k, 
j2sdk1.4.0).

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
        <fo:layout-master-set>
                <fo:simple-page-master master-name="title-page" page-
width="21cm" page-height="29.7cm" margin-top="6cm" margin-bottom="2px" margin-
left="2cm" margin-right="2cm">
                        <fo:region-body margin-top="0px"></fo:region-body>
                </fo:simple-page-master>
                <fo:page-sequence-master master-name="title">
                        <fo:single-page-master-reference master-
reference="title-page"></fo:single-page-master-reference>
                </fo:page-sequence-master>
        </fo:layout-master-set>
        <fo:page-sequence master-reference="title">
                <fo:flow flow-name="xsl-region-body">
                        <fo:block>
                                <fo:instream-foreign-object>
                                        <svg:svg viewBox="0 0 100 100" 
width="100" height="50" xmlns:svg="http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink";>
                                        <svg:defs>
                                                <svg:polygon id="Star" points="-
4,-1 -1,-1 0,-4 1,-1 4,-1 2,1 3,4 0,2 -3,4 -2,1"/>
                                        </svg:defs>
                                        <svg:rect width="100" height="100" 
x="0" y="0" fill="yellow"/>
                                        <svg:use x="50%" y="50%" 
xlink:href="#Star" style="fill:limegreen;stroke:black;stroke-width:0.7px;"/>
                                        </svg:svg>
                                </fo:instream-foreign-object>
                        </fo:block>
                </fo:flow>
        </fo:page-sequence>
</fo:root>

when executing FOP with:

fop svgUse.fo test.pdf

I get the following NullpointerException:

[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] FOP 0.20.5
[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] building formatting object tree
[INFO] setting up fonts
[INFO] [1]
[ERROR] svg graphic could not be built: null
java.lang.NullPointerException
        at org.apache.batik.bridge.UnitProcessor$DefaultContext.getViewportWidth
(UnitProcessor.java:382)
        at org.apache.batik.util.UnitProcessor.percentagesToPixels
(UnitProcessor.java:223)
        at org.apache.batik.util.UnitProcessor.svgToUserSpace
(UnitProcessor.java:166)
        at org.apache.batik.util.UnitProcessor.svgToUserSpace
(UnitProcessor.java:131)
        at org.apache.batik.bridge.UnitProcessor.svgToUserSpace
(UnitProcessor.java:313)
        at 
org.apache.batik.bridge.UnitProcessor.svgHorizontalCoordinateToUserSpace
(UnitProcessor.java:247)
        at org.apache.batik.bridge.SVGUseElementBridge.computeTransform
(SVGUseElementBridge.java:178)
        at org.apache.batik.bridge.SVGUseElementBridge.createGraphicsNode
(SVGUseElementBridge.java:152)
        at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode
(GVTBuilder.java:182)
        at org.apache.batik.bridge.GVTBuilder.buildComposite
(GVTBuilder.java:148)
        at org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:76)
        at org.apache.fop.render.pdf.PDFRenderer.renderSVGDocument
(PDFRenderer.java:590)
        at org.apache.fop.render.pdf.PDFRenderer.renderSVGArea
(PDFRenderer.java:549)
        at org.apache.fop.svg.SVGArea.render(SVGArea.java:98)
        at org.apache.fop.render.pdf.PDFRenderer.renderForeignObjectArea
(PDFRenderer.java:533)
        at org.apache.fop.layout.inline.ForeignObjectArea.render
(ForeignObjectArea.java:89)
        at org.apache.fop.render.AbstractRenderer.renderLineArea
(AbstractRenderer.java:516)
        at org.apache.fop.layout.LineArea.render(LineArea.java:519)
        at org.apache.fop.render.AbstractRenderer.renderBlockArea
(AbstractRenderer.java:485)
        at org.apache.fop.layout.BlockArea.render(BlockArea.java:117)
        at org.apache.fop.render.AbstractRenderer.renderAreaContainer
(AbstractRenderer.java:451)
        at org.apache.fop.layout.ColumnArea.render(ColumnArea.java:71)
        at org.apache.fop.render.AbstractRenderer.renderSpanArea
(AbstractRenderer.java:100)
        at org.apache.fop.layout.SpanArea.render(SpanArea.java:94)
        at org.apache.fop.render.AbstractRenderer.renderBodyAreaContainer
(AbstractRenderer.java:368)
        at org.apache.fop.layout.BodyAreaContainer.render
(BodyAreaContainer.java:137)
        at org.apache.fop.render.AbstractRenderer.renderRegions
(AbstractRenderer.java:529)
        at org.apache.fop.render.pdf.PDFRenderer.renderPage
(PDFRenderer.java:904)
        at org.apache.fop.render.pdf.PDFRenderer.render(PDFRenderer.java:880)
        at org.apache.fop.apps.StreamRenderer.queuePage(StreamRenderer.java:302)
        at org.apache.fop.layout.AreaTree.addPage(AreaTree.java:108)
        at org.apache.fop.fo.pagination.PageSequence.makePage
(PageSequence.java:415)
        at org.apache.fop.fo.pagination.PageSequence.format
(PageSequence.java:338)
        at org.apache.fop.apps.StreamRenderer.render(StreamRenderer.java:262)
        at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:223)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown 
Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement
(Unknown Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.
dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument
(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.fop.apps.Driver.render(Driver.java:498)
        at org.apache.fop.apps.CommandLineStarter.run
(CommandLineStarter.java:106)
        at org.apache.fop.apps.Fop.main(Fop.java:62)
[INFO] Parsing of document complete, stopping renderer

I tested the same svg code in Batik's SVG Viewer Batik-Squiggle without any 
problem. 

When I remove the '%' from the positioning attributes x and y of svg:use, there 
is no problem, except from the fact that the image that is produced is not what 
I meant. The same problem exists when I use 'cm' instead of '%'.

I first posted this question in Batik's mailinglist. We concluded that the 
problem lies within FOP, it seems that "FOP doesn't pass the svg element to 
Batiks bridge".

Any suggestions?

thanx & greetings

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to