auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void createTestByUnauthorizedUser() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .withLogo("ThisIsSomeDummyText") .build(); ObjectMapper mapper = new ObjectMapper(); CollectionRest collectionRest = new CollectionRest(); collectionRest.setName("Collection"); collectionRest.setMetadata(new MetadataRest() .put("dc.description", new MetadataValueRest("<p>Some cool HTML code here</p>")) .put("dc.description.abstract", new MetadataValueRest("Sample top-level community created via the REST API")) .put("dc.description.tableofcontents", new MetadataValueRest("<p>HTML News</p>")) .put("dc.rights", new MetadataValueRest("Custom Copyright Text")) .put("dc.title", new MetadataValueRest("Title Text"))); <START> context.setCurrentUser(eperson); <END> String authToken = getAuthToken(eperson.getEmail(), password); getClient(authToken).perform(post("/api/core/collections") .content(mapper.writeValueAsBytes(collectionRest)) .param("parent", parentCommunity.getID().toString()) .contentType(contentType)) .andExpect(status().isForbidden()); }</code><technical_language>Again, this line a context.restoreAuthSystemState(); turn authorization system "on"</technical_language>

Target:
public void createTestByUnauthorizedUser() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .withLogo("ThisIsSomeDummyText") .build(); ObjectMapper mapper = new ObjectMapper(); CollectionRest collectionRest = new CollectionRest(); collectionRest.setName("Collection"); collectionRest.setMetadata(new MetadataRest() .put("dc.description", new MetadataValueRest("<p>Some cool HTML code here</p>")) .put("dc.description.abstract", new MetadataValueRest("Sample top-level community created via the REST API")) .put("dc.description.tableofcontents", new MetadataValueRest("<p>HTML News</p>")) .put("dc.rights", new MetadataValueRest("Custom Copyright Text")) .put("dc.title", new MetadataValueRest("Title Text"))); context.setCurrentUser(eperson); context.restoreAuthSystemState(); String authToken = getAuthToken(eperson.getEmail(), password); getClient(authToken).perform(post("/api/core/collections") .content(mapper.writeValueAsBytes(collectionRest)) .param("parent", parentCommunity.getID().toString()) .contentType(contentType)) .andExpect(status().isForbidden()); }
Source:
<code>public void testShouldAutomagicallyDetectGitDirectory() throws Exception { FileRepository r = createWorkRepository(); File d = new File(r.getDirectory(), "sub-dir"); <START> assertTrue(d.mkdir()); <END> assertEquals(r.getDirectory(), new FileRepositoryBuilder() .findGitDir(d).getGitDir()); }</code><technical_language>FileUtils.mkdirs</technical_language>

Target:
public void testShouldAutomagicallyDetectGitDirectory() throws Exception { FileRepository r = createWorkRepository(); File d = new File(r.getDirectory(), "sub-dir"); FileUtils.mkdir(d); assertEquals(r.getDirectory(), new FileRepositoryBuilder() .findGitDir(d).getGitDir()); }
Source:
<code>private void checkForParentModification() { <START> if (this.structuralModificationCount != IonSequenceLite.this.structuralModificationCount) <END> throw new ConcurrentModificationException(); }</code><technical_language>encourage a good habit, if block is a single statement; tales confusion -- worth "savings"</technical_language>

Target:
private void checkForParentModification() { if (this.structuralModificationCount != IonSequenceLite.this.structuralModificationCount) { throw new ConcurrentModificationException(); } }
Source:
<code>public Set<Account.Id> findAllByNameOrEmail(final String nameOrEmail) throws OrmException { final int lt = nameOrEmail.indexOf('<'); final int gt = nameOrEmail.indexOf('>'); if (lt >= 0 && gt > lt && nameOrEmail.contains("@")) { Set<Account.Id> ids = byEmail.get(nameOrEmail.substring(lt + 1, gt)); if (ids.size() == 1) { return ids; } for (Account.Id id : ids) { Account a = byId.get(id).getAccount(); <START> if (a.getFullName().equals(nameOrEmail.substring(0, lt - 1))) { <END> return Collections.singleton(id); } } return ids; } if (nameOrEmail.contains("@")) { return byEmail.get(nameOrEmail); } final Account.Id id = realm.lookup(nameOrEmail); if (id != null) { return Collections.singleton(id); } List<Account> m = schema.get().accounts().byFullName(nameOrEmail).toList(); if (m.size() == 1) { return Collections.singleton(m.get(0).getId()); } Set<Account.Id> result = new HashSet<Account.Id>(); String a = nameOrEmail; String b = nameOrEmail + "\u9fa5"; for (Account act : schema.get().accounts().suggestByFullName(a, b, 10)) { result.add(act.getId()); } for (AccountExternalId extId : schema .get() .accountExternalIds() .suggestByKey( new AccountExternalId.Key(AccountExternalId.SCHEME_USERNAME, a), new AccountExternalId.Key(AccountExternalId.SCHEME_USERNAME, b), 10)) { result.add(extId.getAccountId()); } for (AccountExternalId extId : schema.get().accountExternalIds() .suggestByEmailAddress(a, b, 10)) { result.add(extId.getAccountId()); } return result; }</code><technical_language>fullName null for "Anonymous Coward". this NPE. need invert order of test</technical_language>

Target:
public Set<Account.Id> findAllByNameOrEmail(final String nameOrEmail) throws OrmException { final int lt = nameOrEmail.indexOf('<'); final int gt = nameOrEmail.indexOf('>'); if (lt >= 0 && gt > lt && nameOrEmail.contains("@")) { Set<Account.Id> ids = byEmail.get(nameOrEmail.substring(lt + 1, gt)); if (ids.isEmpty() || ids.size() == 1) { return ids; } String name = nameOrEmail.substring(0, lt - 1); Set<Account.Id> nameMatches = Sets.newHashSet(); for (Account.Id id : ids) { Account a = byId.get(id).getAccount(); if (name.equals(a.getFullName())) { nameMatches.add(id); } } return nameMatches.isEmpty() ? ids : nameMatches; } if (nameOrEmail.contains("@")) { return byEmail.get(nameOrEmail); } final Account.Id id = realm.lookup(nameOrEmail); if (id != null) { return Collections.singleton(id); } List<Account> m = schema.get().accounts().byFullName(nameOrEmail).toList(); if (m.size() == 1) { return Collections.singleton(m.get(0).getId()); } Set<Account.Id> result = new HashSet<Account.Id>(); String a = nameOrEmail; String b = nameOrEmail + "\u9fa5"; for (Account act : schema.get().accounts().suggestByFullName(a, b, 10)) { result.add(act.getId()); } for (AccountExternalId extId : schema .get() .accountExternalIds() .suggestByKey( new AccountExternalId.Key(AccountExternalId.SCHEME_USERNAME, a), new AccountExternalId.Key(AccountExternalId.SCHEME_USERNAME, b), 10)) { result.add(extId.getAccountId()); } for (AccountExternalId extId : schema.get().accountExternalIds() .suggestByEmailAddress(a, b, 10)) { result.add(extId.getAccountId()); } return result; }
Source:
<code>public Visit createVisit(String configName, Visit visit) { validateVisit(visit); <START> Visit createdVisit; <END> Config config = configService.getConfigByName(configName); createdVisit = visitResource.createVisit(config, visit); eventRelay.sendEventMessage(new MotechEvent(EventKeys.CREATED_NEW_VISIT_SUBJECT, EventHelper.visitParameters(createdVisit))); return createdVisit; }</code><technical_language>34 36 in line</technical_language>

Target:
public Visit createVisit(String configName, Visit visit) { validateVisit(visit); Config config = configService.getConfigByName(configName); Visit createdVisit = visitResource.createVisit(config, visit); eventRelay.sendEventMessage(new MotechEvent(EventKeys.CREATED_NEW_VISIT_SUBJECT, EventHelper.visitParameters(createdVisit))); return createdVisit; }
Source:
<code>public void delete() { final HaxeFile file = (HaxeFile)getContainingFile(); if(file != null) { final PsiClass[] classes = file.getClasses(); if(classes.length == 1 && classes[0] == this) { file.delete(); return; } } <START> super.delete(); <END> }</code><technical_language>@eliasku Do file deletion triggers is clean deleting class file? thinking is super.delete() fixes PSI tree, triggers index updates (e.g. FindUsages, Hierarchies). said, I run this code verify of correct triggered. I do this: super.delete(); classes = file.getClasses(); if (len(classes) == 0) { file.delete(); } you. ;)</technical_language>

Target:
public void delete() { final HaxeFile file = (HaxeFile)getContainingFile(); super.delete(); if(file != null && file.getClasses().length == 0) { file.delete(); } }
Source:
<code>void relyingPartyRegistrationRepositoryBeanShouldBeCreatedWhenPropertiesPresent() { this.contextRunner.withPropertyValues(getPropertyValues()).run((context) -> { RelyingPartyRegistrationRepository repository = context.getBean(RelyingPartyRegistrationRepository.class); RelyingPartyRegistration registration = repository.findByRegistrationId("foo"); assertThat(registration.getProviderDetails().getWebSsoUrl()) .isEqualTo("<LINK_0>"); assertThat(registration.getProviderDetails().getEntityId()) .isEqualTo("<LINK_1>"); assertThat(registration.getAssertionConsumerServiceUrlTemplate()) .isEqualTo("{baseUrl}" + Saml2WebSsoAuthenticationFilter.DEFAULT_FILTER_PROCESSES_URI); assertThat(registration.getProviderDetails().getBinding()).isEqualTo(Saml2MessageBinding.POST); assertThat(registration.getProviderDetails().isSignAuthNRequest()).isEqualTo(false); assertThat(registration.getSigningCredentials()).isNotNull(); assertThat(registration.getVerificationCredentials()).isNotNull(); <START> assertThat(registration.getLocalEntityIdTemplate()).isEqualTo("{baseUrl}/saml2/local-entity-id"); <END> }); }</code><technical_language>Thanks for updating tests</technical_language>

Target:
void relyingPartyRegistrationRepositoryBeanShouldBeCreatedWhenPropertiesPresent() { this.contextRunner.withPropertyValues(getPropertyValues()).run((context) -> { RelyingPartyRegistrationRepository repository = context.getBean(RelyingPartyRegistrationRepository.class); RelyingPartyRegistration registration = repository.findByRegistrationId("foo"); assertThat(registration.getProviderDetails().getWebSsoUrl()) .isEqualTo("<LINK_0>"); assertThat(registration.getProviderDetails().getEntityId()) .isEqualTo("<LINK_1>"); assertThat(registration.getAssertionConsumerServiceUrlTemplate()) .isEqualTo("{baseUrl}" + Saml2WebSsoAuthenticationFilter.DEFAULT_FILTER_PROCESSES_URI); assertThat(registration.getProviderDetails().getBinding()).isEqualTo(Saml2MessageBinding.POST); assertThat(registration.getProviderDetails().isSignAuthNRequest()).isEqualTo(false); assertThat(registration.getSigningCredentials()).isNotNull(); assertThat(registration.getVerificationCredentials()).isNotNull(); assertThat(registration.getEntityId()).isEqualTo("{baseUrl}/saml2/foo-entity-id"); }); }
Source:
<code>public SchemaPlus get() { SchemaPlus rootSchema = CalciteSchema.createRootSchema(false, false).plus(); <START> calciteSchemas.forEach(schema -> rootSchema.add(schema.getSchemaName(), schema.getSchema())); <END> return rootSchema; }</code><technical_language>nice check for duplicate schema names. I base Calcite class does</technical_language>

Target:
public SchemaPlus get() { SchemaPlus rootSchema = CalciteSchema.createRootSchema(false, false).plus(); List<String> schemaNames = namedSchemas.stream() .map(NamedSchema::getSchemaName) .collect(Collectors.toList()); Set<String> uniqueSchemaNames = new HashSet<>(schemaNames); if (uniqueSchemaNames.size() < schemaNames.size()) { throw new ISE("Found multiple schemas registered to the same name. " + "The list of registered schemas are %s", schemaNames); } namedSchemas.forEach(schema -> rootSchema.add(schema.getSchemaName(), schema.getSchema())); return rootSchema; }
Source:
<code>public void testUMDPatternConversion() { setFilename("test"); testModules( "var foobar = {foo: 'bar'};" + "if (typeof module === 'object' && module.exports) {" + <START> "module.exports = foobar;" + <END> "} else if (typeof define === 'function' && define.amd) {" + "define([], function() {return foobar;});" + "} else {this.foobar = foobar;}", "goog.provide('module$test');" + "var module$test={};" + "var foobar$$module$test={foo:'bar'};" + "module$test=foobar$$module$test;"); testModules( "var foobar = {foo: 'bar'};" + "if (typeof define === 'function' && define.amd) {" + "define([], function() {return foobar;});" + "} else if (typeof module === 'object' && module.exports) {" + "module.exports = foobar;" + "} else {this.foobar = foobar;}", "goog.provide('module$test');" + "var module$test={};" + "var foobar$$module$test={foo:'bar'};" + "module$test=foobar$$module$test;"); testModules( "var foobar = {foo: 'bar'};" + "if (typeof module === 'object' && module.exports) {" + "module.exports = foobar;}" + "if (typeof define === 'function' && define.amd) {" + "define([], function () {return foobar;});}", "goog.provide('module$test');" + "var module$test={};" + "var foobar$$module$test={foo:'bar'};" + "module$test=foobar$$module$test;"); }</code><technical_language>indent strings here? hard read this does. E.g. replace this line with: " module.exports = ..." + (note WS quote)</technical_language>

Target:
public void testUMDPatternConversion() { setFilename("test"); testModules( "var foobar = {foo: 'bar'};" + "if (typeof module === 'object' && module.exports) {" + " module.exports = foobar;" + "} else if (typeof define === 'function' && define.amd) {" + " define([], function() {return foobar;});" + "} else {" + " this.foobar = foobar;}", "goog.provide('module$test');" + "var foobar$$module$test = {foo: 'bar'};" + "module$test = foobar$$module$test;"); testModules( "var foobar = {foo: 'bar'};" + "if (typeof define === 'function' && define.amd) {" + " define([], function() {return foobar;});" + "} else if (typeof module === 'object' && module.exports) {" + " module.exports = foobar;" + "} else {" + " this.foobar = foobar;}", "goog.provide('module$test');" + "var foobar$$module$test = {foo: 'bar'};" + "module$test = foobar$$module$test;"); testModules( "var foobar = {foo: 'bar'};" + "if (typeof module === 'object' && module.exports) {" + " module.exports = foobar;}" + "if (typeof define === 'function' && define.amd) {" + " define([], function () {return foobar;});}", "goog.provide('module$test');" + "var foobar$$module$test = {foo: 'bar'};" + "module$test = foobar$$module$test;"); }
Source:
<code>private void updateExportedFeedInstance(WorkflowExecutionContext context) throws FalconException { <START> LOG.info("Adding export feed instance: {}", context.getNominalTimeAsISO8601()); <END> instanceGraphBuilder.addExportedInstance(context); }</code><technical_language>"Updating" instead of "Adding" for consistency. Also, this called add new feed instance update instance status</technical_language>

Target:
private void updateExportedFeedInstance(WorkflowExecutionContext context) throws FalconException { LOG.info("Updating export feed instance: {}", context.getNominalTimeAsISO8601()); instanceGraphBuilder.addExportedInstance(context); }
Source:
<code>private void interpolateBridgesAndOrTunnels() { if (!ghStorage.getEncodingManager().supports("generic")) { logger.warn("Elevation interpolation of bridges or tunnels is turned on, but generic flag encoder is not enabled. " + "Either enable generic flag encoder using graph.flag_encoders=generic,... " + "or turn off bridge and tunnel interpolation using graph.elevation.interpolate.bridges=false and graph.elevation.interpolate.tunnels=false."); } else { final FlagEncoder genericFlagEncoder = ghStorage.getEncodingManager().getEncoder("generic"); if (!(genericFlagEncoder instanceof DataFlagEncoder)) { throw new IllegalStateException("Generic flag encoder equired for elevation interpolation of bridges and tunnels is enabled but does not habe the expected type " + DataFlagEncoder.class.getName() + "."); <START> } else { <END> final DataFlagEncoder dataFlagEncoder = (DataFlagEncoder) genericFlagEncoder; if (interpolateTunnels) { interpolateTunnels(dataFlagEncoder); } if (interpolateBridges) { interpolateBridges(dataFlagEncoder); } } } }</code><technical_language>I this is a bit of taste: I prefer avoid nested if-else avoid else if stops in case</technical_language>

Target:
private void interpolateBridgesAndOrTunnels() { if (!ghStorage.getEncodingManager().supports("generic")) { logger.warn("Elevation interpolation of bridges or tunnels is turned on, but generic flag encoder is not enabled. " + "Please enable generic flag encoder using graph.flag_encoders=generic,... ."); } else { final FlagEncoder genericFlagEncoder = ghStorage.getEncodingManager() .getEncoder("generic"); if (!(genericFlagEncoder instanceof DataFlagEncoder)) { throw new IllegalStateException( "Generic flag encoder equired for elevation interpolation of bridges and tunnels is enabled but does not habe the expected type " + DataFlagEncoder.class.getName() + "."); } final DataFlagEncoder dataFlagEncoder = (DataFlagEncoder) genericFlagEncoder; interpolateTunnels(dataFlagEncoder); interpolateBridges(dataFlagEncoder); } }
Source:
<code>public RequestRepresentation claim( UserAuthenticationToken user, @PathVariable String id, @RequestBody RequestRepresentation request) { log.info("PUT /requests/" + id + "/claim"); HistoricProcessInstance instance = requestService.getProcessInstance(id); requestService.claimCurrentPalgaTask(id, user.getUser()); Map<String, Object> variables = instance.getProcessVariables(); if (variables != null) { variables.put("assigned_date", new Date()); } runtimeService.setVariables(instance.getId(), variables); requestFormService.invalidateCacheEntry(id); instance = requestService.getProcessInstance(id); RequestRepresentation updatedRequest = new RequestRepresentation(); requestFormService.transferData(instance, updatedRequest, user.getUser()); if (updatedRequest.getAssigneeName() != null) { <START> requestFormService.updateLastAssignee(instance.getId(), updatedRequest.getAssigneeName()); <END> } return updatedRequest; }</code><technical_language>Updating assignee assignee name means name of a user is edited, name remain here. I is store user id fetch name id</technical_language>

Target:
public RequestRepresentation claim( UserAuthenticationToken user, @PathVariable String id, @RequestBody RequestRepresentation request) { log.info("PUT /requests/" + id + "/claim"); HistoricProcessInstance instance = requestService.getProcessInstance(id); requestService.claimCurrentPalgaTask(id, user.getUser()); Map<String, Object> variables = instance.getProcessVariables(); if (variables != null) { variables.put("assigned_date", new Date()); } runtimeService.setVariables(instance.getId(), variables); requestFormService.invalidateCacheEntry(id); instance = requestService.getProcessInstance(id); RequestRepresentation updatedRequest = new RequestRepresentation(); requestFormService.transferData(instance, updatedRequest, user.getUser()); if (updatedRequest.getAssignee() != null) { requestFormService.updateLastAssignee(instance.getId(), updatedRequest.getAssignee()); } return updatedRequest; }
Source:
<code>public void initClusterConnection(Executor asyncWorker) { <START> this.asyncWorker = asyncWorker; <END> try { connect(); } catch (ConnectionException ex) { LOGGER.error("Initial connection failed due to", ex); throw new RuntimeException(ex); } }</code><technical_language>this enforcing a non-null asyncWorker</technical_language>

Target:
public void initClusterConnection(Executor asyncWorker) { this.asyncWorker = requireNonNull(asyncWorker); try { connect(); } catch (ConnectionException ex) { LOGGER.error("Initial connection failed due to", ex); throw new RuntimeException(ex); } }
Source:
<code>public void setAttributeMap(List<String> attributeMappings) { if (CollectionUtils.isEmpty(attributeMappings) || (attributeMappings.size() == 1 && attributeMappings.get(0).isEmpty())) { attributeMap = new HashMap<>(); return; } for (String attributeMapping : attributeMappings) { String[] keyValue = attributeMapping.split("="); attributeMap.put( keyValue[0].trim(), Arrays.asList(keyValue[1].split(",")) .stream() .map(String::trim) <START> .collect(Collectors.toList())); <END> } }</code><technical_language>This replaced java Arrays.stream(keyValue[1].split(",")).map(String::trim).collect(Collectors.toList())); stream instead of asList</technical_language>

Target:
public void setAttributeMap(List<String> attributeMappings) { if (CollectionUtils.isEmpty(attributeMappings) || (attributeMappings.size() == 1 && attributeMappings.get(0).isEmpty())) { attributeMap = new HashMap<>(); return; } for (String attributeMapping : attributeMappings) { String[] keyValue = attributeMapping.split("="); attributeMap.put( keyValue[0].trim(), Arrays.stream(keyValue[1].split(",")).map(String::trim).collect(Collectors.toList())); } }
Source:
<code><START> public void setScript(@Nonnull Location l, @Nonnull String script) { <END> BlockStorage.addBlockInfo(l, "script", script); }</code><technical_language>open sufficient parameter validation, @Nonnull is enforced internal method, need add a Validate call here</technical_language>

Target:
public void setScript(@Nonnull Location l, @Nonnull String script) { Validate.notNull(l, "Location for android not specified"); Validate.notNull(script, "No script given"); BlockStorage.addBlockInfo(l, "script", script); }
Source:
<code>protected static Collection<RequirementMatcher> getRestrictionMatcherCDI11() { return Arrays.asList(new RequirementMatcher(JBossServer.class, FAMILY, ServerMatcher.WildFly()), new RequirementMatcher(JBossServer.class, VERSION, "18"), <START> new RequirementMatcher(JRE.class, VERSION, "1.8")); <END> }</code><technical_language>I in mind removing line - JRE 11 matcher in this case. else branch</technical_language>

Target:
protected static Collection<RequirementMatcher> getRestrictionMatcherCDI11() { return Arrays.asList(new RequirementMatcher(JBossServer.class, FAMILY, ServerMatcher.WildFly()), new RequirementMatcher(JBossServer.class, VERSION, "13"), new RequirementMatcher(JRE.class, VERSION, "1.8")); }
Source:
<code>public Set<String> getPendingDocIDs() throws LiteCoreException { synchronized (lock) { if (handle == 0) { return null; } FLSliceResult result = new FLSliceResult(getPendingDocIds(handle)); <START> return null; <END> } }</code><technical_language>wait, this is empty? is return null</technical_language>

Target:
public Set<String> getPendingDocIDs() throws LiteCoreException { synchronized (lock) { if (handle == 0) { return null; } final FLSliceResult result = new FLSliceResult(getPendingDocIds(handle)); try { final FLValue slice = FLValue.fromData(result); return (slice == null) ? Collections.emptySet() : new HashSet<>(slice.asTypedArray()); } finally { result.free(); } } }
Source:
<code>public Features(ClassLoader classLoader) { features = new Properties(); try { Enumeration<URL> featureFiles = classLoader.getResources(FEATURES_FILE); while (featureFiles.hasMoreElements()) { URL url = featureFiles.nextElement(); try (InputStream is = url.openStream()) { features.load(is); } catch (IOException e) { } } } catch (IOException e) { } <START> } <END></code><technical_language>I put this try/catch while loop, try read other resources</technical_language>

Target:
public Features(ClassLoader classLoader) { features = new Properties(); try { Enumeration<URL> featureFiles = classLoader.getResources(FEATURES_FILE); while (featureFiles.hasMoreElements()) { URL url = featureFiles.nextElement(); try (InputStream is = url.openStream()) { features.load(is); } } if (log.isDebugEnabled()) { features.entrySet().forEach(e -> log.debugf("Feature %s=%s", e.getKey(), e.getValue())); } } catch (IOException e) { log.debugf(e, "Error while attempting to obtain `%s` resources from the classpath", FEATURES_FILE); throw new CacheConfigurationException(e); } }
Source:
<code>public void addAttributesToTooltip(GetItemTooltip event, EntityRef entity, OreonAttributeComponent oreonAttributeComponent) { event.getTooltipLines().add(new TooltipLine("Level : " + oreonAttributeComponent.currentLevel)); <START> event.getTooltipLines().add(new TooltipLine("Health : " + oreonAttributeComponent.health + " / " + oreonAttributeComponent.maxStrength )); <END> event.getTooltipLines().add(new TooltipLine("Hunger : " + oreonAttributeComponent.hunger)); event.getTooltipLines().add(new TooltipLine("Strength : " + oreonAttributeComponent.strength + " / " + oreonAttributeComponent.maxStrength )); event.getTooltipLines().add(new TooltipLine("Intelligence : " + oreonAttributeComponent.intelligence + " / " + oreonAttributeComponent.maxIntelligence )); }</code><technical_language>this maxHealth, maxStr</technical_language>

Target:
public void addAttributesToTooltip(GetItemTooltip event, EntityRef entity, OreonAttributeComponent oreonAttributeComponent) { event.getTooltipLines().add(new TooltipLine("Level : " + oreonAttributeComponent.currentLevel)); event.getTooltipLines().add(new TooltipLine("Health : " + oreonAttributeComponent.health + " / " + oreonAttributeComponent.maxHealth)); event.getTooltipLines().add(new TooltipLine("Hunger : " + oreonAttributeComponent.hunger)); event.getTooltipLines().add(new TooltipLine("Strength : " + oreonAttributeComponent.strength + " / " + oreonAttributeComponent.maxStrength )); event.getTooltipLines().add(new TooltipLine("Intelligence : " + oreonAttributeComponent.intelligence + " / " + oreonAttributeComponent.maxIntelligence )); }
Source:
<code>public void shouldSendApplePayRequestWhenApplePayDetailsArePresent() throws Exception { try { worldpayApplePayAuthorisationHandler.authorise(getApplePayAuthorisationRequest()); } catch (GatewayErrorException e) { <START> gatewayOrderArgumentCaptor = ArgumentCaptor.forClass(GatewayOrder.class); headers = ArgumentCaptor.forClass(Map.class); <END> verify(mockGatewayClient).postRequestFor(eq(WORLDPAY_URL), eq(gatewayAccountEntity), gatewayOrderArgumentCaptor.capture(), headers.capture()); assertXMLEqual(TestTemplateResourceLoader.load(WORLDPAY_VALID_AUTHORISE_WORLDPAY_APPLE_PAY_REQUEST), gatewayOrderArgumentCaptor.getValue().getPayload()); assertThat(headers.getValue().size(), is(1)); assertThat(headers.getValue(), is(AuthUtil.getGatewayAccountCredentialsAsAuthHeader(gatewayAccountEntity))); } }</code><technical_language>need lines. covered @Captor annotation. suggestion</technical_language>

Target:
public void shouldSendApplePayRequestWhenApplePayDetailsArePresent() throws Exception { try { worldpayApplePayAuthorisationHandler.authorise(getApplePayAuthorisationRequest()); } catch (GatewayErrorException e) { verify(mockGatewayClient).postRequestFor(eq(WORLDPAY_URL), eq(gatewayAccountEntity), gatewayOrderArgumentCaptor.capture(), headers.capture()); assertXMLEqual(TestTemplateResourceLoader.load(WORLDPAY_VALID_AUTHORISE_WORLDPAY_APPLE_PAY_REQUEST), gatewayOrderArgumentCaptor.getValue().getPayload()); assertThat(headers.getValue().size(), is(1)); assertThat(headers.getValue(), is(AuthUtil.getGatewayAccountCredentialsAsAuthHeader(gatewayAccountEntity))); } }
Source:
<code><START> private MessageContent getMessageContent(Message message) { <END> return new MessageContent.Builder() .withContentType(message.getContentType()) .withSchema(message.getSchema()) .withData(message.getData()) .build(); }</code><technical_language>actually, MessageContent this a static method</technical_language>

Target:
private MessageContent getMessageContent(Message message) { return new MessageContent.Builder() .withContentType(message.getContentType()) .withSchema(message.getSchema()) .withContent(message.getData()) .build(); }
Source:
<code>private void updateActionAvailability() { <START> getNewCommand().setIsExecutionAllowed(true); <END> boolean hasSelectedItems = getSelectedItems() != null && getSelectedItems().size() > 0; getEditCommand().setIsExecutionAllowed(hasSelectedItems && getSelectedItems().size() == 1); getRemoveCommand().setIsExecutionAllowed(hasSelectedItems); }</code><technical_language>If new command is allowed, do need this line</technical_language>

Target:
private void updateActionAvailability() { boolean hasSelectedItems = getSelectedItems() != null && getSelectedItems().size() > 0; getEditCommand().setIsExecutionAllowed(hasSelectedItems && getSelectedItems().size() == 1); getRemoveCommand().setIsExecutionAllowed(hasSelectedItems); }
Source:
<code>public QuestionableActivityListingDTO checkNonCuresAuditCriteriaAndAddedIcsOnEdit(CertifiedProductSearchDetails origListing, CertifiedProductSearchDetails newListing) { QuestionableActivityListingDTO activity = null; if (ff4j.check(FeatureList.EFFECTIVE_RULE_DATE)) { <START> if (!origListing.getIcs().getInherits() && newListing.getIcs().getInherits()) { END> List<String> matchingNewCriteriaNumbers = new ArrayList<String>(); List<String> matchingOldCriteriaNumbers = new ArrayList<String>(); if (isCriteriaAttestedTo(d2Criterion, newListing)) { matchingNewCriteriaNumbers.add(d2Criterion.getNumber()); } if (isCriteriaAttestedTo(d3Criterion, newListing)) { matchingNewCriteriaNumbers.add(d3Criterion.getNumber()); } if (isCriteriaAttestedTo(d10Criterion, newListing)) { matchingNewCriteriaNumbers.add(d10Criterion.getNumber()); } if (matchingNewCriteriaNumbers.size() > 0) { if (isCriteriaAttestedTo(d2Criterion, origListing)) { matchingOldCriteriaNumbers.add(d2Criterion.getNumber()); } if (isCriteriaAttestedTo(d3Criterion, origListing)) { matchingOldCriteriaNumbers.add(d3Criterion.getNumber()); } if (isCriteriaAttestedTo(d10Criterion, origListing)) { matchingOldCriteriaNumbers.add(d10Criterion.getNumber()); } String newCriteriaNumbers = matchingNewCriteriaNumbers.stream() .collect(Collectors.joining(", ")); String oldCriteriaNumbers = matchingOldCriteriaNumbers.stream() .collect(Collectors.joining(", ")); activity = new QuestionableActivityListingDTO(); activity.setBefore("ICS = 0, Criteria Numbers: " + oldCriteriaNumbers); activity.setAfter("ICS = 1, Criteria Numbers: " + newCriteriaNumbers); } } } return activity; }</code><technical_language>getIcs() null? I thinking specifically if this code called editing a legacy 2014 listing? get called bringing up</technical_language>

Target:
public QuestionableActivityListingDTO checkNonCuresAuditCriteriaAndAddedIcsOnEdit(CertifiedProductSearchDetails origListing, CertifiedProductSearchDetails newListing) { QuestionableActivityListingDTO activity = null; if (ff4j.check(FeatureList.EFFECTIVE_RULE_DATE)) { if (!hasICS(origListing) && hasICS(newListing)) { List<String> matchingNewCriteriaNumbers = new ArrayList<String>(); List<String> matchingOldCriteriaNumbers = new ArrayList<String>(); if (isCriteriaAttestedTo(d2Criterion, newListing)) { matchingNewCriteriaNumbers.add(d2Criterion.getNumber()); } if (isCriteriaAttestedTo(d3Criterion, newListing)) { matchingNewCriteriaNumbers.add(d3Criterion.getNumber()); } if (isCriteriaAttestedTo(d10Criterion, newListing)) { matchingNewCriteriaNumbers.add(d10Criterion.getNumber()); } if (matchingNewCriteriaNumbers.size() > 0) { String newCriteriaNumbers = matchingNewCriteriaNumbers.stream() .collect(Collectors.joining(", ")); activity = new QuestionableActivityListingDTO(); activity.setAfter(newCriteriaNumbers); } } } return activity; }
Source:
<code>private String toJson(Map<String, Object> arguments) { final ObjectMapper mapper = new ObjectMapper(); ObjectNode jsonObject = mapper.createObjectNode(); arguments.forEach((s, o) -> jsonObject.set(s, mapper.convertValue(o, JsonNode.class))); <START> return jsonObject.toString(); <END> }</code><technical_language>return new ObjectMapper().writeValueAsString(arguments)</technical_language>

Target:
private String toJson(Map<String, Object> arguments) { try { return new ObjectMapper().writeValueAsString(arguments); } catch (JsonProcessingException e) { throw new RuntimeException("Failed to convert arguments into json: " + e.getMessage(), e); } }
Source:
<code>public void read_all_messages_with_field_mask() { final int count = 5; final List<I> ids = new LinkedList<>(); final String projectDescriptor = Project.getDescriptor() .getFullName(); <START> @SuppressWarnings("DuplicateStringLiteralInspection") <END> final FieldMask fieldMask = FieldMask.newBuilder() .addPaths(projectDescriptor + ".id") .addPaths(projectDescriptor + ".name") .build(); for (int i = 0; i < count; i++) { final I id = newId(); final ProjectId stateId = ProjectId.newBuilder() .setId(id.toString()) .build(); final Project state = Project.newBuilder() .setId(stateId) .setName(String.format("project_%s", i)) .setStatus(Project.Status.CREATED) .build(); final Any packedState = AnyPacker.pack(state); final EntityStorageRecord record = EntityStorageRecord.newBuilder() .setState(packedState) .setWhenModified(Timestamps.getCurrentTime()) .setVersion(1) .build(); storage.write(id, record); ids.add(id); } final Map<I, EntityStorageRecord> read = storage.readAll(fieldMask); assertSize(ids.size(), read); for (Map.Entry<I, EntityStorageRecord> record : read.entrySet()) { assertContains(record.getKey(), ids); final Any packedState = record.getValue() .getState(); final Project state = AnyPacker.unpack(packedState); assertMatchesMask(state, fieldMask); } }</code><technical_language>Please check this inspection is applicable. Notice a similar expression in of tests below, @SuppressWarnings is applied it</technical_language>

Target:
public void read_all_messages_with_field_mask() { final List<I> ids = fillStorage(5); final String projectDescriptor = Project.getDescriptor() .getFullName(); @SuppressWarnings("DuplicateStringLiteralInspection") final FieldMask fieldMask = maskForPaths(projectDescriptor + ".id", projectDescriptor + ".name"); final Map<I, EntityStorageRecord> read = storage.readAll(fieldMask); assertSize(ids.size(), read); for (Map.Entry<I, EntityStorageRecord> record : read.entrySet()) { assertContains(record.getKey(), ids); final Any packedState = record.getValue() .getState(); final Project state = AnyPacker.unpack(packedState); assertMatchesMask(state, fieldMask); } }
Source:
<code>public void scroll (int destX, int destY, int x, int y, int width, int height, boolean all) { checkWidget(); if (width <= 0 || height <= <START> 0 || GTK.GTK4) return; <END> Point destination = DPIUtil.autoScaleUp (new Point (destX, destY)); Rectangle srcRect = DPIUtil.autoScaleUp (new Rectangle (x, y, width, height)); scrollInPixels(destination.x, destination.y, srcRect.x, srcRect.y, srcRect.width, srcRect.height, all); }</code><technical_language>A separate if-return improve readablility</technical_language>

Target:
public void scroll (int destX, int destY, int x, int y, int width, int height, boolean all) { checkWidget(); if (width <= 0 || height <= 0) return; if (GTK.GTK4) return; Point destination = DPIUtil.autoScaleUp (new Point (destX, destY)); Rectangle srcRect = DPIUtil.autoScaleUp (new Rectangle (x, y, width, height)); scrollInPixels(destination.x, destination.y, srcRect.x, srcRect.y, srcRect.width, srcRect.height, all); }
Source:
<code>public void Case4() { NumberExpression<Float> numExpression = cat.bodyWeight.floatValue().divide(otherCat.bodyWeight.floatValue()).multiply(100); NumberExpression<Float> numExpression2 = cat.id.when(0).then(0.0F).otherwise(numExpression); <START> query().from(cat, otherCat).list(numExpression2); <END> }</code><technical_language>tests assertions assuming if exception thrown working</technical_language>

Target:
public void Case4() { NumberExpression<Float> numExpression = cat.bodyWeight.floatValue().divide(otherCat.bodyWeight.floatValue()).multiply(100); NumberExpression<Float> numExpression2 = cat.id.when(0).then(0.0F).otherwise(numExpression); assertEquals(ImmutableList.of(200, 150, 133, 125, 120), query().from(cat, otherCat) .where(cat.id.eq(otherCat.id.add(1))) .orderBy(cat.id.asc(), otherCat.id.asc()) .list(numExpression2.intValue())); }
Source:
<code>DirectCodecFactory(Configuration config, ByteBufferAllocator allocator, int pageSize) { <START> super(config, pageSize); <END> this.allocator = Objects.requireNonNull(allocator, "allocator"); Preconditions.checkState(allocator.isDirect(), "A %s requires a direct buffer allocator be provided.", getClass().getSimpleName()); }</code><technical_language>suggestion this.allocator = Objects.requireNonNull(allocator, "allocator null");</technical_language>

Target:
DirectCodecFactory(Configuration config, ByteBufferAllocator allocator, int pageSize) { super(config, pageSize); this.allocator = Objects.requireNonNull(allocator, "allocator cannot be null"); Preconditions.checkState(allocator.isDirect(), "A %s requires a direct buffer allocator be provided.", getClass().getSimpleName()); }
Source:
<code>public void convertWithConfluentAvroBytesConverter() { Schema schema = SimpleRecord.getClassSchema(); KafkaSerDe.AvroSkipBytesConverter conv = new KafkaSerDe.AvroSkipBytesConverter(schema, 5); <START> AvroGenericRecordWritable simpleRecord1Writable = conv.getWritable(simpleRecord1AsBytes); Assert.assertNotNull(simpleRecord1Writable); Assert.assertEquals(SimpleRecord.class, simpleRecord1Writable.getRecord().getClass()); SimpleRecord simpleRecord1Deserialized = (SimpleRecord) simpleRecord1Writable.getRecord(); Assert.assertNotNull(simpleRecord1Deserialized); Assert.assertEquals(simpleRecord1, simpleRecord1Deserialized); <END> }</code><technical_language>1 represent here</technical_language>

Target:
public void convertWithConfluentAvroBytesConverter() throws SerDeException { Integer offset = 5; Properties tbl = new Properties(); tbl.setProperty(AvroSerdeUtils.AvroTableProperties.AVRO_SERDE_TYPE.getPropName(), "SKIP"); tbl.setProperty(AvroSerdeUtils.AvroTableProperties.AVRO_SERDE_SKIP_BYTES.getPropName(), offset.toString()); runConversionTest(tbl, simpleRecordConfluentBytes); }
Source:
<code>protected void setMuteButton(final ImageButton muteButton, final boolean isMuted) { <START> if (isMuted) { muteButton.setColorFilter(ContextCompat.getColor(getApplicationContext(), R.color.white)); } else { muteButton.setColorFilter(ContextCompat.getColor(getApplicationContext(), R.color.gray)); } <END> }</code><technical_language>suggestion muteButton.setColorFilter(ContextCompat.getColor(getApplicationContext(), isMuted ? R.color.white : R.color.gray));</technical_language>

Target:
protected void setMuteButton(final ImageButton muteButton, final boolean isMuted) { muteButton.setColorFilter(ContextCompat.getColor(getApplicationContext(), isMuted ? R.color.white : R.color.gray)); }
Source:
<code>public synchronized void setOkHttpClient(OkHttpClient okHttpClient) { if (OK_CLIENTS == null) { OK_CLIENTS = new HashMap<>(); } final String uniqueId = this.oAuthRefreshInterceptor.clientInfo.buildUniqueId(); <START> OkHttpClient curOkHttpClient = null; <END> if (uniqueId != null) { curOkHttpClient = OK_CLIENTS.get(uniqueId); if (curOkHttpClient == null) { if (okHttpClient == null) { curOkHttpClient = getOkHttpClientBuilder().build(); OK_CLIENTS.put(uniqueId, curOkHttpClient); } else { OK_CLIENTS.put(uniqueId, okHttpClient); } } else if (okHttpClient != null) { OK_CLIENTS.put(uniqueId, okHttpClient); } } this.okHttpClient = OK_CLIENTS.get(uniqueId); }</code><technical_language>method is a bit hard follow, simplify e.g. java public synchronized void setOkHttpClient(OkHttpClient okHttpClient) { if (OK_CLIENTS == null) { OK_CLIENTS = new HashMap<>(); } final String uniqueId = this.oAuthRefreshInterceptor.clientInfo.buildUniqueId(); if (uniqueId == null) { return; // now? } // Valid client passed in, cache if (okHttpClient != null) { OK_CLIENTS.put(uniqueId, okHttpClient); } // Null client passed in, create cache if cached else if (!OK_CLIENTS.containsKey(uniqueId)) { OK_CLIENTS.put(uniqueId, getOkHttpClientBuilder().build()); } // cached client this.okHttpClient = OK_CLIENTS.get(uniqueId); }</technical_language>

Target:
public synchronized void setOkHttpClient(OkHttpClient okHttpClient) { if (OK_CLIENTS == null) { OK_CLIENTS = new HashMap<>(); } final String uniqueId = this.oAuthRefreshInterceptor.clientInfo.buildUniqueId(); if (uniqueId == null) { return; } if (okHttpClient != null) { OK_CLIENTS.put(uniqueId, okHttpClient); } else if (!OK_CLIENTS.containsKey(uniqueId)) { OK_CLIENTS.put(uniqueId, getOkHttpClientBuilder().build()); } this.okHttpClient = OK_CLIENTS.get(uniqueId); }
Source:
<code>public Iterable<Object> loadObjects(Class<?> entityClass, Optional<FilterExpression> filterExpression, Optional<Sorting> sorting, Optional<Pagination> pagination, RequestScope scope) { Map<String, Object> data = dataStore.get(entityClass); <START> synchronized (data) { <END> if (filterExpression.isPresent()) { Predicate predicate = filterExpression.get().accept(new InMemoryFilterVisitor(scope)); return data.values().stream() .filter(predicate::test) .collect(Collectors.toList()); } List<Object> results = new ArrayList<>(); data.values().forEach(results::add); return results; } }</code><technical_language>need this synchronized (i.e. loadObject commit). easier wrap LinkedHashMap synchronize entire structure? do want do bookkeeping here</technical_language>

Target:
public Iterable<Object> loadObjects(Class<?> entityClass, Optional<FilterExpression> filterExpression, Optional<Sorting> sorting, Optional<Pagination> pagination, RequestScope scope) { synchronized (dataStore) { Map<String, Object> data = dataStore.get(entityClass); if (filterExpression.isPresent()) { Predicate predicate = filterExpression.get().accept(new InMemoryFilterVisitor(scope)); return data.values().stream() .filter(predicate::test) .collect(Collectors.toList()); } List<Object> results = new ArrayList<>(); data.values().forEach(results::add); return results; } }
Source:
<code>private Component newComponent(final ByteBuf buf, final int offset) { final int srcIndex = buf.readerIndex(); <START> final int len = buf.writerIndex() - buf.readerIndex(); <END> ByteBuf unwrapped = buf; int unwrappedIndex = srcIndex; while (unwrapped instanceof WrappedByteBuf || unwrapped instanceof SwappedByteBuf) { unwrapped = unwrapped.unwrap(); } if (unwrapped instanceof AbstractUnpooledSlicedByteBuf) { unwrappedIndex += ((AbstractUnpooledSlicedByteBuf) unwrapped).idx(0); unwrapped = unwrapped.unwrap(); } else if (unwrapped instanceof PooledSlicedByteBuf) { unwrappedIndex += ((PooledSlicedByteBuf) unwrapped).adjustment; unwrapped = unwrapped.unwrap(); } else if (unwrapped instanceof DuplicatedByteBuf || unwrapped instanceof PooledDuplicatedByteBuf) { unwrapped = unwrapped.unwrap(); } final ByteBuf slice = buf.capacity() == len ? buf : null; return new Component(buf.order(ByteOrder.BIG_ENDIAN), srcIndex, unwrapped.order(ByteOrder.BIG_ENDIAN), unwrappedIndex, offset, len, slice); }</code><technical_language>nit: final int len = buf.readableBytes()</technical_language>

Target:
private Component newComponent(final ByteBuf buf, final int offset) { final int srcIndex = buf.readerIndex(); final int len = buf.readableBytes(); ByteBuf unwrapped = buf; int unwrappedIndex = srcIndex; while (unwrapped instanceof WrappedByteBuf || unwrapped instanceof SwappedByteBuf) { unwrapped = unwrapped.unwrap(); } if (unwrapped instanceof AbstractUnpooledSlicedByteBuf) { unwrappedIndex += ((AbstractUnpooledSlicedByteBuf) unwrapped).idx(0); unwrapped = unwrapped.unwrap(); } else if (unwrapped instanceof PooledSlicedByteBuf) { unwrappedIndex += ((PooledSlicedByteBuf) unwrapped).adjustment; unwrapped = unwrapped.unwrap(); } else if (unwrapped instanceof DuplicatedByteBuf || unwrapped instanceof PooledDuplicatedByteBuf) { unwrapped = unwrapped.unwrap(); } final ByteBuf slice = buf.capacity() == len ? buf : null; return new Component(buf.order(ByteOrder.BIG_ENDIAN), srcIndex, unwrapped.order(ByteOrder.BIG_ENDIAN), unwrappedIndex, offset, len, slice); }
Source:
<code><START> public static InitCommand init() { <END> return new InitCommand(); }</code><technical_language>Style-nit: Static methods start of class, instance members</technical_language>

Target:
static public InitCommand init() { return new InitCommand(); }
Source:
<code>private NamespaceIdentifier getNamespaceIdentifierInstance() { if (namespaceIdentifierInstance == null) { ArrayList<String> name = new ArrayList<String>(1); name.add("whdl"); namespaceIdentifierInstance = new NamespaceIdentifier(name); } return namespaceIdentifierInstance; <START> } <END></code><technical_language>feedback :smile:</technical_language>

Target:
private NamespaceIdentifier getNamespaceIdentifierInstance() { ArrayList<String> name = new ArrayList<String>(1); name.add("whdl"); return new NamespaceIdentifier(name); }
Source:
<code>public CompositeDriverExecutionProfile refresh() { try { primaryProfile = primaryConfig.getProfile(profileName); } catch (IllegalArgumentException e) { <START> primaryProfile = null; <END> } try { fallbackProfile = fallbackConfig.getProfile(profileName); } catch (IllegalArgumentException e) { fallbackProfile = null; } Preconditions.checkArgument( primaryProfile != null || fallbackProfile != null, "Unknown profile '%s'. Check your configuration.", profileName); return this; }</code><technical_language>Can/should add it</technical_language>

Target:
public CompositeDriverExecutionProfile refresh() { return refreshInternal(); }
Source:
<code>public void onNext(ReadRowsResponse response) { List<CellChunk> cellChunks = response.getChunksList(); if (cellChunks.isEmpty()) { log.warn("Got empty cell chunk list"); return; } log.trace("Got cell chunks", response.getChunksList().size()); cellChunkHandler.set(cellChunkHandler.get().consumeChunks(cellChunks)); <START> lastQualifierRef.set(cellChunks.get(cellChunks.size() - 1).getQualifier().getValue()); <END> }</code><technical_language>If called multiple threads, this a race-condition</technical_language>

Target:
public void onNext(ReadRowsResponse response) { List<CellChunk> cellChunks = response.getChunksList(); if (cellChunks.isEmpty()) { log.warn("Got empty cell chunk list"); return; } log.trace("Got cell chunks", response.getChunksList().size()); cellChunkHandler = cellChunkHandler.consumeChunks(cellChunks); lastQualifierRef = cellChunks.get(cellChunks.size() - 1).getQualifier().getValue(); }
Source:
<code>boolean isDefaultExceptionMapperDisabled() { Object prop = getConfiguration().getProperty(CONFIG_KEY_DISABLE_MAPPER); if (prop instanceof Boolean) { return (Boolean)prop; } else { Config config = ConfigProvider.getConfig(); Optional<Boolean> optionalValue = config.getOptionalValue(CONFIG_KEY_DISABLE_MAPPER, Boolean.class); <START> if (optionalValue.isPresent()) { <END> return optionalValue.get(); } } return false; }</code><technical_language>Minor, compact return config.getOptionalValue(CONFIG_KEY_DISABLE_MAPPER, Boolean.class).getOrElse(false);</technical_language>

Target:
boolean isDefaultExceptionMapperDisabled() { Object prop = getConfiguration().getProperty(CONFIG_KEY_DISABLE_MAPPER); if (prop instanceof Boolean) { return (Boolean)prop; } return ConfigFacade.getOptionalValue(CONFIG_KEY_DISABLE_MAPPER, Boolean.class).orElse(false); }
Source:
<code>public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { IdleStateEvent e = null; if (evt instanceof IdleStateEvent) { e = (IdleStateEvent) evt; if (e.state() == IdleState.WRITER_IDLE) { if (isProcessing(ctx)) { logger.trace("keep alive"); ChannelFuture f = ctx.writeAndFlush(new Ack(Protocol.VERSION_2, 0)); if (logger.isTraceEnabled()) { f.addListener((ChannelFutureListener) future -> { if (future.isSuccess()) { logger.trace("Keep alive Success"); } else { logger.trace("Not success"); } }); } } else { logger.warn("not processing so no keep alive"); } } else if (e.state() == IdleState.ALL_IDLE) { <START> logger.debug("idle state, all idle, timeout reaching could if this happen it could mean logstash is under backpressure."); <END> ctx.close(); } } }</code><technical_language>I this is debugging, part "timeout reaching" end is incomprehensible</technical_language>

Target:
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { IdleStateEvent e = null; if (evt instanceof IdleStateEvent) { e = (IdleStateEvent) evt; if (e.state() == IdleState.WRITER_IDLE) { if (isProcessing(ctx)) { ChannelFuture f = ctx.writeAndFlush(new Ack(Protocol.VERSION_2, 0)); if (logger.isTraceEnabled()) { logger.trace("sending keep alive ack to libbeat"); f.addListener((ChannelFutureListener) future -> { if (future.isSuccess()) { logger.trace("acking was successful"); } else { logger.trace("acking failed"); } }); } } } else if (e.state() == IdleState.ALL_IDLE) { logger.debug("reader and writer are idle, closing remote connection"); ctx.flush(); ChannelFuture f = ctx.close(); f.addListener((future) ->{ if (future.isSuccess()){ logger.warn("success"); } else { logger.warn("could not close the ctx"); } }); } } }