<commit_before>package de.podfetcher.syndication.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import android.util.Log;

/** Parses several date formats. */
public class SyndDateUtils {
	private static final String TAG = "DateUtils";
	public static final String RFC822 = "dd MMM yyyy HH:mm:ss Z";
	/** RFC 822 date format with day of the week. */
	public static final String RFC822DAY = "EEE, " + RFC822;

	/** RFC 3339 date format for UTC dates. */
	public static final String RFC3339UTC = "yyyy-MM-dd'T'HH:mm:ss'Z'";

	/** RFC 3339 date format for localtime dates with offset. */
	public static final String RFC3339LOCAL = "yyyy-MM-dd'T'HH:mm:ssZ";

	public static Date parseRFC822Date(final String date) {
		Date result = null;
		SimpleDateFormat format = new SimpleDateFormat(RFC822DAY);
		try {
			result = format.parse(date);
		} catch (ParseException e) {
			format = new SimpleDateFormat(RFC822);
			try {
				result = format.parse(date);
			} catch (ParseException e1) {
				e1.printStackTrace();
			}
		}

		return result;
	}

	public static Date parseRFC3339Date(final String date) {
		Date result = null;
		SimpleDateFormat format = null;
		if (date.endsWith("Z")) {
			format = new SimpleDateFormat(RFC3339UTC);
			try {
				result = format.parse(date);
			} catch (ParseException e) {
				e.printStackTrace();
			}
		} else {
			format = new SimpleDateFormat(RFC3339LOCAL);
			// remove last colon
			StringBuffer buf = new StringBuffer(date.length() - 1);
			int colonIdx = date.lastIndexOf(':');
			for (int x = 0; x < date.length(); x++) {
				if (x != colonIdx)
					buf.append(date.charAt(x));<commit_msg>Fixed error that happened on non-US devices<commit_after>package de.podfetcher.syndication.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import android.util.Log;

/** Parses several date formats. */
public class SyndDateUtils {
	private static final String TAG = "DateUtils";
	public static final String RFC822 = "dd MMM yyyy HH:mm:ss Z";
	/** RFC 822 date format with day of the week. */
	public static final String RFC822DAY = "EEE, " + RFC822;

	/** RFC 3339 date format for UTC dates. */
	public static final String RFC3339UTC = "yyyy-MM-dd'T'HH:mm:ss'Z'";

	/** RFC 3339 date format for localtime dates with offset. */
	public static final String RFC3339LOCAL = "yyyy-MM-dd'T'HH:mm:ssZ";

	public static Date parseRFC822Date(final String date) {
		Date result = null;
		SimpleDateFormat format = new SimpleDateFormat(RFC822DAY, Locale.US);
		try {
			result = format.parse(date);
		} catch (ParseException e) {
			e.printStackTrace();
			format = new SimpleDateFormat(RFC822, Locale.US);
			try {
				result = format.parse(date);
			} catch (ParseException e1) {
				e1.printStackTrace();
			}
		}

		return result;
	}

	public static Date parseRFC3339Date(final String date) {
		Date result = null;
		SimpleDateFormat format = null;
		if (date.endsWith("Z")) {
			format = new SimpleDateFormat(RFC3339UTC, Locale.US);
			try {
				result = format.parse(date);
			} catch (ParseException e) {
				e.printStackTrace();
			}
		} else {
			format = new SimpleDateFormat(RFC3339LOCAL, Locale.US);
			// remove last colon
			StringBuffer buf = new StringBuffer(date.length() - 1);
			int colonIdx = date.lastIndexOf(':');
			for (int x = 0; x < date.length(); x++) {
				if (x != colonIdx)
					buf.append(date.charAt(x));
{'fraction_non_alphanumeric': 0.12194420477423065, 'fraction_numerical': 0.030486051193557663, 'mean_word_length': 3.7191316146540028, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7482917', 'n_tokens_mistral': 1341, 'n_tokens_neox': 1136, 'n_words': 328}