<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestLib.ExceptionSafety
{
public class ExceptionSafe : IDisposable
{
    private readonly PreciousResource resource1, resource2;

    public ExceptionSafe()
    {
        PreciousResource tmp1 = null, tmp2 = null;
        try
        {
            tmp1 = new PreciousResource();
            tmp1.Open();
            tmp2 = new PreciousResource();
            tmp2.Open();

            // Commit point, no exception risk any more.
            resource1 = tmp1;
            tmp1 = null;
            resource2 = tmp2;
            tmp2 = null;
        }
        catch (Exception)
        {
            if (tmp1 != null)
            {
                tmp1.Dispose();
            }

            if (tmp2 != null)
            {
                tmp2.Dispose();
            }

            throw;
        }
    }

    public void Dispose()
    {
        resource1.Dispose();
        resource2.Dispose();
    }
}
}<commit_msg>- Changed to a finally block instead of a catch block<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestLib.ExceptionSafety
{
public class ExceptionSafe : IDisposable
{
    private readonly PreciousResource resource1, resource2;

    public ExceptionSafe()
    {
        PreciousResource tmp1 = null, tmp2 = null;
        try
        {
            tmp1 = new PreciousResource();
            tmp1.Open();
            tmp2 = new PreciousResource();
            tmp2.Open();

            // Commit point, no exception risk any more.
            resource1 = tmp1;
            tmp1 = null;
            resource2 = tmp2;
            tmp2 = null;
        }
        finally
        {
            if (tmp1 != null)
            {
                tmp1.Dispose();
            }

            if (tmp2 != null)
            {
                tmp2.Dispose();
            }
        }
    }

    public void Dispose()
    {
        resource1.Dispose();
        resource2.Dispose();
    }
}
}
{'fraction_non_alphanumeric': 0.0909970958373669, 'fraction_numerical': 0.01936108422071636, 'mean_word_length': 1.373134328358209, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1354624', 'n_tokens_mistral': 570, 'n_tokens_neox': 553, 'n_words': 140}