<commit_before>package org.jenkinsci.plugins.p4.groovy;

import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Map;
import java.util.logging.Logger;

import org.jenkinsci.plugins.p4.client.ClientHelper;
import org.jenkinsci.plugins.p4.tasks.AbstractTask;
import org.jenkinsci.remoting.RoleChecker;
import org.jenkinsci.remoting.RoleSensitive;

import hudson.FilePath.FileCallable;
import hudson.remoting.VirtualChannel;
import jenkins.security.Roles;

public class P4GroovyTask extends AbstractTask implements FileCallable<Map<String,Object>[]>, Serializable {
    
    	private static final long serialVersionUID = 1L;
    
    	private static Logger logger = Logger.getLogger(P4GroovyTask.class.getName());

	private final String cmd;
	private final String[] args;
	private final Map<String,Object> spec;

	public P4GroovyTask(String cmd, String[] args, Map<String,Object> spec) {
		this.cmd = cmd;
		this.args = args;
		this.spec = spec;
	}

	public P4GroovyTask(String cmd, String... args) {
		this(cmd, args, null);
	}

        @Override
	public Map<String,Object>[] invoke(File workspace, VirtualChannel channel) throws IOException {
		return (Map<String,Object>[]) tryTask();
	}

	@Override
	public Object task(ClientHelper p4) throws Exception {
		try {
			if (!checkConnection(p4)) {
				return null;
			}

			return p4.getConnection().execMapCmd(cmd, args, spec);
			
		} catch (Exception e) {<commit_msg>Remove reference to externally mutable object<commit_after>package org.jenkinsci.plugins.p4.groovy;

import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Map;
import java.util.logging.Logger;

import org.jenkinsci.plugins.p4.client.ClientHelper;
import org.jenkinsci.plugins.p4.tasks.AbstractTask;
import org.jenkinsci.remoting.RoleChecker;
import org.jenkinsci.remoting.RoleSensitive;

import hudson.FilePath.FileCallable;
import hudson.remoting.VirtualChannel;
import jenkins.security.Roles;

public class P4GroovyTask extends AbstractTask implements FileCallable<Map<String,Object>[]>, Serializable {
    
    	private static final long serialVersionUID = 1L;
    
    	private static Logger logger = Logger.getLogger(P4GroovyTask.class.getName());

	private final String cmd;
	private final String[] args;
	private final Map<String,Object> spec;

	public P4GroovyTask(String cmd, String[] args, Map<String,Object> spec) {
		this.cmd = cmd;
		this.args = Arrays.copyOf(args, args.length);
		this.spec = spec;
	}

	public P4GroovyTask(String cmd, String... args) {
		this(cmd, args, null);
	}

        @Override
	public Map<String,Object>[] invoke(File workspace, VirtualChannel channel) throws IOException {
		return (Map<String,Object>[]) tryTask();
	}

	@Override
	public Object task(ClientHelper p4) throws Exception {
		try {
			if (!checkConnection(p4)) {
				return null;
			}

			return p4.getConnection().execMapCmd(cmd, args, spec);
			
		} catch (Exception e) {
{'fraction_non_alphanumeric': 0.11019192587690271, 'fraction_numerical': 0.00727994705493051, 'mean_word_length': 4.758095238095238, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2495988', 'n_tokens_mistral': 1034, 'n_tokens_neox': 952, 'n_words': 228}