CPD Results

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

Duplications

File Line
org/apache/struts/taglib/html/LinkTag.java 191
org/apache/struts/taglib/logic/RedirectTag.java 155
}

    public String getName() {
        return (this.name);
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPage() {
        return (this.page);
    }

    public void setPage(String page) {
        this.page = page;
    }

    public String getAction() {
        return (this.action);
    }

    public void setAction(String action) {
        this.action = action;
    }

    public String getModule() {
        return (this.module);
    }

    public void setModule(String module) {
        this.module = module;
    }

    public String getParamId() {
        return (this.paramId);
    }

    public void setParamId(String paramId) {
        this.paramId = paramId;
    }

    public String getParamName() {
        return (this.paramName);
    }

    public void setParamName(String paramName) {
        this.paramName = paramName;
    }

    public String getParamProperty() {
        return (this.paramProperty);
    }

    public void setParamProperty(String paramProperty) {
        this.paramProperty = paramProperty;
    }

    public String getParamScope() {
        return (this.paramScope);
    }

    public void setParamScope(String paramScope) {
        this.paramScope = paramScope;
    }

    public String getProperty() {
        return (this.property);
    }

    public void setProperty(String property) {
        this.property = property;
    }

    public String getScope() {
        return (this.scope);
    }

    public void setScope(String scope) {
        this.scope = scope;
    }

    public String getTarget() {
File Line
org/apache/struts/taglib/html/ImgTag.java 255
org/apache/struts/taglib/html/LinkTag.java 207
}

    public String getAction() {
        return (this.action);
    }

    public void setAction(String action) {
        this.action = action;
    }

    public String getModule() {
        return (this.module);
    }

    public void setModule(String module) {
        this.module = module;
    }

    public String getParamId() {
        return (this.paramId);
    }

    public void setParamId(String paramId) {
        this.paramId = paramId;
    }

    public String getParamName() {
        return (this.paramName);
    }

    public void setParamName(String paramName) {
        this.paramName = paramName;
    }

    public String getParamProperty() {
        return (this.paramProperty);
    }

    public void setParamProperty(String paramProperty) {
        this.paramProperty = paramProperty;
    }

    public String getParamScope() {
        return (this.paramScope);
    }

    public void setParamScope(String paramScope) {
        this.paramScope = paramScope;
    }

    public String getProperty() {
        return (this.property);
    }

    public void setProperty(String property) {
        this.property = property;
    }

    public String getScope() {
        return (this.scope);
    }

    public void setScope(String scope) {
        this.scope = scope;
    }

    public String getSrc() {
File Line
org/apache/struts/taglib/html/ImgTag.java 255
org/apache/struts/taglib/logic/RedirectTag.java 171
}

    public String getAction() {
        return (this.action);
    }

    public void setAction(String action) {
        this.action = action;
    }

    public String getModule() {
        return (this.module);
    }

    public void setModule(String module) {
        this.module = module;
    }

    public String getParamId() {
        return (this.paramId);
    }

    public void setParamId(String paramId) {
        this.paramId = paramId;
    }

    public String getParamName() {
        return (this.paramName);
    }

    public void setParamName(String paramName) {
        this.paramName = paramName;
    }

    public String getParamProperty() {
        return (this.paramProperty);
    }

    public void setParamProperty(String paramProperty) {
        this.paramProperty = paramProperty;
    }

    public String getParamScope() {
        return (this.paramScope);
    }

    public void setParamScope(String paramScope) {
        this.paramScope = paramScope;
    }

    public String getProperty() {
        return (this.property);
    }

    public void setProperty(String property) {
        this.property = property;
    }

    public String getScope() {
        return (this.scope);
    }

    public void setScope(String scope) {
        this.scope = scope;
    }

    public String getSrc() {
File Line
org/apache/struts/taglib/html/OptionsCollectionTag.java 310
org/apache/struts/taglib/html/OptionsTag.java 319
protected void addOption(StringBuilder sb, String label, String value,
        boolean matched) {
        sb.append("<option value=\"");

        if (filter) {
            sb.append(TagUtils.getInstance().filter(value));
        } else {
            sb.append(value);
        }

        sb.append("\"");

        if (matched) {
            sb.append(" selected=\"selected\"");
        }

        if (style != null) {
            sb.append(" style=\"");
            sb.append(TagUtils.getInstance().filter(style));
            sb.append("\"");
        }

        if (styleClass != null) {
            sb.append(" class=\"");
            sb.append(TagUtils.getInstance().filter(styleClass));
            sb.append("\"");
        }

        sb.append(">");

        if (filter) {
            sb.append(TagUtils.getInstance().filter(label));
        } else {
            sb.append(label);
        }

        sb.append("</option>\r\n");
    }

    /**
     * Return an iterator for the options collection.
     *
     * @param collection Collection to be iterated over
     * @throws JspException if an error occurs
     */
    protected Iterator<?> getIterator(Object collection)
File Line
org/apache/struts/taglib/bean/HeaderTag.java 46
org/apache/struts/taglib/bean/ParameterTag.java 42
protected static MessageResources messages =
        MessageResources.getMessageResources(
            "org.apache.struts.taglib.bean.LocalStrings");

    // ------------------------------------------------------------- Properties

    /**
     * The name of the scripting variable that will be exposed as a page scope
     * attribute.
     */
    protected String id = null;

    /**
     * Return an array of header values if <code>multiple</code> is non-null.
     */
    protected String multiple = null;

    /**
     * The name of the header whose value is to be exposed.
     */
    protected String name = null;

    /**
     * The default value to return if no header of the specified name is
     * found.
     */
    protected String value = null;

    public String getId() {
        return (this.id);
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getMultiple() {
        return (this.multiple);
    }

    public void setMultiple(String multiple) {
        this.multiple = multiple;
    }

    public String getName() {
        return (this.name);
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return (this.value);
    }

    public void setValue(String value) {
        this.value = value;
    }

    // --------------------------------------------------------- Public Methods

    /**
     * Retrieve the required property and expose it as a scripting variable.
     *
     * @throws JspException if a JSP exception has occurred
     */
    public int doStartTag() throws JspException {
        if (this.multiple == null) {
File Line
org/apache/struts/taglib/bean/CookieTag.java 46
org/apache/struts/taglib/bean/HeaderTag.java 46
org/apache/struts/taglib/bean/ParameterTag.java 42
protected static MessageResources messages =
        MessageResources.getMessageResources(
            "org.apache.struts.taglib.bean.LocalStrings");

    // ------------------------------------------------------------- Properties

    /**
     * The name of the scripting variable that will be exposed as a page scope
     * attribute.
     */
    protected String id = null;

    /**
     * Return an array of Cookies if <code>multiple</code> is non-null.
     */
    protected String multiple = null;

    /**
     * The name of the cookie whose value is to be exposed.
     */
    protected String name = null;

    /**
     * The default value to return if no cookie of the specified name is
     * found.
     */
    protected String value = null;

    public String getId() {
        return (this.id);
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getMultiple() {
        return (this.multiple);
    }

    public void setMultiple(String multiple) {
        this.multiple = multiple;
    }

    public String getName() {
        return (this.name);
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return (this.value);
    }

    public void setValue(String value) {
        this.value = value;
    }

    // --------------------------------------------------------- Public Methods

    /**
     * Retrieve the required property and expose it as a scripting variable.
     *
     * @throws JspException if a JSP exception has occurred
     */
    public int doStartTag() throws JspException {
File Line
org/apache/struts/taglib/html/OptionsCollectionTag.java 357
org/apache/struts/taglib/html/OptionsTag.java 408
if (collection.getClass().isArray()) {
            collection = Arrays.asList((Object[]) collection);
        }

        if (collection instanceof Collection) {
            return (((Collection<?>) collection).iterator());
        } else if (collection instanceof Iterator) {
            return ((Iterator<?>) collection);
        } else if (collection instanceof Map) {
            return (((Map<?, ?>) collection).entrySet().iterator());
        } else if (collection instanceof Enumeration) {
            Enumeration<?> enumeration = (Enumeration<?>) collection;
            return new IteratorAdapter<>(enumeration);
        } else {
            throw new JspException(messages.getMessage(
File Line
org/apache/struts/taglib/logic/CompareTagBase.java 146
org/apache/struts/taglib/logic/MatchTag.java 107
Object variable = null;

        if (cookie != null) {
            Cookie[] cookies =
                ((HttpServletRequest) pageContext.getRequest()).getCookies();

            if (cookies == null) {
                cookies = new Cookie[0];
            }

            for (int i = 0; i < cookies.length; i++) {
                if (cookie.equals(cookies[i].getName())) {
                    variable = cookies[i].getValue();

                    break;
                }
            }
        } else if (header != null) {
            variable =
                ((HttpServletRequest) pageContext.getRequest()).getHeader(header);
        } else if (name != null) {
            Object bean =
File Line
org/apache/struts/taglib/html/ErrorsTag.java 115
org/apache/struts/taglib/html/MessagesTag.java 128
public String getBundle() {
        return (this.bundle);
    }

    public void setBundle(String bundle) {
        this.bundle = bundle;
    }

    public String getLocale() {
        return (this.locale);
    }

    public void setLocale(String locale) {
        this.locale = locale;
    }

    public String getName() {
        return (this.name);
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getProperty() {
        return (this.property);
    }

    public void setProperty(String property) {
        this.property = property;
    }

    public String getHeader() {
        return (header == null) ? "errors.header" : header;
File Line
org/apache/struts/taglib/bean/DefineTag.java 100
org/apache/struts/taglib/bean/SizeTag.java 87
public String getId() {
        return (this.id);
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return (this.name);
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getProperty() {
        return (this.property);
    }

    public void setProperty(String property) {
        this.property = property;
    }

    public String getScope() {
        return (this.scope);
    }

    public void setScope(String scope) {
        this.scope = scope;
    }

    public String getToScope() {
File Line
org/apache/struts/taglib/html/BaseHandlerTag.java 820
org/apache/struts/taglib/html/OptionTag.java 439
titleKey = null;
    }

    // ------------------------------------------------------ Protected Methods

    /**
     * Return the text specified by the literal value or the message resources
     * key, if any; otherwise return <code>null</code>.
     *
     * @param literal Literal text value or <code>null</code>
     * @param key     Message resources key or <code>null</code>
     * @throws JspException if both arguments are non-null
     */
    protected String message(String literal, String key)
        throws JspException {
        if (literal != null) {
            if (key != null) {
                JspException e =
                    new JspException(messages.getMessage("common.both"));

                TagUtils.getInstance().saveException(pageContext, e);
                throw e;
            } else {
                return (literal);
            }
        } else {
            if (key != null) {
                return TagUtils.getInstance().message(pageContext, getBundle(),
                    getLocale(), key);
            } else {
                return null;
            }
        }
    }
File Line
org/apache/struts/taglib/nested/bean/NestedDefineTag.java 41
org/apache/struts/taglib/nested/bean/NestedMessageTag.java 40
org/apache/struts/taglib/nested/bean/NestedSizeTag.java 41
org/apache/struts/taglib/nested/bean/NestedWriteTag.java 41
org/apache/struts/taglib/nested/html/NestedCheckboxTag.java 41
org/apache/struts/taglib/nested/html/NestedErrorsTag.java 41
org/apache/struts/taglib/nested/html/NestedFileTag.java 40
org/apache/struts/taglib/nested/html/NestedHiddenTag.java 41
org/apache/struts/taglib/nested/html/NestedImgTag.java 40
org/apache/struts/taglib/nested/html/NestedMessagesTag.java 42
org/apache/struts/taglib/nested/html/NestedMultiboxTag.java 41
org/apache/struts/taglib/nested/html/NestedOptionsCollectionTag.java 41
org/apache/struts/taglib/nested/html/NestedPasswordTag.java 41
org/apache/struts/taglib/nested/html/NestedRadioTag.java 41
org/apache/struts/taglib/nested/html/NestedSelectTag.java 41
org/apache/struts/taglib/nested/html/NestedTextTag.java 41
org/apache/struts/taglib/nested/html/NestedTextareaTag.java 41
org/apache/struts/taglib/nested/logic/NestedEmptyTag.java 41
org/apache/struts/taglib/nested/logic/NestedEqualTag.java 41
org/apache/struts/taglib/nested/logic/NestedGreaterEqualTag.java 42
org/apache/struts/taglib/nested/logic/NestedGreaterThanTag.java 42
org/apache/struts/taglib/nested/logic/NestedLessEqualTag.java 42
org/apache/struts/taglib/nested/logic/NestedLessThanTag.java 41
org/apache/struts/taglib/nested/logic/NestedMatchTag.java 41
org/apache/struts/taglib/nested/logic/NestedMessagesNotPresentTag.java 42
org/apache/struts/taglib/nested/logic/NestedMessagesPresentTag.java 42
org/apache/struts/taglib/nested/logic/NestedNotEmptyTag.java 41
org/apache/struts/taglib/nested/logic/NestedNotEqualTag.java 41
org/apache/struts/taglib/nested/logic/NestedNotMatchTag.java 41
org/apache/struts/taglib/nested/logic/NestedNotPresentTag.java 42
org/apache/struts/taglib/nested/logic/NestedPresentTag.java 41
private String originalName = null;
    private String originalProperty = null;

    /**
     * Overriding method of the heart of the matter. Gets the relative
     * property and leaves the rest up to the original tag implementation.
     * Sweet.
     *
     * @return int JSP continuation directive. This is in the hands of the
     *         super class.
     */
    public int doStartTag() throws JspException {
        // get the original properties
        originalName = getName();
        originalProperty = getProperty();

        // request
        HttpServletRequest request =
            (HttpServletRequest) pageContext.getRequest();

        // set the properties
        NestedPropertyHelper.setNestedProperties(request, this);

        // let the super do it's thing
        return super.doStartTag();
    }

    /**
     * Complete the processing of the tag. The nested tags here will restore
     * all the original value for the tag itself and the nesting context.
     *
     * @return int to describe the next step for the JSP processor
     * @throws JspException for the bad things JSP's do
     */
    public int doEndTag() throws JspException {
        // do the super's ending part
        int i = super.doEndTag();

        // reset the properties
        setName(originalName);
        setProperty(originalProperty);

        // continue
        return i;
    }

    /**
     * Release the tag's resources and reset the values.
     */
    public void release() {
        super.release();

        // reset the originals
        originalName = null;
        originalProperty = null;
    }
}