auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testPurgeExpired() throws Exception { <START> long lifespan = 10000; <END> cs.store(TestInternalCacheEntryFactory.create("k1", "v1", lifespan)); cs.store(TestInternalCacheEntryFactory.create("k2", "v2", lifespan)); cs.store(TestInternalCacheEntryFactory.create("k3", "v3", lifespan)); assert cs.containsKey("k1"); assert cs.containsKey("k2"); assert cs.containsKey("k3"); createUnrelatedFile(); Thread.sleep(lifespan + 100); cs.purgeExpired(); FileCacheStore fcs = (FileCacheStore) cs; assert fcs.load("k1") == null; assert fcs.load("k2") == null; assert fcs.load("k3") == null; }</code><technical_language>Mircea, this is fix failure, :)</technical_language>

Target:
public void testPurgeExpired() throws Exception { long start = now(); long lifespan = 1000; cs.store(TestInternalCacheEntryFactory.create("k1", "v1", lifespan)); cs.store(TestInternalCacheEntryFactory.create("k2", "v2", lifespan)); cs.store(TestInternalCacheEntryFactory.create("k3", "v3", lifespan)); assert cs.containsKey("k1") || moreThanLifespanElapsed(start, lifespan); assert cs.containsKey("k2") || moreThanLifespanElapsed(start, lifespan); assert cs.containsKey("k3") || moreThanLifespanElapsed(start, lifespan); createUnrelatedFile(); Thread.sleep(lifespan + 100); cs.purgeExpired(); FileCacheStore fcs = (FileCacheStore) cs; assert fcs.load("k1") == null; assert fcs.load("k2") == null; assert fcs.load("k3") == null; }
Source:
<code>@Override public void onResponse(Call<AggregatedFeedContent> call, Response<AggregatedFeedContent> response) { if (response.isSuccessful()) { UtcDate <START> date = <END> DateUtil.getUtcRequestDateFor(age); List<Card> cards = new ArrayList<>(); AggregatedFeedContent content = response.body(); if (age == 0 && content.news() != null) { cards.add(new NewsListCard(content.news(), age, wiki)); } if (content.tfa() != null) { cards.add(new FeaturedArticleCard(content.tfa(), age, wiki)); } if (content.mostRead() != null) { cards.add(new MostReadListCard(content.mostRead(), wiki)); } if (content.potd() != null) { cards.add(new FeaturedImageCard(content.potd(), age, wiki)); } cb.success(cards); } else { L.v(response.message()); cb.error(new IOException(response.message())); } }</code><technical_language>date appears unused removed</technical_language>

Target:
@Override public void onResponse(Call<AggregatedFeedContent> call, Response<AggregatedFeedContent> response) { if (response.isSuccessful()) { List<Card> cards = new ArrayList<>(); AggregatedFeedContent content = response.body(); if (age == 0 && content.news() != null) { cards.add(new NewsListCard(content.news(), age, wiki)); } if (content.tfa() != null) { cards.add(new FeaturedArticleCard(content.tfa(), age, wiki)); } if (content.mostRead() != null) { cards.add(new MostReadListCard(content.mostRead(), wiki)); } if (content.potd() != null) { cards.add(new FeaturedImageCard(content.potd(), age, wiki)); } cb.success(cards); } else { L.v(response.message()); cb.error(new IOException(response.message())); } }
Source:
<code>public void testSetOwnerRole() throws Exception { String id = "0"; ShareableMetacardImpl before = ShareableMetacardImpl.from(ImmutableMap.of(Metacard.ID, id, Core.METACARD_OWNER, "user1")); ShareableMetacardImpl after = <START> ShareableMetacardImpl.from(ImmutableMap.of(Metacard.ID, id, Core.METACARD_OWNER, "user2")); <END> UpdateRequest update = mockUpdateRequest(ImmutableMap.of(id, after)); doReturn(true).when(subject).isPermitted(any(Permission.class)); accessPlugin.processPreUpdate(update, ImmutableMap.of(id, before)); }</code><technical_language>Ideally, references Core.ID</technical_language>

Target:
public void testSetOwnerRole() throws Exception { String id = "0"; ShareableMetacardImpl before = ShareableMetacardImpl.create(ImmutableMap.of(Core.ID, id, Core.METACARD_OWNER, "user1")); ShareableMetacardImpl after = ShareableMetacardImpl.create(ImmutableMap.of(Core.ID, id, Core.METACARD_OWNER, "user2")); before.setTags(Collections.singleton(WorkspaceAttributes.WORKSPACE_TAG)); after.setTags(Collections.singleton(WorkspaceAttributes.WORKSPACE_TAG)); UpdateRequest update = mockUpdateRequest(ImmutableMap.of(id, after)); doReturn(true).when(subject).isPermitted(any(Permission.class)); accessPlugin.processPreUpdate(update, ImmutableMap.of(id, before)); }
Source:
<code>public RassXmlAwardEntry toRassXmlAwardEntry() { RassXmlAwardEntry award = new RassXmlAwardEntry(); award.setProposalNumber(proposalNumber); award.setStatus(status); award.setAgencyNumber(agencyNumber); award.setProjectTitle(projectTitle); award.setStartDate(buildDateFromDateTime(startDate)); award.setStopDate(buildDateFromDateTime(stopDate)); award.setDirectCostAmount(directCostAmount); award.setIndirectCostAmount(indirectCostAmount); award.setTotalAmount(totalAmount); award.setPurpose(purpose); award.setGrantNumber(grantNumber); award.setGrantDescription(grantDescription); award.setFederalPassThrough(federalPassThrough); award.setFederalPassThroughAgencyNumber(federalPassThroughAgencyNumber); award.setOrganizationCode(organizationCode); award.setCostShareRequired(costShareRequired); award.setFinalReportDueDate(buildDateFromDateTime(finalReportDueDate)); award.setEverify(everify); award.setFinalFinancialReportRequired(finalFinancialReportRequired); award.setBudgetStartDate(buildDateFromDateTime(budgetStartDate)); award.setBudgetStopDate(buildDateFromDateTime(budgetStopDate)); award.setPricingType(pricingType); <START> award.setPrimeAgreementNumber(primeAgreementNumber); <END> for (RassXMLAwardPiCoPiEntryFixture fixture : piFixtures) { if (fixture.active) { award.getPrincipalAndCoPrincipalInvestigators().add(fixture.toRassXMLAwardPiCoPiEntry()); } } return award; }</code><technical_language>code setting budget total XML Award DTO</technical_language>

Target:
public RassXmlAwardEntry toRassXmlAwardEntry() { RassXmlAwardEntry award = new RassXmlAwardEntry(); award.setProposalNumber(proposalNumber); award.setStatus(status); award.setAgencyNumber(agencyNumber); award.setProjectTitle(projectTitle); award.setStartDate(buildDateFromDateTime(startDate)); award.setStopDate(buildDateFromDateTime(stopDate)); award.setDirectCostAmount(directCostAmount); award.setIndirectCostAmount(indirectCostAmount); award.setTotalAmount(totalAmount); award.setPurpose(purpose); award.setGrantNumber(grantNumber); award.setGrantDescription(grantDescription); award.setFederalPassThrough(federalPassThrough); award.setFederalPassThroughAgencyNumber(federalPassThroughAgencyNumber); award.setOrganizationCode(organizationCode); award.setCostShareRequired(costShareRequired); award.setFinalReportDueDate(buildDateFromDateTime(finalReportDueDate)); award.setEverify(everify); award.setFinalFinancialReportRequired(finalFinancialReportRequired); award.setBudgetStartDate(buildDateFromDateTime(budgetStartDate)); award.setBudgetStopDate(buildDateFromDateTime(budgetStopDate)); award.setBudgetTotalAmount(budgetTotalAmount); award.setPricingType(pricingType); award.setPrimeAgreementNumber(primeAgreementNumber); for (RassXMLAwardPiCoPiEntryFixture fixture : piFixtures) { if (fixture.active) { award.getPrincipalAndCoPrincipalInvestigators().add(fixture.toRassXMLAwardPiCoPiEntry()); } } return award; }
Source:
<code>public Map<String, String> getAttributes() { <START> return attributes; <END> }</code><technical_language>Encapsulation</technical_language>

Target:
public Map<String, String> getAttributes() { return this.attributes != null ? new MapView<String, String>(attributes) : null; }
Source:
<code>protected abstract Collection<ThirdPartyDetails> createThirdPartyDetails() throws IOException, ThirdPartyToolException, ProjectBuildingException, MojoFailureException, InvalidDependencyVersionException, ArtifactNotFoundException, ArtifactResolutionException, DependenciesToolException, MojoExecutionException; protected void init() throws Exception { if ( licenseMergesUrl != null ) { if ( HttpRequester.isStringUrl( licenseMergesUrl ) ) { InputStream input = new URL( licenseMergesUrl ).openStream(); String httpRequestResult = IOUtil.toString( input ); <START> licenseMerges = Arrays.asList( httpRequestResult.split( "\n" ) ); <END> input.close(); } } }</code><technical_language>UrlRequester is coming #249 do this</technical_language>

Target:
protected abstract Collection<ThirdPartyDetails> createThirdPartyDetails() throws IOException, ThirdPartyToolException, ProjectBuildingException, MojoFailureException, InvalidDependencyVersionException, ArtifactNotFoundException, ArtifactResolutionException, DependenciesToolException, MojoExecutionException; protected void init() throws IOException { if ( licenseMergesUrl != null ) { getLog().warn( "" ); getLog().warn( "licenseMerges will be overridden by licenseMergesUrl." ); getLog().warn( "" ); if ( UrlRequester.isStringUrl( licenseMergesUrl ) ) { licenseMerges = Arrays.asList( UrlRequester.getFromUrl( licenseMergesUrl ) ); } } }
Source:
<code>public void shouldReturnMusicList() { when(dao.searchSimilarTitle(music.getTitle())).thenReturn(Arrays.asList(music)); controller.search(music); <START> assertEquals(Arrays.asList(music), result.included().get("musics")); <END> }</code><technical_language>change assertThat(result.included().get("musics"), contains(music)). contains is a static import org.hamcrest.Matchers.contains. In case of failure, hamcrest shows a pretty message</technical_language>

Target:
public void shouldReturnMusicList() { when(dao.searchSimilarTitle(music.getTitle())).thenReturn(Arrays.asList(music)); controller.search(music); assertThat((List<Music>) result.included().get("musics"), contains(music)); }
Source:
<code>private boolean canPerformInverseNavigation(EStructuralFeature feature){ return <START> allowInverseNavigation && <END> ( hasEOpposite(feature) || ( useIndex && modelComprehension.representable(feature) && (feature instanceof EReference) )); }</code><technical_language>is point of disallowing cheap (eOpposite-based) inverse navigation? checking this switch in case rely index navigate backards</technical_language>

Target:
private boolean canPerformInverseNavigation(EStructuralFeature feature){ return ( hasEOpposite(feature) || ( useIndex && modelComprehension.representable(feature) && (feature instanceof EReference) )); }
Source:
<code>public Response deleteItem(@Context HttpServletRequest request, @PathParam("id") String id, @QueryParam("deleteChildren") boolean deleteChildren) { Response response = null; try (ItemManager itemManager = new ItemManager()) { if(itemManager.isOrphan(id)){ if (itemManager.delete(id, deleteChildren)) { response = Response.ok().build(); } else { throw new Error(); } try (StatusManager statusMan = new StatusManager(); ThumbnailManager thumbMan = new ThumbnailManager()) { Status status = new Status(); status.setStatusName(Status.StatusName.ITEM_UPDATE); statusMan.save(status); thumbMan.updateDirtyBits(id); } } else { <START> response = Response.status(400).build(); <END> } } return response; }</code><technical_language>wondering status is 400 404</technical_language>

Target:
public Response deleteItem(@Context HttpServletRequest request, @PathParam("id") String id, @QueryParam("deleteChildren") boolean deleteChildren) { Response response = null; try (ItemManager itemManager = new ItemManager()) { if(itemManager.isOrphan(id)){ if (itemManager.delete(id, deleteChildren, true)) { response = Response.ok().build(); } else { throw new Error(); } try (StatusManager statusMan = new StatusManager(); ThumbnailManager thumbMan = new ThumbnailManager()) { Status status = new Status(); status.setStatusName(Status.StatusName.ITEM_UPDATE); statusMan.save(status); thumbMan.updateDirtyBits(id); } } else { response = Response.status(400).build(); } } return response; }
Source:
<code>public int getStateTableIndex(ITimeEvent event) { if (event instanceof TimeEvent && ((TimeEvent) event).hasValue()) { TimeEvent tcEvent = (TimeEvent) event; XmlEntry entry = (XmlEntry) event.getEntry(); int value = tcEvent.getValue(); if (entry.getType() == EntryDisplayType.DISPLAY) { int index = value % stateValues.size(); <START> return index; <END> } } if (event instanceof TimeEvent) { TimeEvent tcEvent = (TimeEvent) event; if (tcEvent.hasValue()) { return INVISIBLE; } } return TRANSPARENT; }</code><technical_language>Is safe else case fall through? entry display type checked in method return immediately if DISPLAY</technical_language>

Target:
public int getStateTableIndex(ITimeEvent event) { if (event instanceof TimeEvent && ((TimeEvent) event).hasValue()) { TimeEvent tcEvent = (TimeEvent) event; XmlEntry entry = (XmlEntry) event.getEntry(); int value = tcEvent.getValue(); if (entry.getType() == EntryDisplayType.DISPLAY) { int index = value % stateValues.size(); return index; } } return INVISIBLE; }
Source:
<code><START> public Optional<Long> ownerLevel() { <END> return Optional.ofNullable(priority); }</code><technical_language>convinced Optional add here</technical_language>

Target:
public Long ownerLevel() { return ownerLevel; }
Source:
<code>private <M> OperatorImpl<M, ?> createOperatorImpl(OperatorSpec operatorSpec, Config config, TaskContext context) { if (operatorSpec instanceof StreamOperatorSpec) { StreamOperatorSpec<M, ?> streamOpSpec = (StreamOperatorSpec<M, ?>) operatorSpec; <START> return new StreamOperatorImpl<>(streamOpSpec, config, context); <END> } else if (operatorSpec instanceof SinkOperatorSpec) { return new SinkOperatorImpl<>((SinkOperatorSpec<M>) operatorSpec, config, context); } else if (operatorSpec instanceof WindowOperatorSpec) { return new WindowOperatorImpl((WindowOperatorSpec<M, ?, ?>) operatorSpec, clock); } else if (operatorSpec instanceof PartialJoinOperatorSpec) { return new PartialJoinOperatorImpl<>((PartialJoinOperatorSpec) operatorSpec, config, context, clock); } throw new IllegalArgumentException( String.format("Unsupported OperatorSpec: %s", operatorSpec.getClass().getName())); }</code><technical_language>minor: potentially inline rest</technical_language>

Target:
private <M> OperatorImpl<M, ?> createOperatorImpl(OperatorSpec operatorSpec, Config config, TaskContext context) { if (operatorSpec instanceof StreamOperatorSpec) { return new StreamOperatorImpl<>((StreamOperatorSpec<M, ?>) operatorSpec, config, context); } else if (operatorSpec instanceof SinkOperatorSpec) { return new SinkOperatorImpl<>((SinkOperatorSpec<M>) operatorSpec, config, context); } else if (operatorSpec instanceof WindowOperatorSpec) { return new WindowOperatorImpl((WindowOperatorSpec<M, ?, ?>) operatorSpec, clock); } else if (operatorSpec instanceof PartialJoinOperatorSpec) { return new PartialJoinOperatorImpl<>((PartialJoinOperatorSpec) operatorSpec, config, context, clock); } throw new IllegalArgumentException( String.format("Unsupported OperatorSpec: %s", operatorSpec.getClass().getName())); }
Source:
<code>public void availableExternalIdIsAssigned() { Account account = createAccount("healthCode"); ExternalIdentifier externalId = setupExternalIdentifier(account, "AAA"); <START> dao.commitAssignExternalId(externalId); <END> Optional<ExternalIdentifier> optionalId = dao.getExternalId(studyId, "AAA"); assertEquals("AAA", optionalId.get().getIdentifier()); assertEquals("healthCode", optionalId.get().getHealthCode()); assertEquals(studyId.getIdentifier(), optionalId.get().getStudyId()); }</code><technical_language>result in code churn write dao.getExternalId(studyId, "AAA").get();</technical_language>

Target:
public void availableExternalIdIsAssigned() { Account account = createAccount("healthCode"); ExternalIdentifier externalId = setupExternalIdentifier(account, "AAA"); dao.commitAssignExternalId(externalId); externalId = dao.getExternalId(studyId, "AAA").get(); assertEquals("AAA", externalId.getIdentifier()); assertEquals("healthCode", externalId.getHealthCode()); assertEquals(studyId.getIdentifier(), externalId.getStudyId()); }
Source:
<code>public Transfer commitTransfer(String transactionId) throws CoinbaseException, IOException { URL commitUrl; try { commitUrl = new URL(_baseApiUrl, "transfers/" + transactionId + "/commit"); } catch (MalformedURLException ex) { <START> throw new AssertionError(ex); <END> } return post(commitUrl, null, TransferResponse.class).getTransfer(); }</code><technical_language>This a CoinbaseException for invalid transaction id</technical_language>

Target:
public Transfer commitTransfer(String transactionId) throws CoinbaseException, IOException { URL commitUrl; try { commitUrl = new URL(_baseApiUrl, "transfers/" + transactionId + "/commit"); } catch (MalformedURLException ex) { throw new CoinbaseException("Invalid transaction id"); } return post(commitUrl, null, TransferResponse.class).getTransfer(); }
Source:
<code>public void parsesResponseMissingLength() throws IOException, InterruptedException { server.enqueue(new MockResponse().setChunkedBody("foo", 1)); TestInterface api = Feign.builder() .client(new ApacheHttpClient()) .target(TestInterface.class, "http://localhost:" + server.getPort()); Response response = api.post("testing"); try { <START> assertThat(response.status()).isEqualTo(200); <END> assertThat(response.reason()).isEqualTo("OK"); assertThat(response.body().length()).isNull(); assertThat(response.body().asInputStream()) .hasContentEqualTo(new ByteArrayInputStream("foo".getBytes(UTF_8))); } finally { response.close(); } }</code><technical_language>bad a feign Response assertj class, right? this nicer chained. (ps if feel it, one, else biggie)</technical_language>

Target:
public void parsesResponseMissingLength() throws IOException, InterruptedException { server.enqueue(new MockResponse().setChunkedBody("foo", 1)); TestInterface api = Feign.builder() .client(new ApacheHttpClient()) .target(TestInterface.class, "http://localhost:" + server.getPort()); Response response = api.post("testing"); assertThat(response.status()).isEqualTo(200); assertThat(response.reason()).isEqualTo("OK"); assertThat(response.body().length()).isNull(); assertThat(response.body().asInputStream()) .hasContentEqualTo(new ByteArrayInputStream("foo".getBytes(UTF_8))); }
Source:
<code>public void rethrowsExceptionWithoutRetryAfterWhenLimitExceeded() { assertThatThrownBy(() -> { for (int i = 0; i < FAILOVERS; i++) { <START> target.url(); <END> target.continueOrPropagate(EXCEPTION_WITHOUT_RETRY_AFTER); } }).isEqualTo(EXCEPTION_WITHOUT_RETRY_AFTER); }</code><technical_language>This is called for side effect of mostRecentServerIndex.set(failoverCount.get()) is non-transparent. a method call a descriptive name</technical_language>

Target:
public void rethrowsExceptionWithoutRetryAfterWhenLimitExceeded() { assertThatThrownBy(() -> { for (int i = 0; i < FAILOVERS; i++) { simulateRequest(); target.continueOrPropagate(EXCEPTION_WITHOUT_RETRY_AFTER); } }).isEqualTo(EXCEPTION_WITHOUT_RETRY_AFTER); }
Source:
<code>public static boolean isBlockAboveAir(final World world, final int x, final int y, final int z) { <START> PaperLib.getChunkAtAsync(world, x, z); END> return y > world.getMaxHeight() || HOLLOW_MATERIALS.contains(world.getBlockAt(x, y - 1, z).getType()); }</code><technical_language>This call is useless simply do getBlockAt in next line. This function need chain of getChunkAtAsync return CompletableFuture<Boolean></technical_language>

Target:
public static boolean isBlockAboveAir(final World world, final int x, final int y, final int z) { return y > world.getMaxHeight() || HOLLOW_MATERIALS.contains(world.getBlockAt(x, y - 1, z).getType()); }
Source:
<code>public RouterSecurityManager(Configuration conf) throws IOException { AuthenticationMethod authMethodConfigured = SecurityUtil.getAuthenticationMethod(conf); AuthenticationMethod authMethodToInit = AuthenticationMethod.KERBEROS; if (authMethodConfigured.equals(authMethodToInit)) { this.dtSecretManager = FederationUtil.newSecretManager(conf); if (this.dtSecretManager == null <START> || this.dtSecretManager.isRunning() == false) { <END> throw new IOException("Failed to create SecretManager"); } } }</code><technical_language>I guess do !this.dtSecretManager.isRunning(). This fit in a single line</technical_language>

Target:
public RouterSecurityManager(Configuration conf) throws IOException { AuthenticationMethod authMethodConfigured = SecurityUtil.getAuthenticationMethod(conf); AuthenticationMethod authMethodToInit = AuthenticationMethod.KERBEROS; if (authMethodConfigured.equals(authMethodToInit)) { this.dtSecretManager = FederationUtil.newSecretManager(conf); if (this.dtSecretManager == null || !this.dtSecretManager.isRunning()) { throw new IOException("Failed to create SecretManager"); } } }
Source:
<code>private void tryFlushLogs() { if (loggingPermissionSupplier.getAsBoolean()) { Optional<ActionProfile> actionProfile = slowestOperation.getAndSet(Optional.empty()); if (actionProfile.isPresent()) { ActionProfile presentActionProfile = actionProfile.get(); logger.info("Call to TimeLockService#{} took {}. This was the slowest operation that completed" + " in the last {}. The operation completed with outcome - if it failed, the error" + " was {}. We include a stack trace of the call: {}", SafeArg.of("actionName", presentActionProfile.actionName()), SafeArg.of("duration", presentActionProfile.duration()), SafeArg.of("timeWindow", LOGGING_TIME_WINDOW), SafeArg.of("outcome", presentActionProfile.failure().isPresent() ? "fail" : "success"), UnsafeArg.of("failure", presentActionProfile.failure()), <START> SafeArg.of("stacktrace", new RuntimeException().getStackTrace())); <END> } } }</code><technical_language>worried a fast operation slowed a previous window slow calls dump a stack trace, unclear expensive is</technical_language>

Target:
private void tryFlushLogs() { if (loggingPermissionSupplier.getAsBoolean()) { Optional<ActionProfile> actionProfile = slowestOperation.getAndSet(Optional.empty()); if (actionProfile.isPresent()) { ActionProfile presentActionProfile = actionProfile.get(); logger.info("Call to TimeLockService#{} took {}. This was the slowest operation that completed" + " in the last {}. The operation completed with outcome - if it failed, the error" + " was {}.", SafeArg.of("actionName", presentActionProfile.actionName()), SafeArg.of("duration", presentActionProfile.duration()), SafeArg.of("timeWindow", LOGGING_TIME_WINDOW), SafeArg.of("outcome", presentActionProfile.failure().isPresent() ? "fail" : "success"), UnsafeArg.of("failure", presentActionProfile.failure())); } } }
Source:
<code>public Collection<ExternalVnicProfileMapping> cloneExternalVnicProfiles(Cluster cluster) { if (externalVnicProfilesPerTargetCluster.get(cluster) == null) { <START> return new ArrayList<>(); <END> } final Collection<ExternalVnicProfileMapping> result = new ArrayList<>(externalVnicProfilesPerTargetCluster.get(cluster).size()); externalVnicProfilesPerTargetCluster.get(cluster).stream().forEach( vnicProfileMappingEntity -> result.add(vnicProfileMappingEntity.getExternalVnicProfileMapping())); return result; }</code><technical_language>instead of new ArrayList<>() please Collections.emptylist() returning a blank list</technical_language>

Target:
public Collection<ExternalVnicProfileMapping> cloneExternalVnicProfiles(Cluster cluster) { if (externalVnicProfilesPerTargetCluster.get(cluster) == null) { return Collections.emptyList(); } return externalVnicProfilesPerTargetCluster.get(cluster).stream() .map(VnicProfileMappingEntity::getExternalVnicProfileMapping) .collect(Collectors.toList()); }
Source:
<code>private IdentityCache createIdentityCache(HttpServerRequest request) { SSLSession sslSession = request.getSSLSession(); if (sslSession == null) { return null; } return new IdentityCache() { @Override public void put(SecurityIdentity identity) { <START> sslSession.putValue(CACHED_IDENTITY_KEY, new CachedIdentity(getMechanismName(), identity)); <END> } @Override public CachedIdentity get() { return (CachedIdentity) sslSession.getValue(CACHED_IDENTITY_KEY); } @Override public CachedIdentity remove() { CachedIdentity cachedIdentity = get(); sslSession.removeValue(CACHED_IDENTITY_KEY); return cachedIdentity; } }; }</code><technical_language>some previous work ensure mechanism instances backed security domains storing SecurityIdentity in a globally accessible - need is covered here</technical_language>

Target:
private Function<SecurityDomain, IdentityCache> createIdentityCache(HttpServerRequest request) { SSLSession sslSession = request.getSSLSession(); if (sslSession == null) { return null; } return securityDomain -> new IdentityCache() { final Map<SecurityDomain, CachedIdentity> identities = SSLUtils.computeIfAbsent(sslSession, "org.wildfly.elytron.identity-cache", key -> new ConcurrentHashMap<>()); @Override public void put(SecurityIdentity identity) { identities.putIfAbsent(securityDomain, new CachedIdentity(getMechanismName(), identity)); } @Override public CachedIdentity get() { return identities.get(securityDomain); } @Override public CachedIdentity remove() { return identities.remove(securityDomain); } }; }
Source:
<code>public List<Column> getColumns() { List<Column> columns = super.getColumns(); if (canInitAward() || !canViewInvoiceLink()) { LOG.debug("getColumns, remove invoices column"); for (Iterator<Column> it = columns.iterator(); it.hasNext(); ) { Column column = it.next(); <START> if (StringUtils.equalsAnyIgnoreCase(column.getPropertyName(), INVOICE_LINK_COLUMN_NAME)) { <END> it.remove(); } } } return columns; }</code><technical_language>matching string, I suggest "equalsIgnoreCase" instead of "equalsAnyIgnoreCase"</technical_language>

Target:
public List<Column> getColumns() { List<Column> columns = super.getColumns(); if (canInitAward() || !canViewInvoiceLink() || !getAccountsReceivableModuleBillingService().isContractsGrantsBillingEnhancementActive()) { LOG.debug("getColumns, remove invoices column"); for (Iterator<Column> it = columns.iterator(); it.hasNext(); ) { Column column = it.next(); if (StringUtils.equalsIgnoreCase(column.getPropertyName(), INVOICE_LINK_COLUMN_NAME)) { it.remove(); } } } return columns; }
Source:
<code>public VersionNumber getMinimumJavaVersion() throws IOException { String manifestEntry = getManifestAttributes().getValue("Minimum-Java-Version"); if (StringUtils.isNotBlank(manifestEntry)) { return new VersionNumber(manifestEntry); } <START> return JavaVersionUtil.interpolateJavaVersionByCore(new VersionNumber(getRequiredJenkinsVersion())); <END> }</code><technical_language>issue a warning a log of plugins fixed? I should, do if this is generate a lines, dozens more of them</technical_language>

Target:
public JavaSpecificationVersion getMinimumJavaVersion() throws IOException { String manifestEntry = getManifestAttributes().getValue("Minimum-Java-Version"); if (StringUtils.isNotBlank(manifestEntry)) { return new JavaSpecificationVersion(manifestEntry); } return null; }
Source:
<code>private void overwriteLibrary(final List<SAMReadGroupRecord> readGroups, final String libraryName) { <START> for (final SAMReadGroupRecord rg : readGroups) { <END> rg.setLibrary(libraryName); } }</code><technical_language>forEach</technical_language>

Target:
private void overwriteLibrary(final List<SAMReadGroupRecord> readGroups, final String libraryName) { readGroups.forEach(rg -> rg.setLibrary(libraryName)); }
Source:
<code>public void generateSchema(PersistenceUnitInfo info, Map map) { <START> <END> }</code><technical_language>above. I throw new UnsupportedOperationException for new method persistence API supported us</technical_language>

Target:
public void generateSchema(PersistenceUnitInfo info, Map map) { throw new UnsupportedOperationException("generateSchema"); }
Source:
<code>public void onCreate() { super.onCreate(); Realm.init(this); Realm.setDefaultConfiguration(new RealmConfiguration.Builder() .deleteRealmIfMigrationNeeded() .initialData(new Realm.Transaction() { @Override public void execute(@NonNull Realm realm) { Person person = realm.createObject(Person.class); person.setName("Makoto Yamazaki"); person.setAge(29); person = realm.createObject(Person.class); person.setName("Christian Melchior"); <START> person.setAge(32); <END> person = realm.createObject(Person.class); person.setName("Chen Mulong"); person.setAge(26); person = realm.createObject(Person.class); person.setName("Nabil Hachicha"); person.setAge(28); } }) .build()); }</code><technical_language>I wish</technical_language>

Target:
public void onCreate() { super.onCreate(); Realm.init(this); Realm.setDefaultConfiguration(new RealmConfiguration.Builder() .deleteRealmIfMigrationNeeded() .initialData(new Realm.Transaction() { @Override public void execute(@NonNull Realm realm) { Person person = realm.createObject(Person.class); person.setName("Makoto Yamazaki"); person.setAge(32); person = realm.createObject(Person.class); person.setName("Christian Melchior"); person.setAge(34); person = realm.createObject(Person.class); person.setName("Chen Mulong"); person.setAge(29); person = realm.createObject(Person.class); person.setName("Nabil Hachicha"); person.setAge(31); } }) .build()); }
Source:
<code>private void onTagsChanged(ListChangeListener.Change<? extends T> change) { while (change.next()) { if (change.wasRemoved()) { tagList.getChildren().subList(change.getFrom(), change.getFrom() + change.getRemovedSize()).clear(); <START> if(!allowsMultiple) { inputTextField.setDisable(false);} <END> } else if (change.wasAdded()) { tagList.getChildren().addAll(change.getFrom(), change.getAddedSubList().stream().map(this::createTag).collect(Collectors.toList())); if(!allowsMultiple) { inputTextField.setDisable(true);} } } }</code><technical_language>I is a bit easier understand if add logic enable / disable input field while loop. I guess inputTextField.setDisable(!tags.isEmpty()) work</technical_language>

Target:
private void onTagsChanged(ListChangeListener.Change<? extends T> change) { while (change.next()) { if (change.wasRemoved()) { tagList.getChildren().subList(change.getFrom(), change.getFrom() + change.getRemovedSize()).clear(); } else if (change.wasAdded()) { tagList.getChildren().addAll(change.getFrom(), change.getAddedSubList().stream().map(this::createTag).collect(Collectors.toList())); } } if (this.properties.contains(FieldProperty.SINGLE_ENTRY_LINK)) { inputTextField.setDisable(!tags.isEmpty()); } }
Source:
<code>public Set<Integer> clearRegionLocal(RegionEventImpl regionEvent) { Set<Integer> clearedBuckets = new HashSet<>(); setMembershipChange(false); synchronized (lockForListenerAndClientNotification) { if (partitionedRegion.getDataStore() != null) { partitionedRegion.getDataStore().lockBucketCreationForRegionClear(); try { boolean retry; do { waitForPrimary(new PartitionedRegion.RetryTimeKeeper(retryTime)); RegionEventImpl bucketRegionEvent; for (BucketRegion localPrimaryBucketRegion : partitionedRegion.getDataStore() .getAllLocalPrimaryBucketRegions()) { if (localPrimaryBucketRegion.size() > 0) { bucketRegionEvent = new RegionEventImpl(localPrimaryBucketRegion, Operation.REGION_CLEAR, null, false, partitionedRegion.getMyId(), regionEvent.getEventId()); localPrimaryBucketRegion.cmnClearRegion(bucketRegionEvent, false, true); } clearedBuckets.add(localPrimaryBucketRegion.getId()); } if (getMembershipChange()) { setMembershipChange(false); retry = true; } else { retry = false; } } while (retry); doAfterClear(regionEvent); } finally { partitionedRegion.getDataStore().unlockBucketCreationForRegionClear(); } } else { doAfterClear(regionEvent); } } <START> incClearCount(); <END> return clearedBuckets; }</code><technical_language>I feel calls incClearCount() incClearDuration() time, a consistent approach a clear is "done."</technical_language>

Target:
public Set<Integer> clearRegionLocal(RegionEventImpl regionEvent) { Set<Integer> clearedBuckets = new HashSet<>(); long clearStartTime = System.nanoTime(); setMembershipChange(false); synchronized (lockForListenerAndClientNotification) { if (partitionedRegion.getDataStore() != null) { partitionedRegion.getDataStore().lockBucketCreationForRegionClear(); try { boolean retry; do { waitForPrimary(new PartitionedRegion.RetryTimeKeeper(retryTime)); RegionEventImpl bucketRegionEvent; for (BucketRegion localPrimaryBucketRegion : partitionedRegion.getDataStore() .getAllLocalPrimaryBucketRegions()) { if (localPrimaryBucketRegion.size() > 0) { bucketRegionEvent = new RegionEventImpl(localPrimaryBucketRegion, Operation.REGION_CLEAR, null, false, partitionedRegion.getMyId(), regionEvent.getEventId()); localPrimaryBucketRegion.cmnClearRegion(bucketRegionEvent, false, true); } clearedBuckets.add(localPrimaryBucketRegion.getId()); } if (getMembershipChange()) { setMembershipChange(false); retry = true; } else { retry = false; } } while (retry); doAfterClear(regionEvent); } finally { partitionedRegion.getDataStore().unlockBucketCreationForRegionClear(); if (clearedBuckets.size() != 0 && partitionedRegion.getCachePerfStats() != null) { partitionedRegion.getRegionCachePerfStats().incRegionClearCount(); partitionedRegion.getRegionCachePerfStats() .incPartitionedRegionClearLocalDuration(System.nanoTime() - clearStartTime); } } } else { doAfterClear(regionEvent); } } return clearedBuckets; }
Source:
<code>public void init(final IEditorSite site, final IEditorInput input) throws PartInitException { setSite(site); internalInit(site.getWorkbenchWindow(), site, input); fActivationListener = new ActivationListener(site.getWorkbenchWindow().getPartService()); <START> fMacroContext = site.getService(EMacroContext.class); <END> if (fMacroContext != null) { fMacroContext.addMacroContextListener(this); if (fMacroContext.isRecording() || fMacroContext.isPlayingBack()) { this.macroStateChanged(fMacroContext); } } }</code><technical_language>This name, EMacroContext, needs change in line other services in workbench (i.e., XXXService)</technical_language>

Target:
public void init(final IEditorSite site, final IEditorInput input) throws PartInitException { setSite(site); internalInit(site.getWorkbenchWindow(), site, input); fActivationListener = new ActivationListener(site.getWorkbenchWindow().getPartService()); fMacroContext = site.getService(EMacroContextService.class); if (fMacroContext != null) { fMacroContextListener = new MacroContextListener(); fMacroContext.addMacroContextListener(fMacroContextListener); if (fMacroContext.isRecording() || fMacroContext.isPlayingBack()) { this.fMacroContextListener.macroStateChanged(fMacroContext); } } }
Source:
<code>public void testColorButtonBoolean() throws NoSuchFieldException, IllegalAccessException { selectTool(ToolType.ERASER); EraserTool eraserTool = (EraserTool) PaintroidApplication.currentTool; boolean eraserSelected = getToolMemberColorButton(eraserTool).getDrawSelectedColor(); <START> assertEquals("Value should be false", false, eraserSelected); <END> }</code><technical_language>please assertFalse</technical_language>

Target:
public void testColorButtonBoolean() throws NoSuchFieldException, IllegalAccessException { selectTool(ToolType.ERASER); EraserTool eraserTool = (EraserTool) PaintroidApplication.currentTool; boolean eraserSelected = getToolMemberColorButton(eraserTool).getDrawSelectedColor(); assertFalse("Value should be false", eraserSelected); }
Source:
<code>private EmailJobErrorHandler getEmailJobErrorHandler() { <START> for (JobErrorHandler jobErrorHandler : ServiceLoader.load(JobErrorHandler.class)) { <END> if (null != jobErrorHandler && jobErrorHandler instanceof EmailJobErrorHandler) { return (EmailJobErrorHandler) jobErrorHandler; } } return new EmailJobErrorHandler(); }</code><technical_language>rename jobErrorHandler -></technical_language>

Target:
private EmailJobErrorHandler getEmailJobErrorHandler() { for (JobErrorHandler each : ServiceLoader.load(JobErrorHandler.class)) { if (null != each && each instanceof EmailJobErrorHandler) { return (EmailJobErrorHandler) each; } } return new EmailJobErrorHandler(); }
Source:
<code>public void deleteTimeline(final UUID id) { jdbcTemplate.update( "DELETE FROM zn_data.timeline WHERE tl_id=?", <START> new Object[]{id}); <END> }</code><technical_language>a vararg version of method, skip array creation</technical_language>

Target:
public void deleteTimeline(final UUID id) { jdbcTemplate.update("DELETE FROM zn_data.timeline WHERE tl_id=?", id); }
Source:
<code><START> public Response end(Action action) { <END> return doAction(VdcActionType.EndExternalJob, new EndExternalJobParameters(guid, JobMapper.map(action.getStatus()), action.isForce()), action); }</code><technical_language>mandatory parameters require validation</technical_language>

Target:
public Response end(Action action) { validateParameters(action, "status"); return doAction(VdcActionType.EndExternalJob, new EndExternalJobParameters(guid, JobMapper.map(action.getStatus(), null), action.isSetForce() ? action.isForce() : false), action); }
Source:
<code>private void internalEndSuccessfully() { log.info("Ending command '{}' successfully.", getClass().getName()); if (hasTaskHandlers()) { getCurrentTaskHandler().endSuccessfully(); getParameters().incrementExecutionIndex(); if (getExecutionIndex() < getTaskHandlers().size()) { _actionState = CommandActionState.EXECUTE; execute(); } } else { endSuccessfully(); <START> CommandEntity cmdEntity = CommandCoordinatorUtil.getCommandEntity(getCommandId()); <END> if (cmdEntity != null) { cmdEntity.setCallbackNotified(true); } } }</code><technical_language>this change related this patch. also, setCallbackNotified set if callback</technical_language>

Target:
private void internalEndSuccessfully() { log.info("Ending command '{}' successfully.", getClass().getName()); if (hasTaskHandlers()) { getCurrentTaskHandler().endSuccessfully(); getParameters().incrementExecutionIndex(); if (getExecutionIndex() < getTaskHandlers().size()) { _actionState = CommandActionState.EXECUTE; execute(); } } else { endSuccessfully(); } }
Source:
<code>public IntervalLiteral(String value, Sign sign, IntervalField startField, @Nullable IntervalField endField) { checkNotNull(value, "value is null"); checkNotNull(sign, "sign is null"); checkNotNull(startField, "startField is null"); <START> <END> this.value = value; this.sign = sign; this.startField = startField; this.endField = endField; }</code><technical_language>validations handled parser</technical_language>

Target:
public IntervalLiteral(String value, Sign sign, IntervalField startField, @Nullable IntervalField endField) { this.value = value; this.sign = sign; this.startField = startField; this.endField = endField; }
Source:
<code>public Response getAllLookupsStatus( @QueryParam("detailed") boolean detailed ) { try { Map<String, Map<String, LookupExtractorFactoryMapContainer>> configuredLookups = lookupCoordinatorManager.getKnownLookups(); if (configuredLookups == null) { return Response.status(Response.Status.NOT_FOUND) <START> .entity("No lookups found") <END> .build(); } Map<HostAndPort, LookupsState<LookupExtractorFactoryMapContainer>> lookupsStateOnNodes = lookupCoordinatorManager.getLastKnownLookupsStateOnNodes(); Map<String, Map<String, LookupStatus>> result = new HashMap<>(); for (Map.Entry<String, Map<String, LookupExtractorFactoryMapContainer>> tierEntry : configuredLookups.entrySet()) { String tier = tierEntry.getKey(); Map<String, LookupStatus> lookupStatusMap = new HashMap<>(); result.put(tier, lookupStatusMap); Collection<HostAndPort> hosts = lookupCoordinatorManager.discoverNodesInTier(tier); for (Map.Entry<String, LookupExtractorFactoryMapContainer> lookupsEntry : tierEntry.getValue().entrySet()) { lookupStatusMap.put( lookupsEntry.getKey(), getLookupStatus( lookupsEntry.getKey(), lookupsEntry.getValue(), hosts, lookupsStateOnNodes, detailed ) ); } } return Response.ok(result).build(); } catch (Exception ex) { LOG.error(ex, "Error getting lookups status"); return Response.serverError().entity(ServletResourceUtils.sanitizeException(ex)).build(); } }</code><technical_language>this produce json (with quotes), a literal string</technical_language>

Target:
public Response getAllLookupsStatus( @QueryParam("detailed") boolean detailed ) { try { Map<String, Map<String, LookupExtractorFactoryMapContainer>> configuredLookups = lookupCoordinatorManager.getKnownLookups(); if (configuredLookups == null) { return Response.status(Response.Status.NOT_FOUND) .entity(ServletResourceUtils.jsonize("No lookups found")) .build(); } Map<HostAndPort, LookupsState<LookupExtractorFactoryMapContainer>> lookupsStateOnNodes = lookupCoordinatorManager.getLastKnownLookupsStateOnNodes(); Map<String, Map<String, LookupStatus>> result = new HashMap<>(); for (Map.Entry<String, Map<String, LookupExtractorFactoryMapContainer>> tierEntry : configuredLookups.entrySet()) { String tier = tierEntry.getKey(); Map<String, LookupStatus> lookupStatusMap = new HashMap<>(); result.put(tier, lookupStatusMap); Collection<HostAndPort> hosts = lookupCoordinatorManager.discoverNodesInTier(tier); for (Map.Entry<String, LookupExtractorFactoryMapContainer> lookupsEntry : tierEntry.getValue().entrySet()) { lookupStatusMap.put( lookupsEntry.getKey(), getLookupStatus( lookupsEntry.getKey(), lookupsEntry.getValue(), hosts, lookupsStateOnNodes, detailed ) ); } } return Response.ok(result).build(); } catch (Exception ex) { LOG.error(ex, "Error getting lookups status"); return Response.serverError().entity(ServletResourceUtils.sanitizeException(ex)).build(); } }
Source:
<code>public static String reconcilePath(String originalPath ) { int len = originalPath.length(); int len1 = len - 1; int j = 0; boolean noSepBefore = true; char[] ein = new char[len]; char[] aus = new char[len + 1]; originalPath.getChars(0, len, ein, 0); char separatorChar = File.separatorChar; if (UNCPathConverter.isUNC(originalPath)) <START> { <END> if ((len < 2) || ((ein[0] != BSLASH) && (ein[0] != SLASH)) || ((ein[1] != BSLASH) && (ein[1] != SLASH)) || ((ein[0] != ein[1]))) { assert false : "Unknown UNC path format"; } separatorChar = ein[0]; aus[j++] = separatorChar; } for (int i= 0; i < len; i++) { char c = ein[i]; switch (c) { case QUOTE: noSepBefore = true; break; case SLASH: case BSLASH: if (noSepBefore) { noSepBefore = false; aus[j++] = separatorChar; } break; case DOT: if (noSepBefore && j > 0) { aus[j++] = c; } else { if (i < len1) { c = ein[i + 1]; if (c == SLASH || c == BSLASH) { i++; noSepBefore = false; } else { i++; noSepBefore = true; aus[j++] = DOT; aus[j++] = c; } } } break; default: noSepBefore = true; aus[j++] = c; } } return new String(aus, 0, j); }</code><technical_language>Opening bracket line statement</technical_language>

Target:
public static String reconcilePath(String originalPath ) { int len = originalPath.length(); int len1 = len - 1; int j = 0; boolean noSepBefore = true; char[] ein = new char[len]; char[] aus = new char[len + 1]; originalPath.getChars(0, len, ein, 0); char separatorChar = File.separatorChar; if (UNCPathConverter.isUNC(originalPath)) { Assert.isTrue(len >= 2, "Unknown UNC path format"); Assert.isTrue(ein[0] == ein[1], "Unknown UNC path format"); Assert.isTrue(ein[0] == BSLASH || ein[0] == SLASH, "Unknown UNC path format"); separatorChar = ein[0]; aus[j++] = separatorChar; } for (int i= 0; i < len; i++) { char c = ein[i]; switch (c) { case QUOTE: noSepBefore = true; break; case SLASH: case BSLASH: if (noSepBefore) { noSepBefore = false; aus[j++] = separatorChar; } break; case DOT: if (noSepBefore && j > 0) { aus[j++] = c; } else { if (i < len1) { c = ein[i + 1]; if (c == SLASH || c == BSLASH) { i++; noSepBefore = false; } else { i++; noSepBefore = true; aus[j++] = DOT; aus[j++] = c; } } } break; default: noSepBefore = true; aus[j++] = c; } } return new String(aus, 0, j); }
Source:
<code>public Int32Token sdiv(BitVector<Integer> bitVector) { <START> if (!(bitVector.value == 0 || (value == Integer.MIN_VALUE && bitVector.value == -1))) { <END> return Int32Token.of(value / bitVector.value); } else { return null; } }</code><technical_language>I in place here, needed here. threw exception returned null though</technical_language>

Target:
public BuiltinList sdiv(BitVector<Integer> bitVector) { if (bitVector.value != 0) { return makeBuiltinListOfOverflowArithmeticResult(Ints.checkedDiv(value, bitVector.value)); } else { return null; } }
Source:
<code>private String getImageOverlay(Match match) { <START> return "full/ovr16/match_ov.png"; <END> }</code><technical_language>Please change .png .gif -> folder ovr16 contains gif resources</technical_language>

Target:
private String getImageOverlay(Match match) { return "full/ovr16/match_ov"; }
Source:
<code>public void removesGistByName() throws Exception { final Gists gists = gists(); final Gist gist = gists.create( Collections.singletonList("fileName.txt") ); MatcherAssert.assertThat( gists.iterate(), Matchers.hasItem( gist ) ); <START> gists.remove(GIST_NAME); <END> MatcherAssert.assertThat( gists.iterate(), Matchers.not(Matchers.hasItem(gist)) ); }</code><technical_language>run test? work Github account? I does, creating gist deleting another one</technical_language>

Target:
public void removesGistByName() throws Exception { final Gists gists = gists(); final Gist gist = gists.create( Collections.singletonMap("fileName.txt", "content of test file") ); MatcherAssert.assertThat( gists.iterate(), Matchers.notNullValue() ); gists.remove(gist.json().getString("id")); MatcherAssert.assertThat( gists.iterate(), Matchers.not(Matchers.hasItem(gist)) ); }
Source:
<code>protected VersioningOption getVersioningOption() { <START> return options.getOrDefault(version, VersioningOption.MINOR); <END> }</code><technical_language>a change of semantics, ignore case anymore</technical_language>

Target:
protected VersioningOption getVersioningOption() { return options.getOrDefault(version.toLowerCase(Locale.ENGLISH), VersioningOption.MINOR); }
Source:
<code>public void setIsByReference(boolean value) { assertNotFrozen(); <START> if (value) { <END> fDeclarator.addPointerOperator(CPPNodeFactory.getDefault().newReferenceOperator(false)); } else if (!value && isByReference()) { ((CPPASTDeclarator) fDeclarator).removePointerOperator(fDeclarator.getPointerOperators()[0]); } }</code><technical_language>this condition 'value && !isByReference()', adding pointer operators repeated calls setIsByReference(true)</technical_language>

Target:
public void setIsByReference(boolean value) { assertNotFrozen(); boolean isReferenceCapture = isByReference(); if (value && !isReferenceCapture) { fDeclarator.addPointerOperator(CPPNodeFactory.getDefault().newReferenceOperator(false)); } else if (!value && isReferenceCapture) { ((CPPASTDeclarator) fDeclarator).removePointerOperator(fDeclarator.getPointerOperators()[0]); } }
Source:
<code>public static String processResourceName(String uri) { <START> String processedUri = ""; <END> String[] split = uri.replaceAll("\\{", "").replaceAll("\\}", "") .split("/"); for (String str : split) { processedUri += StringUtils.firstUpper(str); } return processedUri; }</code><technical_language>If need build a string instruction (other "a" + "b" + "c"), a StringBuilder</technical_language>

Target:
public static String processResourceName(String uri) { StringBuilder sb = new StringBuilder(); String[] split = uri.replaceAll("\\{", "").replaceAll("\\}", "") .split("/"); for (String str : split) { sb.append(StringUtils.firstUpper(str)); } return sb.toString(); }