Bug 162157 Exception when extract data from inside nest query with filter
Description: Exception when extract data from inside nest query with filter. Steps to reproduce: filterExpression = new IFilterDefinition[1]; filterExpression[0] = new FilterDefinition( new ConditionalExpression( "row[\"number\"]", ConditionalExpression.OP_EQ, "112", null ) ); extractTask.setFilters( filterExpression ); result = extractTask.extract( ); if ( result != null ) { int num = 0; IDataIterator data = result.nextResultIterator( ); if ( data != null ) { data.next( ); num = Integer.parseInt( data .getValue( "number" ) .toString( ) ); assertEquals( 112, num ); } data.close( ); } Detail case in DataExtractionTaskTest.testDataExtractionFromIID_nestquery() in org.eclipse.birt.report.tests.engine.api package. Expected result: Data are extracted correctly. Actual result: Exception throws. Error logs: org.eclipse.birt.core.exception.CoreException: Error evaluating Javascript expression. Script engine error: ReferenceError: "dataSetRow" is not defined. Script source: source, line: 0, text: dataSetRow["CUSTOMERNUMBER"] at org.eclipse.birt.core.script.JavascriptEvalUtil.wrapRhinoException(JavascriptEvalUtil.java:281) at org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawScript(JavascriptEvalUtil.java:105) at org.eclipse.birt.data.engine.expression.ExprEvaluateUtil.doEvaluateRawExpression(ExprEvaluateUtil.java:229) at org.eclipse.birt.data.engine.expression.ExprEvaluateUtil.evaluateRawExpression(ExprEvaluateUtil.java:194) at org.eclipse.birt.data.engine.impl.PreparedDummyQuery$ResultIterator.getValue(PreparedDummyQuery.java:538) at org.eclipse.birt.report.engine.api.impl.DataIterator.getValue(DataIterator.java:49) at org.eclipse.birt.report.tests.engine.api.DataExtractionTaskTest.testDataExtractionFromIID_nestquery(DataExtractionTaskTest.java:456) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:58) at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:24) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:348) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:165) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:341) at org.eclipse.core.launcher.Main.basicRun(Main.java:285) at org.eclipse.core.launcher.Main.run(Main.java:987) at org.eclipse.core.launcher.Main.main(Main.java:962) Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "dataSetRow" is not defined. at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3240) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3230) at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3303) at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1632) at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1571) at org.mozilla.javascript.gen.c14._c0(source:0) at org.mozilla.javascript.gen.c14.call(source) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:304) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2769) at org.mozilla.javascript.gen.c14.call(source) at org.mozilla.javascript.gen.c14.exec(source) at org.eclipse.birt.core.script.JavascriptEvalUtil.evaluateRawScript(JavascriptEvalUtil.java:98) ... 35 more
engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/api/impl/DataExtractionTask.java
String queryId = IOUtil.readString( dis );
				
				String rsetId = IOUtil.readString( dis );
				
				IQueryDefinition query = getQuery( queryId );
				if ( !isMasterQuery ( query ) )
				{
					continue;
				}
				
				rsetId2queryIdMapping.put( rsetId, queryId );
				
				int count = -1;
				Integer countObj = (Integer) queryCounts.get( queryId );
				if ( countObj != null )
				{
					count = countObj.intValue( );
				}
				count++;
				String rsetName = getQueryName( queryId );
				if( count > 0)
				{
					rsetName = rsetName + "_" + count;
				}
				queryCounts.put( queryId, new Integer( count ) );
				rsetName2IdMapping.put( rsetName, rsetId );
				if ( null != query2ResultMetaData )
				{
					ResultMetaData metaData = (ResultMetaData) query2ResultMetaData.get( query );