<commit_before>package com.dsdev.assets;

import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import java.io.*;
import java.net.URL;
import org.apache.commons.io.FileUtils;
import com.dsdev.moddle.*;

/**
 * This class contains all of the tools required to build and maintain a copy of
 * the Minecraft assets.
 *
 * @author Nathan2055
 */
public class AssetBuilder {

    /**
     * This method builds a fresh copy of the Minecraft assets in the provided
     * directory. If the directory already exists, it is deleted.
     *
     * @param directory A String representing the directory where the assets
     * should be created. MAKE SURE THAT IT ENDS WITH A / CHARCTER OR THIS CODE
     * WILL GO BOOM!
     * @throws java.io.IOException Of course. :P
     */
    public static void buildAssets(String directory) throws IOException {
        Logger.info("Assets", "Building Minecraft assets at " + directory);

        // Let's start by setting up the stuff we're gonna need
        Logger.info("Assets", "Setting up folders...");
        File assetFolder = new File(directory);
        try {
            FileUtils.deleteDirectory(assetFolder);
            Logger.info("Assets", "Deleting existing folder...");
        } catch (IOException e) {
            Logger.info("Assets", "Folder exists. Skipping deletion...");
        }
        assetFolder.mkdir();
        File assetFolderLegacy = new File(directory + "/legacy");
        assetFolderLegacy.mkdir();

        // Now let's download the version definition file from Mojang and store it in a temporary file
        Logger.info("Assets", "Fetching asset definition file...");
        File defFile = File.createTempFile("assets", ".json");
        URL defWeb = new URL("https://s3.amazonaws.com/Minecraft.Download/indexes/legacy.json");
        FileUtils.copyURLToFile(defWeb, defFile);
        Logger.info("Assets", "Saving asset definition file...");
        File defFileSaved = new File(directory + "assetDef.json");
        FileUtils.copyFile(defFile, defFileSaved);

        // And now we parse...
        Logger.info("Assets", "String asset download...");
        String defString = FileUtils.readFileToString(defFile);
        StringReader defReader = new StringReader(defString);
        JsonReader reader = new JsonReader(defReader);
        try {
            reader.beginObject();
            reader.nextName();<commit_msg>Purposefully broken code<commit_after>package com.dsdev.assets;

import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import java.io.*;
import java.net.URL;
import org.apache.commons.io.FileUtils;
import com.dsdev.moddle.*;

/**
 * This class contains all of the tools required to build and maintain a copy of
 * the Minecraft assets.
 *
 * @author Nathan2055
 */
public class AssetBuilder {

    /**
     * This method builds a fresh copy of the Minecraft assets in the provided
     * directory. If the directory already exists, it is deleted.
     *
     * @param directory A String representing the directory where the assets
     * should be created. MAKE SURE THAT IT ENDS WITH A / CHARCTER OR THIS CODE
     * WILL GO BOOM!
     * @throws java.io.IOException Of course. :P
     */
    public static void buildAssets(String directory) throws IOException {
        Logger.info("Assets", "Building Minecraft assets at " + directory);space

        // Let's start by setting up the stuff we're gonna need
        Logger.info("Assets", "Setting up folders...");
        File assetFolder = new File(directory);
        try {
            FileUtils.deleteDirectory(assetFolder);
            Logger.info("Assets", "Deleting existing folder...");
        } catch (IOException e) {
            Logger.info("Assets", "Folder exists. Skipping deletion...");
        }
        assetFolder.mkdir();
        File assetFolderLegacy = new File(directory + "/legacy");
        assetFolderLegacy.mkdir();

        // Now let's download the version definition file from Mojang and store it in a temporary file
        Logger.info("Assets", "Fetching asset definition file...");
        File defFile = File.createTempFile("assets", ".json");
        URL defWeb = new URL("https://s3.amazonaws.com/Minecraft.Download/indexes/legacy.json");
        FileUtils.copyURLToFile(defWeb, defFile);
        Logger.info("Assets", "Saving asset definition file...");
        File defFileSaved = new File(directory + "assetDef.json");
        FileUtils.copyFile(defFile, defFileSaved);

        // And now we parse...
        Logger.info("Assets", "String asset download...");
        String defString = FileUtils.readFileToString(defFile);
        StringReader defReader = new StringReader(defString);
        JsonReader reader = new JsonReader(defReader);
        try {
            reader.beginObject();
            reader.nextName();
{'fraction_non_alphanumeric': 0.10864197530864197, 'fraction_numerical': 0.00205761316872428, 'mean_word_length': 2.759474091260634, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1067884', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1283, 'n_words': 419}