You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Alejandro Vilar <al...@synacom.com.bo> on 2010/08/01 21:27:09 UTC

Exception in CalendarButton constructor

Hi all,

                I was editing the current date on my PC to perform some
tests related to my project and I have a problem with CalendarButtons, on
1st august 2010 there is a ArrayIndexOutOfBoundsException thrown in the
constructor(without args). Checking the code I found the cause on this
class:

 

Class: org.apache.pivot.wtk.skin.terra.TerraCalendarSkin

Method: updateSelection(CalendarDate)

Line: 680

 

// Update the button group

int cellIndex = getCellIndex(year, month, day, calendar.getLocale()); //<--
cellIndex: -1

int rowIndex = cellIndex / 7;

int columnIndex = cellIndex % 7; //<-- columnIndex: -1

 

TablePane.Row row = calendarTablePane.getRows().get(rowIndex + 2);

DateButton dateButton = (DateButton)row.get(columnIndex); //<-- Exception

dateButton.setSelected(true);

 

 

I don't know if the problem is only in my environment due I was changing
dates but it is clear that a negative index is calculated for some reason,
the attached image shows the calendar one day after (August 2) and as you
can see the 1st august doesn't exists. Does someone had this problem before?

 

Checked in pivot 1.4 and 1.5

 

Thanks,

Alejandro

 


Re: Exception in CalendarButton constructor

Posted by Greg Brown <gk...@mac.com>.
Haven't seen this issue. Feel free to submit a bug report on it. Thanks!

On Aug 1, 2010, at 3:27 PM, Alejandro Vilar wrote:

> Hi all,
>                 I was editing the current date on my PC to perform some tests related to my project and I have a problem with CalendarButtons, on 1st august 2010 there is a ArrayIndexOutOfBoundsException thrown in the constructor(without args). Checking the code I found the cause on this class:
>  
> Class: org.apache.pivot.wtk.skin.terra.TerraCalendarSkin
> Method: updateSelection(CalendarDate)
> Line: 680
>  
> // Update the button group
> int cellIndex = getCellIndex(year, month, day, calendar.getLocale()); //<-- cellIndex: -1
> int rowIndex = cellIndex / 7;
> int columnIndex = cellIndex % 7; //<-- columnIndex: -1
>  
> TablePane.Row row = calendarTablePane.getRows().get(rowIndex + 2);
> DateButton dateButton = (DateButton)row.get(columnIndex); //<-- Exception
> dateButton.setSelected(true);
>  
>  
> I don’t know if the problem is only in my environment due I was changing dates but it is clear that a negative index is calculated for some reason, the attached image shows the calendar one day after (August 2) and as you can see the 1st august doesn't exists. Does someone had this problem before?
>  
> Checked in pivot 1.4 and 1.5
>  
> Thanks,
> Alejandro
>  
> <calendar.png>