rem:   var params; var metadata; var firstArg = args[0]; var lastArg = args[args.length - 1]; 
add: } DWREngine._batch.map[prefix + "scriptName"] = scriptName; DWREngine._batch.map[prefix + "methodName"] = methodName; DWREngine._batch.map[prefix + "id"] = id; 
context: DWREngine._execute = function(path, scriptName, methodName, vararg_params) {    var singleShot = false;    if (DWREngine._batch == null) {        DWREngine.beginBatch();        singleShot = true;    }    // To make them easy to manipulate we copy the arguments into an args array    var args = [];    for (var i = 0; i < arguments.length - 3; i++) {        args[i] = arguments[i + 3];    }    // All the paths MUST be to the same servlet    if (DWREngine._batch.path == null) {        DWREngine._batch.path = path;    }    else {        if (DWREngine._batch.path != path) {            DWREngine._handleError("Can't batch requests to multiple DWR Servlets.");            return;        }    }    // From the other params, work out which is the function (or object with    // call meta-data) and which is the call parameters    var params;    var metadata;    var firstArg = args[0];    var lastArg = args[args.length - 1];    if (typeof firstArg == "function") {        metadata = { callback:args.shift() };        params = args;    }    else if (typeof lastArg == "function") {        metadata = { callback:args.pop() };        params = args;    }    else if (typeof lastArg == "object" && lastArg.callback != null && typeof lastArg.callback == "function") {        metadata = args.pop();        params = args;    }    else if (firstArg == null) {        // This could be a null callback function, but if the last arg is also        // null then we can't tell which is the function unless there are only        // 2 args, in which case we don't care!        if (lastArg == null && args.length > 2) {            if (DWREngine._warningHandler) {                DWREngine._warningHandler("Ambiguous nulls at start and end of parameter list. Which is the callback function?");            }        }        metadata = { callback:args.shift() };        params = args;    }    else if (lastArg == null) {        metadata = { callback:args.pop() };        params = args;    }    else {        if (DWREngine._warningHandler) {            DWREngine._warningHandler("Missing callback function or metadata object.");        }        return;    }    // Get a unique ID for this call    var random = Math.floor(Math.random() * 10001);    var id = (random + "_" + new Date().getTime()).toString();    DWREngine._metadatas[id] = metadata;    var prefix = "c" + DWREngine._batch.map.callCount + "-";    // merge the metadata from this call into the batch    if (metadata != null)  {        for (var prop in metadata) {            DWREngine._batch.metadata[prop] = metadata[prop];        }    }    DWREngine._batch.map[prefix + "scriptName"] = scriptName;    DWREngine._batch.map[prefix + "methodName"] = methodName;    DWREngine._batch.map[prefix + "id"] = id;    // Serialize the parameters into batch.map    DWREngine._addSerializeFunctions();    for (i = 0; i < params.length; i++) {        DWREngine._serializeAll(DWREngine._batch, [], params[i], prefix + "param" + i);    }    DWREngine._removeSerializeFunctions();    // Merge in the global values for timeout and errorHandler    if (DWREngine._timeout && !DWREngine._batch.timeout) {        DWREngine._batch.timeout = DWREngine._timeout;    }    if (DWREngine._errorHandler && !DWREngine._batch.metadata.errorHandler) {        DWREngine._batch.metadata.errorHandler = DWREngine._errorHandler;    }    // Now we have finished remembering the call, we incr the call count    DWREngine._batch.map.callCount++;    if (singleShot) {        DWREngine.endBatch();    }};
meta: 266	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/266/769a5807f342d8541951d74937d724ab38fcafe0/engine.js/buggy/java/uk/ltd/getahead/dwr/engine.js