You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Dean Murphy (JIRA)" <ji...@codehaus.org> on 2009/03/04 05:15:12 UTC
[jira] Created: (DOXIA-295) doxia-module-fo fails with a division
by 0 error when using FoSink
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
[jira] Closed: (DOXIA-295) doxia-module-fo fails with a division by
0 error when using FoSink
Posted by "Lukas Theussl (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/DOXIA-295?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukas Theussl closed DOXIA-295.
-------------------------------
Assignee: Lukas Theussl
Resolution: Won't Fix
Closing 'won't fix' as discussed above. Any parser has to emit at least one table cell for every table.
> 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
> Assignee: Lukas Theussl
>
> 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
[jira] Commented: (DOXIA-295) doxia-module-fo fails with a division
by 0 error when using FoSink
Posted by "Lukas Theussl (JIRA)" <ji...@codehaus.org>.
[ 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
[jira] Commented: (DOXIA-295) doxia-module-fo fails with a division
by 0 error when using FoSink
Posted by "Dean Murphy (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/DOXIA-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=168273#action_168273 ]
Dean Murphy commented on DOXIA-295:
-----------------------------------
I am using a parser and calling parse() with the sink. I will double check the content to determine if it is xhtml compliant.
I do agree with you to an extent that hiding this would probably not be beneficial. Would it be better to throw some type of exception versus death by a division by zero attempt?
I will post soon regarding the content I'm trying to parse to conclude whether or not it is compliant.
Thanks!
> 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