Program: 66883
Project: 66883
Buggy source:
/** 
 * This method is used to register the Java Script Objects which are defined in the scope of source ResultSet ( might be IResultSet or CubeCursor ) to target scope. One possible client of this method is Report Engine. A classic use case is that instead of register its own "row" object  the Report Engine can simply call this method with proper argument so that the "row" object registered in IResultIterator's scope, that is, JSResultSetRow, can be accessed by engine using engine scope. 
 * @param targetScope
 * @param source
 * @throws AdapterException 
 */
public static void registerDataObject(ScriptContext context,ILinkedResult source) throws AdapterException {
  try {
    Scriptable targetScope=((IDataScriptEngine)context.getScriptEngine(IDataScriptEngine.ENGINE_NAME)).getJSScope(context);
    int type=((ILinkedResult)source).getCurrentResultType();
    if (type == ILinkedResult.TYPE_TABLE) {
      targetScope.put("String_Node_Str",targetScope,new JSResultIteratorObject((ILinkedResult)source,targetScope));
    }
 else     if (type == ILinkedResult.TYPE_CUBE) {
      Scriptable scope=((ICubeCursor)source.getCurrentResult()).getScope();
      targetScope.put("String_Node_Str",targetScope,scope.get("String_Node_Str",scope));
      if (scope.get("String_Node_Str",scope) != null && scope.get("String_Node_Str",scope) instanceof Scriptable)       targetScope.put("String_Node_Str",targetScope,scope.get("String_Node_Str",scope));
      targetScope.put("String_Node_Str",targetScope,scope.get("String_Node_Str",scope));
      targetScope.put("String_Node_Str",targetScope,scope.get("String_Node_Str",scope));
    }
  }
 catch (  BirtException e) {
    throw new AdapterException(e.getErrorCode(),e);
  }
}

Fixed version (ground truth):
/** 
 * This method is used to register the Java Script Objects which are defined in the scope of source ResultSet ( might be IResultSet or CubeCursor ) to target scope. One possible client of this method is Report Engine. A classic use case is that instead of register its own "row" object  the Report Engine can simply call this method with proper argument so that the "row" object registered in IResultIterator's scope, that is, JSResultSetRow, can be accessed by engine using engine scope. 
 * @param targetScope
 * @param source
 * @throws AdapterException 
 */
public static void registerDataObject(ScriptContext context,ILinkedResult source) throws AdapterException {
  try {
    Scriptable targetScope=((IDataScriptEngine)context.getScriptEngine(IDataScriptEngine.ENGINE_NAME)).getJSScope(context);
    int type=((ILinkedResult)source).getCurrentResultType();
    if (type == ILinkedResult.TYPE_TABLE) {
      targetScope.put("String_Node_Str",targetScope,new JSResultIteratorObject((ILinkedResult)source,targetScope));
    }
 else     if (type == ILinkedResult.TYPE_CUBE && source.getCurrentResult() != null) {
      Scriptable scope=((ICubeCursor)source.getCurrentResult()).getScope();
      targetScope.put("String_Node_Str",targetScope,scope.get("String_Node_Str",scope));
      if (scope.get("String_Node_Str",scope) != null && scope.get("String_Node_Str",scope) instanceof Scriptable)       targetScope.put("String_Node_Str",targetScope,scope.get("String_Node_Str",scope));
      targetScope.put("String_Node_Str",targetScope,scope.get("String_Node_Str",scope));
      targetScope.put("String_Node_Str",targetScope,scope.get("String_Node_Str",scope));
    }
  }
 catch (  BirtException e) {
    throw new AdapterException(e.getErrorCode(),e);
  }
}