xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Chow <eric...@gmail.com>
Subject BUG or ...... [ERROR] java.lang.ArrayIndexOutOfBoundsException: -2
Date Tue, 03 May 2005 09:35:33 GMT
Hello,


I don't know why it will raised the "java.lang.ArrayIndexOutOfBoundsException".

The problem always be raised when the XML record over 1. Please check
the following XSL and XML.

if there is only one <ot> record, no problem at all. I am using
fop-0.20.5 in WinXP with jdk1.4.2.


[code]
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
exclude-result-prefixes="fo">
  <xsl:output method="xml" version="1.0" omit-xml-declaration="no"
indent="yes"/>
  
	<!-- ========================= -->
	<!-- root element: otrecord -->
	<!-- ========================= -->
	<xsl:template match="otrecord">
    	
  	
    
		<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
			<fo:layout-master-set>
				<fo:simple-page-master master-name="simpleA4" page-height="29.7cm"
page-width="21cm" margin-top="2cm" margin-bottom="2cm"
margin-left="1.5cm" margin-right="1.5cm">
					<fo:region-body/>				
      			
      			<fo:region-after extent="1cm"/>
      			
				</fo:simple-page-master>
			</fo:layout-master-set>
	      
	      <fo:page-sequence master-reference="simpleA4">
	      	<fo:static-content flow-name="xsl-region-after">
	  				<fo:block font-family="kai" font-size="10pt" text-align="start" >
	  					<fo:table table-layout="fixed">
							<fo:table-column column-width="2cm"/>
							<fo:table-column column-width="3cm"/>
							<fo:table-column column-width="6cm"/>
							<fo:table-column column-width="5cm"/>
							
							<fo:table-body>
								<fo:table-row>
									<fo:table-cell>
        								<fo:block text-align="right" padding="1mm">
          								日期 Data:
        								</fo:block>
        							</fo:table-cell>
        							<fo:table-cell paddding="1mm">
        								<fo:block text-align="center"
border-bottom-style="solid" border-bottom-width="0.5pt">
          								<xsl:value-of select="properties/date"/>
        								</fo:block>
      							</fo:table-cell>
      						
									<fo:table-cell>
        								<fo:block text-align="right" padding="1mm">
          								簽名 Assinatura:
        								</fo:block>
        							</fo:table-cell>
        							
        							<fo:table-cell>	
        								<fo:block text-align="start" padding="1mm"
border-bottom-style="solid" border-bottom-width="0.5pt">
          								&#160;
        								</fo:block>
      							</fo:table-cell>
      						</fo:table-row>
      						
							</fo:table-body>	  				
	  					</fo:table>	  					
	  				</fo:block>
				</fo:static-content>
	      
				<fo:flow flow-name="xsl-region-body">
					<fo:block font-family="kai" font-size="10pt" >
						
					
	          		<fo:block font-size="14pt"
text-align="center">資訊處人員超時工作記錄</fo:block>
	          		<fo:block font-size="14pt" space-after="0.5cm"
text-align="center" font-weight="bold">
	          			Lista das Horas Extraordiárias do Pessoal da DINF
	          		</fo:block>
	                    	
						<xsl:call-template name="showProperties"/>
							
						
						<fo:table table-layout="fixed">
							<fo:table-column column-width="1cm"/>
							<fo:table-column column-width="2cm"/>
							<fo:table-column column-width="2cm"/>					
							<fo:table-column column-width="2.2cm"/>
							<fo:table-column column-width="2.2cm"/>
							<fo:table-column column-width="8.5cm"/>
						
							<fo:table-body>
								
								<xsl:call-template name="showTableHeader"/>
								
								
								<xsl:call-template name="showTableContents"/>
																
								
							</fo:table-body>
						</fo:table>
					</fo:block>
				</fo:flow>
			</fo:page-sequence>
		</fo:root>
	</xsl:template>
  
  
  
  <!-- ========================= -->
  <!-- showProperties     -->
  <!-- ========================= -->
	<xsl:template name="showProperties">
		<fo:block space-after="0.5cm">
			<fo:table table-layout="fixed">
				<fo:table-column column-width="2cm"/>
            <fo:table-column column-width="1.5cm"/>
            <fo:table-column column-width="2cm"/>
            <fo:table-column column-width="1.3cm"/>
            <fo:table-column column-width="2.5cm"/>
            <fo:table-column column-width="8cm"/>
				
				<fo:table-body>
					
					<fo:table-row>
						<fo:table-cell>
        					<fo:block text-align="right">
          					年Ano:
        					</fo:block>
      				</fo:table-cell>
					
      				<fo:table-cell>
        					<fo:block text-align="left" border-bottom-style="solid"
border-bottom-width="0.5pt" border-color="black">
        						<xsl:call-template name="space">
									<xsl:with-param name="num" select="1"/>
								</xsl:call-template> 
        						
          					<xsl:value-of select="properties/year"/>
          					          					
        					</fo:block>
      				</fo:table-cell>
      				
      				
      				<fo:table-cell>
        					<fo:block text-align="right">
          					月Mês: 
        					</fo:block>
      				</fo:table-cell>
					
      				<fo:table-cell>
        					<fo:block text-align="left" border-bottom-style="solid"
border-bottom-width="0.5pt" border-color="black">
        						<xsl:call-template name="space">
									<xsl:with-param name="num" select="1"/>
								</xsl:call-template> 
        						
          					<xsl:value-of select="properties/month"/>

        					</fo:block>
      				</fo:table-cell>
      				
      				
      				<fo:table-cell>
        					<fo:block text-align="right">
          					姓名Nome: 
        					</fo:block>
      				</fo:table-cell>
					
      				<fo:table-cell>
        					<fo:block text-align="left" border-bottom-style="solid"
border-bottom-width="0.5pt" border-color="black">
        						<xsl:call-template name="space">
									<xsl:with-param name="num" select="1"/>
								</xsl:call-template> 
        						
          					<xsl:value-of select="properties/name"/>
          					
        					</fo:block>
      				</fo:table-cell>
      				
      				
					</fo:table-row>
				</fo:table-body>
			</fo:table>
		</fo:block>
					
	</xsl:template>
  
  
  
	<xsl:template name="showTableHeader">													
			<fo:table-row>
				<fo:table-cell 
						border-style="solid" 
						border-width="0.1pt" 
						number-rows-spanned="2" 
						text-align="center" 
						vertical-align="middle" 
						padding-top="7mm" 
						background-color="#E7E7E7">
	        		
	        		<fo:block>
	        			日
	        		</fo:block>
	        		<fo:block>
	        			Dia
	        		</fo:block>
				</fo:table-cell>
				
				<fo:table-cell 
						border-style="solid" 
						border-width="0.1pt" 
						number-columns-spanned="2" 
						text-align="center" 
						vertical-align="middle" 
						padding="1mm"
						background-color="#E7E7E7">
						
	        		<fo:block text-align="center">
	          		時段
	        		</fo:block>
	        		<fo:block text-align="center">
	          		Período das Horas
	        		</fo:block>	        		
				</fo:table-cell>
				
				<fo:table-cell 
						border-style="solid" 
						border-width="0.1pt" 
						number-columns-spanned="2" 
						text-align="center" 
						vertical-align="middle"  
						padding="1mm" 
						background-color="#E7E7E7">
						
	        		<fo:block text-align="center">
	          		總時數
	        		</fo:block>
	        		<fo:block text-align="center">
	          		 Horas Totais
	        		</fo:block>
				</fo:table-cell>
				
				<fo:table-cell 
						border-style="solid" 
						border-width="0.1pt" 
						number-rows-spanned="2" 
						text-align="center" 
						vertical-align="bottom" 
						padding-top="1cm"
						background-color="#E7E7E7">
						
	        		<fo:block text-align="center">
	          		原因 Razão
	        		</fo:block>	        		
				</fo:table-cell>				
			</fo:table-row>
			
			<fo:table-row>
				<fo:table-cell 
						border-style="solid" 
						border-width="0.1pt" 
						padding="1mm" 
						text-align="center" 
						vertical-align="middle" 
						background-color="#E7E7E7">
						
					<fo:block text-align="center">
		         	由Desde
					</fo:block>
				</fo:table-cell>
				
				<fo:table-cell 
						border-style="solid" 
						border-width="0.1pt" 
						padding="1mm" 
						text-align="center" 
						vertical-align="middle" 
						background-color="#E7E7E7">
						
					<fo:block text-align="center">
		         	至Até
					</fo:block>
				</fo:table-cell>
				
				<fo:table-cell 
						border-style="solid" 
						border-width="0.1pt" 
						padding="1mm" 
						text-align="center" 
						vertical-align="middle" 
						background-color="#E7E7E7">
						
		        	<fo:block text-align="center">
						常日Normal
					</fo:block>
				</fo:table-cell>
				
				<fo:table-cell 
						border-style="solid" 
						border-width="0.1pt" 
						padding="1mm" 
						text-align="center" 
						vertical-align="middle" 
						background-color="#E7E7E7">
						
		        	<fo:block text-align="center">
						假日Feriado
		       	</fo:block>
				</fo:table-cell>
					
			</fo:table-row>
	</xsl:template>
      	
  
  
	<!-- ========================= -->
	<!-- child element: ot     -->
	<!-- ========================= -->
	<xsl:template name="showTableContents">  	
  
		<xsl:for-each select="/otrecord/ot">
    	        
		 <fo:table-row>
		
			<fo:table-cell 
					border-style="solid" 
					border-width="0.1pt" 
					number-rows-spanned="2" 
					text-align="center" 
					vertical-align="middle" 
					padding="1mm">
							
		     <fo:block text-align="center">
		       <xsl:value-of select="@day"/>
		     </fo:block>
		   </fo:table-cell>
		   
		
		   <fo:table-cell 
					border-style="solid" 
					border-width="0.1pt" 
					number-rows-spanned="2" 
					text-align="center" 
					vertical-align="middle" 
					padding="1mm">
					
		     <fo:block>
		       <xsl:value-of select="from"/>
		     </fo:block>
		   </fo:table-cell>
		   
		   
		   <fo:table-cell 
					border-style="solid" 
					border-width="0.1pt" 
					number-rows-spanned="2" 
					text-align="center" 
					vertical-align="middle" 
					padding="1mm">
					
		     <fo:block>
		       <xsl:value-of select="to"/>
		     </fo:block>
		   </fo:table-cell>
		   
		   
		   <fo:table-cell 
					border-style="solid" 
					border-width="0.1pt" 
					number-rows-spanned="2" 
					text-align="center" 
					vertical-align="middle" 
					padding="1mm">
					
				<fo:block>
					<xsl:variable name="otType" select="type"/>
		     		<xsl:if test="type = 'N'">
		     			<xsl:value-of select='format-number(duration, "##")'/>
		     		</xsl:if>
		     		
					<xsl:if test="type = 'H'">
		     			&#160;
		     		</xsl:if>
		     </fo:block>
		   </fo:table-cell>
		   
		   
		   <fo:table-cell 
					border-style="solid" 
					border-width="0.1pt" 
					number-rows-spanned="2" 
					text-align="center" 
					vertical-align="middle" 
					padding="1mm">
					
		     <fo:block>
		       	<xsl:variable name="otType" select="type"/>
		     		<xsl:if test="type = 'N'">
		     			&#160;
		     		</xsl:if>
		     		
					<xsl:if test="type = 'H'">
		     			<xsl:value-of select='format-number(duration, "##")'/>
		     		</xsl:if>
		     </fo:block>
		   </fo:table-cell>
		   
		        
		   <fo:table-cell 
					border-style="solid" 
					border-width="0.1pt" 
					number-rows-spanned="2" 
					text-align="start" 
					vertical-align="middle" 
					padding="1mm">
					
		     <fo:block text-align="start" >
		       <xsl:value-of select="reason"/>
		     </fo:block>
		   </fo:table-cell>
		 </fo:table-row>
		</xsl:for-each>
	</xsl:template>
  
  
	<xsl:template name="space">
		<xsl:param name="num" select="0"/>
		
		<xsl:if test="$num &gt; 0">
			&#160;
		
			<xsl:call-template name="space">
				<xsl:with-param name="num" select="number($num)-1"/>
			</xsl:call-template>
		</xsl:if>
	</xsl:template>	
	
</xsl:stylesheet>


[/code]

[code]
<?xml version="1.0" encoding="UTF-8"?>

<otrecord>
	
	<properties>
		<year>2005</year>
		<month>04</month>
		<name>CHAO HOI KA, Eric</name>
		<date>03/05/2005</date>
	</properties>
  
	<ot day="15">
		<from>17:30</from>
		<to>19:12</to>
		<!-- 
		N: normal day
		H: holiday
		-->
		<type>N</type>
		<duration>1.4</duration>
		<reason>Portal Meeting</reason>
	</ot>
	
	
	<ot day="20">
		<from>17:45</from>
		<to>19:32</to>
	
		<type>N</type>
		<duration>1.8</duration>
		<reason>Upgrade System</reason>
	</ot>
	
	
</otrecord>



[/code]






[code]
[DEBUG] Input mode:
[DEBUG] xslt transformation
[DEBUG] xml input file: ot.xml
[DEBUG] xslt stylesheet: ot.xsl
[DEBUG] Output mode:
[DEBUG] awt on screen
[DEBUG] OPTIONS
[DEBUG] user configuration file: conf\userconfig.xml
[DEBUG] debug mode on
[DEBUG] dump configuration
[DEBUG] quiet mode on
[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] base directory: D:/fop-0.20.5
[INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
[INFO] building formatting object tree
[INFO] setting up fonts
[ERROR] property 'paddding' ignored
[INFO] [1]
[INFO] Create embedded AWT font from stream file:/D:/fop-0.20.5/kaiu.TTF
[ERROR] unknown font kai,normal,bold so defaulted font to any
[ERROR] unknown font kai,normal,bold so defaulted font to any
[INFO] [1]
[ERROR] java.lang.ArrayIndexOutOfBoundsException: -2
org.apache.fop.apps.FOPException: java.lang.ArrayIndexOutOfBoundsException: -2
        at org.apache.fop.apps.AWTStarter.run(AWTStarter.java:156)
        at org.apache.fop.apps.Fop.main(Fop.java:62)

---------

java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: -2
        at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java
:3407)
        at org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(Trans
formerHandlerImpl.java:433)
        at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Sourc
e)
        at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Sourc
e)
        at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager$EntityScanner.load(Unknown So
urce)
        at org.apache.xerces.impl.XMLEntityManager$EntityScanner.skipSpaces(Unkn
own Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.
dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known 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.xalan.transformer.TrAXFilter.parse(TrAXFilter.java:134)
        at org.apache.fop.apps.Driver.render(Driver.java:498)
        at org.apache.fop.apps.AWTStarter.run(AWTStarter.java:146)
        at org.apache.fop.apps.Fop.main(Fop.java:62)

---------

java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: -2
        at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java
:3407)
        at org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(Trans
formerHandlerImpl.java:433)
        at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Sourc
e)
        at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Sourc
e)
        at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager$EntityScanner.load(Unknown So
urce)
        at org.apache.xerces.impl.XMLEntityManager$EntityScanner.skipSpaces(Unkn
own Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.
dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known 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.xalan.transformer.TrAXFilter.parse(TrAXFilter.java:134)
        at org.apache.fop.apps.Driver.render(Driver.java:498)
        at org.apache.fop.apps.AWTStarter.run(AWTStarter.java:146)
        at org.apache.fop.apps.Fop.main(Fop.java:62)

D:\fop-0.20.5>
[/code]
Mime
View raw message