You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by bu...@apache.org on 2006/02/15 04:48:56 UTC

DO NOT REPLY [Bug 38648] New: - NPE in PropertyTokenizer. with table-cell property border=inherit

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38648

           Summary: NPE in PropertyTokenizer.<init> with table-cell property
                    border=inherit
           Product: Fop
           Version: 1.0dev
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: fo tree
        AssignedTo: fop-dev@xmlgraphics.apache.org
        ReportedBy: nils@meiers.net


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)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 38648] - NPE in PropertyTokenizer. with table-cell property border=inherit

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38648





------- Additional Comments From a_l.delmelle@pandora.be  2006-02-15 15:16 -------
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()"


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 38648] - NPE in PropertyTokenizer. with table-cell property border=inherit

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38648





------- Additional Comments From nils@meiers.net  2006-02-15 04:50 -------
Created an attachment (id=17700)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=17700&action=view)
test input with simple table using border=inherit in cells


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 38648] - NPE in PropertyTokenizer. with table-cell property border=inherit

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38648





------- Additional Comments From a_l.delmelle@pandora.be  2006-02-15 15:11 -------
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

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Re: DO NOT REPLY [Bug 38648] - NPE in PropertyTokenizer. with table-cell property border=inherit

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Feb 15, 2006, at 15:01, bugzilla@apache.org wrote:

> ------- Additional Comments From nils@meiers.net  2006-02-15 15:01  
> -------
> (In reply to comment #3)
> 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".

Grr... :-) Well, that message is actually more of a warning, I guess.  
It's not prohibited to do so --maybe this warning should just be put  
in different terms-- but nothing is done with them at the level of  
the table-body. They are OTOH available on the body's property-list,  
so inheritance should still work --if it is an inherited property.  
Unfortunately, borders are not inherited by default.

But this:

<fo:table border-collapse="separate">
   <fo:table-column .../>
   <fo:table-body border="...">
     <fo:table-cell starts-row="true" border="inherit">

Is definitely legal AFAICT. The table-cell will receive the values  
*specified* on the parent, while the border property is not  
*applicable* to the table-body itself in this situation.


Cheers,

Andreas

DO NOT REPLY [Bug 38648] - NPE in PropertyTokenizer. with table-cell property border=inherit

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38648





------- Additional Comments From nils@meiers.net  2006-02-15 15:01 -------
(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

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 38648] - NPE in PropertyTokenizer. with table-cell property border=inherit

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38648





------- Additional Comments From jeremias@apache.org  2006-02-15 11:07 -------
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.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 38648] - NPE in PropertyTokenizer. with table-cell property border=inherit

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38648





------- Additional Comments From a_l.delmelle@pandora.be  2006-02-15 11:58 -------
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."

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 38648] - NPE in PropertyTokenizer. with table-cell property border=inherit

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38648





------- Additional Comments From a_l.delmelle@pandora.be  2006-02-15 11:02 -------
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

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 38648] - NPE in PropertyTokenizer. with table-cell property border=inherit

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38648


a_l.delmelle@pandora.be changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From a_l.delmelle@pandora.be  2006-02-15 14:11 -------
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

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 38648] - NPE in PropertyTokenizer. with table-cell property border=inherit

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

http://issues.apache.org/bugzilla/show_bug.cgi?id=38648


jeremias@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




------- Additional Comments From jeremias@apache.org  2006-02-15 08:53 -------
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.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.