Spring Validator error in Jdk 1.8

258 views Asked by At

We were using JDK 1.6 32 bit and trying to check few things in JDK 1.8 32 bit. We have a form validator whose class implements spring-context-3.0.7 validate method. springmodules-validation 0.4 version is also used. We have a date calendar object which we are trying to check if empty. In JDK 1.8 32 bit, this gives error even though it is filled/not empty. Would anyone know if it is not supported in JDK 1.8? Do I need a higher spring version?

This code gives an error. Joda DateTime is being used. JDK 1.8 32 bit gives error on validate method even though the date is not empty.

import org.joda.time.LocalDate;  
import org.springframework.validation.Errors;  
import org.springframework.validation.ValidationUtils;  
import org.springframework.validation.Validator;  

public class ChangeValidator implements Validator {
    public boolean supports(Class<?> clazz) {
        return (clazz.equals(VO.class));
    }
public void validate(Object object, Errors errors) {
    VO cvo= (VO) object;
    if ("hello".equals(cvo.getAction())) {  
        ValidationUtils.rejectIfEmpty(errors,  
            "checkInDate","CheckInDate.EMPTY",  
            "Please enter a valid checkin date");  
        ValidationUtils.rejectIfEmpty(errors,  
            "checkOutDate","CheckOutDate.EMPTY",  
            "Please enter a valid checkout date");  
   }}
0

There are 0 answers