<commit_before>import java.io.*;
import java.net.*;
import java.nio.file.*;
import java.nio.file.attribute.*;
import java.util.*;
import java.util.stream.*;
import java.util.zip.*;

public class ReproducibleJar {
    public static void main(String[] args) throws Exception {
        Path inputJar = Paths.get(args[0]);
        long timeStamp = Long.parseLong(args[1]);

        URI uri = URI.create("jar:" + inputJar.toUri());
        byte[] newJar;
        try (FileSystem fs = FileSystems.newFileSystem(uri, Collections.emptyMap())) {
            Iterable<Path> roots = fs.getRootDirectories();
            Path root = roots.iterator().next();
            newJar = setAllTimes(root, FileTime.fromMillis(timeStamp));
        }
        Files.write(inputJar, newJar, StandardOpenOption.TRUNCATE_EXISTING);
    }

    private static byte[] setAllTimes(Path root, FileTime lastModified) {
        Map<Path, byte[]> files = new TreeMap<>();
        try {
            Set<Path> all = Files.walk(root).collect(Collectors.toSet());
            for (Path p: all) {
                if (! Files.isDirectory(p))
                    files.put(p, Files.readAllBytes(p));
            }
            ByteArrayOutputStream bout = new ByteArrayOutputStream();
            ZipOutputStream zout = new ZipOutputStream(bout);
            for (Path p: files.keySet()) {
                ZipEntry zipEntry = new ZipEntry(p.toString());
                zipEntry.setLastModifiedTime(lastModified);
                zout.putNextEntry(zipEntry);
                zout.write(files.get(p));
                zout.closeEntry();
            }
            zout.finish();
            return bout.toByteArray();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    private static void setTime(Path p, FileTime lastModified) {
        System.out.println("Processing: " + p);
        if (p.getFileName() == null)
            return;
        try {
            Files.setLastModifiedTime(p, lastModified);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}<commit_msg>remove dead code in jar canonicaliser<commit_after>import java.io.*;
import java.net.*;
import java.nio.file.*;
import java.nio.file.attribute.*;
import java.util.*;
import java.util.stream.*;
import java.util.zip.*;

public class ReproducibleJar {
    public static void main(String[] args) throws Exception {
        Path inputJar = Paths.get(args[0]);
        long timeStamp = Long.parseLong(args[1]);

        URI uri = URI.create("jar:" + inputJar.toUri());
        byte[] newJar;
        try (FileSystem fs = FileSystems.newFileSystem(uri, Collections.emptyMap())) {
            Iterable<Path> roots = fs.getRootDirectories();
            Path root = roots.iterator().next();
            newJar = setAllTimes(root, FileTime.fromMillis(timeStamp));
        }
        Files.write(inputJar, newJar, StandardOpenOption.TRUNCATE_EXISTING);
    }

    private static byte[] setAllTimes(Path root, FileTime lastModified) {
        Map<Path, byte[]> files = new TreeMap<>();
        try {
            Set<Path> all = Files.walk(root).collect(Collectors.toSet());
            for (Path p: all) {
                if (! Files.isDirectory(p))
                    files.put(p, Files.readAllBytes(p));
            }
            ByteArrayOutputStream bout = new ByteArrayOutputStream();
            ZipOutputStream zout = new ZipOutputStream(bout);
            for (Path p: files.keySet()) {
                ZipEntry zipEntry = new ZipEntry(p.toString());
                zipEntry.setLastModifiedTime(lastModified);
                zout.putNextEntry(zipEntry);
                zout.write(files.get(p));
                zout.closeEntry();
            }
            zout.finish();
            return bout.toByteArray();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
{'fraction_non_alphanumeric': 0.12359550561797752, 'fraction_numerical': 0.0010214504596527069, 'mean_word_length': 2.1436597110754416, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '7108388', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1080, 'n_words': 239}