<commit_before>package org.intalio.tempo.workflow.tas.sling;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.io.IOUtils;
import org.apache.tools.ant.util.FileUtils;
import org.intalio.tempo.security.Property;
import org.intalio.tempo.workflow.tas.core.AttachmentMetadata;
import org.intalio.tempo.workflow.tas.core.StorageStrategy;
import org.intalio.tempo.workflow.tas.core.UnavailableAttachmentException;

public class FileSystemStorageStrategy implements StorageStrategy {

    private String path = "/Users/niko/Sites";
    private String publicPath = "http://localhost/~niko/";

    public void deleteAttachment(Property[] props, String url) throws UnavailableAttachmentException {
        if (url.startsWith(url)) {
            String localUrl = url.substring(publicPath.length() + 1);
            FileUtils.delete(new File(localUrl));
        }

    }

    public String storeAttachment(Property[] properties, AttachmentMetadata metadata, InputStream payload) throws IOException {
        FileOutputStream fos = new FileOutputStream(new File(path + File.separator + metadata.getFilename()));
        IOUtils.copy(payload, fos);
        return publicPath + File.separator + metadata.getFilename();
    }

}<commit_msg>using File instead of FileUtils<commit_after>package org.intalio.tempo.workflow.tas.sling;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.intalio.tempo.security.Property;
import org.intalio.tempo.workflow.tas.core.AttachmentMetadata;
import org.intalio.tempo.workflow.tas.core.StorageStrategy;
import org.intalio.tempo.workflow.tas.core.UnavailableAttachmentException;

public class FileSystemStorageStrategy implements StorageStrategy {

    private String path = "/Users/niko/Sites";
    private String publicPath = "http://localhost/~niko/";

    public void deleteAttachment(Property[] props, String url) throws UnavailableAttachmentException {
        if (url.startsWith(url)) {
            String localUrl = url.substring(publicPath.length() + 1);
            File localFile = new File(path + File.separator + localUrl);
            localFile.delete();
        }

    }

    public String storeAttachment(Property[] properties, AttachmentMetadata metadata, InputStream payload) throws IOException {
        FileOutputStream fos = new FileOutputStream(new File(path + File.separator + metadata.getFilename()));
        IOUtils.copy(payload, fos);
        return publicPath + File.separator + metadata.getFilename();
    }

}
{'fraction_non_alphanumeric': 0.10381905821282907, 'fraction_numerical': 0.0007415647015202076, 'mean_word_length': 4.218568665377176, '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': '1923956', 'n_tokens_mistral': 761, 'n_tokens_neox': 766, 'n_words': 157}