cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From beyaNet Consultancy <beya...@ntlworld.com>
Subject org.apache.cocoon.ProcessingException: Failed to execute pipeline.: java.lang.IllegalArgumentException: Width (0) and height (0) cannot be <= 0 Batik SVG cocoon bug???
Date Sun, 21 Mar 2004 12:11:52 GMT
Hi,
I think that i may have stumbled on a bug with usage of SVG in cocoon.  
I have a pipeline which takes in a jpg:

			<map:match pattern="**artistImage/*/*.jpg">
			 <map:generate type="serverpages" src="xsp/svg.xsp">
				<map:parameter name="imageNum" value="{3}"/>
				<map:parameter name="artistID" value="{2}"/>
			 </map:generate>
				<map:serialize type="svg2jpeg"/>			
			</map:match>

This in turn causes xsp:/svg.xsp to be processed. The code in svg.xsp  
is:

<xsp:structure>
    <xsp:include>test.ArtistImages</xsp:include>
</xsp:structure>

<svg width="100" height="100">
	<xsp:logic>
		String base64 = null;
		String width = "300";
		String height = "300";
		
		try {
			int imageNum = Integer.parseInt(<util:get-sitemap-parameter  
name="imageNum"/>);
			int artistID = Integer.parseInt(<util:get-sitemap-parameter  
name="artistID"/>);
		
			<!-- request made to static object -->
			base64 = ArtistImages.getArtistImage(artistID,imageNum);
			
		}catch (Exception e) {
			width = "100";
			height = "100";
			
			<!-- request made to static object -->
			base64 = ArtistImages.getArtistImage(<util:get-sitemap-parameter  
name="imageNum"/>);
			
		}
		
		<!-- spit the image back to the browser requester -->
		<xsp:element name="image">
			<xsp:attribute name="x">0</xsp:attribute>
			<xsp:attribute name="y">0</xsp:attribute>
			<xsp:attribute  
name="width"><xsp:expr>width</xsp:expr></xsp:attribute>
			<xsp:attribute  
name="height"><xsp:expr>height</xsp:expr></xsp:attribute>
			<xsp:attribute  
name="xlink:href">data:image/jpeg;base64,<xsp:expr>base64</xsp:expr></ 
xsp:attribute>
		</xsp:element>
	</xsp:logic>
</svg>

The problem lays with the width and height attributes of the svg tag  
being specified as percentages. I specified them as so because I wanted  
the canvas size to same size as the image size. This causes the above  
mentioned error to be thrown. If I replace the width and height with  
whole sizes the problem is rectified. What is happening here as I know  
that Percentages are valid for the width and height of an svg!??

The full exception stack trace is:

Original Exception: java.lang.IllegalArgumentException: Width (0) and  
height (0) cannot be <= 0
	at  
org.apache.cocoon.serialization.SVGSerializer.notify(SVGSerializer.java: 
246)
	at  
org.apache.cocoon.xml.dom.SVGBuilder.endDocument(SVGBuilder.java:166)
	at  
org.apache.cocoon.www.beyarecords.xsp.svg_xsp.generate(org.apache.cocoon 
.www.beyarecords.xsp.svg_xsp:283)
	at  
org.apache.cocoon.generation.ServerPagesGenerator.generate(ServerPagesGe 
nerator.java:263)
	at  
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process 
XMLPipeline(AbstractProcessingPipeline.java:573)
	at  
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipe 
line.processXMLPipeline(AbstractCachingProcessingPipeline.java:196)
	at  
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process 
(AbstractProcessingPipeline.java:525)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke( 
SerializeNode.java:155)
	at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:84)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.i 
nvoke(PreparableMatchNode.java:165)
	at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:107)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(P 
ipelineNode.java:162)
	at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:107)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke( 
PipelinesNode.java:136)
	at  
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro 
cessor.java:371)
	at  
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro 
cessor.java:312)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(Moun 
tNode.java:133)
	at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:84)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.i 
nvoke(PreparableMatchNode.java:165)
	at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:107)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(P 
ipelineNode.java:162)
	at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:107)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke( 
PipelinesNode.java:136)
	at  
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro 
cessor.java:371)
	at  
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro 
cessor.java:312)
	at org.apache.cocoon.Cocoon.process(Cocoon.java:656)
	at  
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java: 
1112)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
	at  
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica 
tionFilterChain.java:284)
	at  
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt 
erChain.java:204)
	at  
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv 
e.java:257)
	at  
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo 
ntext.java:151)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
564)
	at  
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCon 
textValve.java:245)
	at  
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv 
e.java:199)
	at  
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo 
ntext.java:151)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
564)
	at  
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java 
:195)
	at  
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo 
ntext.java:151)
	at  
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java 
:164)
	at  
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo 
ntext.java:149)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
564)
	at  
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. 
java:156)
	at  
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo 
ntext.java:151)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
564)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
	at  
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
	at  
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:324)
	at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:395)
	at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:673)
	at  
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java: 
615)
	at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:786)
	at  
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool 
.java:683)
	at java.lang.Thread.run(Thread.java:552)

Original Exception: java.lang.IllegalArgumentException: Width (0) and  
height (0) cannot be <= 0
	at  
java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectCol 
orModel.java:999)
	at java.awt.image.BufferedImage.<init>(BufferedImage.java:250)
	at  
org.apache.batik.transcoder.image.JPEGTranscoder.createImage(Unknown  
Source)
	at org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown  
Source)
	at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown  
Source)
	at  
org.apache.cocoon.serialization.SVGSerializer.notify(SVGSerializer.java: 
240)
	at  
org.apache.cocoon.xml.dom.SVGBuilder.endDocument(SVGBuilder.java:166)
	at  
org.apache.cocoon.www.beyarecords.xsp.svg_xsp.generate(org.apache.cocoon 
.www.beyarecords.xsp.svg_xsp:283)
	at  
org.apache.cocoon.generation.ServerPagesGenerator.generate(ServerPagesGe 
nerator.java:263)
	at  
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process 
XMLPipeline(AbstractProcessingPipeline.java:573)
	at  
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipe 
line.processXMLPipeline(AbstractCachingProcessingPipeline.java:196)
	at  
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process 
(AbstractProcessingPipeline.java:525)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke( 
SerializeNode.java:155)
	at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:84)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.i 
nvoke(PreparableMatchNode.java:165)
	at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:107)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(P 
ipelineNode.java:162)
	at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:107)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke( 
PipelinesNode.java:136)
	at  
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro 
cessor.java:371)
	at  
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro 
cessor.java:312)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(Moun 
tNode.java:133)
	at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:84)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.i 
nvoke(PreparableMatchNode.java:165)
	at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:107)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(P 
ipelineNode.java:162)
	at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:107)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke( 
PipelinesNode.java:136)
	at  
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro 
cessor.java:371)
	at  
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro 
cessor.java:312)
	at org.apache.cocoon.Cocoon.process(Cocoon.java:656)
	at  
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java: 
1112)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
	at  
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica 
tionFilterChain.java:284)
	at  
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt 
erChain.java:204)
	at  
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv 
e.java:257)
	at  
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo 
ntext.java:151)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
564)
	at  
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCon 
textValve.java:245)
	at  
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv 
e.java:199)
	at  
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo 
ntext.java:151)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
564)
	at  
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java 
:195)
	at  
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo 
ntext.java:151)
	at  
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java 
:164)
	at  
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo 
ntext.java:149)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
564)
	at  
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. 
java:156)
	at  
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo 
ntext.java:151)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
564)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
	at  
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
	at  
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:324)
	at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:395)
	at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:673)
	at  
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java: 
615)
	at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:786)
	at  
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool 
.java:683)
	at java.lang.Thread.run(Thread.java:552)

many thanks in advance
Mime
View raw message