<commit_before>package edu.columbia.cs.psl.test.phosphor;

import edu.columbia.cs.psl.phosphor.runtime.MultiTainter;
import org.junit.Test;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;


public class SerializationObjTagITCase extends BaseMultiTaintClass {

    public static class ArrayHolderObjField implements Serializable{
        private static final long serialVersionUID = 2710507305915502837L;
        private Object arr;
        public ArrayHolderObjField(Object arr){
            this.arr = arr;
        }
        private void writeObject(ObjectOutputStream oos) throws IOException {

        	oos.defaultWriteObject();
        }

    public static class ArrayHolder implements Serializable {
        private static final long serialVersionUID = 7515681563331750671L;
        private byte[] arr;
        public ArrayHolder(byte[] arr) {
            this.arr = arr;
        }
    }

    public static class PrimitiveHolder implements  Serializable {
        private static final long serialVersionUID = -7447282366633906624L;
        private int x;
        public PrimitiveHolder(int x) {
            this.x = x;
        }
    }

    /* Checks that when an object with a tainted primitive array field is serialized and then deserialized the primitive
     * array of the deserialized object is also tainted. */
    @Test
    public void testSerializeObjectWithTaintedPrimitiveArrayField() throws Exception {
        byte[] arr = new byte[3];
        for(int i = 0; i < arr.length; i++) {
            arr[i] = MultiTainter.taintedByte((byte)i, "label");
        }<commit_msg>Fix compilation bug...<commit_after>package edu.columbia.cs.psl.test.phosphor;

import edu.columbia.cs.psl.phosphor.runtime.MultiTainter;
import org.junit.Test;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;


public class SerializationObjTagITCase extends BaseMultiTaintClass {

    public static class ArrayHolderObjField implements Serializable {
        private static final long serialVersionUID = 2710507305915502837L;
        private Object arr;

        public ArrayHolderObjField(Object arr) {
            this.arr = arr;
        }

        private void writeObject(ObjectOutputStream oos) throws IOException {

            oos.defaultWriteObject();
        }
    }

    public static class ArrayHolder implements Serializable {
        private static final long serialVersionUID = 7515681563331750671L;
        private byte[] arr;
        public ArrayHolder(byte[] arr) {
            this.arr = arr;
        }
    }

    public static class PrimitiveHolder implements  Serializable {
        private static final long serialVersionUID = -7447282366633906624L;
        private int x;
        public PrimitiveHolder(int x) {
            this.x = x;
        }
    }

    /* Checks that when an object with a tainted primitive array field is serialized and then deserialized the primitive
     * array of the deserialized object is also tainted. */
    @Test
    public void testSerializeObjectWithTaintedPrimitiveArrayField() throws Exception {
        byte[] arr = new byte[3];
        for(int i = 0; i < arr.length; i++) {
            arr[i] = MultiTainter.taintedByte((byte)i, "label");
        }
{'fraction_non_alphanumeric': 0.07313109425785481, 'fraction_numerical': 0.031960996749729145, 'mean_word_length': 3.022875816993464, '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': '7252669', 'n_tokens_mistral': 1079, 'n_tokens_neox': 995, 'n_words': 284}