<commit_before>package com.bwfcwalshy.flarebot.util;

import com.bwfcwalshy.flarebot.FlareBot;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;

public class Images {
    public static Color averageColor(BufferedImage bi) {
        if(bi == null)
            return null;
        int red = 0, green = 0, blue = 0;
        for (int x = 0; x < bi.getWidth(); x++) {
            for (int y = 0; y < bi.getHeight(); y++) {
                Color pixel = new Color(bi.getRGB(x, y));
                red += pixel.getRed();
                green += pixel.getGreen();
                blue += pixel.getBlue();
            }
        }
        int pixels = bi.getHeight() * bi.getWidth();
        return new Color(red / pixels, green / pixels, blue / pixels);
    }

    public static BufferedImage imageFor(String url) {
        if(url == null)
            return null;
        try {
            URL urll = new URL(url);
            URLConnection connection = urll.openConnection();
            connection.addRequestProperty("User-Agent", "Mozilla/5.0");
            connection.connect();
            return ImageIO.read(connection.getInputStream());
        } catch (IOException e) {
            FlareBot.LOGGER.error(String.format("Could not get BufferedImage for '%s'", url), e);
            return null;
        }
    }
}
<commit_msg>Make Images.java Not Null<commit_after>package com.bwfcwalshy.flarebot.util;

import com.bwfcwalshy.flarebot.FlareBot;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;

public class Images {
    public static Color averageColor(BufferedImage bi) {
        if(bi == null)
            return Color.DARK_GRAY;
        int red = 0, green = 0, blue = 0;
        for (int x = 0; x < bi.getWidth(); x++) {
            for (int y = 0; y < bi.getHeight(); y++) {
                Color pixel = new Color(bi.getRGB(x, y));
                red += pixel.getRed();
                green += pixel.getGreen();
                blue += pixel.getBlue();
            }
        }
        int pixels = bi.getHeight() * bi.getWidth();
        return new Color(red / pixels, green / pixels, blue / pixels);
    }

    public static BufferedImage imageFor(String url) {
        if(url == null)
            return null;
        try {
            URL urll = new URL(url);
            URLConnection connection = urll.openConnection();
            connection.addRequestProperty("User-Agent", "Mozilla/5.0");
            connection.connect();
            return ImageIO.read(connection.getInputStream());
        } catch (IOException e) {
            FlareBot.LOGGER.error(String.format("Could not get BufferedImage for '%s'", url), e);
            return null;
        }
    }
}

{'fraction_non_alphanumeric': 0.12427051150017164, 'fraction_numerical': 0.004806041881222108, 'mean_word_length': 2.029106029106029, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2399264', 'n_tokens_mistral': 862, 'n_tokens_neox': 841, 'n_words': 217}