Bug

A discussion forum for the JCommon class library.

Bug

Postby 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
jfreebob
 
Posts: 1
Joined: Thu May 07, 2009 9:20 am

Re: Bug

Postby 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
david.gilbert
JFreeChart Project Leader
 
Posts: 11648
Joined: Fri Mar 14, 2003 10:29 am


Return to JCommon

Who is online

Users browsing this forum: No registered users and 2 guests