<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 javax.servlet.http;

import java.util.Hashtable;
import javax.servlet.ServletInputStream;
import java.io.IOException;

public class HttpUtils {

public HttpUtils() {
}

public static Hashtable parseQueryString(String s) {
	Hashtable h = new Hashtable();

	int spos = 0;
	for (;;) {
		int sep = s.indexOf('=', spos);
		if (sep == -1) {
			break;
		}
		int send = s.indexOf('&', sep);
		if (send == -1) {
			send = s.length();
		}
		add(h, s.substring(spos, sep-1), s.substring(sep+1, send));
		spos = send+1;
	}
	return (h);
}

private static void add(Hashtable table, String key, String value) {
	key = parse(key);
	value = parse(value);

	String[] vals = (String[])table.get(key);
	if (vals == null) {
		vals = new String[] { value };
	}
	else {
		String[] nvals = new String[vals.length + 1];
		System.arraycopy(vals, 0, nvals, 0, vals.length);
		vals = nvals;
	}
	table.put(key, vals);
}<commit_msg>* Fixed minor servlet bug.<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 javax.servlet.http;

import java.util.Hashtable;
import javax.servlet.ServletInputStream;
import java.io.IOException;

public class HttpUtils {

public HttpUtils() {
}

public static Hashtable parseQueryString(String s) {
	Hashtable h = new Hashtable();

	int spos = 0;
	for (;;) {
		int sep = s.indexOf('=', spos);
		if (sep == -1) {
			break;
		}
		int send = s.indexOf('&', sep);
		if (send == -1) {
			send = s.length();
		}
		add(h, s.substring(spos, sep), s.substring(sep+1, send));
		spos = send+1;
	}
	return (h);
}

private static void add(Hashtable table, String key, String value) {
	key = parse(key);
	value = parse(value);

	String[] vals = (String[])table.get(key);
	if (vals == null) {
		vals = new String[] { value };
	}
	else {
		String[] nvals = new String[vals.length + 1];
		System.arraycopy(vals, 0, nvals, 0, vals.length);
		vals = nvals;
	}
	table.put(key, vals);
}
{'fraction_non_alphanumeric': 0.15567054764984908, 'fraction_numerical': 0.014230271668822769, 'mean_word_length': 3.5224171539961016, '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': '419543', 'n_tokens_mistral': 893, 'n_tokens_neox': 824, 'n_words': 240}