CPD Results

The following document contains the results of PMD's CPD 6.55.0.

Duplications

File Line
org/apache/struts/validator/DynaValidatorForm.java 120
org/apache/struts/validator/ValidatorForm.java 126
int validationPage = determinePage(mapping, request);

        Validator validator =
            Resources.initValidator(validationKey, this, application, request,
                errors, validationPage);

        try {
            validatorResults = validator.validate();
        } catch (ValidatorException e) {
            log.error(e.getMessage(), e);
        }

        return errors;
    }

    // 2014/07/02 - security problem patch.
    // Author: NTT DATA Corporation
    /**
     * Determine validation page.<br>
     * If acceptPage of ActionMapping is null, then returns Integer.MAX_VALUE.
     * (multi-page validation is disabled. All validation fields are enabled.)<br>
     * If page property is less than acceptPage of ActionMapping, returns acceptPage value.<br>
     * If page property is greater than or equal to acceptPage of ActionMapping, returns page property value.
     *
     * @param mapping The mapping used to select this instance.
     * @param request The servlet request we are processing.
     *
     * @return validation page.
     *
     * @since Struts 1.4.1
     */
    protected int determinePage(ActionMapping mapping, HttpServletRequest request) {
        Integer acceptPage = mapping.getAcceptPage();
        return acceptPage != null ? Math.max(acceptPage.intValue(), getPage()) : Integer.MAX_VALUE;
    }

    /**
     * Returns the Validation key.
     *
     * @param mapping The mapping used to select this instance
     * @param request The servlet request we are processing
     * @return validation key - the form element's name in this case
     */
    public String getValidationKey(ActionMapping mapping,
        HttpServletRequest request) {
        return mapping.getAttribute();
    }