ClassCastException in HeaderCell.addToTotal when totaling column
----------------------------------------------------------------

         Key: DISPL-375
         URL: http://jira.codehaus.org/browse/DISPL-375
     Project: DisplayTag
        Type: Bug

  Components: Tag Library  
    Versions: 1.1    
    Reporter: Michael Watts


I am getting a ClassCastException in org.displaytag.model.HeaderCell.addToTotal 
when value for cell is the empty string "".  This is a problem when totaling a 
column using the total="true" attribute on ColumnTag.

This method should be changed to avoid this problem.  Here is my proposed:

Original:
=====
    private void addToTotal(Object value)
    {
        if (value != null)
        {
            this.total = this.total + ((Number) value).doubleValue();
        }
    }
=====

Proposal:
=====
    private void addToTotal(Object value)
    {
        if (value != null && value instanceof Number)
        {
            this.total = this.total + ((Number) value).doubleValue();
        }
    }
=====

-- 
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



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
displaytag-devel mailing list
displaytag-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-devel

Reply via email to