<commit_before>
package edu.wustl.catissuecore.util;

import java.util.Comparator;

import edu.wustl.catissuecore.bean.DeriveSpecimenBean;
import edu.wustl.catissuecore.bean.GenericSpecimen;
import edu.wustl.catissuecore.domain.Specimen;

public class IdComparator implements Comparator
{

	public int compare(Object arg0, Object arg1)
	{
		Long id1 = null;
		Long id2 = null;

		if (arg0 != null && arg1 != null)
		{
			if (arg0 instanceof DeriveSpecimenBean && arg1 instanceof DeriveSpecimenBean)
			{
				id1 = ((DeriveSpecimenBean) arg0).getId();
				id2 = ((DeriveSpecimenBean) arg1).getId();

			}
			if (arg0 instanceof Specimen && arg1 instanceof Specimen)
			{
				id1 = ((Specimen) arg0).getId();
				id2 = ((Specimen) arg1).getId();

			}

			if (arg0 instanceof GenericSpecimen && arg1 instanceof GenericSpecimen)
			{
				id1 = ((GenericSpecimen) arg0).getId();
				id2 = ((GenericSpecimen) arg1).getId();

			}
			if (id1 != null && id2 != null)
			{
				return id1.compareTo(id2);
			}
			if (id1 == null && id2 == null)
				return 0;

			if (id1 == null)
				return 1;
			if (id2 == null)
				return -1;
		}
		// TODO Auto-generated method stub
		return 0;
	}

}
<commit_msg>Fixed bug 8905<commit_after>
package edu.wustl.catissuecore.util;

import java.util.Comparator;

import edu.wustl.catissuecore.bean.ConsentBean;
import edu.wustl.catissuecore.bean.DeriveSpecimenBean;
import edu.wustl.catissuecore.bean.GenericSpecimen;
import edu.wustl.catissuecore.domain.ConsentTier;
import edu.wustl.catissuecore.domain.ConsentTierResponse;
import edu.wustl.catissuecore.domain.ConsentTierStatus;
import edu.wustl.catissuecore.domain.Specimen;

public class IdComparator implements Comparator
{

	public int compare(Object arg0, Object arg1)
	{
		Long id1 = null;
		Long id2 = null;

		if (arg0 != null && arg1 != null)
		{
			if (arg0 instanceof DeriveSpecimenBean && arg1 instanceof DeriveSpecimenBean)
			{
				id1 = ((DeriveSpecimenBean) arg0).getId();
				id2 = ((DeriveSpecimenBean) arg1).getId();

			}
			if (arg0 instanceof Specimen && arg1 instanceof Specimen)
			{
				id1 = ((Specimen) arg0).getId();
				id2 = ((Specimen) arg1).getId();

			}

			if (arg0 instanceof GenericSpecimen && arg1 instanceof GenericSpecimen)
			{
				id1 = ((GenericSpecimen) arg0).getId();
				id2 = ((GenericSpecimen) arg1).getId();

			}
//			bug 8905 start
			if(arg0 instanceof ConsentTierResponse && arg1 instanceof ConsentTierResponse)
			{
				id1 = ((ConsentTierResponse) arg0).getConsentTier().getId();
				id2 = ((ConsentTierResponse) arg1).getConsentTier().getId();
			}
			if(arg0 instanceof ConsentTier && arg1 instanceof ConsentTier)
			{
				id1 = ((ConsentTier) arg0).getId();
				id2 = ((ConsentTier) arg1).getId();
			}
			if(arg0 instanceof ConsentTierStatus && arg1 instanceof ConsentTierStatus)
			{
				id1 = ((ConsentTierStatus) arg0).getConsentTier().getId();
				id2 = ((ConsentTierStatus) arg1).getConsentTier().getId();
			}
			if(arg0 instanceof ConsentBean && arg1 instanceof ConsentBean)
			{
				String id3 = ((ConsentBean) arg0).getConsentTierID();
				String id4 = ((ConsentBean) arg1).getConsentTierID();
				if(id3!=null && id4!=null)
				{
					id1 = Long.parseLong(id3);
					id2 = Long.parseLong(id4);
				}
			}
			if(arg0 instanceof String && arg1 instanceof String)
			{
				id1 = Long.parseLong(getId((String)arg0));
				id2 = Long.parseLong(getId((String)arg1));
			}
//			bug 8905 end
			if (id1 != null && id2 != null)
			{
				return id1.compareTo(id2);
			}
			if (id1 == null && id2 == null)
				return 0;

			if (id1 == null)
				return 1;
			if (id2 == null)
				return -1;
		}
		// TODO Auto-generated method stub
		return 0;
	}
//	bug 8905
	/**
	 * This method is used to get consent id from key 
	 * @param key - ConsentBean:counter_consentTierID
	 * @return id
	 */
	private String getId(String arg)
	{
		String[] first = ((String)arg).split(":");
		String id = null;
		if(first.length > 0)
		{
			for(String s : first)
			{
				if(s.contains("_"))
				{
					String[] idStmt = ((String)s).split("_");
					id = idStmt[0];
				}
			}
		}
		return id;
	}

}

{'fraction_non_alphanumeric': 0.1308105582807755, 'fraction_numerical': 0.02943237561317449, 'mean_word_length': 2.8334825425246195, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 4, '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': '2400522', 'n_tokens_mistral': 1789, 'n_tokens_neox': 1529, 'n_words': 326}