Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.1
-
Fix Version/s: 1.1.1
-
Component/s: Tag Library
-
Labels:None
Description
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 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();
}
}
=====
Activity
andy pruitt
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Resolution | Fixed [ 1 ] | |
| Fix Version/s | 1.1.1 [ 12450 ] |
fabrizio giustina
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |