<commit_before>
/*
 * Java core library component.
 *
 * Copyright (c) 1997, 1998
 *      Transvirtual Technologies, Inc.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file.
 */

package java.text;

import java.io.File;
import java.io.Serializable;
import java.util.Locale;
import java.util.ResourceBundle;

public abstract class Format implements Serializable, Cloneable {
/*
 * XXX implement serial form!
 */

private static final String RESOURCEBASE = "kaffe.text.";

public Format() {
	// Does nothing
}

public Object clone() {
	try {
		return (super.clone());
	}
	catch (CloneNotSupportedException _) {
		return (null);
	}
}

public final String format(Object obj) {
	return (format(obj, new StringBuffer(), new FieldPosition(0)).toString());
}

public abstract StringBuffer format(Object obj, StringBuffer buf, FieldPosition pos);

public abstract Object parseObject(String source, ParsePosition status);

public Object parseObject(String source) {
	return parseObject(source, new ParsePosition(0));
}

static ResourceBundle getResources(String name, Locale loc) {
	return (ResourceBundle.getBundle(RESOURCEBASE + name + ".locale", loc));
}

static Locale[] getAvailableLocales(String name) {
	File dir = new File(RESOURCEBASE + name);
	String[] list = dir.list();

	int j = 0;
	for (int i = 0; i < list.length; i++) {
		String nm = list[i];
		if (!nm.startsWith("locale_") && nm.length() == 12) {
			j++;
		}
		else {
			list[i] = null;
		}
	}

	Locale[] locales = new Locale[j];
	for (int i = 0; i < list.length; i++) {
		String nm = list[i];
		if (nm != null) {
			String lang = nm.substring(7, 9);
			String cont = nm.substring(10, 12);
			locales[j] = new Locale(lang, cont);
			j++;
		}
	}

	return (locales);
}

}
<commit_msg>Check for parse error in parseObject(String) and throw ParseException if so.<commit_after>
/*
 * Java core library component.
 *
 * Copyright (c) 1997, 1998
 *      Transvirtual Technologies, Inc.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file.
 */

package java.text;

import java.io.File;
import java.io.Serializable;
import java.util.Locale;
import java.util.ResourceBundle;

public abstract class Format implements Serializable, Cloneable {
/*
 * XXX implement serial form!
 */

private static final String RESOURCEBASE = "kaffe.text.";

public Format() {
	// Does nothing
}

public Object clone() {
	try {
		return (super.clone());
	}
	catch (CloneNotSupportedException _) {
		return (null);
	}
}

public final String format(Object obj) {
	return (format(obj, new StringBuffer(), new FieldPosition(0)).toString());
}

public abstract StringBuffer format(Object obj, StringBuffer buf, FieldPosition pos);

public abstract Object parseObject(String source, ParsePosition status);

public Object parseObject(String source) throws ParseException {
	ParsePosition pp = new ParsePosition(0);
	Object obj = parseObject(source, pp);
	if (obj == null || pp.getIndex() == 0)
		throw new ParseException("parse failed", pp.getErrorIndex());
	return obj;
}

static ResourceBundle getResources(String name, Locale loc) {
	return (ResourceBundle.getBundle(RESOURCEBASE + name + ".locale", loc));
}

static Locale[] getAvailableLocales(String name) {
	File dir = new File(RESOURCEBASE + name);
	String[] list = dir.list();

	int j = 0;
	for (int i = 0; i < list.length; i++) {
		String nm = list[i];
		if (!nm.startsWith("locale_") && nm.length() == 12) {
			j++;
		}
		else {
			list[i] = null;
		}
	}

	Locale[] locales = new Locale[j];
	for (int i = 0; i < list.length; i++) {
		String nm = list[i];
		if (nm != null) {
			String lang = nm.substring(7, 9);
			String cont = nm.substring(10, 12);
			locales[j] = new Locale(lang, cont);
			j++;
		}
	}

	return (locales);
}

}

{'fraction_non_alphanumeric': 0.1350156087408949, 'fraction_numerical': 0.011186264308012487, 'mean_word_length': 4.006510416666667, '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': '2751425', 'n_tokens_mistral': 1322, 'n_tokens_neox': 1219, 'n_words': 388}