<commit_before>package org.rhq.audit.common;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class AuditRecord {
    private final String message;
    private final Subsystem subsystem;
    private final long timestamp;
    private final Map<String, String> details;

    public static AuditRecord fromJSON(String json) {
        final Gson gson = new GsonBuilder().create();
        return gson.fromJson(json, AuditRecord.class);
    }

    public AuditRecord(String message, Subsystem subsystem) {
        this(message, subsystem, null, 0);
    }

    public AuditRecord(String message, Subsystem subsystem, Map<String, String> details) {
        this(message, subsystem, details, 0);
    }

    public AuditRecord(String message, Subsystem subsystem, Map<String, String> details, long timestamp) {
        if (subsystem == null) {
            subsystem = Subsystem.MISCELLANEOUS;
        }
        if (timestamp <= 0) {
            timestamp = System.currentTimeMillis();
        }

        this.message = message;
        this.subsystem = subsystem;
        this.timestamp = timestamp;

        // make our own copy of the details data
        if (details != null) {
            this.details = new HashMap<String, String>(details);
        } else {
            this.details = null;
        }
    }

    public String getMessage() {
        return message;
    }

    public Subsystem getSubsystem() {
        return subsystem;
    }

    public Map<String, String> getDetails() {
        if (details == null) {
            return null;
        }
        return Collections.unmodifiableMap(details);
    }

    public long getTimestamp() {
        return timestamp;
    }

    @Override
    public String toString() {
        return toJSON();
    };

    public String toJSON() {
        final Gson gson = new GsonBuilder().create();
        return gson.toJson(this);
    }
}
<commit_msg>null out details if empty<commit_after>package org.rhq.audit.common;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class AuditRecord {
    private final String message;
    private final Subsystem subsystem;
    private final long timestamp;
    private final Map<String, String> details;

    public static AuditRecord fromJSON(String json) {
        final Gson gson = new GsonBuilder().create();
        return gson.fromJson(json, AuditRecord.class);
    }

    public AuditRecord(String message, Subsystem subsystem) {
        this(message, subsystem, null, 0);
    }

    public AuditRecord(String message, Subsystem subsystem, Map<String, String> details) {
        this(message, subsystem, details, 0);
    }

    public AuditRecord(String message, Subsystem subsystem, Map<String, String> details, long timestamp) {
        if (subsystem == null) {
            subsystem = Subsystem.MISCELLANEOUS;
        }
        if (timestamp <= 0) {
            timestamp = System.currentTimeMillis();
        }

        this.message = message;
        this.subsystem = subsystem;
        this.timestamp = timestamp;

        // make our own copy of the details data
        if (details != null && !details.isEmpty()) {
            this.details = new HashMap<String, String>(details);
        } else {
            this.details = null;
        }
    }

    public String getMessage() {
        return message;
    }

    public Subsystem getSubsystem() {
        return subsystem;
    }

    public Map<String, String> getDetails() {
        if (details == null) {
            return null;
        }
        return Collections.unmodifiableMap(details);
    }

    public long getTimestamp() {
        return timestamp;
    }

    @Override
    public String toString() {
        return toJSON();
    };

    public String toJSON() {
        final Gson gson = new GsonBuilder().create();
        return gson.toJson(this);
    }
}

{'fraction_non_alphanumeric': 0.09736711376055639, 'fraction_numerical': 0.0014903129657228018, 'mean_word_length': 2.3614357262103507, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, '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': '4643613', 'n_tokens_mistral': 1136, 'n_tokens_neox': 1093, 'n_words': 309}