auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void actionPerformed(AnActionEvent anActionEvent) { final Project project = anActionEvent.getProject(); if (project == null) { return; } BuckModule buckModule = project.getComponent(BuckModule.class); DataContext dataContext = anActionEvent.getDataContext(); final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext); if (view == null) { return; } final PsiDirectory directory = view.getOrChooseDirectory(); if (directory == null) { return; } String directoryString = directory.getVirtualFile().getPath(); VirtualFile potentialBuckFile = BuckFileUtil.getBuckFile(directory.getVirtualFile()); if (potentialBuckFile != null) { directoryString = potentialBuckFile.getParent().getPath(); } String basepath = project.getBasePath(); if (basepath == null) { return; } String relative = directoryString.replace(basepath, ""); String target = "/" + relative + "/..."; BuckBuildCommandHandler handler = new BuckBuildCommandHandler(project, project.getBaseDir(), BuckCommand.PROJECT); handler.command().addParameter(target); handler.command().addParameter("--ide"); handler.command().addParameter("INTELLIJ"); BuckBuildManager buildManager = BuckBuildManager.getInstance(project); buildManager.setBuilding(project, true); buckModule.attach(target); buildManager.runBuckCommand(handler, "Running buck project on selected groups."); buildManager.setBuilding(project, false); }

Target:
public void actionPerformed(AnActionEvent anActionEvent) { final Project project = anActionEvent.getProject(); if (project == null) { return; } DataContext dataContext = anActionEvent.getDataContext(); final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext); if (view == null) { return; } final PsiDirectory directory = view.getOrChooseDirectory(); if (directory == null) { return; } String directoryString = directory.getVirtualFile().getPath(); VirtualFile potentialBuckFile = BuckFileUtil.getBuckFile(directory.getVirtualFile()); if (potentialBuckFile != null) { directoryString = potentialBuckFile.getParent().getPath(); } String basepath = project.getBasePath(); if (basepath == null) { return; } String relative = directoryString.replace(basepath, ""); String target = "/" + relative + "/..."; SelectProjectUtils.generateTargetForProject(target, project); }
Source:
public void setUp() throws Exception { secretContentDAO = testDBRule.getDbi().onDemand(SecretContentDAO.class); testDBRule.jooqContext().delete(SECRETS).execute(); testDBRule.jooqContext().insertInto(SECRETS, SECRETS.ID, SECRETS.NAME) .values((int) secretContent1.secretSeriesId(), "secretName") .execute(); testDBRule.jooqContext().insertInto(SECRETS_CONTENT) .set(SECRETS_CONTENT.ID, (int) secretContent1.id()) .set(SECRETS_CONTENT.SECRETID, (int) secretContent1.secretSeriesId()) .set(SECRETS_CONTENT.ENCRYPTED_CONTENT, secretContent1.encryptedContent()) .set(SECRETS_CONTENT.VERSION, secretContent1.version().orElse(null)) .set(SECRETS_CONTENT.CREATEDAT, secretContent1.createdAt()) .set(SECRETS_CONTENT.CREATEDBY, secretContent1.createdBy()) .set(SECRETS_CONTENT.UPDATEDAT, secretContent1.updatedAt()) .set(SECRETS_CONTENT.UPDATEDBY, secretContent1.updatedBy()) .execute(); }

Target:
public void setUp() throws Exception { secretContentDAO = testDBRule.getDbi().onDemand(SecretContentDAO.class); testDBRule.jooqContext().delete(SECRETS).execute(); testDBRule.jooqContext().insertInto(SECRETS, SECRETS.ID, SECRETS.NAME) .values((int) secretContent1.secretSeriesId(), "secretName") .execute(); testDBRule.jooqContext().insertInto(SECRETS_CONTENT) .set(SECRETS_CONTENT.ID, (int) secretContent1.id()) .set(SECRETS_CONTENT.SECRETID, (int) secretContent1.secretSeriesId()) .set(SECRETS_CONTENT.ENCRYPTED_CONTENT, secretContent1.encryptedContent()) .set(SECRETS_CONTENT.VERSION, secretContent1.version().orElse(null)) .set(SECRETS_CONTENT.CREATEDAT, secretContent1.createdAt()) .set(SECRETS_CONTENT.CREATEDBY, secretContent1.createdBy()) .set(SECRETS_CONTENT.UPDATEDAT, secretContent1.updatedAt()) .set(SECRETS_CONTENT.UPDATEDBY, secretContent1.updatedBy()) .set(SECRETS_CONTENT.METADATA, "{}") .execute(); }
Source:
public int compare( RemoteRepository r1, RemoteRepository r2 ) { if ( r1 == null ) { return 1; } if ( r2 == null ) { return -1; } final int priorityCompareResult = r2.getPrefetchPriority() - r1.getPrefetchPriority(); if ( StringUtils.isBlank( r1.getPrefetchRescanTimestamp() ) && StringUtils.isBlank( r2.getPrefetchRescanTimestamp() ) ) { return priorityCompareResult; } if ( StringUtils.isBlank( r1.getPrefetchRescanTimestamp() ) && StringUtils.isNotBlank( r2.getPrefetchRescanTimestamp() ) ) { return -1; } else if ( StringUtils.isBlank( r2.getPrefetchRescanTimestamp() ) && StringUtils.isNotBlank( r1.getPrefetchRescanTimestamp() ) ) { return 1; } final ZonedDateTime rescanTime1 = ZonedDateTime.parse( r1.getPrefetchRescanTimestamp(), DateTimeFormatter.ISO_ZONED_DATE_TIME ); final ZonedDateTime rescanTime2 = ZonedDateTime.parse( r2.getPrefetchRescanTimestamp(), DateTimeFormatter.ISO_ZONED_DATE_TIME ); if ( rescanTime1.isBefore( rescanTime2 ) ) { return -1; } else if ( rescanTime1.isAfter( rescanTime2 ) ) { return 1; } else { return priorityCompareResult; } }

Target:
public int compare( RemoteRepository r1, RemoteRepository r2 ) { if ( r1 == null ) { return 1; } if ( r2 == null ) { return -1; } final int priorityCompareResult = r2.getPrefetchPriority() - r1.getPrefetchPriority(); if ( StringUtils.isBlank( r1.getPrefetchRescanTimestamp() ) && StringUtils.isBlank( r2.getPrefetchRescanTimestamp() ) ) { return priorityCompareResult; } if ( StringUtils.isBlank( r1.getPrefetchRescanTimestamp() ) && StringUtils.isNotBlank( r2.getPrefetchRescanTimestamp() ) ) { return -1; } else if ( StringUtils.isBlank( r2.getPrefetchRescanTimestamp() ) && StringUtils.isNotBlank( r1.getPrefetchRescanTimestamp() ) ) { return 1; } final ZonedDateTime rescanTime1 = ZonedDateTime.parse( r1.getPrefetchRescanTimestamp(), RescanTimeUtils.UTC_TIME_FORMATTER ); final ZonedDateTime rescanTime2 = ZonedDateTime.parse( r2.getPrefetchRescanTimestamp(), RescanTimeUtils.UTC_TIME_FORMATTER ); if ( rescanTime1.isBefore( rescanTime2 ) ) { return -1; } else if ( rescanTime1.isAfter( rescanTime2 ) ) { return 1; } else { return priorityCompareResult; } }
Source:
public void afterWalk( final WalkerContext context ) throws Exception { for ( Map.Entry<Gav, Map<Version, List<StorageFileItem>>> gavListEntry : gas.entrySet() ) { Map<Version, List<StorageFileItem>> versions = gavListEntry.getValue(); if ( versions.size() > request.getNumberOfVersionsToKeep() ) { getLogger().debug( "{} will delete versions of artifact with g={} a ={}", ReleaseRemovalTaskDescriptor.ID, versions.size() - request.getNumberOfVersionsToKeep(), gavListEntry.getKey().getGroupId(), gavListEntry.getKey().getArtifactId() ); List<Version> sortedVersions = Lists.newArrayList( versions.keySet() ); Collections.sort( sortedVersions ); List<Version> toDelete = sortedVersions.subList( 0, versions.size() - request.getNumberOfVersionsToKeep() ); getLogger().debug( "Will delete these specific versions: {}", toDelete ); for ( Version version : toDelete ) { for ( StorageFileItem storageFileItem : versions.get( version ) ) { repository.deleteItem( createResourceStoreRequest( storageFileItem, context ) ); deletedFiles++; } } if ( context.getContext().containsKey( POSSIBLY_EMPTY_COLLECTIONS ) ) { for ( StorageCollectionItem coll : (List<StorageCollectionItem>) context.getContext().get( POSSIBLY_EMPTY_COLLECTIONS ) ) { removeDirectoryIfEmpty( repository, coll ); } } } } result.setDeletedFileCount( deletedFiles ); result.setSuccessful( true ); }

Target:
public void afterWalk( final WalkerContext context ) throws Exception { for ( Map.Entry<Gav, Map<Version, List<StorageFileItem>>> gavListEntry : groupArtifactToVersions.entrySet() ) { Map<Version, List<StorageFileItem>> versions = gavListEntry.getValue(); if ( versions.size() > request.getNumberOfVersionsToKeep() ) { getLogger().debug( "{} will delete versions of artifact with g={} a={}", ReleaseRemovalTaskDescriptor.ID, versions.size() - request.getNumberOfVersionsToKeep(), gavListEntry.getKey().getGroupId(), gavListEntry.getKey().getArtifactId() ); List<Version> sortedVersions = Lists.newArrayList( versions.keySet() ); Collections.sort( sortedVersions ); List<Version> toDelete = sortedVersions.subList( 0, versions.size() - request.getNumberOfVersionsToKeep() ); getLogger().debug( "Will delete these specific versions: {}", toDelete ); for ( Version version : toDelete ) { for ( StorageFileItem storageFileItem : versions.get( version ) ) { repository.deleteItem( createResourceStoreRequest( storageFileItem, context ) ); deletedFiles++; } } if ( context.getContext().containsKey( POSSIBLY_EMPTY_COLLECTIONS ) ) { for ( StorageCollectionItem coll : (List<StorageCollectionItem>) context.getContext().get( POSSIBLY_EMPTY_COLLECTIONS ) ) { removeDirectoryIfEmpty( repository, coll ); } } } } result.setDeletedFileCount( deletedFiles ); result.setSuccessful( true ); }
Source:
public void getPatientNotFoundChecksForMultipleRecords() throws ComponentLookupException, QueryException, XWikiRestException { Query query = mock(DefaultQuery.class); when(this.repository.getPatientByExternalId(this.eid)).thenReturn(null); when(this.qm.createQuery(Matchers.anyString(), Matchers.anyString())).thenReturn(query); when(query.execute()).thenReturn(new ArrayList<Object>()); Response response = this.component.getPatient(this.eid); verify(this.logger).debug("No patient record with external ID exists yet", this.eid); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus()); }

Target:
public void getPatientNotFoundChecksForMultipleRecords() throws ComponentLookupException, QueryException { Query query = mock(DefaultQuery.class); when(this.repository.getPatientByExternalId(this.eid)).thenReturn(null); when(this.qm.createQuery(Matchers.anyString(), Matchers.anyString())).thenReturn(query); when(query.execute()).thenReturn(new ArrayList<Object>()); Response response = this.component.getPatient(this.eid); verify(this.logger).debug("No patient record with external ID exists yet", this.eid); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatus()); }
Source:
public TaskContext addTaskContext(TaskStateMachine taskStateMachine, Session session, boolean verboseStats, boolean cpuTimerEnabled) { MemoryTrackingContext taskMemoryContext; synchronized (this) { taskMemoryContext = queryMemoryContext.newMemoryTrackingContext(); } TaskContext taskContext = TaskContext.createTaskContext( this, taskStateMachine, notificationExecutor, yieldExecutor, session, taskMemoryContext, verboseStats, cpuTimerEnabled); taskContexts.put(taskStateMachine.getTaskId(), taskContext); return taskContext; }

Target:
public TaskContext addTaskContext(TaskStateMachine taskStateMachine, Session session, boolean verboseStats, boolean cpuTimerEnabled) { TaskContext taskContext = TaskContext.createTaskContext( this, taskStateMachine, notificationExecutor, yieldExecutor, session, queryMemoryContext.newMemoryTrackingContext(), verboseStats, cpuTimerEnabled); taskContexts.put(taskStateMachine.getTaskId(), taskContext); return taskContext; }
Source:
private void deleteAssignmentsFromPersistence(List<Assignment> assignments) { preparePersistenceAccess(); EKBCommit commit = getEKBCommit(); for (Assignment assignment : assignments) { List<Role> result = queryService.queryByString(Role.class, "uuid:\"" + assignment.getUuid() + "\""); if (result.size() == 0) { LOGGER.warn("User {1} does not exist.", assignment.getUuid()); } else { commit.addDelete(assignment); } } persistService.commit(commit); revokePersistenceAccess(); }

Target:
private void deleteAssignmentsFromPersistence(List<Assignment> assignments) { preparePersistenceAccess(); EKBCommit commit = getEKBCommit(); for (Assignment assignment : assignments) { List<Role> result = queryService.query(Role.class, QueryRequest.query("uuid", assignment.getUuid())); if (result.size() == 0) { LOGGER.warn("User {1} does not exist.", assignment.getUuid()); } else { commit.addDelete(assignment); } } persistService.commit(commit); revokePersistenceAccess(); }
Source:
public static CommentService getInstance() { if (Objects.equals(instance, null)) { synchronized (TaskService.class) { if (Objects.equals(instance, null)) { instance = new CommentService(); } } } return instance; }

Target:
public static CommentService getInstance() { if (Objects.equals(instance, null)) { synchronized (CommentService.class) { if (Objects.equals(instance, null)) { instance = new CommentService(); } } } return instance; }
Source:
public void testDeployableFeature() throws Exception { Verifier v01 = getVerifier("TYCHO0439repositoryCategories"); v01.executeGoal("install"); v01.verifyErrorFreeLog(); File site = new File(v01.getBasedir(), "target/site"); Assert.assertTrue(site.isDirectory()); File content = new File(site, "content.jar"); Assert.assertTrue(content.isFile()); boolean found = false; XMLParser parser = new XMLParser(); Document document = null; ZipUnArchiver contentJar = new ZipUnArchiver(content); TemporaryFolder tempFolder = new TemporaryFolder(); tempFolder.create(); try { contentJar.extract("content.xml", tempFolder.getRoot()); document = parser.parse(new XMLIOSource(new File(tempFolder.getRoot(), "content.xml"))); } finally { tempFolder.delete(); } Element repository = document.getRootElement(); all_units: for (Element unit : repository.getChild("units").getChildren("unit")) { for (Element property : unit.getChild("properties").getChildren("property")) { if ("org.eclipse.equinox.p2.type.category".equals(property.getAttributeValue("name")) && Boolean.parseBoolean(property.getAttributeValue("value"))) { found = true; break all_units; } } } Assert.assertTrue("Custom category", found); }

Target:
public void testDeployableFeature() throws Exception { Verifier v01 = getVerifier("TYCHO0439repositoryCategories"); v01.executeGoal("install"); v01.verifyErrorFreeLog(); File site = new File(v01.getBasedir(), "target/site"); Assert.assertTrue(site.isDirectory()); File content = new File(site, "content.jar"); Assert.assertTrue(content.isFile()); boolean found = false; XMLParser parser = new XMLParser(); Document document = null; ZipFile contentJar = new ZipFile(content); try { ZipEntry entry = contentJar.getEntry("content.xml"); document = parser.parse(new XMLIOSource(contentJar.getInputStream(entry))); } finally { contentJar.close(); } Element repository = document.getRootElement(); all_units: for (Element unit : repository.getChild("units").getChildren("unit")) { for (Element property : unit.getChild("properties").getChildren("property")) { if ("org.eclipse.equinox.p2.type.category".equals(property.getAttributeValue("name")) && Boolean.parseBoolean(property.getAttributeValue("value"))) { found = true; break all_units; } } } Assert.assertTrue("Custom category", found); }
Source:
static TabData getTabData(ClientGinjector ginjector) { return new ModelBoundTabData(ginjector.getApplicationConstants().hostBiosSubTabLabel(), 5, ginjector.getSubTabHostBiosModelProvider()); }

Target:
static TabData getTabData(ClientGinjector ginjector) { return new ModelBoundTabData(ginjector.getApplicationConstants().hostBiosSubTabLabel(), 6, ginjector.getSubTabHostBiosModelProvider()); }
Source:
public void guestbookResponseValidator(FacesContext context, UIComponent toValidate, Object value) { String response = (String) value; if (response != null && response.length() > 255) { ((EditableValueHolder) toValidate).setValid(false); FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, JH.localize("dataset.guestbookResponse.guestbook.responseTooLong"), null); context.addMessage(toValidate.getClientId(context), message); } }

Target:
public void guestbookResponseValidator(FacesContext context, UIComponent toValidate, Object value) { String response = (String) value; if (response != null && response.length() > 255) { ((UIInput) toValidate).setValid(false); FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, JH.localize("dataset.guestbookResponse.guestbook.responseTooLong"), null); context.addMessage(toValidate.getClientId(context), message); } }
Source:
private void checkRequiredHeadings(CSVRecord headingRecord) throws ValidationException { List<String> missingRequiredHeadings = Headings.getRequiredHeadings().stream() .filter(heading -> !uploadUtil.hasHeading(heading, headingRecord)) .map(headingVal -> headingVal.getNamesAsString()) .collect(Collectors.toList()); if (missingRequiredHeadings != null && missingRequiredHeadings.size() > 0) { throw new ValidationException(msgUtil.getMessage("listing.upload.missingRequiredHeadings", String.join("; ", missingRequiredHeadings))); } }

Target:
private void checkRequiredHeadings(CSVRecord headingRecord) throws ValidationException { List<String> missingRequiredHeadings = Headings.getRequiredHeadings().stream() .filter(heading -> !uploadUtil.hasHeading(heading, headingRecord)) .map(headingVal -> headingVal.getNamesAsString()) .collect(Collectors.toList()); if (missingRequiredHeadings.size() > 0) { throw new ValidationException(msgUtil.getMessage("listing.upload.missingRequiredHeadings", String.join("; ", missingRequiredHeadings))); } }
Source:
private WorkingSetDescriptor getSelectedWorkingSet() { IStructuredSelection selection = typesListViewer.getStructuredSelection(); boolean hasSelection = !selection.isEmpty(); WorkingSetDescriptor descriptor = null; if (hasSelection) { descriptor = (WorkingSetDescriptor) selection .getFirstElement(); } return descriptor; }

Target:
private WorkingSetDescriptor getSelectedWorkingSet() { IStructuredSelection selection = typesListViewer.getStructuredSelection(); WorkingSetDescriptor descriptor = null; if (!selection.isEmpty()) { descriptor = (WorkingSetDescriptor) selection.getFirstElement(); } return descriptor; }
Source:
public IMetadataRepository createRepository(URI location, String name, String type, Map<String, String> properties) throws ProvisionException, OperationCanceledException { return delegate.createRepository(location, name, type, properties); }

Target:
public IMetadataRepository createRepository(URI location, String name, String type, Map<String, String> properties) throws ProvisionException, OperationCanceledException { return delegate.createRepository(translate(location), name, type, properties); }
Source:
public <T> T instantiateInFramework(Class<? extends T> clazz) { try { clazz.getConstructor(); } catch (NoSuchMethodException e) { Exceptions.duck(e); } Bundle b = bundle().addResourceWithCopy(clazz) .start(); try { @SuppressWarnings("unchecked") Class<? extends T> insideClass = (Class<? extends T>) b.loadClass(clazz.getName()); return insideClass.newInstance(); } catch (Exception e) { throw Exceptions.duck(e); } }

Target:
public <T> T instantiateInFramework(Class<? extends T> clazz) { try { clazz.getConstructor(); } catch (NoSuchMethodException e) { Exceptions.duck(e); } Bundle b = bundle().addResourceWithCopy(clazz) .start(); try { @SuppressWarnings("unchecked") Class<? extends T> insideClass = (Class<? extends T>) b.loadClass(clazz.getName()); return insideClass.getConstructor() .newInstance(); } catch (Exception e) { throw Exceptions.duck(e); } }
Source:
public LinuxSecretServiceAccess() { try { gnomeLoginKeyring = new SimpleCollection(); } catch (Exception e) { } }

Target:
public LinuxSecretServiceAccess() { SimpleCollection keyring = null; try { keyring = new SimpleCollection(); } catch (Exception e) { } finally { gnomeLoginKeyring = Optional.ofNullable(keyring); } }
Source:
void verifyMessage(Message message) { if (!message.getMsgType().toString().equalsIgnoreCase(MessageType.TASK_REPLY.name())) { String errorMsg = "Unexpected msg type for message " + message.getMsgId() + " type:" + message.getMsgType() + " Expected : " + MessageType.TASK_REPLY; _logger.error(errorMsg); throw new HelixException(errorMsg); } String correlationId = message.getCorrelationId(); if (correlationId == null) { String errorMsg = "Message " + message.getMsgId() + " does not have correlation id"; _logger.error(errorMsg); throw new HelixException(errorMsg); } _logger.info("Verified reply message " + message.getMsgId() + " correlation:" + correlationId); }

Target:
void verifyMessage(Message message) { if (!message.getMsgType().toString().equalsIgnoreCase(MessageType.TASK_REPLY.name())) { String errorMsg = "Unexpected msg type for message " + message.getMsgId() + " type:" + message.getMsgType() + " Expected : " + MessageType.TASK_REPLY; _logger.error(errorMsg); throw new HelixException(errorMsg); } String correlationId = message.getCorrelationId(); if (correlationId == null) { String errorMsg = "Message " + message.getMsgId() + " does not have correlation id"; _logger.error(errorMsg); throw new HelixException(errorMsg); } if (!_callbackMap.containsKey(correlationId)) { String errorMsg = "Message " + message.getMsgId() + " does not have correponding callback. Probably timed out already. Correlation id: " + correlationId; _logger.error(errorMsg); throw new HelixException(errorMsg, false); } _logger.info("Verified reply message " + message.getMsgId() + " correlation:" + correlationId); }
Source:
public LicensedVideoSwapPageObject(WebDriver driver) { super(driver); PageFactory.initElements(driver, this); }

Target:
public LicensedVideoSwapPageObject(WebDriver driver) { super(driver); }
Source:
public Response add(Cluster cluster) { validateParameters(cluster, "name", "dataCenter.name|id"); validateEnums(Cluster.class, cluster); storage_pool pool = getStoragePool(cluster, this); VDSGroup entity = map(cluster, map(pool)); return performCreate(VdcActionType.AddVdsGroup, new VdsGroupOperationParameters(entity), new QueryIdResolver<Guid>(VdcQueryType.GetVdsGroupById, GetVdsGroupByIdParameters.class)); }

Target:
public Response add(Cluster cluster) { validateParameters(cluster, "name"); validateEnums(Cluster.class, cluster); DataCenter dataCenter = new DataCenter(); dataCenter.setId(dataCenterId.toString()); cluster.setDataCenter(dataCenter); storage_pool pool = getStoragePool(cluster, this); VDSGroup entity = map(cluster, map(pool)); return performCreate(VdcActionType.AddVdsGroup, new VdsGroupOperationParameters(entity), new QueryIdResolver<Guid>(VdcQueryType.GetVdsGroupById, GetVdsGroupByIdParameters.class)); }
Source:
public Block mapFromEntries( @TypeParameter("row(K,V)") RowType rowType, @SqlType("map(K,V)") Block block) { verify(rowType.getTypeParameters().size() == 2); Type keyType = rowType.getTypeParameters().get(0); Type valueType = rowType.getTypeParameters().get(1); ArrayType arrayType = new ArrayType(rowType); if (pageBuilder.isFull()) { pageBuilder.reset(); } verify((block.getPositionCount() & 1) == 0); int entryCount = block.getPositionCount() / 2; BlockBuilder arrayBlockBuilder = pageBuilder.getBlockBuilder(0); BlockBuilder resultBuilder = arrayBlockBuilder.beginBlockEntry(); for (int i = 0; i < entryCount; i++) { BlockBuilder rowBuilder = resultBuilder.beginBlockEntry(); keyType.appendTo(block, 2 * i, rowBuilder); valueType.appendTo(block, 2 * i + 1, rowBuilder); resultBuilder.closeEntry(); } arrayBlockBuilder.closeEntry(); pageBuilder.declarePosition(); return arrayType.getObject(arrayBlockBuilder, arrayBlockBuilder.getPositionCount() - 1); }

Target:
public Block mapFromEntries( @TypeParameter("row(K,V)") RowType rowType, @SqlType("map(K,V)") Block block) { verify(rowType.getTypeParameters().size() == 2); verify(block.getPositionCount() % 2 == 0); Type keyType = rowType.getTypeParameters().get(0); Type valueType = rowType.getTypeParameters().get(1); ArrayType arrayType = new ArrayType(rowType); if (pageBuilder.isFull()) { pageBuilder.reset(); } int entryCount = block.getPositionCount() / 2; BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(0); BlockBuilder entryBuilder = blockBuilder.beginBlockEntry(); for (int i = 0; i < entryCount; i++) { BlockBuilder rowBuilder = entryBuilder.beginBlockEntry(); keyType.appendTo(block, 2 * i, rowBuilder); valueType.appendTo(block, 2 * i + 1, rowBuilder); entryBuilder.closeEntry(); } blockBuilder.closeEntry(); pageBuilder.declarePosition(); return arrayType.getObject(blockBuilder, blockBuilder.getPositionCount() - 1); }
Source:
public DialectEditorCloserFilter(DRepresentationDescriptor dRepresentationDescriptor) { this.dRepDescriptor = dRepresentationDescriptor; }

Target:
public DialectEditorCloserFilter(DRepresentationDescriptor dRepresentationDescriptor) { Assert.isNotNull(dRepresentationDescriptor); this.dRepDescriptor = dRepresentationDescriptor; }
Source:
private void validateVolumeCount(VolumeTemplate value, VmType vmType, VolumeParameterType volumeParameterType, ValidationResult.ValidationResultBuilder validationBuilder, InstanceGroup instanceGroup) { if (vmType != null && needToCheckVolume(volumeParameterType, value.getVolumeCount())) { VolumeParameterConfig config = vmType.getVolumeParameterbyVolumeParameterType(volumeParameterType); if (config != null) { if (value.getVolumeCount() > config.maximumNumber()) { validationBuilder.error(String.format("Max allowed volume count for '%s': %s", vmType.value(), config.maximumNumber())); } else if (isIDBrokerInstanceGroup(instanceGroup)) { if (value.getVolumeCount() != 0) { validationBuilder.error(String.format("IDBroker volume count: %s is not zero", value.getVolumeCount())); } } else if (value.getVolumeCount() < config.minimumNumber()) { validationBuilder.error(String.format("Min allowed volume count for '%s': %s", vmType.value(), config.minimumNumber())); } } else { validationBuilder.error(String.format("The '%s' instance type does not support 'Ephemeral' volume type", vmType.value())); } } }

Target:
private void validateVolumeCount(VolumeTemplate value, VmType vmType, VolumeParameterType volumeParameterType, ValidationResult.ValidationResultBuilder validationBuilder, InstanceGroup instanceGroup) { if (vmType != null && needToCheckVolume(volumeParameterType, value.getVolumeCount())) { VolumeParameterConfig config = vmType.getVolumeParameterbyVolumeParameterType(volumeParameterType); if (config != null) { if (value.getVolumeCount() > config.maximumNumber()) { validationBuilder.error(String.format("Max allowed volume count for '%s': %s", vmType.value(), config.maximumNumber())); } else if (!isIDBrokerInstanceGroup(instanceGroup) && value.getVolumeCount() < config.minimumNumber()) { validationBuilder.error(String.format("Min allowed volume count for '%s': %s", vmType.value(), config.minimumNumber())); } } else { validationBuilder.error(String.format("The '%s' instance type does not support 'Ephemeral' volume type", vmType.value())); } } }
Source:
public String toString() { return MoreObjects.toStringHelper(this) .add("name", name) .add("columnName", columnName) .add("expression", expressionStr) .toString(); }

Target:
public String toString() { return "CheckConstraint{" + "name='" + name + '\'' + ", columnName='" + columnName + '\'' + ", expression=" + expression + '}'; }
Source:
@Nullable @Override protected MetadataMarshalled reduce0(List<ComputeJobResult> results) { if (results.get(0).getException() != null) throw results.get(0).getException(); else return results.get(0).getData(); }

Target:
@Nullable @Override protected MetadataMarshalled reduce0(List<ComputeJobResult> results) { if (results.size() != 1) throw new IgniteException("Invalid job results. Expected exactly 1 result, but was: " + results); if (results.get(0).getException() != null) throw results.get(0).getException(); else return results.get(0).getData(); }
Source:
public void shutdown() { if (acceptTasks.getAndSet(false)) { queue.submit(new Runnable() { @Override public void run() { db.close(); } }); queue.shutdown(); try { queue.awaitTermination(5, TimeUnit.MINUTES); } catch (InterruptedException e) { logger.log(Level.SEVERE, "Interrupted while waiting for queue to terminate", e); } } }

Target:
public void shutdown() { if (acceptTasks.getAndSet(false)) { queue.submit(new Runnable() { @Override public void run() { db.close(); } }); queue.shutdown(); try { queue.awaitTermination(5, TimeUnit.MINUTES); } catch (InterruptedException e) { logger.log(Level.SEVERE, "Interrupted while waiting for queue to terminate", e); } } else { logger.log(Level.WARNING, "Database is already closed."); } }
Source:
private static List<IFile> getWorkspaceFiles(final IResource[] resources) throws CoreException { final List<IFile> files = new ArrayList<IFile>(); for (int i = 0; i < resources.length; i++) { final IResource resource = resources[i]; if (resource.isAccessible()) { if (resource instanceof IFile) { IFile file = (IFile) resource; file.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor()); if (resource.exists()) { files.add(file); } } else if (resource instanceof IContainer) { files.addAll(getWorkspaceFiles(((IContainer) resource).members())); } } } return files; }

Target:
private static List<IFile> getWorkspaceFiles(final IResource[] resources) throws CoreException { final List<IFile> files = new ArrayList<IFile>(); for (int i = 0; i < resources.length; i++) { final IResource resource = resources[i]; resource.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor()); if (resource.isAccessible()) { if (resource instanceof IFile) { IFile file = (IFile) resource; files.add(file); } else if (resource instanceof IContainer) { files.addAll(getWorkspaceFiles(((IContainer) resource).members())); } } } return files; }
Source:
protected List<OrganizationType> getAllOrganizations() { List<OrganizationType> organizations = null; try { organizations = WebServiceProxyHelper.getAllOrganizationsByMerge(); } catch (ExchangeManagerException ex) { LOG.error("Exception while retrieving Exchange-Organization: {}", ex.getLocalizedMessage(), ex); } return organizations; }

Target:
protected List<OrganizationType> getAllOrganizations() { List<OrganizationType> organizations = null; try { organizations = WebServiceProxyHelper.getGatewayAllOrganizations(); } catch (ExchangeManagerException ex) { LOG.error("Exception while retrieving Exchange-Organization: {}", ex.getLocalizedMessage(), ex); } return organizations; }
Source:
public void persist(final OCFLPersistentStorageSession session, final ResourceOperation operation) throws PersistentStorageException { final var mapping = getMapping(operation.getResourceId()); final var fedoraResourceRoot = mapping.getRootObjectIdentifier(); final var resourceId = operation.getResourceId(); final var objectSession = session.findOrCreateSession(mapping.getOcflObjectId()); log.debug("Deleting from {}", resourceId, mapping.getOcflObjectId()); if (fedoraResourceRoot.equals(resourceId)) { try { objectSession.listHeadSubpaths().filter(p -> !isSidecarSubpath(p)).forEach( p -> deletePathWrapped(p, objectSession)); } catch (final PersistentStorageRuntimeException exc) { throw new PersistentStorageException(exc.getCause().getMessage()); } } else { final var relativeSubPath = relativizeSubpath(fedoraResourceRoot, operation.getResourceId()); final var ocflSubPath = resolveOCFLSubpath(fedoraResourceRoot, relativeSubPath); final var headers = (ResourceHeadersImpl) readHeaders(objectSession, ocflSubPath); final boolean isRdf = !Objects.equals(NON_RDF_SOURCE.toString(), headers.getInteractionModel()); final var filePath = resolveExtensions(ocflSubPath, isRdf); deletePath(filePath, objectSession, headers); if (!isRdf) { final var descPath = resolveExtensions(ocflSubPath + "-description", true); deletePath(descPath, objectSession); } } }

Target:
public void persist(final OCFLPersistentStorageSession session, final ResourceOperation operation) throws PersistentStorageException { final var mapping = getMapping(operation.getResourceId()); final var fedoraResourceRoot = mapping.getRootObjectIdentifier(); final var resourceId = operation.getResourceId(); final var objectSession = session.findOrCreateSession(mapping.getOcflObjectId()); final var user = operation.getUserPrincipal(); final var deleteTime = Instant.now(); log.debug("Deleting from {}", resourceId, mapping.getOcflObjectId()); if (fedoraResourceRoot.equals(resourceId)) { try { objectSession.listHeadSubpaths().filter(p -> !isSidecarSubpath(p)).forEach( p -> deletePathWrapped(p, objectSession, user, deleteTime)); } catch (final PersistentStorageRuntimeException exc) { throw new PersistentStorageException(exc); } } else { final var relativeSubPath = relativizeSubpath(fedoraResourceRoot, operation.getResourceId()); final var ocflSubPath = resolveOCFLSubpath(fedoraResourceRoot, relativeSubPath); final var headers = (ResourceHeadersImpl) readHeaders(objectSession, ocflSubPath); final boolean isRdf = !Objects.equals(NON_RDF_SOURCE.toString(), headers.getInteractionModel()); final var filePath = resolveExtensions(ocflSubPath, isRdf); deletePath(filePath, objectSession, headers, user, deleteTime); if (!isRdf) { final var descPath = resolveExtensions(ocflSubPath + "-description", true); deletePath(descPath, objectSession, user, deleteTime); } } }
Source:
public void onMovieSelected(MovieListFragment.ViewHolder vh) { selectedMovieTitle = vh.movieTitle; selectedMovieId = vh.movieId; if (Utils.isLollipopOrLater()) { MovieDetailsFragment movieDetailsFragment = MovieDetailsFragment.newInstance(vh); FragmentTransaction fragTrans = getSupportFragmentManager().beginTransaction(); movieDetailsFragment.setEnterTransition(TransitionInflater .from(this) .inflateTransition(R.transition.media_details)); movieDetailsFragment.setSharedElementReturnTransition(TransitionInflater.from( this).inflateTransition(R.transition.change_image)); movieDetailsFragment.setSharedElementEnterTransition(TransitionInflater.from( this).inflateTransition(R.transition.change_image)); fragTrans.replace(R.id.fragment_container, movieDetailsFragment) .addToBackStack(null) .addSharedElement(vh.artView, vh.artView.getTransitionName()) .commit(); } else { MovieDetailsFragment movieDetailsFragment = MovieDetailsFragment.newInstance(vh); FragmentTransaction fragTrans = getSupportFragmentManager().beginTransaction(); fragTrans.setCustomAnimations(R.anim.fragment_details_enter, 0, R.anim.fragment_list_popenter, 0); fragTrans.replace(R.id.fragment_container, movieDetailsFragment) .addToBackStack(null) .commit(); } setupActionBar(selectedMovieTitle); }

Target:
public void onMovieSelected(MovieListFragment.ViewHolder vh) { selectedMovieTitle = vh.movieTitle; selectedMovieId = vh.movieId; if (Utils.isLollipopOrLater()) { MovieDetailsFragment movieDetailsFragment = MovieDetailsFragment.newInstance(vh); FragmentTransaction fragTrans = getSupportFragmentManager().beginTransaction(); movieDetailsFragment.setEnterTransition(TransitionInflater .from(this) .inflateTransition(R.transition.media_details)); movieDetailsFragment.setReturnTransition(null); Transition changeImageTransition = TransitionInflater.from( this).inflateTransition(R.transition.change_image); movieDetailsFragment.setSharedElementReturnTransition(changeImageTransition); movieDetailsFragment.setSharedElementEnterTransition(changeImageTransition); fragTrans.replace(R.id.fragment_container, movieDetailsFragment) .addToBackStack(null) .addSharedElement(vh.artView, vh.artView.getTransitionName()) .commit(); } else { MovieDetailsFragment movieDetailsFragment = MovieDetailsFragment.newInstance(vh); FragmentTransaction fragTrans = getSupportFragmentManager().beginTransaction(); fragTrans.setCustomAnimations(R.anim.fragment_details_enter, 0, R.anim.fragment_list_popenter, 0); fragTrans.replace(R.id.fragment_container, movieDetailsFragment) .addToBackStack(null) .commit(); } setupActionBar(selectedMovieTitle); }
Source:
public void saveOrUpdateShouldBeUnsuccessfulWhenCandidateIdNotExists() throws Exception { given(this.messageKeyResolver.resolveMessageOrDefault(COMMON_INVALID_INPUT_MESSAGE_KEY)).willReturn(COMMON_INVALID_INPUT_MESSAGE); given(this.messageKeyResolver.resolveMessageOrDefault(CANDIDATE_NOT_FOUND_ERROR_MESSAGE_KEY)).willReturn(CANDIDATE_NOT_FOUND_ERROR_MESSAGE); this.mockMvc.perform(post(REQUEST_URL_POST) .param("candidateId", STRING_VALUE_TWO) .param("position.id", STRING_VALUE_ONE).param("position.name", POSITION_NAME_DEVELOPER) .param("channel.id", STRING_VALUE_ONE).param("channel.name", CHANNEL_NAME_FACEBOOK) .param("description", DESCRIPTION)) .andExpect(status().is3xxRedirection()) .andExpect(flash().attribute("candidateIdErrorMessage", CANDIDATE_NOT_FOUND_ERROR_MESSAGE)) .andExpect(redirectedUrl(REDIRECT_URL_FOR_CANDIDATE_WITH_WRONG_ID)); verifyZeroInteractions(applicationsService); then(this.candidateService).should().getCandidate(2L); then(this.positionService).should().getPositionDtoById(1L); then(this.channelService).should().getChannelDtoById(1L); }

Target:
public void saveOrUpdateShouldBeUnsuccessfulWhenCandidateIdNotExists() throws Exception { given(this.candidateService.getCandidate(2L)).willReturn(null); given(this.positionService.getPositionDtoById(1L)).willReturn(positionDTO); given(this.channelService.getChannelDtoById(1L)).willReturn(channelDTO); given(this.messageKeyResolver.resolveMessageOrDefault(COMMON_INVALID_INPUT_MESSAGE_KEY)).willReturn(COMMON_INVALID_INPUT_MESSAGE); given(this.messageKeyResolver.resolveMessageOrDefault(CANDIDATE_NOT_FOUND_ERROR_MESSAGE_KEY)).willReturn(CANDIDATE_NOT_FOUND_ERROR_MESSAGE); this.mockMvc.perform(post(REQUEST_URL_POST) .param("candidateId", STRING_VALUE_TWO) .param("position.id", STRING_VALUE_ONE).param("position.name", POSITION_NAME_DEVELOPER) .param("channel.id", STRING_VALUE_ONE).param("channel.name", CHANNEL_NAME_FACEBOOK) .param("description", DESCRIPTION)) .andExpect(status().is3xxRedirection()) .andExpect(redirectedUrl(REDIRECT_URL_FOR_CANDIDATE_WITH_WRONG_ID)) .andExpect(flash().attributeCount(1)) .andExpect(flash().attribute("candidateIdErrorMessage", CANDIDATE_NOT_FOUND_ERROR_MESSAGE)); verifyZeroInteractions(applicationsService); then(this.candidateService).should().getCandidate(2L); then(this.positionService).should().getPositionDtoById(1L); then(this.channelService).should().getChannelDtoById(1L); }
Source:
public void taskSchedulerRegistered() { Object taskScheduler = context.getBean(IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME); assertEquals(ThreadPoolTaskScheduler.class, taskScheduler.getClass()); Object errorHandler = new DirectFieldAccessor(taskScheduler).getPropertyValue("errorHandler"); assertEquals(MessagePublishingErrorHandler.class, errorHandler.getClass()); }

Target:
public void taskSchedulerRegistered() { Object taskScheduler = context.getBean(IntegrationContextUtils.TASK_SCHEDULER_BEAN_NAME); assertEquals(ThreadPoolTaskScheduler.class, taskScheduler.getClass()); ErrorHandler errorHandler = TestUtils.getPropertyValue(taskScheduler, "errorHandler", ErrorHandler.class); assertEquals(MessagePublishingErrorHandler.class, errorHandler.getClass()); MessageChannel defaultErrorChannel = TestUtils.getPropertyValue(errorHandler, "defaultErrorChannel", MessageChannel.class); assertNull(defaultErrorChannel); errorHandler.handleError(new Throwable()); defaultErrorChannel = TestUtils.getPropertyValue(errorHandler, "defaultErrorChannel", MessageChannel.class); assertNotNull(defaultErrorChannel); assertEquals(context.getBean(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME), defaultErrorChannel); }
Source:
protected String getAndDeleteNodeURL(String nodeName, int rank) { try { File f = new File(getNodeURLFilename(nodeName, rank)); if (f.exists()) { try (BufferedReader in = new BufferedReader(new FileReader(f))) { String read = in.readLine(); return read; } finally { FileUtils.deleteQuietly(f); } } } catch (IOException e) { e.printStackTrace(); } return null; }

Target:
protected String getAndDeleteNodeURL(String nodeName, int rank) { try { File f = new File(getNodeURLFilename(nodeName, rank)); if (f.exists()) { try (BufferedReader in = new BufferedReader(new FileReader(f))) { return in.readLine(); } finally { FileUtils.deleteQuietly(f); } } } catch (IOException e) { e.printStackTrace(); } return null; }
Source:
private static int lengthOfSoftClipping(Iterator<CigarElement> iterator) { int clipped = 0; while (iterator.hasNext()) { final CigarElement elem = iterator.next(); if (elem.getOperator() != CigarOperator.SOFT_CLIP) break; clipped = elem.getLength(); } return clipped; }

Target:
private static int lengthOfSoftClipping(Iterator<CigarElement> iterator) { int clipped = 0; while (iterator.hasNext()) { final CigarElement elem = iterator.next(); if (elem.getOperator() != CigarOperator.SOFT_CLIP && elem.getOperator() != CigarOperator.HARD_CLIP) break; if (elem.getOperator() == CigarOperator.SOFT_CLIP) clipped = elem.getLength(); } return clipped; }
Source:
public void handleGetMbusEncryptionKeyStatusByChannelResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType resultType, final OsgpException exception, final GetMbusEncryptionKeyStatusByChannelResponseDto getMbusEncryptionKeyStatusByChannelResponseDto) { LOGGER.info("handleGetMbusEncryptionKeyStatusResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); final String gatewayDeviceIdentification = deviceMessageMetadata.getDeviceIdentification(); final EncryptionKeyStatusType encryptionKeyStatusType = EncryptionKeyStatusType .valueOf(getMbusEncryptionKeyStatusByChannelResponseDto.getEncryptionKeyStatus().name()); this.webServiceResponseMessageSender.send( new ResponseMessage(deviceMessageMetadata.getCorrelationUid(), deviceMessageMetadata.getOrganisationIdentification(), gatewayDeviceIdentification, resultType, exception, encryptionKeyStatusType, deviceMessageMetadata.getMessagePriority()), deviceMessageMetadata.getMessageType()); }

Target:
public void handleGetMbusEncryptionKeyStatusByChannelResponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType resultType, final OsgpException exception, final GetMbusEncryptionKeyStatusByChannelResponseDto getMbusEncryptionKeyStatusByChannelResponseDto) { LOGGER.info("handleGetMbusEncryptionKeyStatusByChannelResponse for MessageType: {}", deviceMessageMetadata.getMessageType()); final String gatewayDeviceIdentification = deviceMessageMetadata.getDeviceIdentification(); final EncryptionKeyStatusType encryptionKeyStatusType = EncryptionKeyStatusType .valueOf(getMbusEncryptionKeyStatusByChannelResponseDto.getEncryptionKeyStatus().name()); this.webServiceResponseMessageSender.send( new ResponseMessage(deviceMessageMetadata.getCorrelationUid(), deviceMessageMetadata.getOrganisationIdentification(), gatewayDeviceIdentification, resultType, exception, encryptionKeyStatusType, deviceMessageMetadata.getMessagePriority()), deviceMessageMetadata.getMessageType()); }
Source:
protected URI createTableURI(final EObject sourceElement, final TableConfiguration tableConfiguration) { if (sourceElement != null) { setRegisterTableConfigurationByEClass(sourceElement.eClass() instanceof EClass); } IPath preferencePath = Activator.getDefault().getStateLocation(); preferencePath = preferencePath.append(TABLES_PREFERENCES_FOLDER_NAME).append(tableConfiguration.getType()); final StringBuilder b = new StringBuilder().append(preferencePath.toPortableString()); if (this.registerTableConfigurationByEClass) { final ModelElement modelElement = input.getModelElement(propertyPath); EClass eClass = null; if (modelElement instanceof CompositeModelElement) { CompositeModelElement compoModelElement = (CompositeModelElement) modelElement; Iterator<ModelElement> iter = compoModelElement.getSubElements().iterator(); while (eClass == null && iter.hasNext()) { ModelElement tmp = iter.next(); if (tmp instanceof UMLNotationModelElement) { EditPart part = ((UMLNotationModelElement) tmp).getEditPart(); eClass = EMFHelper.getEObject(part).eClass(); } else if (tmp instanceof EMFModelElement) { eClass = ((EMFModelElement) tmp).getSource().eClass(); } } } if (modelElement instanceof UMLNotationModelElement) { EditPart part = ((UMLNotationModelElement) modelElement).getEditPart(); eClass = EMFHelper.getEObject(part).eClass(); } b.append("_"); b.append(eClass.getName()); } URI newURI = URI.createFileURI(b.toString()).appendFileExtension(FILE_EXTENSION); return newURI; }

Target:
protected URI createTableURI(final EObject sourceElement, final TableConfiguration tableConfiguration) { if (null != sourceElement) { setRegisterTableConfigurationByEClass(sourceElement.eClass() instanceof EClass); } IPath preferencePath = Activator.getDefault().getStateLocation(); preferencePath = preferencePath.append(TABLES_PREFERENCES_FOLDER_NAME).append(tableConfiguration.getType()); final StringBuilder b = new StringBuilder().append(preferencePath.toPortableString()); if (this.registerTableConfigurationByEClass) { final ModelElement modelElement = input.getModelElement(propertyPath); EClass eClass = null; if (modelElement instanceof CompositeModelElement) { CompositeModelElement compoModelElement = (CompositeModelElement) modelElement; Iterator<ModelElement> iter = compoModelElement.getSubElements().iterator(); while (eClass == null && iter.hasNext()) { ModelElement tmp = iter.next(); if (tmp instanceof UMLNotationModelElement) { EditPart part = ((UMLNotationModelElement) tmp).getEditPart(); eClass = EMFHelper.getEObject(part).eClass(); } else if (tmp instanceof EMFModelElement) { eClass = ((EMFModelElement) tmp).getSource().eClass(); } } } if (modelElement instanceof UMLNotationModelElement) { EditPart part = ((UMLNotationModelElement) modelElement).getEditPart(); eClass = EMFHelper.getEObject(part).eClass(); } b.append("_"); b.append(eClass.getName()); } URI newURI = URI.createFileURI(b.toString()).appendFileExtension(FILE_EXTENSION); return newURI; }
Source:
private void addUserChanges(final Map<String, User> usersById, final List<AddUserProblemFactChange> newUserChanges, final List<ProblemFactChange<TaskAssigningSolution>> updateUserChanges) { final List<User> updatedUserList = filterDuplicates(externalUserList) .filter(externalUser -> !IS_PLANNING_USER.test(externalUser.getId())) .map(UserUtil::fromExternalUser) .collect(Collectors.toList()); final Set<String> updatedUserIds = new HashSet<>(); for (User user : updatedUserList) { final User previousUser = usersById.get(user.getEntityId()); updatedUserIds.add(user.getEntityId()); if (previousUser == null) { newUserChanges.add(new AddUserProblemFactChange(user)); } else if (!equalsByProperties(previousUser, user)) { updateUserChanges.add(new UserPropertyChangeProblemFactChange(previousUser, true, user.getAttributes(), user.getAllLabelValues(), user.getGroups())); } } usersById.values().stream() .filter(user -> !IS_PLANNING_USER.test(user.getEntityId())) .filter(user -> !updatedUserIds.contains(user.getEntityId())) .filter(User::isEnabled) .forEach(user -> updateUserChanges.add(new DisableUserProblemFactChange(user))); }

Target:
private void addUserChanges(final Map<String, User> usersById, final List<AddUserProblemFactChange> newUserChanges, final List<ProblemFactChange<TaskAssigningSolution>> updateUserChanges) { final Set<String> updatedUserIds = new HashSet<>(); filterDuplicates(externalUserList) .filter(externalUser -> !IS_PLANNING_USER.test(externalUser.getId())) .map(UserUtil::fromExternalUser) .forEach(user -> { final User previousUser = usersById.get(user.getEntityId()); updatedUserIds.add(user.getEntityId()); if (previousUser == null) { newUserChanges.add(new AddUserProblemFactChange(user)); } else if (!equalsByProperties(previousUser, user)) { updateUserChanges.add(new UserPropertyChangeProblemFactChange(previousUser, true, user.getAttributes(), user.getAllLabelValues(), user.getGroups())); } } ); usersById.values().stream() .filter(user -> !IS_PLANNING_USER.test(user.getEntityId())) .filter(user -> !updatedUserIds.contains(user.getEntityId())) .filter(User::isEnabled) .forEach(user -> updateUserChanges.add(new DisableUserProblemFactChange(user))); }
Source:
public boolean accepts(Photograph photograph) { if (getState() != null && photograph.getState() != getState()) { return false; } if (getType() != null && photograph.getPhotoType() != getType()) { return false; } if (processDates(photograph)) { return false; } Person person = photograph.getPerson(); if (person != null) { if (getPersonType() != null && !getPersonType().isMember(person.getUser())) { return false; } if (!getUserName().equals("") && !getUserName().equals(person.getUsername())) { return false; } } else { return false; } return true; }

Target:
public boolean accepts(Photograph photograph) { if (getState() != null && photograph.getState() != getState()) { return false; } if (getType() != null && photograph.getPhotoType() != getType()) { return false; } if (processDates(photograph)) { return false; } Person person = photograph.getPerson(); if (person != null) { if (getPersonType() != null && !getPersonType().isMember(person.getUser())) { return false; } if (!Strings.isNullOrEmpty(getUserName()) && !getUserName().equals(person.getUsername())) { return false; } } else { return false; } return true; }