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

        

Reply via email to