<commit_before>package org.verapdf.report;

import org.verapdf.pdfa.results.MetadataFixerResult;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import java.util.ArrayList;
import java.util.List;

/**
 * @author <NAME>
 */
public class MetadataFixesReport {

	@XmlAttribute
	private final String status;
	@XmlAttribute
    private final Integer completedMetadataFixes;
    @XmlElement(name = "appliedFix")
	private final List<String> appliedFixes;
    @XmlElement(name = "errorMessage")
    private final List<String> errorMessages;

    private MetadataFixesReport(String status, Integer completedMetadataFixes, List<String> appliedFixes, List<String> errorMessages) {
        this.status = status;
		this.completedMetadataFixes = completedMetadataFixes;
		this.appliedFixes = appliedFixes;
        this.errorMessages = errorMessages;
    }

	private MetadataFixesReport() {
        this("", 0, null, null);
    }

	static MetadataFixesReport fromValues(final MetadataFixerResult fixerResult) {
		if (fixerResult == null) {
			return null;
		}
		String status = fixerResult.getRepairStatus().toString();
        Integer completedFixes = null;
        List<String> fixes = null;
        List<String> errorMessages = null;
        switch (fixerResult.getRepairStatus()) {
            case SUCCESS:
            case ID_REMOVED:
                completedFixes = fixes.size();
                fixes = new ArrayList<>(fixerResult.getAppliedFixes());
                break;
            case FIX_ERROR:
                errorMessages = new ArrayList<>(fixerResult.getAppliedFixes());
                break;
        }

        return new MetadataFixesReport(status, completedFixes, fixes, errorMessages);
    }
}<commit_msg>Fixed errors while saving metadata fixer report.<commit_after>package org.verapdf.report;

import org.verapdf.pdfa.results.MetadataFixerResult;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import java.util.ArrayList;
import java.util.List;

/**
 * @author <NAME>
 */
public class MetadataFixesReport {

	@XmlAttribute
	private final String status;
	@XmlAttribute
    private final Integer completedMetadataFixes;
    @XmlElement(name = "appliedFix")
	private final List<String> appliedFixes;
    @XmlElement(name = "errorMessage")
    private final List<String> errorMessages;

    private MetadataFixesReport(String status, Integer completedMetadataFixes, List<String> appliedFixes, List<String> errorMessages) {
        this.status = status;
		this.completedMetadataFixes = completedMetadataFixes;
		this.appliedFixes = appliedFixes;
        this.errorMessages = errorMessages;
    }

	private MetadataFixesReport() {
        this("", 0, null, null);
    }

	static MetadataFixesReport fromValues(final MetadataFixerResult fixerResult) {
		if (fixerResult == null) {
			return null;
		}
        MetadataFixerResult.RepairStatus repairStatus = fixerResult.getRepairStatus();
        Integer completedFixes = null;
        List<String> fixes = null;
        List<String> errorMessages = null;
        List<String> appliedFixes = fixerResult.getAppliedFixes();
        switch (repairStatus) {
            case SUCCESS:
            case ID_REMOVED:
                completedFixes = appliedFixes.size();
                fixes = new ArrayList<>(appliedFixes);
                break;
            case FIX_ERROR:
                errorMessages = new ArrayList<>(appliedFixes);
                break;
        }
        String status = repairStatus.toString();
        return new MetadataFixesReport(status, completedFixes, fixes, errorMessages);
    }
}
{'fraction_non_alphanumeric': 0.09088420476320833, 'fraction_numerical': 0.0005474952094169176, 'mean_word_length': 3.2193995381062357, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '2368146', 'n_tokens_mistral': 1047, 'n_tokens_neox': 998, 'n_words': 228}