auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void init(AndroidAnnotationsEnvironment environment) { classSuffix = environment.getOptionValue(OPTION_CLASS_SUFFIX).trim(); if (classSuffix.isEmpty()) { throw new IllegalArgumentException("'" + classSuffix + "' may not be an empty string."); } <START> if (!SourceVersion.isName("validName" + classSuffix) || classSuffix.contains(".")) { <END> throw new IllegalArgumentException("'" + classSuffix + "' may not be a valid Java identifier."); } }</code><technical_language>I capitalize ValidName</technical_language>

Target:
public static void init(AndroidAnnotationsEnvironment environment) { classSuffix = environment.getOptionValue(OPTION_CLASS_SUFFIX).trim(); if (classSuffix.isEmpty()) { throw new IllegalArgumentException("'" + classSuffix + "' may not be an empty string."); } if (!SourceVersion.isName("ValidName" + classSuffix) || classSuffix.contains(".")) { throw new IllegalArgumentException("'" + classSuffix + "' may not be a valid Java identifier."); } }
Source:
<code>public void testGlobStatusPathExpansionAndFilter() throws IOException { Path testRoot = new Path("/parent"); ghfs.mkdirs(testRoot); <START> ghfs.mkdirs(new Path("/parent/date")); ghfs.mkdirs(new Path("/parent/date/2020")); ghfs.mkdirs(new Path("/parent/date/2020/07")); ghfs.mkdirs(new Path("/parent/date/2020/07/17")); ghfs.mkdirs(new Path("/parent/date/2020/07/18")); ghfs.mkdirs(new Path("/parent/date/2020/07/19")); <END> ghfs.mkdirs(new Path("/parent/date/2020/07/17/0")); ghfs.mkdirs(new Path("/parent/date/2020/07/18/0")); ghfs.mkdirs(new Path("/parent/date/2020/07/19/0")); byte[] data = "data".getBytes(StandardCharsets.UTF_8); PathFilter FILE_FILTER = path -> path.getName().endsWith(".json"); createFile(new Path("/parent/date/2020/07/17/0/file1.xml"), data); createFile(new Path("/parent/date/2020/07/17/0/file1.json"), data); createFile(new Path("/parent/date/2020/07/18/0/file2.xml"), data); createFile(new Path("/parent/date/2020/07/18/0/file2.json"), data); createFile(new Path("/parent/date/2020/07/19/0/file3.xml"), data); createFile(new Path("/parent/date/2020/07/19/0/file3.json"), data); FileStatus[] files = ghfs.globStatus(new Path("/parent *"), FILE_FILTER); assertThat(files).hasLength(3); assertThat(files[0].getPath().getName()).isEqualTo("file1.json"); assertThat(files[1].getPath().getName()).isEqualTo("file2.json"); assertThat(files[2].getPath().getName()).isEqualTo("file3.json"); assertThat(ghfs.delete(testRoot, true)).isTrue(); }</code><technical_language>I need calls, mkdirs create parent directories</technical_language>

Target:
public void testGlobStatusPathExpansionAndFilter() throws IOException { Path testRoot = new Path("/testGlobStatusPathExpansionAndFilter"); byte[] data = "testGlobStatusPathExpansionAndFilter_data".getBytes(UTF_8); createFile(testRoot.suffix("/date/2020/07/17/0/file1.xml"), data); createFile(testRoot.suffix("/date/2020/07/17/0/file1.json"), data); createFile(testRoot.suffix("/date/2020/07/18/0/file2.xml"), data); createFile(testRoot.suffix("/date/2020/07/18/0/file2.json"), data); createFile(testRoot.suffix("/date/2020/07/19/0/file3.xml"), data); createFile(testRoot.suffix("/date/2020/07/19/0/file3.json"), data); createFile(testRoot.suffix("/date/2020/07/20/0/file4.xml"), data); createFile(testRoot.suffix("/date/2020/07/20/0/file4.json"), data); FileStatus[] files = ghfs.globStatus( testRoot.suffix(" *"), path -> path.getName().endsWith(".json")); Path workingDirRoot = new Path(ghfs.getWorkingDirectory(), testRoot); assertThat(Arrays.stream(files).map(FileStatus::getPath).collect(toImmutableList())) .containsExactly( workingDirRoot.suffix("/date/2020/07/17/0/file1.json"), workingDirRoot.suffix("/date/2020/07/18/0/file2.json"), workingDirRoot.suffix("/date/2020/07/19/0/file3.json")); assertThat(ghfs.delete(testRoot, true)).isTrue(); }
Source:
<code>public DynamicLifespanScheduler(BucketNodeMap bucketNodeMap, List<Node> allNodes, List<ConnectorPartitionHandle> partitionHandles, OptionalInt concurrentLifespansPerTask) { <START> this.bucketNodeMap = bucketNodeMap; <END> this.allNodes = allNodes; this.partitionHandles = requireNonNull(partitionHandles, "partitionHandles is null"); if (concurrentLifespansPerTask.isPresent()) { checkArgument(concurrentLifespansPerTask.getAsInt() >= 1, "concurrentLifespansPerTask must be great or equal to 1 if present"); } this.concurrentLifespansPerTask = requireNonNull(concurrentLifespansPerTask, "concurrentLifespansPerTask is null"); int bucketCount = partitionHandles.size(); this.driverGroups = new IntArrayList(IntStream.range(0, bucketCount).toArray()).iterator(); }</code><technical_language>null checks</technical_language>

Target:
public DynamicLifespanScheduler(BucketNodeMap bucketNodeMap, List<Node> allNodes, List<ConnectorPartitionHandle> partitionHandles, OptionalInt concurrentLifespansPerTask) { this.bucketNodeMap = requireNonNull(bucketNodeMap, "bucketNodeMap is null"); this.allNodes = requireNonNull(allNodes, "allNodes is null"); this.partitionHandles = unmodifiableList(new ArrayList<>( requireNonNull(partitionHandles, "partitionHandles is null"))); this.concurrentLifespansPerTask = requireNonNull(concurrentLifespansPerTask, "concurrentLifespansPerTask is null"); concurrentLifespansPerTask.ifPresent(lifespansPerTask -> checkArgument(lifespansPerTask >= 1, "concurrentLifespansPerTask must be great or equal to 1 if present")); int bucketCount = partitionHandles.size(); verify(bucketCount > 0); this.driverGroups = new IntArrayList(IntStream.range(0, bucketCount).toArray()).iterator(); }
Source:
<code>public void testPutIfAbsentNoStoreEntryCacheAccessExceptionNoCacheWriterEntry() throws Exception { final FakeStore realStore = new FakeStore(Collections.<String, String>emptyMap()); this.store = spy(realStore); doThrow(new CacheAccessException("")).when(this.store).computeIfAbsent(eq("key"), getAnyFunction()); final FakeCacheWriter realCache = new FakeCacheWriter(Collections.<String, String>emptyMap()); this.cacheWriter = spy(realCache); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheWriter); final InOrder ordered = inOrder(this.cacheWriter, this.spiedResilienceStrategy); ehcache.putIfAbsent("key", "value"); verify(this.store).computeIfAbsent(eq("key"), getAnyFunction()); ordered.verify(this.cacheWriter).write(eq("key"), eq("value")); ordered.verify(this.spiedResilienceStrategy) .putIfAbsentFailure(eq("key"), eq("value"), any(CacheAccessException.class), eq(true)); assertThat(realCache.getEntryMap().get("key"), equalTo("value")); <START> validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.PutIfAbsentOutcome.FAILURE)); END> }</code><technical_language>Clarifying this part of #163</technical_language>

Target:
public void testPutIfAbsentNoStoreEntryCacheAccessExceptionNoCacheWriterEntry() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.<String, String>emptyMap()); this.store = spy(fakeStore); doThrow(new CacheAccessException("")).when(this.store).computeIfAbsent(eq("key"), getAnyFunction()); final FakeCacheWriter fakeWriter = new FakeCacheWriter(Collections.<String, String>emptyMap()); this.cacheWriter = spy(fakeWriter); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheWriter); final InOrder ordered = inOrder(this.cacheWriter, this.spiedResilienceStrategy); ehcache.putIfAbsent("key", "value"); verify(this.store).computeIfAbsent(eq("key"), getAnyFunction()); ordered.verify(this.cacheWriter).write(eq("key"), eq("value")); ordered.verify(this.spiedResilienceStrategy) .putIfAbsentFailure(eq("key"), eq("value"), any(CacheAccessException.class), eq(true)); assertThat(fakeWriter.getEntryMap().get("key"), equalTo("value")); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.PutIfAbsentOutcome.FAILURE)); }
Source:
<code>public void removeBuddyAfterConnectRejection(UUID idOfRequestingUser, UUID buddyId) { <START> userService.getValidatedUserById(idOfRequestingUser); <END> Buddy buddy = buddyRepository.findOne(buddyId); if (buddy != null) { removeBuddy(idOfRequestingUser, buddy); } }</code><technical_language>more speaking call a validate method instead of a get</technical_language>

Target:
public void removeBuddyAfterConnectRejection(UUID idOfRequestingUser, UUID buddyId) { userService.assertValidatedUser(userService.getUserEntityById(idOfRequestingUser)); Buddy buddy = buddyRepository.findOne(buddyId); if (buddy != null) { removeBuddy(idOfRequestingUser, buddy); } }
Source:
<code>Mono<Response<Boolean>> existsWithResponse(Context context) { return this.getPropertiesWithResponse(context) .map(cp -> (Response<Boolean>) new SimpleResponse<>(cp, true)) <START> .onErrorResume(t -> t instanceof ShareStorageException && ((ShareStorageException) t).getStatusCode() == 404, <END> t -> { HttpResponse response = ((ShareStorageException) t).getResponse(); return Mono.just(new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), false)); }); }</code><technical_language>For readability mind putting entire conditional next line</technical_language>

Target:
Mono<Response<Boolean>> existsWithResponse(Context context) { return this.getPropertiesWithResponse(context) .map(cp -> (Response<Boolean>) new SimpleResponse<>(cp, true)) .onErrorResume(t -> t instanceof ShareStorageException && ((ShareStorageException) t).getStatusCode() == 404 && ((ShareStorageException) t).getErrorCode() == ShareErrorCode.SHARE_NOT_FOUND, t -> { HttpResponse response = ((ShareStorageException) t).getResponse(); return Mono.just(new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), false)); }); }
Source:
<code>public void write(List<? extends List<IBaseResource>> theList) throws Exception { for (List<IBaseResource> resourceList : theList) { for (IBaseResource nextFileResource : resourceList) { myParser.encodeResourceToWriter(nextFileResource, myWriter); myWriter.append("\n"); } } Optional<IIdType> createdId = flushToFiles(); <START> createdId.ifPresent(theIIdType -> ourLog.warn("Created resources for bulk export file containing resources of type ", theIIdType.toUnqualifiedVersionless().getValue())); <END> }</code><technical_language>nitpick: simple if statements more approachable junior developers</technical_language>

Target:
public void write(List<? extends List<IBaseResource>> theList) throws Exception { int count = 0; for (List<IBaseResource> resourceList : theList) { for (IBaseResource nextFileResource : resourceList) { myParser.encodeResourceToWriter(nextFileResource, myWriter); myWriter.append("\n"); count++; } } Optional<IIdType> createdId = flushToFiles(); if (createdId.isPresent()) { ourLog.info("Created resources for bulk export file containing resources of type ", count, createdId.get().toUnqualifiedVersionless().getValue(), myReosurceType); } }
Source:
<code>private Optional<String> getPath(String documentationOptions) { try { Properties docProps = new Properties(); docProps.load(new <START> StringReader(documentationOptions)); <END> String path = docProps.getProperty(PATH_PREFIX); if (path != null) { return Optional.of(path); } } catch (IOException e) { } return Optional.empty(); }</code><technical_language>generally speaking a stream closed avoid memory leak</technical_language>

Target:
private Optional<String> getPath(String documentationOptions) { try { Properties docProps = new Properties(); StringReader docReader = new StringReader(documentationOptions); try { docProps.load(docReader); } finally { docReader.close(); } String path = docProps.getProperty(PATH_PREFIX); if (path != null) { return Optional.of(path); } } catch (IOException e) { } return Optional.empty(); }
Source:
<code>public void shouldGetCohortQueryReportWithGivenParameters() throws Exception { CohortQueryReport cohortQueryReport = buildCohortQueryReport(); URI url = config.toInstancePathWithParams("/reportingrest/cohort/{uuid}", cohortQueryReport.getUuid()); Map<String, String> parameters = new HashMap<>(); parameters.put("param1", "value"); parameters.put("param2", "value"); url = addParametersToPath(url, parameters); doReturn(getResponseFromFile(GET_COHORT_QUERY_REPORT_RESPONSE_JSON)) .when(restOperations).exchange(eq(url), eq(HttpMethod.GET), any(HttpEntity.class), eq(String.class)); CohortQueryReport created = cohortResource.getCohortQueryReport(config, cohortQueryReport.getUuid(), parameters); verify(restOperations).exchange(eq(url), eq(HttpMethod.GET), requestCaptor.capture(), eq(String.class)); assertThat(created, equalTo(cohortQueryReport)); assertThat(requestCaptor.getValue().getHeaders(), equalTo(getHeadersForGet(config))); <START> assertThat(JsonUtils.readJson(requestCaptor.getValue().getBody(), JsonObject.class), nullValue()); <END> }</code><technical_language>do assert this json null</technical_language>

Target:
public void shouldGetCohortQueryReportWithGivenParameters() throws Exception { getCohortQueryReport(true); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof ACE) { ACE ace = (ACE) obj; boolean beginEqual = ace.begin == null && begin == null || !(ace.begin == null || begin == null) && ace.begin.getTimeInMillis() == begin.getTimeInMillis(); boolean endEqual = ace.end == null && end == null || !(ace.end == null || end == null) && ace.end.getTimeInMillis() == end.getTimeInMillis(); boolean creatorEqual = StringUtils.equals(ace.creator, creator); boolean usernameEqual = StringUtils.equals(ace.username, username); <START> boolean permissionEqual = StringUtils.equals(ace.permission, permission); <END> return ace.isGranted == isGranted && usernameEqual && permissionEqual && creatorEqual && beginEqual && endEqual; } return super.equals(obj); }</code><technical_language>Objects.equals() here</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof ACE) { ACE ace = (ACE) obj; boolean beginEqual = ace.begin == null && begin == null || !(ace.begin == null || begin == null) && ace.begin.getTimeInMillis() == begin.getTimeInMillis(); boolean endEqual = ace.end == null && end == null || !(ace.end == null || end == null) && ace.end.getTimeInMillis() == end.getTimeInMillis(); boolean creatorEqual = Objects.equals(ace.creator, creator); boolean usernameEqual = Objects.equals(ace.username, username); boolean permissionEqual = Objects.equals(ace.permission, permission); return ace.isGranted == isGranted && usernameEqual && permissionEqual && creatorEqual && beginEqual && endEqual; } return super.equals(obj); }
Source:
<code>public void getProperties() { try { String response = solrCatalogSchemaClientFactory.getClient().getFieldTypes("json"); Map<String, Object> map = gson.fromJson(response, new TypeToken<Map<String, Object>>() {}.getType()); if (map != null) { fieldTypes = (ArrayList<Object>) map.get("fieldTypes"); } } catch (Exception e) { <START> LOGGER.debug("Unable to getProperties from: {}", getSolrCatalogSchemaUrl(), e); <END> } }</code><technical_language>This form print exception a parameter is used. concatenate parameter string instead of passing 'debug() drop exception if do wish log it</technical_language>

Target:
public void getProperties() { try { String response = solrCatalogSchemaClientFactory.getClient().getFieldTypes("json"); Map<String, Object> map = gson.fromJson(response, new TypeToken<Map<String, Object>>() {}.getType()); if (map != null) { fieldTypes = (ArrayList<Object>) map.get("fieldTypes"); } } catch (Exception e) { LOGGER.debug("Unable to getProperties from: {}", getSolrCatalogSchemaUrl()); } }
Source:
<code>public void registerKfsPvenDisapprovalForExistingPaymentWorksVendor(String kfsVendorDocumentNumber, VendorDetail vendorDetail) { PaymentWorksVendor pmwVendor = getPaymentWorksVendorByDocumentNumber(kfsVendorDocumentNumber); if (ObjectUtils.isNotNull(pmwVendor)) { LOG.info("registerKfsPvenDisapprovalForExistingPaymentWorksVendor: Disapproving PaymentWorks originating Vendor with table ID '" + pmwVendor.getId() + "' and kfsVendorDocumentNumber '" + kfsVendorDocumentNumber + "' and pmwVendorRequestId '" + pmwVendor.getPmwVendorRequestId() + "'"); getPaymentWorksVendorDao().updateExistingPaymentWorksVendorInStagingTable(pmwVendor.getId(), PaymentWorksConstants.KFSVendorProcessingStatus.VENDOR_DISAPPROVED, vendorDetail.getVendorHeaderGeneratedIdentifier(), vendorDetail.getVendorDetailAssignedIdentifier(), PaymentWorksConstants.SupplierUploadStatus.INELIGIBLE_FOR_UPLOAD, getDateTimeService().getCurrentTimestamp()); <START> } else { <END> LOG.error("registerKfsPvenDisapprovalForExistingPaymentWorksVendor: Vendor retrieval by KFS document number '" + kfsVendorDocumentNumber + "' did not find vendor with pmwVendorRequestId '" + pmwVendor.getPmwVendorRequestId() + "'."); } }</code><technical_language>previously noted, PaymentWorksConstants.SupplierUploadStatus.INELIGIBLE_FOR_UPLOAD removed</technical_language>

Target:
public void registerKfsPvenDisapprovalForExistingPaymentWorksVendor(String kfsVendorDocumentNumber, VendorDetail vendorDetail) { PaymentWorksVendor pmwVendor = getPaymentWorksVendorByDocumentNumber(kfsVendorDocumentNumber); if (ObjectUtils.isNotNull(pmwVendor)) { LOG.info("registerKfsPvenDisapprovalForExistingPaymentWorksVendor: Disapproving PaymentWorks originating Vendor with table ID '" + pmwVendor.getId() + "' and kfsVendorDocumentNumber '" + kfsVendorDocumentNumber + "' and pmwVendorRequestId '" + pmwVendor.getPmwVendorRequestId() + "'"); getPaymentWorksVendorDao().updateExistingPaymentWorksVendorInStagingTable(pmwVendor.getId(), PaymentWorksConstants.KFSVendorProcessingStatus.VENDOR_DISAPPROVED, vendorDetail.getVendorHeaderGeneratedIdentifier(), vendorDetail.getVendorDetailAssignedIdentifier(), getDateTimeService().getCurrentTimestamp()); } else { LOG.error("registerKfsPvenDisapprovalForExistingPaymentWorksVendor: Vendor retrieval by KFS document number '" + kfsVendorDocumentNumber + "' did not find vendor with pmwVendorRequestId '" + pmwVendor.getPmwVendorRequestId() + "'."); } }
Source:
<code>public void lunAlreadyPartOfStorageDomains() { LUNs lun1 = new LUNs(); lun1.setLUN_id(GUIDS[0].toString()); lun1.setStorageDomainId(Guid.newGuid()); LUNs lun2 = new LUNs(); lun2.setLUN_id(GUIDS[1].toString()); lun2.setStorageDomainId(Guid.newGuid()); doReturn(lunDAO).when(cmd).getLunDao(); when(lunDAO.getAll()).thenReturn(Arrays.asList(lun1, lun2)); List<String> specifiedLunIds = Collections.singletonList(GUIDS[0].toString()); assertTrue(cmd.isLunsAlreadyInUse(specifiedLunIds)); List<String> messages = cmd.getReturnValue().getCanDoActionMessages(); assertEquals(2, messages.size()); <START> assertEquals(messages.get(0), VdcBllMessages.ACTION_TYPE_FAILED_LUNS_ALREADY_PART_OF_STORAGE_DOMAINS.toString()); <END> assertEquals(messages.get(1), String.format("$lunIds %1$s", cmd.getFormattedLunId(lun1, lun1.getStorageDomainName()))); }</code><technical_language>actual <--> expected replaced</technical_language>

Target:
public void lunAlreadyPartOfStorageDomains() { LUNs lun1 = new LUNs(); lun1.setLUN_id(GUIDS[0].toString()); lun1.setStorageDomainId(Guid.newGuid()); LUNs lun2 = new LUNs(); lun2.setLUN_id(GUIDS[1].toString()); lun2.setStorageDomainId(Guid.newGuid()); doReturn(lunDAO).when(cmd).getLunDao(); when(lunDAO.getAll()).thenReturn(Arrays.asList(lun1, lun2)); List<String> specifiedLunIds = Collections.singletonList(GUIDS[0].toString()); assertTrue(cmd.isLunsAlreadyInUse(specifiedLunIds)); List<String> messages = cmd.getReturnValue().getCanDoActionMessages(); assertEquals(2, messages.size()); assertEquals(VdcBllMessages.ACTION_TYPE_FAILED_LUNS_ALREADY_PART_OF_STORAGE_DOMAINS.toString(), messages.get(0)); assertEquals(String.format("$lunIds %1$s", cmd.getFormattedLunId(lun1, lun1.getStorageDomainName())), messages.get(1)); }
Source:
<code>private void ensureConceptIsSet(Order order) { boolean isDrugOrder = DrugOrder.class.isAssignableFrom(getActualType(order)); Concept concept = order.getConcept(); if (concept == null && isDrugOrder) { DrugOrder drugOrder = (DrugOrder) order; if (drugOrder.getDrug() != null) { concept = drugOrder.getDrug().getConcept(); drugOrder.setConcept(concept); } } if (isDrugOrder) { ((DrugOrder) order).setAutoExpireDateBasedOnDuration(); } if (concept == null) { <START> throw new MissingRequiredPropertyException("Order.concept.required"); <END> } }</code><technical_language>remove newline end of methods</technical_language>

Target:
private void ensureConceptIsSet(Order order) { Concept concept = order.getConcept(); if (concept == null && isDrugOrder(order)) { DrugOrder drugOrder = (DrugOrder) order; if (drugOrder.getDrug() != null) { concept = drugOrder.getDrug().getConcept(); drugOrder.setConcept(concept); } } if (concept == null) { throw new MissingRequiredPropertyException("Order.concept.required"); } }
Source:
<code><START> public static boolean hasMergeRegions(Cell[] cells) { <END> for (Cell cell : cells) { if (!isMergeQualifierPrefix(cell)) { continue; } return true; } return false; }</code><technical_language>Minor suggestion. reduce line code. :-) for (Cell cell : cells) { if (isMergeQualifierPrefix(cell)) { return true; } } return false;</technical_language>

Target:
public static boolean hasMergeRegions(Cell[] cells) { for (Cell cell : cells) { if (isMergeQualifierPrefix(cell)) { return true; } } return false; }
Source:
<code><START> public void testDifferentMessageRetentionDays() throws StoreException, InterruptedException { <END> List<String> bestCandidates = null; int[] messageRetentionDayValues = new int[]{1, 2, 3, 6, 9}; for (int messageRetentionDays : messageRetentionDayValues) { time = new MockTime(); Pair<MockBlobStore, StoreConfig> initState = initializeBlobStore(properties, time, -1, messageRetentionDays, DEFAULT_MAX_BLOB_SIZE); if (type.equals(CompactionPolicyType.DEFAULT)) { bestCandidates = setUpStateForDefaultCompactionPolicy(blobStore, mockBlobStoreStats); compactionPolicy = new DefaultCompactionPolicy(initState.getSecond(), time); } else if (type.equals(CompactionPolicyType.COMPACT_ALL)) { blobStore.logSegmentsNotInJournal = generateRandomStrings(3); bestCandidates = blobStore.logSegmentsNotInJournal; compactionPolicy = new CompactAllPolicy(initState.getSecond(), time); } verifyCompactionDetails( new CompactionDetails(time.milliseconds() - (messageRetentionDays * Time.SecsPerDay * Time.MsPerSec), bestCandidates), blobStore, compactionPolicy); } }</code><technical_language>this a class variable</technical_language>

Target:
public void testDifferentMessageRetentionDays() throws StoreException, InterruptedException { List<String> bestCandidates = null; int[] messageRetentionDayValues = new int[]{1, 2, 3, 6, 9}; for (int messageRetentionDays : messageRetentionDayValues) { time = new MockTime(); Pair<MockBlobStore, StoreConfig> initState = initializeBlobStore(properties, time, -1, messageRetentionDays, DEFAULT_MAX_BLOB_SIZE); if (compactionPolicy instanceof DefaultCompactionPolicy) { bestCandidates = setUpStateForDefaultCompactionPolicy(blobStore, mockBlobStoreStats); compactionPolicy = new DefaultCompactionPolicy(initState.getSecond(), time); } else if (compactionPolicy instanceof CompactAllPolicy) { blobStore.logSegmentsNotInJournal = generateRandomStrings(3); bestCandidates = blobStore.logSegmentsNotInJournal; compactionPolicy = new CompactAllPolicy(initState.getSecond(), time); } verifyCompactionDetails( new CompactionDetails(time.milliseconds() - (messageRetentionDays * Time.SecsPerDay * Time.MsPerSec), bestCandidates), blobStore, compactionPolicy); } }
Source:
<code>public void testMatrixJob() { jenkins.save(); MatrixProject job = jenkins.jobs.create(MatrixProject.class); job.configure(); LabelExpressionAxis a = job.addAxis(LabelExpressionAxis.class); a.values.set("label1"); job.addUserAxis("X", "1 2 3 4 5"); job.save(); MatrixBuild b = job.startBuild().as(MatrixBuild.class); jenkins.runScript("def items = Jenkins.getInstance().getQueue().getBuildableItems();\n" + "for (hudson.model.Queue$BuildableItem i: items) {\n" + " Label l = i.getAssignedLabel();\n" + " if (l != null) {\n" + " println('suggesting review of label ' + l.getName());\n" + " l.nodeProvisioner.suggestReviewNow();\n" + " }\n" + <START> "}"); <END> b.waitUntilFinished(EXTENDED_PROVISION_TIMEOUT); for (MatrixRun config: b.getConfigurations()) { config.shouldSucceed(); } }</code><technical_language>I do this intervention, especially if is necessary implement test. whiteboxy here..</technical_language>

Target:
public void testMatrixJob() { jenkins.save(); MatrixProject job = jenkins.jobs.create(MatrixProject.class); job.configure(); LabelExpressionAxis a = job.addAxis(LabelExpressionAxis.class); a.values.set("label1"); job.addUserAxis("X", "1 2 3 4 5"); job.save(); MatrixBuild b = job.startBuild().as(MatrixBuild.class); b.waitUntilFinished(EXTENDED_PROVISION_TIMEOUT); for (MatrixRun config: b.getConfigurations()) { config.shouldSucceed(); } }
Source:
<code>public Assertion validate(String jsonWebToken, String service) throws TicketValidationException { JwtClaims claims = JWTUtils.parseJWT(jsonWebToken, jsonWebTokenSigned, jsonWebTokenSignatureKey, jsonWebTokenEncrypted, jsonWebTokenEncryptionKey, iamServerUrlPrefix, service); try { AttributePrincipal principal = new AttributePrincipalImpl(claims.getSubject()); Assertion assertion = new AssertionImpl(new AttributePrincipalImpl(principal.getName(), claims.getClaimsMap())); logger.debug("Assertion generated for principal " + principal.getName()); return assertion; } catch (MalformedClaimException e) { <START> throw new IAMException("Malformed Json Web Token acquired from IAM [" + jsonWebToken + "]"); <END> } }</code><technical_language>link exception e here</technical_language>

Target:
public Assertion validate(String jsonWebToken, String service) throws TicketValidationException { JwtClaims claims = JWTUtils.parseJWT(jsonWebToken, jsonWebTokenSigned, jsonWebTokenSignatureKey, jsonWebTokenEncrypted, jsonWebTokenEncryptionKey, iamServerUrlPrefix, service); try { AttributePrincipal principal = new AttributePrincipalImpl(claims.getSubject()); Assertion assertion = new AssertionImpl(new AttributePrincipalImpl(principal.getName(), claims.getClaimsMap())); logger.debug("Assertion generated for principal " + principal.getName()); return assertion; } catch (MalformedClaimException e) { throw new IAMException("Malformed Json Web Token acquired from IAM [" + jsonWebToken + "]", e); } }
Source:
<code>public void useRetry() { if (!canRetry()) { throw new IllegalStateException("No retries left"); } retriesDone++; <START> firstRetry = false; <END> }</code><technical_language>This is redundant. retriesDone tells done retries not</technical_language>

Target:
public void useRetry() { if (!canRetry()) { throw new IllegalStateException("No retries left"); } retriesDone++; }
Source:
<code>public void before() { <START> spanCache = new InfinispanSpanCache(cacheManager.getCache("spans"), cacheManager.getCache("children")); <END> }</code><technical_language>cache name in standalone.xml (spanChildren)? matter for local cache, if decide change cache configurations, necessary match config in standalone.xml</technical_language>

Target:
public void before() { spanCache = new InfinispanSpanCache(cacheManager); }
Source:
<code>private DeepLinkEntry findEntry(String uriString) { DeepLinkEntry entryRegExpMatch = null; List<DeepLinkEntry> entryIdxMatches = new ArrayList<>(); DeepLinkUri uri = DeepLinkUri.parse(uriString); for (BaseRegistry registry : registries) { DeepLinkEntry entryIdxMatch = registry.idxMatch(uri, configurablePathSegmentReplacements); if (entryIdxMatch != null) { entryIdxMatches.add(entryIdxMatch); } } if (entryIdxMatches.isEmpty()) { return null; } else if (entryIdxMatches.size() == 1) { return entryIdxMatches.get(0); } Collections.sort(entryIdxMatches, new Comparator<DeepLinkEntry>() { @Override public int compare(DeepLinkEntry a, DeepLinkEntry b) { return a.moreConcreteThan(b); } }); if (entryIdxMatches.get(0).moreConcreteThan(entryIdxMatches.get(1)) == 0) { <START> Log.w(TAG, "More than one match with the same concreteness!! (" <END> + entryIdxMatches.get(0).toString() + ") vs. (" + entryIdxMatches.get(1).toString() + ")"); } return entryIdxMatches.get(0); }</code><technical_language>I guess this is a bit indeterministic called. nice able hook this warning log crash in development (maybe add optional constructor injected logger interface)</technical_language>

Target:
private DeepLinkEntry findEntry(String uriString) { DeepLinkEntry entryRegExpMatch = null; List<DeepLinkEntry> entryIdxMatches = new ArrayList<>(); DeepLinkUri uri = DeepLinkUri.parse(uriString); for (BaseRegistry registry : registries) { DeepLinkEntry entryIdxMatch = registry.idxMatch(uri, configurablePathSegmentReplacements); if (entryIdxMatch != null) { entryIdxMatches.add(entryIdxMatch); } } if (entryIdxMatches.isEmpty()) { return null; } else if (entryIdxMatches.size() == 1) { return entryIdxMatches.get(0); } Collections.sort(entryIdxMatches); if (entryIdxMatches.get(0).compareTo(entryIdxMatches.get(1)) == 0) { if (errorHandler != null) { errorHandler.duplicateMatch(uriString, entryIdxMatches.subList(0, 2)); } Log.w(TAG, "More than one match with the same concreteness!! (" + entryIdxMatches.get(0).toString() + ") vs. (" + entryIdxMatches.get(1).toString() + ")"); } return entryIdxMatches.get(0); }
Source:
<code>public void testExecuteQueryCommand() { Guid roleId = Guid.NewGuid(); when(getQueryParameters().getRoleId()).thenReturn(roleId); <START> ActionGroup group = RandomUtils.instance().pickRandom(ActionGroup.values()); <END> List<ActionGroup> expected = Collections.singletonList(group); ActionGroupDAO actionGroupDAOMock = mock(ActionGroupDAO.class); when(actionGroupDAOMock.getAllForRole(roleId)).thenReturn(expected); when(getDbFacadeMockInstance().getActionGroupDAO()).thenReturn(actionGroupDAOMock); getQuery().executeQueryCommand(); assertEquals("Wrong query result", expected, getQuery().getQueryReturnValue().getReturnValue()); }</code><technical_language>alternatively nextEnum method ;)</technical_language>

Target:
public void testExecuteQueryCommand() { Guid roleId = Guid.NewGuid(); when(getQueryParameters().getRoleId()).thenReturn(roleId); ActionGroup group = RandomUtils.instance().nextEnum(ActionGroup.class); List<ActionGroup> expected = Collections.singletonList(group); ActionGroupDAO actionGroupDAOMock = mock(ActionGroupDAO.class); when(actionGroupDAOMock.getAllForRole(roleId)).thenReturn(expected); when(getDbFacadeMockInstance().getActionGroupDAO()).thenReturn(actionGroupDAOMock); getQuery().executeQueryCommand(); assertEquals("Wrong query result", expected, getQuery().getQueryReturnValue().getReturnValue()); }
Source:
<code>private void schedulePeriodicReload() { assert adminExecutor.inEventLoop(); if (periodicTaskHandle != null) { periodicTaskHandle.cancel(false); } if (reloadInterval.isZero()) { LOG.debug("[{}] Reload interval is 0, disabling periodic reloading", logPrefix); } else { LOG.debug("[{}] Scheduling periodic reloading with interval {}", logPrefix, reloadInterval); periodicTaskHandle = adminExecutor.scheduleAtFixedRate( <START> () -> reload(null), <END> reloadInterval.toNanos(), reloadInterval.toNanos(), TimeUnit.NANOSECONDS); } }</code><technical_language>I understand is intention of passing null here. Is for triggering reload returning user? If I suggesting create some constant marker null assigned it. TRIGGER_RELOAD_WITHOUT_RETURNIG_RESULT constant in code. intention clean signal null a special meaning</technical_language>

Target:
private void schedulePeriodicReload() { assert adminExecutor.inEventLoop(); if (periodicTaskHandle != null) { periodicTaskHandle.cancel(false); } if (reloadInterval.isZero()) { LOG.debug("[{}] Reload interval is 0, disabling periodic reloading", logPrefix); } else { LOG.debug("[{}] Scheduling periodic reloading with interval {}", logPrefix, reloadInterval); periodicTaskHandle = adminExecutor.scheduleAtFixedRate( this::reloadInBackground, reloadInterval.toNanos(), reloadInterval.toNanos(), TimeUnit.NANOSECONDS); } }
Source:
<code>public int compareTo( Position other ) { if ( y < other.y ) { return -1; } else if( y > other.y ) { <START> return 1; <END> } else { if ( x < other.x ) { return -1; } else if( x > other.x ) { return 1; } else { return 0; } } }</code><technical_language>y - other.y cover equal cases</technical_language>

Target:
public int compareTo( Position other ) { if ( y != other.y ) { return y - other.y ; } return x - other.x; }
Source:
<code>private static void registerTransformersWildFly16(ResourceTransformationDescriptionBuilder subsystemBuilder) { subsystemBuilder.getAttributeBuilder() .addRejectCheck(RejectAttributeChecker.DEFINED, UUID_INSTANCE_ID) <START> .setDiscard(DiscardAttributeChecker.ALWAYS, UUID_INSTANCE_ID) <END> .end(); subsystemBuilder .addChildResource(UndertowExtension.SERVER_PATH) .addChildResource(UndertowExtension.HOST_PATH) .rejectChildResource(ConsoleAccessLogDefinition.INSTANCE.getPathElement()); }</code><technical_language>I want DiscardAttributeChecker.UNDEFINED (and for other version transformations), a of true result in rejection</technical_language>

Target:
private static void registerTransformersWildFly16(ResourceTransformationDescriptionBuilder subsystemBuilder) { subsystemBuilder.getAttributeBuilder().addRejectCheck(RejectAttributeChecker.DEFINED, OBFUSCATE_SESSION_ROUTE) .setDiscard(DiscardAttributeChecker.DEFAULT_VALUE, OBFUSCATE_SESSION_ROUTE) .end(); subsystemBuilder .addChildResource(UndertowExtension.SERVER_PATH) .addChildResource(UndertowExtension.HOST_PATH) .rejectChildResource(ConsoleAccessLogDefinition.INSTANCE.getPathElement()); }
Source:
<code>private void buttonsEnablement() { if (findMaxDefined() != findMaxPermitted()) { fSubmit.setEnabled(false); } <START> <END> if (fChangeInfo.getLabels().get("Verified") != null && fChangeInfo.getLabels().get("Verified").isBlocking()) { fSubmit.setEnabled(false); } else if (fChangeInfo.getLabels().get("Verified") != null && fChangeInfo.getLabels().get("Verified").getValue() == null && fChangeInfo.getVerifiedTally() <= 0) { fSubmit.setEnabled(false); } else if (fChangeInfo.getLabels().get("Verified") != null && fChangeInfo.getLabels().get("Verified").getValue() != null && new Integer(fChangeInfo.getLabels().get("Verified").getValue()).intValue() <= 0) { fSubmit.setEnabled(false); } else if (fChangeInfo.getLabels().get("Code-Review") != null && fChangeInfo.getLabels().get("Code-Review").isBlocking()) { fSubmit.setEnabled(false); } else if (fChangeInfo.getLabels().get("Code-Review") != null && fChangeInfo.getLabels().get("Code-Review").getValue() == null && fChangeInfo.getCodeReviewedTally() <= 0) { fSubmit.setEnabled(false); } else if (fChangeInfo.getLabels().get("Code-Review") != null && fChangeInfo.getLabels().get("Code-Review").getValue() != null && new Integer(fChangeInfo.getLabels().get("Code-Review").getValue()).intValue() <= 0) { fSubmit.setEnabled(false); } }</code><technical_language>"Verified" "Code-Review" everywhere, put in a private field definition</technical_language>

Target:
private void buttonsEnablement() { submitButtonEnablement(); }
Source:
<code>public MergedTrackingToken( @JsonProperty("lowerSegmentToken") TrackingToken lowerSegmentToken, @JsonProperty("upperSegmentToken") TrackingToken upperSegmentToken) { <START> this.lowerSegmentToken = lowerSegmentToken; <END> this.upperSegmentToken = upperSegmentToken; this.lowerSegmentAdvanced = false; this.upperSegmentAdvanced = false; }</code><technical_language>call a protected constructor this one</technical_language>

Target:
public MergedTrackingToken( @JsonProperty("lowerSegmentToken") TrackingToken lowerSegmentToken, @JsonProperty("upperSegmentToken") TrackingToken upperSegmentToken) { this(lowerSegmentToken, upperSegmentToken, false, false); }
Source:
<code>private boolean isValidNight(final Long accountId, final List<TrackerMotion> motionData){ if(!hasNewInvalidNightFilterEnabled(accountId)){ <START> return motionData.size() >= MININIMUM_NUMBER_OF_TRACKER_MOTIIONS; <END> } if(motionData.size() == 0){ return false; } if(motionData.get(motionData.size() - 1).timestamp - motionData.get(0).timestamp < 3 * DateTimeConstants.MILLIS_PER_HOUR) { return false; } return true; }</code><technical_language>"MININIMUM", "MOTIIONS" <- minor typos MIN_NUM_TRACKER_MOTIONS</technical_language>

Target:
private boolean isValidNight(final Long accountId, final List<TrackerMotion> motionData){ if(!hasNewInvalidNightFilterEnabled(accountId)){ return motionData.size() >= MIN_TRACKER_MOTION_COUNT; } if(motionData.size() == 0){ return false; } if(motionData.get(motionData.size() - 1).timestamp - motionData.get(0).timestamp < 5 * DateTimeConstants.MILLIS_PER_HOUR) { return false; } return true; }
Source:
<code>public static List<ChildNumber> parsePath(@Nonnull String path) { <START> path = checkNotNull(path); <END> String[] parsedNodes = path.split("/"); List<ChildNumber> nodes = new ArrayList<ChildNumber>(); for (String n : parsedNodes) { n = n.replaceAll(" ", ""); if (n.length() == 0) { continue; } boolean isHard = n.endsWith("'"); if (isHard) { n = n.substring(0, n.length() - 1); } int nodeNumber = Integer.parseInt(n); nodes.add(new ChildNumber(nodeNumber, isHard)); } return ImmutableList.copyOf(nodes); }</code><technical_language>unnecessary here, line trigger NPE anyway</technical_language>

Target:
public static List<ChildNumber> parsePath(@Nonnull String path) { String[] parsedNodes = path.split("/"); List<ChildNumber> nodes = new ArrayList<ChildNumber>(); for (String n : parsedNodes) { n = n.replaceAll(" ", ""); if (n.length() == 0) continue; boolean isHard = n.endsWith("'"); if (isHard) n = n.substring(0, n.length() - 1); int nodeNumber = Integer.parseInt(n); nodes.add(new ChildNumber(nodeNumber, isHard)); } return nodes; }
Source:
<code>public void refreshAnchorTypes() { String signature = "(Num a, Show b) => Signal a -> Signal b"; <START> Type type = getPane().getEnvInstance().buildType(signature); <END> inputAnchor.setFreshRequiredType(type, new TypeScope()); }</code><technical_language>type built in constructor</technical_language>

Target:
public void refreshAnchorTypes() { inputAnchor.setFreshRequiredType(funConstraint, new TypeScope()); }
Source:
<code>public void testNullStringEquality() throws Exception { testQuery( "SELECT COUNT(*)\n" + "FROM druid.foo\n" + "WHERE NULLIF(dim2, 'a') = null", NullHandling.replaceWithDefault() ? ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(querySegmentSpec(Filtration.eternity())) .granularity(Granularities.ALL) <START> .filters(selector("dim2", "a", null)) <END> .aggregators(aggregators(new CountAggregatorFactory("a0"))) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ) : ImmutableList.of(), NullHandling.replaceWithDefault() ? ImmutableList.of(new Object[]{2L}) : ImmutableList.of(new Object[]{0L}) ); }</code><technical_language>NULLIF(dim2, 'a') = NULL translated as, - Old, NullHandling.replaceWithDefault() is on: CASE dim2 = 'a' TRUE ELSE dim2 IS NULL END - equivalent dim2 = 'a' dim2 IS NULL - Old, NullHandling.replaceWithDefault() is off: FALSE - New, NullHandling.replaceWithDefault() is on: dim2 = 'a' - New, NullHandling.replaceWithDefault() is off: FALSE I new dim2 = 'a' translation is defensible: if considers a null return NULLIF due dim2 = 'a' equal null, count a null return due dim2 IS NULL (or empty string, equivalent if replaceWithDefault is on). translations correct, I think, in respective modes. I a similar query in PostgreSQL 9.6 zero back, sense PostgreSQL behaves in "NullHandling.replaceWithDefault() is off" (the SQL standard) mode, treating this filter "always false": SELECT COUNT(*) test NULLIF(NULL, 'a') = NULL NULLIF('a', 'a') = NULL I looked this for a minutes a reason translation changed. @xueyumusic - do idea</technical_language>

Target:
public void testNullStringEquality() throws Exception { testQuery( "SELECT COUNT(*)\n" + "FROM druid.foo\n" + "WHERE NULLIF(dim2, 'a') = null", NullHandling.replaceWithDefault() ? ImmutableList.of( Druids.newTimeseriesQueryBuilder() .dataSource(CalciteTests.DATASOURCE1) .intervals(querySegmentSpec(Filtration.eternity())) .granularity(Granularities.ALL) .filters( NullHandling.replaceWithDefault() ? new InDimFilter("dim2", ImmutableList.of("", "a"), null) : selector("dim2", "", null)) .aggregators(aggregators(new CountAggregatorFactory("a0"))) .context(TIMESERIES_CONTEXT_DEFAULT) .build() ) : ImmutableList.of(), NullHandling.replaceWithDefault() ? ImmutableList.of(new Object[]{5L}) : ImmutableList.of(new Object[]{0L}) ); }
Source:
<code>protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler context) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { <START> final int icIndex = uiColumnIndex - DecisionTableUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; <END> dtable.getInput().add(icIndex, inputClause); dtable.getRule().forEach(rule -> { final UnaryTests ut = new UnaryTests(); ut.setText(INPUT_CLAUSE_DEFAULT_VALUE); rule.getInputEntry().add(icIndex, ut); }); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final int clauseIndex = dtable.getInput().indexOf(inputClause); dtable.getRule().forEach(rule -> rule.getInputEntry().remove(clauseIndex)); dtable.getInput().remove(inputClause); return GraphCommandResultBuilder.SUCCESS; } }; }</code><technical_language>Please replace icIndex clauseIndex consistent undo method</technical_language>

Target:
protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler context) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { final int clauseIndex = uiColumnIndex - DecisionTableUIModelMapperHelper.ROW_INDEX_COLUMN_COUNT; dtable.getInput().add(clauseIndex, inputClause); dtable.getRule().forEach(rule -> { final UnaryTests ut = new UnaryTests(); ut.setText(INPUT_CLAUSE_DEFAULT_VALUE); rule.getInputEntry().add(clauseIndex, ut); }); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) { final int clauseIndex = dtable.getInput().indexOf(inputClause); dtable.getRule().forEach(rule -> rule.getInputEntry().remove(clauseIndex)); dtable.getInput().remove(inputClause); return GraphCommandResultBuilder.SUCCESS; } }; }
Source:
<code>private void nextUnalignedFragment() throws ErrorMsg { while (hasMoreUnalignedFragments == null || hasMoreUnalignedFragments) { hasMoreUnalignedFragments = unalignedIterator.nextFragment(); lastUnalignedFragmentIndex++; if (hasMoreUnalignedFragments && !unalignedIterator.isAligned()) { return; } } if (!hasMoreUnalignedReads) { throw new RuntimeException("Cannot get next unaligned read - already at last one"); } while (true) { hasMoreUnalignedReads = unalignedIterator.nextRead(); lastUnalignedFragmentIndex = -1; if (!hasMoreUnalignedReads) { break; } while (true) { hasMoreUnalignedFragments = unalignedIterator.nextFragment(); lastUnalignedFragmentIndex++; if (!hasMoreUnalignedFragments) { break; } if (!unalignedIterator.isAligned()) { break; } <START> } <END> if (hasMoreUnalignedFragments) { break; } } }</code><technical_language>Avoid while (true) -- this re-written a do....while(hasMoreUnalignedFragments && unalignedIterator.isAligned()); loop</technical_language>

Target:
private void nextUnalignedFragment() throws ErrorMsg { while (hasMoreUnalignedFragments == null || hasMoreUnalignedFragments) { hasMoreUnalignedFragments = unalignedIterator.nextFragment(); lastUnalignedFragmentIndex++; if (hasMoreUnalignedFragments && !unalignedIterator.isAligned()) { return; } } if (!hasMoreUnalignedReads) { throw new RuntimeException("Cannot get next unaligned read - already at last one"); } while (true) { hasMoreUnalignedReads = unalignedIterator.nextRead(); lastUnalignedFragmentIndex = -1; if (!hasMoreUnalignedReads) { break; } do { hasMoreUnalignedFragments = unalignedIterator.nextFragment(); lastUnalignedFragmentIndex++; } while (hasMoreUnalignedFragments && unalignedIterator.isAligned()); if (hasMoreUnalignedFragments) { return; } } }
Source:
<code><START> public void image(Attributes attributes, String url) { <END> delegate.image(attributes, url); }</code><technical_language>assertOpenBlock(); here, a test fails</technical_language>

Target:
public void image(Attributes attributes, String url) { assertOpenBlock(); delegate.image(attributes, url); }
Source:
<code>void markBlockAsMoved(final int blockId) { <START> if (!blockIds.contains(blockId) || movedBlockIds.contains(blockId)) { <END> LOG.log(Level.WARNING, "Block id {0} seems to have finished already.", blockId); } movedBlockIds.add(blockId); }</code><technical_language>If blockIds.contains(blockId) is false, allow adding this blockId movedBlockIds</technical_language>

Target:
void markBlockAsMoved(final int blockId) { if (!blockIds.contains(blockId)) { LOG.log(Level.WARNING, "Block id {0} was not asked to move.", blockId); } else if (movedBlockIds.contains(blockId)) { LOG.log(Level.WARNING, "Block id {0} seems to have finished already.", blockId); } else { movedBlockIds.add(blockId); } }
Source:
<code>private static Set<String> reducePVCSourcedVolumes(List<Volume> volumes) { Set<String> pvcSourcedVolumes = new HashSet<>(); Iterator<Volume> volumeIterator = volumes.iterator(); while (volumeIterator.hasNext()) { <START> io.fabric8.kubernetes.api.model.Volume volume = volumeIterator.next(); <END> if (volume.getPersistentVolumeClaim() != null) { pvcSourcedVolumes.add(volume.getName()); volumeIterator.remove(); } } return pvcSourcedVolumes; }</code><technical_language>fully qualified name is necessary here</technical_language>

Target:
private static Set<String> reducePVCSourcedVolumes(List<Volume> volumes) { Set<String> pvcSourcedVolumes = new HashSet<>(); Iterator<Volume> volumeIterator = volumes.iterator(); while (volumeIterator.hasNext()) { Volume volume = volumeIterator.next(); if (volume.getPersistentVolumeClaim() != null) { pvcSourcedVolumes.add(volume.getName()); volumeIterator.remove(); } } return pvcSourcedVolumes; }
Source:
<code>public QueryMetrics<Query<?>> makeMetrics(SegmentMetadataQuery query) { <START> query.withAnalysisTypes(getFinalAnalysisTypes(query)); <END> return queryMetricsFactory.makeMetrics(query); }</code><technical_language>result of this call is unused. I here</technical_language>

Target:
public QueryMetrics<Query<?>> makeMetrics(SegmentMetadataQuery query) { return queryMetricsFactory.makeMetrics(query); }
Source:
<code>public void waitForInterstitialShowUp() { JavascriptActions javascriptActions = new JavascriptActions(driver); <START> javascriptActions.waitForJavaScriptTruthy("document.querySelectorAll(\"" + INTERSTITIAL_AD_WRAPPER_SELECTOR <END> + "\").length == 1"); }</code><technical_language>Minor thing: String.format() ' querySelectorAll() more readable slashes? ;)</technical_language>

Target:
public void waitForInterstitialShowUp() { JavascriptActions javascriptActions = new JavascriptActions(driver); String jsIsInterstitialPresent = String.format("document.querySelectorAll('%s').length == 1", INTERSTITIAL_AD_WRAPPER_SELECTOR); javascriptActions.waitForJavaScriptTruthy(jsIsInterstitialPresent); }
Source:
<code>public List<UUID> getMessageIds() { <START> return this.messageIds; <END> }</code><technical_language>return immutable list</technical_language>

Target:
public List<UUID> getMessageIds() { return Collections.unmodifiableList(this.messageIds); }