<commit_before>package org.openengsb.labs.delegation.itests.bundles.consumer.internal;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.concurrent.Callable;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;

public class SerializerConsumer implements BundleActivator {
    @Override
    public void start(BundleContext context) throws Exception {
        ServiceReference reference = context.getServiceReferences(Callable.class.getName(), "(type=pageProvider)")[0];
        @SuppressWarnings("unchecked")
        Callable<Object> provider = (Callable<Object>) context.getService(reference);
        Object orignal = provider.call();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        new ObjectOutputStream(out).writeObject(orignal);
        byte[] data = out.toByteArray();

        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data));
        Object pageObject = ois.readObject();
        if (!pageObject.equals(orignal)) {
            throw new Exception("not equal");
        }
    }
<commit_msg>indicate that the test fails because of different classloaders<commit_after>package org.openengsb.labs.delegation.itests.bundles.consumer.internal;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.concurrent.Callable;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;

public class SerializerConsumer implements BundleActivator {
    @Override
    public void start(BundleContext context) throws Exception {
        ServiceReference reference = context.getServiceReferences(Callable.class.getName(), "(type=pageProvider)")[0];
        @SuppressWarnings("unchecked")
        Callable<Object> provider = (Callable<Object>) context.getService(reference);
        Object original = provider.call();
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        new ObjectOutputStream(out).writeObject(original);
        byte[] data = out.toByteArray();

        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data));
        Object pageObject = ois.readObject();
        if (!pageObject.equals(original)) {
            throw new Exception(String.format("object was not equal after deserializing\n" +
                    "%s != %s\n" +
                    "%s <-> %s", pageObject, original, pageObject.getClass().getClassLoader(), original.getClass()
                .getClassLoader()));
        }
    }

    @Override
{'fraction_non_alphanumeric': 0.10198398886181692, 'fraction_numerical': 0.0006961364427427776, 'mean_word_length': 4.07773851590106, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '3234385', 'n_tokens_mistral': 742, 'n_tokens_neox': 741, 'n_words': 158}