<commit_before>package org.amc.servlet.validator;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

import org.amc.servlet.model.MouldingProcess;
import org.amc.servlet.model.MouldingProcessForm;

public class ProcessForm_Validator 
{
	public List<String> validate(MouldingProcessForm form)
	{
		List<String> errors=new ArrayList<String>();
		
		String id=form.getId();
		try
		{
			Integer.parseInt(id);
		}
		catch(NumberFormatException nfe)
		{
			errors.add("ID is not an integer");
		}
		String date=form.getDateOfIssue();
		try
		{
			java.sql.Date.valueOf(date);
		}
		catch(IllegalArgumentException iae)
		{
			errors.add("Date is not in the correct format:yyyy-mm-dd");
		}
		String machineSize=form.getMachineSize();
		try
		{
			Integer.parseInt(machineSize);
		}
		catch(NumberFormatException nfe)
		{
			errors.add("Machine Size is not an integer");
		}
		
		for(int i=9;i<81;i++)
		{
			String field=null;
			try
			{
				field=MouldingProcess.fields[i];
				Field refField=MouldingProcessForm.class.getDeclaredField(field);
				Float.parseFloat((String)refField.get(form));
				
			}
			catch(NoSuchFieldException nsfe)
			{<commit_msg>Added more input validation to ProcessPage values as null product names(Part_ID) where allowed which is wrong<commit_after>package org.amc.servlet.validator;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

import org.amc.servlet.model.MouldingProcess;
import org.amc.servlet.model.MouldingProcessForm;

public class ProcessForm_Validator 
{
	public List<String> validate(MouldingProcessForm form)
	{
		List<String> errors=new ArrayList<String>();
		
		String id=form.getId();
		try
		{
			Integer.parseInt(id);
		}
		catch(NumberFormatException nfe)
		{
			errors.add("ID is not an integer");
		}
		
		String productName=form.getPartId();
		if(productName==null||productName.equals(""))
		{
			errors.add("Product Name required");
		}
		
		String date=form.getDateOfIssue();
		try
		{
			java.sql.Date.valueOf(date);
		}
		catch(IllegalArgumentException iae)
		{
			errors.add("Date is not in the correct format:yyyy-mm-dd");
		}
		String machineSize=form.getMachineSize();
		try
		{
			Integer.parseInt(machineSize);
		}
		catch(NumberFormatException nfe)
		{
			errors.add("Machine Size is not an integer");
		}
		
		for(int i=9;i<81;i++)
		{
			String field=null;
			try
			{
				field=MouldingProcess.fields[i];
				Field refField=MouldingProcessForm.class.getDeclaredField(field);
				Float.parseFloat((String)refField.get(form));
				
			}
			catch(NoSuchFieldException nsfe)
			{
{'fraction_non_alphanumeric': 0.12111920275967804, 'fraction_numerical': 0.0022997316979685703, 'mean_word_length': 4.0778210116731515, 'pattern_counts': {'":': 0, '<': 11, '<?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': '3020349', 'n_tokens_mistral': 1027, 'n_tokens_neox': 878, 'n_words': 159}