CPD Results

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

Duplications

FileLine
info/magnolia/security/app/dialog/field/validator/UniqueGroupNameValidator.java62
info/magnolia/security/app/dialog/field/validator/UniqueRoleNameValidator.java59
    public UniqueUserNameValidator(Item item, String errorMessage, SecuritySupport securitySupport) {
        super(errorMessage);
        this.item = item;
        this.securitySupport = securitySupport;
    }

    @Override
    protected boolean isValidValue(String value) {

        if (item instanceof JcrNodeAdapter) {
            // If we're editing an existing node then its allowed to use the current username of course
            if (!(item instanceof JcrNewNodeAdapter)) {
                try {
                    String currentName = ((JcrNodeAdapter)item).getJcrItem().getName();
                    if (StringUtils.equals(value, currentName)) {
                        return true;
                    }
                } catch (RepositoryException e) {
                    log.error("Exception occurred getting node name of node [{}]", ((JcrNodeAdapter) item).getItemId(), e);
                    return false;
                }
            }
FileLine
info/magnolia/security/app/dialog/field/WebAccessFieldFactory.java128
info/magnolia/security/app/dialog/field/WorkspaceAccessFieldFactory.java187
                        Component ruleRow = createRuleRow(aclLayout, entryItem, emptyLabel);
                        aclLayout.removeComponent(emptyLabel);
                        aclLayout.addComponent(ruleRow, aclLayout.getComponentCount() - 1);
                    } catch (RepositoryException e) {
                        throw new RuntimeRepositoryException(e);
                    }
                }
            });
            buttons.addComponent(addButton);
            aclLayout.addComponent(buttons);

            layout.addComponent(aclLayout);

        } catch (RepositoryException e) {
            throw new RuntimeRepositoryException(e);
        }

        return new CustomField<Object>() {

            @Override
            protected Component initContent() {
                return layout;
            }

            @Override
            public Class<?> getType() {
                return Object.class;
            }
        };
    }