CPD Results

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

Duplications

File Line
info/magnolia/dam/app/setup/DamAppVersionHandler.java 325
info/magnolia/dam/app/setup/DamAppVersionHandler.java 511
                        new BootstrapSingleModuleResource("config.server.MIMEMapping.image.xml"),
                        new NodeExistsDelegateTask("", "/server/MIMEMapping/txt",
                                new SetPropertyTask(RepositoryConstants.CONFIG, "/server/MIMEMapping/txt", "iconStyle", "icon-file-text")),
                        new NodeExistsDelegateTask("", "/server/MIMEMapping/txt",
                                new SetPropertyTask(RepositoryConstants.CONFIG, "/server/MIMEMapping/doc", "iconStyle", "icon-file-word")),
                        new NodeExistsDelegateTask("", "/server/MIMEMapping/txt",
                                new SetPropertyTask(RepositoryConstants.CONFIG, "/server/MIMEMapping/docx", "iconStyle", "icon-file-word")),
                        new NodeExistsDelegateTask("", "/server/MIMEMapping/txt",
                                new SetPropertyTask(RepositoryConstants.CONFIG, "/server/MIMEMapping/xls", "iconStyle", "icon-file-excel")),
                        new NodeExistsDelegateTask("", "/server/MIMEMapping/txt",
                                new SetPropertyTask(RepositoryConstants.CONFIG, "/server/MIMEMapping/xlsx", "iconStyle", "icon-file-excel")),
                        new NodeExistsDelegateTask("", "/server/MIMEMapping/txt",
                                new SetPropertyTask(RepositoryConstants.CONFIG, "/server/MIMEMapping/ppt", "iconStyle", "icon-file-powerpoint")),
                        new NodeExistsDelegateTask("", "/server/MIMEMapping/txt",
                                new SetPropertyTask(RepositoryConstants.CONFIG, "/server/MIMEMapping/pptx", "iconStyle", "icon-file-powerpoint")),
                        new NodeExistsDelegateTask("", "/server/MIMEMapping/txt",
                                new SetPropertyTask(RepositoryConstants.CONFIG, "/server/MIMEMapping/pdf", "iconStyle", "icon-file-pdf")),
                        new NodeExistsDelegateTask("", "/server/MIMEMapping/txt",
                                new SetPropertyTask(RepositoryConstants.CONFIG, "/server/MIMEMapping/htm", "iconStyle", "icon-file-webpage")),
                        new NodeExistsDelegateTask("", "/server/MIMEMapping/txt",
                                new SetPropertyTask(RepositoryConstants.CONFIG, "/server/MIMEMapping/html", "iconStyle", "icon-file-webpage")))));
File Line
info/magnolia/dam/app/assets/field/UploadAndEditActionRenderer.java 79
info/magnolia/dam/app/assets/field/UploadAssetActionRenderer.java 118
        chooseDialogEventBus.addHandler(SelectionChangedEvent.class, event -> {
            // inner availability logic here mirrors the one in UpladAssetActionRenderer (in use for DirectUploadAction)
            Set<Object> itemIds = event.getItemIds();
            if (itemIds == null || itemIds.isEmpty()) {
                return;
            }
            try {
                JcrNodeItemId nodeItemId = (JcrNodeItemId) itemIds.iterator().next();
                javax.jcr.Node node = MgnlContext.getJCRSession(nodeItemId.getWorkspace()).getNodeByIdentifier(nodeItemId.getUuid());
                boolean uploadAllowed = itemIds.size() == 1;
                if (uploadAllowed) {
                    uploadAllowed = NodeUtil.isNodeType(node, NodeTypes.Folder.NAME) || NodeUtil.getAncestors(node).isEmpty();
                    // Upload is allowed only if user has WRITE permission on child path which is intended to create (checking "untitled" as default) under the current path.
                    uploadAllowed &= PermissionUtil.isGranted(node, Permission.WRITE)
                            && PermissionUtil.isGranted(node.getSession(), PathUtil.createPath(node.getPath(), AbstractRepositoryAction.DEFAULT_NEW_ITEM_NAME), Permission.WRITE);
                }
File Line
info/magnolia/dam/app/setup/migration/ChangeDataDmsReferenceToDamMigrationTask.java 124
info/magnolia/dam/app/setup/migration/ChangeWebsiteDmsReferenceToDamMigrationTask.java 112
        log.info("Start to update DATA reference to DAM for the following repository '{}'", this.contentRepository);
        try {
            // Init
            contentSession = ctx.getJCRSession(contentRepository);
            damSession = ctx.getJCRSession(DamConstants.WORKSPACE);
            for (String path : this.contentPathsList) {
                if (!contentSession.nodeExists(path)) {
                    log.warn("'{}' path do not exist for the following repository: '{}' No Data migration will be performed ", path, contentRepository);
                    continue;
                }
                // Handle path
                handlePath(path);
            }
        } catch (Exception e) {
            log.error("Unable to execute update of DATA reference to DAM", e);
            ctx.error("Unable to perform Migration task " + getName(), e);
            throw new TaskExecutionException(e.getMessage());
        }
        log.info("Successfully execute update of DATA reference to DAM for the following repository '{}'", this.contentRepository);