<commit_before>/*
 * Created on Jul 18, 2010
 */
package org.griphyn.vdl.karajan.lib;

import java.util.List;

import org.globus.cog.karajan.arguments.Arg;
import org.globus.cog.karajan.stack.VariableStack;
import org.globus.cog.karajan.util.TypeUtil;
import org.globus.cog.karajan.workflow.ExecutionException;
import org.griphyn.vdl.mapping.DSHandle;
import org.griphyn.vdl.mapping.DataDependentException;
import org.griphyn.vdl.mapping.HandleOpenException;
import org.griphyn.vdl.mapping.MappingDependentException;
import org.griphyn.vdl.mapping.Path;

public class Mark extends VDLFunction {
    public static final Arg RESTARTS = new Arg.Positional("restarts");
    public static final Arg ERR = new Arg.Positional("err");
    public static final Arg MAPPING = new Arg.Optional("mapping", Boolean.FALSE);

    static {
        setArguments(Mark.class, new Arg[] { RESTARTS, ERR, MAPPING });
    }

    @Override
    protected Object function(VariableStack stack) throws ExecutionException,
            HandleOpenException {
        try {
            if (TypeUtil.toBoolean(ERR.getValue(stack))) {
                boolean mapping = TypeUtil.toBoolean(MAPPING.getValue(stack));
                List files = TypeUtil.toList(RESTARTS.getValue(stack));
                for (Object f : files) {
                    List pv = TypeUtil.toList(f);
                    Path p = Path.parse(TypeUtil.toString(pv.get(0)));
                    DSHandle handle = (DSHandle) pv.get(1);
                    DSHandle leaf = handle.getField(p);
                    synchronized (leaf) {
                        if (mapping) {
                            leaf.setValue(new MappingDependentException(leaf, null));
                        }
                        else {
                            leaf.setValue(new DataDependentException(leaf, null));
                        }
                        closeShallow(stack, leaf);
                    }
                }
            }
        }
        catch (Exception e) {
            throw new ExecutionException(e);
        }
        return null;
    }<commit_msg>another invalid path<commit_after>/*
 * Created on Jul 18, 2010
 */
package org.griphyn.vdl.karajan.lib;

import java.util.List;

import org.globus.cog.karajan.arguments.Arg;
import org.globus.cog.karajan.stack.VariableStack;
import org.globus.cog.karajan.util.TypeUtil;
import org.globus.cog.karajan.workflow.ExecutionException;
import org.griphyn.vdl.mapping.DSHandle;
import org.griphyn.vdl.mapping.DataDependentException;
import org.griphyn.vdl.mapping.HandleOpenException;
import org.griphyn.vdl.mapping.MappingDependentException;
import org.griphyn.vdl.mapping.Path;

public class Mark extends VDLFunction {
    public static final Arg RESTARTS = new Arg.Positional("restarts");
    public static final Arg ERR = new Arg.Positional("err");
    public static final Arg MAPPING = new Arg.Optional("mapping", Boolean.FALSE);

    static {
        setArguments(Mark.class, new Arg[] { RESTARTS, ERR, MAPPING });
    }

    @Override
    protected Object function(VariableStack stack) throws ExecutionException,
            HandleOpenException {
        try {
            if (TypeUtil.toBoolean(ERR.getValue(stack))) {
                boolean mapping = TypeUtil.toBoolean(MAPPING.getValue(stack));
                List files = TypeUtil.toList(RESTARTS.getValue(stack));
                for (Object f : files) {
                    List pv = TypeUtil.toList(f);
                    Path p = parsePath(pv.get(0), stack);
                    DSHandle handle = (DSHandle) pv.get(1);
                    DSHandle leaf = handle.getField(p);
                    synchronized (leaf) {
                        if (mapping) {
                            leaf.setValue(new MappingDependentException(leaf, null));
                        }
                        else {
                            leaf.setValue(new DataDependentException(leaf, null));
                        }
                        closeShallow(stack, leaf);
                    }
                }
            }
        }
        catch (Exception e) {
            throw new ExecutionException(e);
        }
        return null;
    }
{'fraction_non_alphanumeric': 0.09747378455672069, 'fraction_numerical': 0.0038131553860819827, 'mean_word_length': 1.9473314606741574, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6190017', 'n_tokens_mistral': 1200, 'n_tokens_neox': 1157, 'n_words': 237}