Bug 48534 - java.lang.StringIndexOutOfBoundsException
Summary: java.lang.StringIndexOutOfBoundsException
Status: NEW
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: fo tree (show other bugs)
Version: all
Hardware: PC Windows XP
: P3 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-13 04:17 UTC by Antti Karanta
Modified: 2012-04-07 01:52 UTC (History)
0 users



Attachments
Sample xsl-fo file to reproduce the bug (44.86 KB, application/octet-stream)
2010-01-13 04:18 UTC, Antti Karanta
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Karanta 2010-01-13 04:17:05 UTC
both fop 0.95 and trunk version fail the attached fo file with 

C:\Temp\cr14230>\programs\Java\fop-trunk\fop.bat -fo testi.fo -pdf testix.pdf
13.1.2010 14:12:06 org.apache.fop.cli.Main startFOP
SEVERE: Exception
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:302)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
        at org.apache.fop.cli.Main.startFOP(Main.java:174)
        at org.apache.fop.cli.Main.main(Main.java:205)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        at java.lang.String.charAt(String.java:686)
        at org.apache.fop.fo.properties.CharacterProperty$Maker.make(CharacterProperty.java:44)
        at org.apache.fop.fo.PropertyList.convertAttributeToProperty(PropertyList.java:412)
        at org.apache.fop.fo.PropertyList.addAttributesToList(PropertyList.java:319)
        at org.apache.fop.fo.FObj.processNode(FObj.java:119)
        at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:282)
        at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:171)
        at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1072)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
        at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(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.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:299)
        ... 3 more

---------

java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        at java.lang.String.charAt(String.java:686)
        at org.apache.fop.fo.properties.CharacterProperty$Maker.make(CharacterProperty.java:44)
        at org.apache.fop.fo.PropertyList.convertAttributeToProperty(PropertyList.java:412)
        at org.apache.fop.fo.PropertyList.addAttributesToList(PropertyList.java:319)
        at org.apache.fop.fo.FObj.processNode(FObj.java:119)
        at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:282)
        at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:171)
        at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1072)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
        at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(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.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)
        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:299)
        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
        at org.apache.fop.cli.Main.startFOP(Main.java:174)
        at org.apache.fop.cli.Main.main(Main.java:205)

(stack trace from trunk version as of 13. Jan 2010).

It is likely something wrong with the given xsl-fo. It validates fine with XMLasdf Spy, but I would guess it's something e.g. in attribute values that goes undetected by it.

Even though the error is likely in the xsl-fo given, IMO fop should fail with some sensible error that might give a clue as to where the error lies.
Comment 1 Antti Karanta 2010-01-13 04:18:21 UTC
Created attachment 24835 [details]
Sample xsl-fo file to reproduce the bug
Comment 2 Pascal Sancho 2010-01-13 04:46:01 UTC
This issue is due to empty hyphenation-character property.
hyphenation-character property should have either a <character> or inherit value.
I think that empty string is not a valid value.
Comment 3 Andreas L. Delmelle 2011-01-07 13:33:50 UTC
The crash is indeed a bug.

However, I believe it is also erroneous to have the following property specifications (appearing twice in the sample document, and causing the issue):

hyphenation-character="" 
hyphenation-push-character-count="" 
hyphenation-remain-character-count=""

Whether this should be treated as a recoverable error could be made to depend on the 'strict-validation' config option. If validation is relaxed, then we could just use the initial values.
Comment 4 Glenn Adams 2012-04-07 01:44:32 UTC
resetting P2 open bugs to P3 pending further review