Home » Archived » BIRT » Calendar/GregorianCalender exception(Can not convert the value of java.util.GregorianCalendar to Date type.)
Calendar/GregorianCalender exception [message #804267] |
Wed, 22 February 2012 11:59 |
Ludwig Moser Messages: 476 Registered: July 2009 |
Senior Member |
|
|
obviously i know what causes the exception.
data type is defined as date, my java object is Calendar (which contains a date)
so is there a way to tell birt it shall call .getTime() on my calendar object to gain the date?
some sort of Converter / Dataprovider which converts like:
public static Date toDate(Calendar cal) {
return cal.getTime();
}
as this would resolve the issue...
Quote:
org.eclipse.birt.data.engine.core.DataException: A BIRT exception occurred. See next exception for more information.
Can not convert the value of java.util.GregorianCalendar[time=1327398408340,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2012,MONTH=0,WEEK_OF_YEAR=4,WEEK_OF_MONTH=4,DAY_OF_MONTH=24,DAY_OF_YEAR=24,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=4,AM_PM=0,HOUR=10,HOUR_OF_DAY=10,MINUTE=46,SECOND=48,MILLISECOND=340,ZONE_OFFSET=3600000,DST_OFFSET=0] to Date type.
at org.eclipse.birt.data.engine.core.DataException.wrap(DataException.java:123)
at org.eclipse.birt.data.engine.expression.ExprEvaluateUtil.evaluateExpression(ExprEvaluateUtil.java:86)
at org.eclipse.birt.data.engine.impl.BindingColumnsEvalUtil.evaluateValue(BindingColumnsEvalUtil.java:201)
at org.eclipse.birt.data.engine.impl.BindingColumnsEvalUtil.getColumnsValue(BindingColumnsEvalUtil.java:161)
at org.eclipse.birt.data.engine.impl.ResultIterator.prepareCurrentRow(ResultIterator.java:778)
at org.eclipse.birt.data.engine.impl.ResultIterator.nextRow(ResultIterator.java:527)
|
|
|
Re: Calendar/GregorianCalender exception [message #804413 is a reply to message #804267] |
Wed, 22 February 2012 15:44 |
|
In the binding expression you should be able to add something like:
importPackage(Packages.java.util);
var mydate = yourcalobject.getTime();
Jason
On 2/22/2012 6:59 AM, Ludwig Moser wrote:
> obviously i know what causes the exception.
> data type is defined as date, my java object is Calendar (which contains
> a date)
>
> so is there a way to tell birt it shall call .getTime() on my calendar
> object to gain the date?
> some sort of Converter / Dataprovider which converts like:
>
> public static Date toDate(Calendar cal) {
> return cal.getTime();
> }
>
> as this would resolve the issue...
>
> Quote:
>> org.eclipse.birt.data.engine.core.DataException: A BIRT exception
>> occurred. See next exception for more information.
>> Can not convert the value of
>> java.util.GregorianCalendar[time=1327398408340,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2012,MONTH=0,WEEK_OF_YEAR=4,WEEK_OF_MONTH=4,DAY_OF_MONTH=24,DAY_OF_YEAR=24,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=4,AM_PM=0,HOUR=10,HOUR_OF_DAY=10,MINUTE=46,SECOND=48,MILLISECOND=340,ZONE_OFFSET=3600000,DST_OFFSET=0]
>> to Date type.
>> at
>> org.eclipse.birt.data.engine.core.DataException.wrap(DataException.java:123)
>>
>> at
>> org.eclipse.birt.data.engine.expression.ExprEvaluateUtil.evaluateExpression(ExprEvaluateUtil.java:86)
>>
>> at
>> org.eclipse.birt.data.engine.impl.BindingColumnsEvalUtil.evaluateValue(BindingColumnsEvalUtil.java:201)
>>
>> at
>> org.eclipse.birt.data.engine.impl.BindingColumnsEvalUtil.getColumnsValue(BindingColumnsEvalUtil.java:161)
>>
>> at
>> org.eclipse.birt.data.engine.impl.ResultIterator.prepareCurrentRow(ResultIterator.java:778)
>>
>> at
>> org.eclipse.birt.data.engine.impl.ResultIterator.nextRow(ResultIterator.java:527)
>>
>
|
|
| |
Goto Forum:
Current Time: Fri Apr 19 09:23:16 GMT 2024
Powered by FUDForum. Page generated in 0.02116 seconds
|