<commit_before>package org.esupportail.crousannonces.form;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;

import org.esupportail.crousannonces.utils.URLUtils;

public class JobForm extends CrousForm {

	protected int domaine;
	protected Integer[] type;

	protected Integer[] aideADomicile;
	protected Integer[] animation;
	protected Integer[] autres;
	protected Integer[] bureau;
	protected Integer[] hotellerie;
	protected Integer[] vente;
	protected Integer[] contrat;
	protected int teletravail;
	protected int typeLieu;
	protected int codeLieu;
	protected int townCode;
	protected int departmentCode;
	protected int regionCode;
	protected String order;
	protected boolean isSavedSearch;
	
	public String buildQueryString(Map<String, String> defaults) {
		
		Map<String, String> argumentMap = new HashMap<String, String>();
		Vector<String> arrayQueryStrings = new Vector<String>();
		
		argumentMap.putAll(defaults);
		
		if(this.domaine > 0) {
			switch(this.domaine) {
				case 4 : 
					if(this.aideADomicile.length > 0) {
						this.type = this.aideADomicile;
					}
					break;
				case 2 : 
					if(this.animation.length > 0) {
						this.type = this.animation;
					}
					break;
				case 1 : 
					if(this.autres.length > 0) {
						this.type = this.autres;
					}
					break;
				case 5 : 
					if(this.bureau.length > 0) {
						this.type = this.bureau;
					}
					break;
				case 3 : 
					if(this.hotellerie.length > 0) {
						this.type = this.hotellerie;
					}
					break;
				case 6 : 
					if(this.vente.length > 0) {
						this.type = this.vente;
					}
					break;
			}
			
			argumentMap.put("domaine", this.domaine+"");
			arrayQueryStrings.add(URLUtils.arrayToQueryString("type", this.type));
		}
		if(this.contrat.length > 0) {
			arrayQueryStrings.add(URLUtils.arrayToQueryString("contrat", this.contrat));
		}
		if(this.teletravail > 0) {
			argumentMap.put("teletravail", this.teletravail+"");
		}
		
		if(this.typeLieu > 0) {
			switch(this.typeLieu) {
				case 2:
					this.setCodeLieu(this.townCode);
					break;
				case 3:
					this.setCodeLieu(this.departmentCode);
					break;
				case 4:
					this.setCodeLieu(this.regionCode);
					break;
			}
			argumentMap.put("type_lieu", this.typeLieu + "");
			argumentMap.put("code_lieu", this.codeLieu + "");	
		}
		
		StringBuilder sb = new StringBuilder();
		<commit_msg>fix NPE error on jobForm<commit_after>package org.esupportail.crousannonces.form;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;

import org.esupportail.crousannonces.utils.URLUtils;

public class JobForm extends CrousForm {

	protected int domaine;
	protected Integer[] type;

	protected Integer[] aideADomicile;
	protected Integer[] animation;
	protected Integer[] autres;
	protected Integer[] bureau;
	protected Integer[] hotellerie;
	protected Integer[] vente;
	protected Integer[] contrat;
	protected int teletravail;
	protected int typeLieu;
	protected int codeLieu;
	protected int townCode;
	protected int departmentCode;
	protected int regionCode;
	protected String order;
	protected boolean isSavedSearch;
	
	public String buildQueryString(Map<String, String> defaults) {
		
		Map<String, String> argumentMap = new HashMap<String, String>();
		Vector<String> arrayQueryStrings = new Vector<String>();
		
		argumentMap.putAll(defaults);
		
		if(this.domaine > 0) {
			switch(this.domaine) {
				case 4 : 
					if(this.aideADomicile.length > 0) {
						this.type = this.aideADomicile;
					}
					break;
				case 2 : 
					if(this.animation.length > 0) {
						this.type = this.animation;
					}
					break;
				case 1 : 
					if(this.autres.length > 0) {
						this.type = this.autres;
					}
					break;
				case 5 : 
					if(this.bureau.length > 0) {
						this.type = this.bureau;
					}
					break;
				case 3 : 
					if(this.hotellerie.length > 0) {
						this.type = this.hotellerie;
					}
					break;
				case 6 : 
					if(this.vente.length > 0) {
						this.type = this.vente;
					}
					break;
			}
			
			argumentMap.put("domaine", this.domaine+"");
			
			if(this.type != null) {
				arrayQueryStrings.add(URLUtils.arrayToQueryString("type", this.type));				
			}
		}
		if(this.contrat.length > 0) {
			arrayQueryStrings.add(URLUtils.arrayToQueryString("contrat", this.contrat));
		}
		if(this.teletravail > 0) {
			argumentMap.put("teletravail", this.teletravail+"");
		}
		
		if(this.typeLieu > 0) {
			switch(this.typeLieu) {
				case 2:
					this.setCodeLieu(this.townCode);
					break;
				case 3:
					this.setCodeLieu(this.departmentCode);
					break;
				case 4:
					this.setCodeLieu(this.regionCode);
					break;
			}
			argumentMap.put("type_lieu", this.typeLieu + "");
			argumentMap.put("code_lieu", this.codeLieu + "");	
		}
		
		StringBuilder sb = new StringBuilder();
		
{'fraction_non_alphanumeric': 0.12069672131147541, 'fraction_numerical': 0.00778688524590164, 'mean_word_length': 3.0742904841402336, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 33, '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': '936011', 'n_tokens_mistral': 2102, 'n_tokens_neox': 1641, 'n_words': 334}