<commit_before>package hu.qgears.commons;

import java.lang.reflect.Field;

public class UtilEquals {

	private UtilEquals() {
		// disable constructor of utility class
	}
	/**
	 * Compare public fields.
	 * @param objA
	 * @param objB
	 * @return
	 */
	public static boolean equals(Object objA, Object objB) {
		try {
			if(objA.getClass().equals(objB.getClass()))
			{
				Field[] fd=objA.getClass().getFields();
				for(Field f: fd)
				{
					Object a=f.get(objA);
					Object b=f.get(objB);
					if(a==null)
					{
						if(b!=null)
						{
							return false;
						}
					}else
					{
						if(!a.equals(b))
						{
							return false;
						}
					}
				}
				return true;
			}
		} catch (Exception e) {
			//every exceptional case is treated as not equal parameters
		}
		return false;
	}
	/**
	 * Safe compare for equals:
	 * null equals null
	 * null does not equal anything else
	 * if objA is not null its equal is called to objB
	 * @param objA
	 * @param objB
	 * @return
	 * @since 3.0
	 */
	public static boolean safeEquals(Object objA, Object objB) {
		try {
			if (objA == objB) {
				//handling null and eq by reference cases
				return true;
			} else if(objA.getClass().equals(objB.getClass()))
			{
				Field[] fd=objA.getClass().getFields();
				for(Field f: fd)
				{
					Object a=f.get(objA);
					Object b=f.get(objB);
					if(a==null)
					{
						if(b!=null)
						{
							return false;
						}
					}else
					{
						if(!a.equals(b))
						{
							return false;
						}
					}
				}
				return true;
			}
		} catch (Exception e) {
			//every exceptional case is treated as not equal parameters
		}
		return false;
	}
}
<commit_msg>adding NOSONAR to intentional construct<commit_after>package hu.qgears.commons;

import java.lang.reflect.Field;

public class UtilEquals {

	private UtilEquals() {
		// disable constructor of utility class
	}
	/**
	 * Compare public fields.
	 * @param objA
	 * @param objB
	 * @return
	 */
	public static boolean equals(Object objA, Object objB) {
		try {
			if(objA.getClass().equals(objB.getClass()))
			{
				Field[] fd=objA.getClass().getFields();
				for(Field f: fd)
				{
					Object a=f.get(objA);
					Object b=f.get(objB);
					if(a==null)
					{
						if(b!=null)
						{
							return false;
						}
					}else
					{
						if(!a.equals(b))
						{
							return false;
						}
					}
				}
				return true;
			}
		} catch (Exception e) {
			//every exceptional case is treated as not equal parameters
		}
		return false;
	}
	/**
	 * Safe compare for equals:
	 * null equals null
	 * null does not equal anything else
	 * if objA is not null its equal is called to objB
	 * @param objA
	 * @param objB
	 * @return
	 * @since 3.0
	 */
	public static boolean safeEquals(Object objA, Object objB) {
		try {
			if (objA == objB) { // NOSONAR appropriate & intentional because of performance 
				//handling null and eq by reference cases
				return true;
			} else if(objA.getClass().equals(objB.getClass()))
			{
				Field[] fd=objA.getClass().getFields();
				for(Field f: fd)
				{
					Object a=f.get(objA);
					Object b=f.get(objB);
					if(a==null)
					{
						if(b!=null)
						{
							return false;
						}
					}else
					{
						if(!a.equals(b))
						{
							return false;
						}
					}
				}
				return true;
			}
		} catch (Exception e) {
			//every exceptional case is treated as not equal parameters
		}
		return false;
	}
}

{'fraction_non_alphanumeric': 0.12540192926045016, 'fraction_numerical': 0.001169248757673195, 'mean_word_length': 2.094032549728752, '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': '827694', 'n_tokens_mistral': 1588, 'n_tokens_neox': 1153, 'n_words': 310}