<commit_before>package com.liuxinglanyue.session.serializer;

import org.apache.catalina.util.CustomObjectInputStream;

import java.util.Enumeration;
import java.util.HashMap;
import java.io.*;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;

import com.liuxinglanyue.session.CustomSession;
import com.liuxinglanyue.session.SessionMetadata;

public class JavaSerializer implements Serializer {
	private ClassLoader loader;

	private final Log log = LogFactory.getLog(JavaSerializer.class);

	@Override
	public void setClassLoader(ClassLoader loader) {
		this.loader = loader;
	}

	public byte[] attributesFrom(CustomSession session) throws IOException {
		HashMap<String, Object> attributes = new HashMap<String, Object>();
		for (Enumeration<String> enumerator = session.getAttributeNames(); enumerator.hasMoreElements();) {
			String key = enumerator.nextElement();
			attributes.put(key, session.getAttribute(key));<commit_msg>hashmap<commit_after>package com.liuxinglanyue.session.serializer;

import org.apache.catalina.util.CustomObjectInputStream;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.io.*;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;

import com.liuxinglanyue.session.CustomSession;
import com.liuxinglanyue.session.SessionMetadata;

public class JavaSerializer implements Serializer {
	private ClassLoader loader;

	private final Log log = LogFactory.getLog(JavaSerializer.class);

	@Override
	public void setClassLoader(ClassLoader loader) {
		this.loader = loader;
	}

	public byte[] attributesFrom(CustomSession session) throws IOException {
		Map<String, Object> attributes = new HashMap<String, Object>();
		for (Enumeration<String> enumerator = session.getAttributeNames(); enumerator.hasMoreElements();) {
			String key = enumerator.nextElement();
			attributes.put(key, session.getAttribute(key));
{'fraction_non_alphanumeric': 0.10038058991436727, 'fraction_numerical': 0.0, 'mean_word_length': 6.483985765124555, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3404125', 'n_tokens_mistral': 614, 'n_tokens_neox': 596, 'n_words': 129}