<commit_before>package voterAcess;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import voterAcess.dao.ChangePasswordDAO;
import voterAcess.dao.VoterDAO;
import voterAcess.model.Voter;
import voterAcess.persistence.VoterRepository;


@RestController
public class RESTController {
	
	private static final Logger log = LoggerFactory.getLogger(RESTController.class);
	
	private final VoterRepository voterRepository;
	
	@Autowired
	RESTController(VoterRepository voterRepository) {
		this.voterRepository = voterRepository;
	}
	
    @RequestMapping(value="/user",method= RequestMethod.POST,
    		headers ="Accept=application/json",
    		produces = "application/json")
    public VoterDAO getInfoVoter(@RequestBody Voter voter) {
    	
    	log.info("Datos peticion: "+voter.getEmail()+" "+voter.getPassword());
    	
    	Voter user = this.voterRepository.findByEmail(voter.getEmail());
    	
    	if(user.getPassword().compareTo(voter.getPassword()) == 0)
    		return new VoterDAO(user);
    	else
    		return null;
    }
    
    @RequestMapping(value="/changePassword",method= RequestMethod.POST, 
    		headers = "Accept=application/json",
    		produces = "application/json")
    public void changePassword(@RequestBody ChangePasswordDAO data) {
    	Voter voter = this.voterRepository.findByEmail(data.getEmail());
    	if(voter!=null){
    		if(data.getPassword().compareTo(data.getRepeatPassword())==0)
    			if(data.getPassword().compareTo(voter.getPassword())==0){
    				voter.setPassword(data.getNewPassword());
    				this.voterRepository.save(voter);
    			}
    	}
    	for (Voter v : this.voterRepository.findAll()) {
			log.info(v.toString());
		}
    		
    }
    
    
    @RequestMapping("/")
    public String landing() {
          return "User Management Service";
    }
    
}<commit_msg>Lanzamiento de excepción Error 404 - Not Found<commit_after>package voterAcess;

import javax.xml.ws.http.HTTPException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import voterAcess.dao.ChangePasswordDAO;
import voterAcess.dao.VoterDAO;
import voterAcess.model.Voter;
import voterAcess.persistence.VoterRepository;


@RestController
public class RESTController {
	
	private static final Logger log = LoggerFactory.getLogger(RESTController.class);
	
	private final VoterRepository voterRepository;
	
	@Autowired
	RESTController(VoterRepository voterRepository) {
		this.voterRepository = voterRepository;
	}
	
    @RequestMapping(value="/user",method= RequestMethod.POST,
    		headers ="Accept=application/json",
    		produces = "application/json")
    public VoterDAO getInfoVoter(@RequestBody Voter voter) {
    	
    	log.info("Datos peticion: "+voter.getEmail()+" "+voter.getPassword());
    	
    	Voter user = this.voterRepository.findByEmail(voter.getEmail());
    	
    	if(user.getPassword().compareTo(voter.getPassword()) == 0)
    		return new VoterDAO(user);
    	else
    		throw new HTTPException(404); //404 exception
    }
    
    @RequestMapping(value="/changePassword",method= RequestMethod.POST, 
    		headers = "Accept=application/json",
    		produces = "application/json")
    public void changePassword(@RequestBody ChangePasswordDAO data) {
    	Voter voter = this.voterRepository.findByEmail(data.getEmail());
    	if(voter!=null){
    		if(data.getPassword().compareTo(data.getRepeatPassword())==0)
    			if(data.getPassword().compareTo(voter.getPassword())==0){
    				voter.setPassword(<PASSWORD>.<PASSWORD>());
    				this.voterRepository.save(voter);
    			}
    	}
    	for (Voter v : this.voterRepository.findAll()) {
			log.info(v.toString());
		}
    		
    }
    
    
    @RequestMapping("/")
    public String landing() {
          return "User Management Service";
    }
    
}
{'fraction_non_alphanumeric': 0.11529834006280844, 'fraction_numerical': 0.004262000897263347, 'mean_word_length': 3.7335456475583864, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, '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': '7477547', 'n_tokens_mistral': 1436, 'n_tokens_neox': 1368, 'n_words': 213}