<commit_before>package dashteacup.pman;

import java.io.File;

import javax.swing.filechooser.FileFilter;

/**
 * Custom file filter to restrict the openable files to .PMAN files
 */
public class PmanFileFilter extends FileFilter {

    /**
     * Determines if a file should be displayed as selectable in the file
     * chooser.
     */
    @Override
    public boolean accept(File f) {
        if (f.isDirectory()) {
            return true;
        }
        String filename = f.getName();
        int extIndex = filename.lastIndexOf('.');
        // I don't want to worry about the case of the extension
        String extension = filename.substring(extIndex + 1).toLowerCase();
        return extension.equals("pman");<commit_msg>Properly handle out of bounds indices in pman filter.<commit_after>package dashteacup.pman;

import java.io.File;

import javax.swing.filechooser.FileFilter;

/**
 * Custom file filter to restrict the openable files to .PMAN files
 */
public class PmanFileFilter extends FileFilter {

    /**
     * Determines if a file should be displayed as selectable in the file
     * chooser.
     */
    @Override
    public boolean accept(File f) {
        if (f.isDirectory()) {
            return true;
        }
        String filename = f.getName();
        int extIndex = filename.lastIndexOf('.');
        try {
            // I don't want to worry about the case of the extension
            String extension = filename.substring(extIndex + 1).toLowerCase();
            return extension.equals("pman");
        }
        catch (IndexOutOfBoundsException e) {
            return false;
        }
{'fraction_non_alphanumeric': 0.09202453987730061, 'fraction_numerical': 0.001226993865030675, 'mean_word_length': 2.3698347107438016, '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': '1997037', 'n_tokens_mistral': 441, 'n_tokens_neox': 436, 'n_words': 147}