I'm running the attached simply xsl-fo (foo.xml) through the FOTreeBuilder - with "border=inherit" this fails because of a NPE below. Somehow org.apache.fop.fo.properties.PropertyMaker.make(PropertyMaker.java:391) passes a defaultValue=null down the line which doesn't fare well. Thanks Nils ---- java.lang.NullPointerException at org.apache.fop.fo.expr.PropertyTokenizer.<init>(PropertyTokenizer.java:67) at org.apache.fop.fo.expr.PropertyParser.<init>(PropertyParser.java:103) at org.apache.fop.fo.expr.PropertyParser.parse(PropertyParser.java:88) at org.apache.fop.fo.properties.PropertyMaker.make(PropertyMaker.java:423) at org.apache.fop.fo.properties.PropertyMaker.make(PropertyMaker.java:391) at org.apache.fop.fo.properties.PropertyMaker.get(PropertyMaker.java:298) at org.apache.fop.fo.PropertyList.get(PropertyList.java:171) at org.apache.fop.fo.StaticPropertyList.get(StaticPropertyList.java:71) at org.apache.fop.fo.PropertyList.get(PropertyList.java:152) at org.apache.fop.fo.PropertyList.getFromParent(PropertyList.java:208) at org.apache.fop.fo.properties.PropertyMaker.make(PropertyMaker.java:412) at org.apache.fop.fo.PropertyList.convertAttributeToProperty(PropertyList.java:344) at org.apache.fop.fo.PropertyList.addAttributesToList(PropertyList.java:300) at org.apache.fop.fo.FObj.processNode(FObj.java:118) at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:216)
Created attachment 17700 [details] test input with simple table using border=inherit in cells
Hmm, surrounding the code in the PropertyTokenizer's constructor with an "if (s != null)" fixes the NPE, but "inherit" still doesn't work because only the direct parent gets evaluated. The property value is not properly inherited. Looks like this will need further inspection. Work-around for now: Explicitely specify the border property on every table-cell. Use attribute-sets in XSLT.
I'll have a look at that, since I'm currently active in that part of the source code... For now: the only real problem here is that if border has a value of "inherit", then only the parent is checked. Which is correct, since the border shorthand is a non-inherited property. Since there are no borders specified on the table-row (and the table-body), there is no border to be inherited. The error message, however, is confusing and misleading for the end-user, so this definitely needs to be looked at. Another possible workaround is to use: border="from-nearest-specified-value()" on the table-cells. I have tried this, and it seems to work nicely... Haven't checked the results yet, but might be an option for Nils. Cheers, Andreas
Argh, missed that. I thought "inherit" meant the same as from-nearest-specified-value(), not as from-parent(). D'oh! Thanks for setting me straight.
FWIW: I still stumble over these inheritance issues myself from time to time... :-) I think the cause for the NPE being thrown is the fact that there is no default set on the PropertyMaker for the border shorthand (see: FOPropertyMapping.createShorthandProperties()). As such, the call to PropertyList.getFromParent() returns null (instead of, say, an empty string "") This leads to PropertyMaker.make() trying to run that null value through the PropertyParser, and the parser chokes on it. I'll add this ASAP, but would like to add a little warning as well. Something like: "Specified value of 'inherit', but the property was not found on the parent... Using default value."
Added a default value of "" to avoid the NPE being thrown. Still TODO: add the warning. Property now silently falls back to the default value... Main issue is fixed: FOP doesn't crash anymore in this case. See: http://svn.apache.org/viewcvs?rev=378003&view=rev
(In reply to comment #3) > For now: the only real problem here is that if border has > a value of "inherit", then only the parent is checked. > Which is correct, since the border shorthand is a > non-inherited property. Since there are no borders specified > on the table-row (and the table-body), there is no border to > be inherited. just to clarify - there's a border property on the 'table'. That doesn't count for inherit? I can't specify a border on 'table-body' because with border-collapse="separate" FOP reports "borders cannot be specified on a fo:table-body". I know I can set the border on each cell but i wanted to not repeat that border property if i don't have to :) Thanks Nils
Nils, Your comment is correct. Because border (just like the individual border-* properties) is not an inherited property, the value is not automatically inherited by the descendant table-body and table- row. So, the property gets its default/initial value on the table-row --null in this case, but this has been rectified-- and that value is then inherited by the table-cell. The only ways I see to avoid having to specify border="inherit" on the intermediate table-body and table-row, is to follow either my suggestion, and use border="from-nearest-specified-value()" or Jeremias' option of repeating the border specs on every table-cell. Cheers, Andreas
Just thought of a third option: use border="inherit" on the table-columns --they will inherit the table's borders--, and have the table-cells get that value through border="from-table-column()"
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed