Project: Birt
Bug 123568 Can not evaluate new Date(String).getDate()
Reported: 2006-01-12 03:11:17 | Status: closed fixed

Description: Add a computed column named "a", set its type to "Date", and set its expression as "new Date("1/1/2002")". Pull the computed column "a" to the layout, and change the expression to "row["a"].getDate()", error pops up. Error message: iO3EI OU iIo: -Data OO iIo: 81 iIo 0 : data.engine.BirtException ( 1 I IeI EAI: org.eclipse.birt.data.engine.core.DataException: Eu BIRT AyIaoO Javascript i iE12CoOE3o i 12A34OyC iIo: TypeError: getDate is not a function. 12A34O : null: 0IA34:<compiled script>2e IAO oAyIaOOAE12a uaAIO Javascript i iE12CoOE3o i 12A34OyC iIo: TypeError: getDate is not a function. 12A34O : null: 0IA34:<compiled script> at org.eclipse.birt.data.engine.core.DataException.wrap(DataException.java:113) at org.eclipse.birt.data.engine.impl.BytecodeExpression.evaluate(BytecodeExpression.java:53) at org.eclipse.birt.data.engine.impl.ResultIterator.evaluateCompiledExpression(ResultIterator.java:248) at org.eclipse.birt.data.engine.impl.ResultIterator.getValue(ResultIterator.java:275) at org.eclipse.birt.report.engine.data.dte.DteDataEngine.evaluate(DteDataEngine.java:297) at org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:528) at org.eclipse.birt.report.engine.executor.DataItemExecutor.execute(DataItemExecutor.java:86) at org.eclipse.birt.report.engine.executor.ReportExecutorVisitor.visitDataItem(ReportExecutorVisitor.java:157) at org.eclipse.birt.report.engine.ir.DataItemDesign.accept(DataItemDesign.java:68) at org.eclipse.birt.report.engine.executor.ReportExecutor.execute(ReportExecutor.java:121) at org.eclipse.birt.report.engine.executor.ReportExecutor.execute(ReportExecutor.java:87) at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:158) at org.eclipse.birt.report.services.ReportEngineService.runAndRenderReport(Unknown Source) at org.eclipse.birt.report.viewer.aggregation.layout.EngineFragment.doService(Unknown Source) at org.eclipse.birt.report.viewer.aggregation.BaseFragment.service(Unknown Source) at org.eclipse.birt.report.viewer.servlet.ViewerServlet.doGet(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.eclipse.tomcat.internal.EclipseErrorReportValve.invoke(EclipseErrorReportValve.java:153) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Thread.java:534)Caused by: org.eclipse.birt.core.exception.CoreException: O Javascript i iE12CoOE3o i 12A34OyC iIo: TypeError: getDate is not a function. 12A34O : null: 0IA34:<compiled script> at org.eclipse.birt.core.script.JavascriptEvalUtil.wrapRhinoException(JavascriptEvalUtil.java:220) ... 49 moreCaused by: org.mozilla.javascript.EcmaError: TypeError: getDate is not a function. at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3240) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3230) at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3246) at org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntime.java:3258) at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3317) at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:1987) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2869) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2164) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:140) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:304) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2769) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2145) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:140) at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:149) at org.eclipse.birt.data.engine.impl.BytecodeExpression.evaluate(BytecodeExpression.java:47) ... 48 more

Files changed in fix:
data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/executor/ResultClass.java data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/impl/ResultIterator.java