You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Lukas Theussl (JIRA)" <ji...@codehaus.org> on 2009/03/05 09:59:12 UTC

[jira] Commented: (DOXIA-295) doxia-module-fo fails with a division by 0 error when using FoSink

    [ http://jira.codehaus.org/browse/DOXIA-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=167968#action_167968 ] 

Lukas Theussl commented on DOXIA-295:
-------------------------------------

It would be good to know how you arrived at this problem, are you using a Doxia parser or the Sink directly? The point is that a table without cells is not really a table, e.g. a html table without a <td> element leads to invalid xhtml. 

I think it's logical to require a table to have at least one cell. The javadocs for table in Sink.java [1] specifies the canonical sequence of events, and explicitly mentions only tableCaption to be optional.

I am hesitant to fix this as you suggest, as it could potentially hide bugs in parsers.


[1] http://maven.apache.org/doxia/doxia/doxia-sink-api/apidocs/index.html

> doxia-module-fo fails with a division by 0 error when using FoSink
> ------------------------------------------------------------------
>
>                 Key: DOXIA-295
>                 URL: http://jira.codehaus.org/browse/DOXIA-295
>             Project: Maven Doxia
>          Issue Type: Bug
>          Components: Module - FO
>    Affects Versions: 1.2
>         Environment: Linux / Solairs jdk 1.5
> Build from svn check out Revsion: 749805
>            Reporter: Dean Murphy
>
> When using the FoSink to convert from documents containing a table, I am running into a division by 0 error on line: 703 in org.apache.maven.doxia.module.fo.FoSink.java:
>               int percent = 100 / cellCount;
>               for ( int i = 0; i < cellCount; i++ )
>               {
>                   sb.append( "<fo:table-column column-width=\"" + percent + "%\"/>" );
>                   sb.append( EOL );
>               }
> Simple fix would be to check if cellCount != 0:
>             if ( cellCount != 0 ) {
>               int percent = 100 / cellCount;
>               for ( int i = 0; i < cellCount; i++ )
>               {
>                   sb.append( "<fo:table-column column-width=\"" + percent + "%\"/>" );
>                   sb.append( EOL );
>               }
>             }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira