<commit_before>package com.jenjinstudios.io.serialization;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSyntaxException;
import com.jenjinstudios.io.Message;
import com.jenjinstudios.io.MessageReader;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * Implements a MessageWriter which relies on Gson to deserialize incoming data.
 *
 * @author <NAME>
 */
public class GsonMessageReader implements MessageReader
{
    private final DataInputStream inputStream;
    private final Object gsonMessageDeserializer = new GsonMessageDeserializer();

    /**
     * Construct a new GsonMessageReader that will read Messages from the given InputStream.
     *
     * @param inputStream The InputStream.
     */
    public GsonMessageReader(InputStream inputStream) {
        this.inputStream = new DataInputStream(inputStream);
    }

    @Override
    public Message read() throws IOException {
        final String s = (inputStream.available() > 0) ? inputStream.readUTF() : "";
        Gson gson = new GsonBuilder()
              .registerTypeAdapter(Message.class, gsonMessageDeserializer)
              .create();
        Message message;
        try {
            message = gson.fromJson(s, Message.class);
        } catch (JsonSyntaxException ex) {
            throw new IOException("Syntax error in message JSON", ex);
        } catch (JsonParseException ex) {
            throw new IOException("Unable to properly parse JSON data into Message object", ex);
        }
        return message;
    }

    @Override
    public void close() throws IOException {
        inputStream.close();
    }
}<commit_msg>Re-scarify error message<commit_after>package com.jenjinstudios.io.serialization;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
import com.google.gson.JsonSyntaxException;
import com.jenjinstudios.io.Message;
import com.jenjinstudios.io.MessageReader;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * Implements a MessageWriter which relies on Gson to deserialize incoming data.
 *
 * @author <NAME>
 */
public class GsonMessageReader implements MessageReader
{
    private final DataInputStream inputStream;
    private final Object gsonMessageDeserializer = new GsonMessageDeserializer();

    /**
     * Construct a new GsonMessageReader that will read Messages from the given InputStream.
     *
     * @param inputStream The InputStream.
     */
    public GsonMessageReader(InputStream inputStream) {
        this.inputStream = new DataInputStream(inputStream);
    }

    @Override
    public Message read() throws IOException {
        final String s = inputStream.readUTF();
        Gson gson = new GsonBuilder()
              .registerTypeAdapter(Message.class, gsonMessageDeserializer)
              .create();
        Message message;
        try {
            message = gson.fromJson(s, Message.class);
        } catch (JsonSyntaxException ex) {
            throw new IOException("Syntax error in message JSON", ex);
        } catch (JsonParseException ex) {
            throw new IOException("Unable to properly parse JSON data into Message object", ex);
        }
        return message;
    }

    @Override
    public void close() throws IOException {
        inputStream.close();
    }
}
{'fraction_non_alphanumeric': 0.08473105841526894, 'fraction_numerical': 0.0002891844997108155, 'mean_word_length': 3.1032028469750887, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '1794370', 'n_tokens_mistral': 923, 'n_tokens_neox': 912, 'n_words': 260}