There will be no log4j error message while it displays warning "The visited 
object is null, VisitorValidator will not be able to handle validation 
properly. Please make sure the visited object is not null for VisitorValidator 
to function properly"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: WW-3365
                 URL: https://issues.apache.org/struts/browse/WW-3365
             Project: Struts 2
          Issue Type: Bug
          Components: Core Interceptors
    Affects Versions: 2.1.2
         Environment: Tomcat 6.0 + Struts 2.1.2
            Reporter: jession ji


We use log4j debug in all validator methods to get the detail for illegal 
input. And we found that there will might be no log4j log and a waring on 
tomcat server "The visited object is null, VisitorValidator will not be able to 
handle validation properly. Please make sure the visited object is not null for 
VisitorValidator to function properly". It will be OK after we restart tomcat 
server. This issue can not be found every time. Could anyone give me some 
advice?

public void validate(Object object) throws ValidationException {
        String fieldName = getFieldName();
        String val = (String) getFieldValue(fieldName, object);
        wbxLogger.logInfo("Field:" + fieldName + " &Value:" + val);
        if (val == null || val.length() <= 0) {
            // use a required validator for these
            return;
        }
        try {
                val = UTF8ValidateUtil.getUTFString(val);
        }catch (UnsupportedEncodingException e){
                return;
        }
        if (doTrim) {
            val = val.trim();
            if (val.length() <= 0) { 
                // use a required validator
                return;
            }
        }
        if ((minLength > -1) && (val.length() < minLength)) {
            addFieldError(fieldName, object);
        } else if ((maxLength > -1) && (val.length() > maxLength)) {
                wbxLogger.logError("Input validation max length checking 
failure:"+fieldName);
            addFieldError(fieldName, object);
        }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to