Bug

A discussion forum for the JCommon class library.
Post Reply
jfreebob
Posts: 1
Joined: Thu May 07, 2009 9:20 am

Bug

Post by jfreebob » Thu May 07, 2009 10:01 am

I think I've found a pretty major bug in the 'private int calcSerial(final int d, final int m, final int y)' function of the SpreadsheetDate class in the jcommon library.

if (m > MonthConstants.FEBRUARY) {

should be replaced with either:

if (m >= MonthConstants.FEBRUARY) {

or

if (m > 1) {

Maybe something like this:

public static int calcSerial(final int d, final int m, final int y)
{
final int yy = ((y - 1900) * 365) + SerialDate.leapYearCount(y - 1);
int mm = AGGREGATE_DAYS_TO_END_OF_PRECEDING_MONTH[m];
if (m > 1 && SerialDate.isLeapYear(y))
return yy + mm + d + 2;
return yy + mm + d + 1;
}

Cheers, Bob

david.gilbert
JFreeChart Project Leader
Posts: 11679
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Bug

Post by david.gilbert » Fri May 22, 2009 2:45 am

I don't think this is a bug - see my comments on the bug report:

https://sourceforge.net/tracker/?func=d ... tid=115494
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited

Post Reply