auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static <T> Observable<T> bindLifecycle(Observable<LifecycleEvent> lifecycle, Observable<T> source, Func1<LifecycleEvent, LifecycleEvent> correspondingEvents) { if (lifecycle == null || source == null) { throw new IllegalArgumentException("Lifecycle and Observable must be given"); } <START> Observable<LifecycleEvent> sharedLifecycle = lifecycle.share(); <END> return source.lift( new OperatorSubscribeUntil<T, Boolean>( Observable.combineLatest( sharedLifecycle.take(1).map(correspondingEvents), sharedLifecycle.skip(1), new Func2<LifecycleEvent, LifecycleEvent, Boolean>() { @Override public Boolean call(LifecycleEvent lifecycleEvent, LifecycleEvent bindUntilEvent) { return lifecycleEvent == bindUntilEvent; } }) .takeFirst(new Func1<Boolean, Boolean>() { @Override public Boolean call(Boolean shouldComplete) { return shouldComplete; } }) ) ); }</code><technical_language>nice, aware of share</technical_language>

Target:
private static <T> Observable<T> bindLifecycle(Observable<LifecycleEvent> lifecycle, Observable<T> source, Func1<LifecycleEvent, LifecycleEvent> correspondingEvents) { if (lifecycle == null || source == null) { throw new IllegalArgumentException("Lifecycle and Observable must be given"); } Observable<LifecycleEvent> sharedLifecycle = lifecycle.share(); return source.lift( new OperatorSubscribeUntil<T, Boolean>( Observable.combineLatest( sharedLifecycle.take(1).map(correspondingEvents), sharedLifecycle.skip(1), new Func2<LifecycleEvent, LifecycleEvent, Boolean>() { @Override public Boolean call(LifecycleEvent bindUntilEvent, LifecycleEvent lifecycleEvent) { return lifecycleEvent == bindUntilEvent; } }) .takeFirst(new Func1<Boolean, Boolean>() { @Override public Boolean call(Boolean shouldComplete) { return shouldComplete; } }) ) ); }
Source:
<code>public void updateVersion(String version) { CorfuStoreMetadata.Timestamp timestamp = corfuStore.getTimestamp(); String persistedVersion = queryString(timestamp, LogReplicationMetadataType.VERSION); if (persistedVersion.equals(version)) { <START> log.warn("Skip update the current version with new version as they are the same", <END> persistedVersion, version); return; } TxBuilder txBuilder = corfuStore.tx(NAMESPACE); for (LogReplicationMetadataType key : LogReplicationMetadataType.values()) { long val = Address.NON_ADDRESS; if (key == LogReplicationMetadataType.VERSION) { appendUpdate(txBuilder, key, version); } else if (key == LogReplicationMetadataType.TOPOLOGY_CONFIG_ID) { val = query(timestamp, LogReplicationMetadataType.TOPOLOGY_CONFIG_ID); appendUpdate(txBuilder, key, val); } else { appendUpdate(txBuilder, key, val); } } txBuilder.commit(timestamp); }</code><technical_language>> Skip update of current version {}, same</technical_language>

Target:
public void updateVersion(String version) { CorfuStoreMetadata.Timestamp timestamp = corfuStore.getTimestamp(); String persistedVersion = queryString(timestamp, LogReplicationMetadataType.VERSION); if (persistedVersion.equals(version)) { log.warn("Skip update of the current version to as they are the same", persistedVersion, version); return; } TxBuilder txBuilder = corfuStore.tx(NAMESPACE); for (LogReplicationMetadataType key : LogReplicationMetadataType.values()) { long val = Address.NON_ADDRESS; if (key == LogReplicationMetadataType.VERSION) { appendUpdate(txBuilder, key, version); } else if (key == LogReplicationMetadataType.TOPOLOGY_CONFIG_ID) { val = query(timestamp, LogReplicationMetadataType.TOPOLOGY_CONFIG_ID); appendUpdate(txBuilder, key, val); } else { appendUpdate(txBuilder, key, val); } } txBuilder.commit(timestamp); }
Source:
<code>public void testBankAccountResourceFields() throws HTTPError { BankAccount bankAccount = createdAssociatedBankAccount(); assertNotNull(bankAccount.customer); assertNotNull(bankAccount.account_number); assertNotNull(bankAccount.account_type); assertNotNull(bankAccount.address); assertNotNull(bankAccount.bank_name); assertNotNull(bankAccount.can_credit); assertNotNull(bankAccount.can_debit); assertNotNull(bankAccount.created_at); assertNotNull(bankAccount.fingerprint); assertNotNull(bankAccount.href); assertNotNull(bankAccount.id); assertNotNull(bankAccount.verifications); assertNull(bankAccount.verification); assertNotNull(bankAccount.credits); assertNotNull(bankAccount.debits); assertNotNull(bankAccount.meta); assertNotNull(bankAccount.name); assertNotNull(bankAccount.routing_number); <START> assertNotNull(bankAccount.updated_at); <END> }</code><technical_language>Assert applicable field values match supplied in createdAssociatedBankAccount()</technical_language>

Target:
public void testBankAccountResourceFields() throws HTTPError { Map<String, Object> payload = personCustomerPayload(); Customer customer = new Customer(payload); customer.save(); BankAccount bankAccount = new BankAccount(); bankAccount.name = "Harry Fakester"; bankAccount.routing_number = "121042882"; bankAccount.account_number = "112233a"; bankAccount.account_type = "checking"; bankAccount.save(); bankAccount.associateToCustomer(customer); Map<String, String> meta = new HashMap<String, String>(); meta.put("facebook", "0192837465"); bankAccount.meta = meta; bankAccount.save(); assertEquals(bankAccount.customer.href, customer.href); assertEquals(bankAccount.account_number, "xxx233a"); assertEquals(bankAccount.account_type, "checking"); assertEquals(bankAccount.address.toString(), "{city=null, line2=null, " + "line1=null, state=null, postal_code=null, country_code=null}"); assertEquals(bankAccount.bank_name, "WELLS FARGO BANK NA"); assertTrue(bankAccount.can_credit); assertFalse(bankAccount.can_debit); assertNotNull(bankAccount.created_at); assertNotNull(bankAccount.fingerprint); assertTrue(bankAccount.href.contains("/bank_accounts/BA")); assertTrue(bankAccount.id.contains("BA")); assertTrue(bankAccount.links.containsKey("customer")); assertTrue(bankAccount.links.containsKey("bank_account_verification")); assertEquals(bankAccount.meta.get("facebook"), "0192837465"); assertEquals(bankAccount.name, "Harry Fakester"); assertEquals(bankAccount.routing_number, "121042882"); assertNotNull(bankAccount.updated_at); assertNull(bankAccount.verification); assertTrue(bankAccount.verifications instanceof BankAccountVerification.Collection); assertTrue(bankAccount.credits instanceof Credit.Collection); assertEquals(bankAccount.bank_name, "WELLS FARGO BANK NA"); }
Source:
<code>public Groups list() { if (isFiltered()) { <START> return mapDbGroupsCollection(getBackendCollection(DbUser.class, VdcQueryType.GetDbUserByUserId, new GetDbUserByUserIdParameters(getCurrent().get(VdcUser.class).getUserId()))); <END> } else { return mapDbGroupsCollection(getGroupsCollection(SearchType.DBUser, getSearchPattern())); } }</code><technical_language>query called GetAllDbUsers</technical_language>

Target:
public Groups list() { if (isFiltered()) { return mapDbGroupsCollection(getBackendCollection(DbUser.class, VdcQueryType.GetAllDbUsers, new VdcQueryParametersBase())); } else { return mapDbGroupsCollection(getGroupsCollection(SearchType.DBUser, getSearchPattern())); } }
Source:
<code>private QueryResult executeInternal(QueryContext context, String rewrittenQuery) throws GrillException { <START> checkConfigured(); <END> JdbcQueryContext queryContext = new JdbcQueryContext(context); queryContext.setPrepared(false); queryContext.setRewrittenQuery(rewrittenQuery); QueryResult result = new QueryCallable(queryContext).call(); return result; }</code><technical_language>Need do a checkConfigured() call here. Callers of method</technical_language>

Target:
private QueryResult executeInternal(QueryContext context, String rewrittenQuery) throws GrillException { JdbcQueryContext queryContext = new JdbcQueryContext(context); queryContext.setPrepared(false); queryContext.setRewrittenQuery(rewrittenQuery); QueryResult result = new QueryCallable(queryContext).call(); return result; }
Source:
<code>public T map(int row, ResultSet rs, StatementContext ctx) throws SQLException { T bean; try { bean = type.newInstance(); } catch (Exception e) { throw new IllegalArgumentException(String.format("A bean, %s, was mapped " + "which was not instantiable", type.getName()), e); } ResultSetMetaData metadata = rs.getMetaData(); for (int i = 1; i <= metadata.getColumnCount(); ++i) { String name = metadata.getColumnLabel(i).toLowerCase(); PropertyDescriptor descriptor = properties.get(name); if (descriptor != null) { Class type = descriptor.getPropertyType(); Object value; ResultColumnMapper mapper = ctx.columnMapperFor(type); if (mapper != null) { value = mapper.mapColumn(rs, i, ctx); } else if (type.isEnum()) { <START> String str = rs.getString(i); <END> value = str == null ? null : Enum.valueOf(type, str); } else { value = rs.getObject(i); } try { descriptor.getWriteMethod().invoke(bean, value); } catch (IllegalAccessException e) { throw new IllegalArgumentException(String.format("Unable to access setter for " + "property, %s", name), e); } catch (InvocationTargetException e) { throw new IllegalArgumentException(String.format("Invocation target exception trying to " + "invoker setter for the %s property", name), e); } catch (NullPointerException e) { throw new IllegalArgumentException(String.format("No appropriate method to " + "write property %s", name), e); } } } return bean; }</code><technical_language>Enum handling move ResultColumnMapperFactory? weird this edge case now</technical_language>

Target:
public T map(int row, ResultSet rs, StatementContext ctx) throws SQLException { T bean; try { bean = type.newInstance(); } catch (Exception e) { throw new IllegalArgumentException(String.format("A bean, %s, was mapped " + "which was not instantiable", type.getName()), e); } ResultSetMetaData metadata = rs.getMetaData(); for (int i = 1; i <= metadata.getColumnCount(); ++i) { String name = metadata.getColumnLabel(i).toLowerCase(); PropertyDescriptor descriptor = properties.get(name); if (descriptor != null) { Class type = descriptor.getPropertyType(); Object value; ResultColumnMapper mapper = ctx.columnMapperFor(type); if (mapper != null) { value = mapper.mapColumn(rs, i, ctx); } else { value = rs.getObject(i); } try { descriptor.getWriteMethod().invoke(bean, value); } catch (IllegalAccessException e) { throw new IllegalArgumentException(String.format("Unable to access setter for " + "property, %s", name), e); } catch (InvocationTargetException e) { throw new IllegalArgumentException(String.format("Invocation target exception trying to " + "invoker setter for the %s property", name), e); } catch (NullPointerException e) { throw new IllegalArgumentException(String.format("No appropriate method to " + "write property %s", name), e); } } } return bean; }
Source:
<code>private void populate() { choiceBox = new ComboBox<>(repositoryChoices); choiceBox.setPromptText(tr("Please select the repository type you want to add")); choiceBox.setConverter(new StringConverter<RepositoryType>() { @Override public String toString(RepositoryType repositoryType) { return repositoryType.getLabel(); } @Override public RepositoryType fromString(String string) { return Arrays.stream(RepositoryType.values()).filter(type -> type.getLabel().equals(string)).findAny() .orElse(null); } }); choiceBox.setOnAction( event -> onRepositoryTypeSelection.accept(choiceBox.getSelectionModel().getSelectedItem())); Label choiceBoxLabel = new Label(tr("Repository type:")); choiceBoxLabel.setLabelFor(choiceBox); HBox content = new HBox(choiceBoxLabel, choiceBox); content.setId("repositoryTypeSelection"); HBox.setHgrow(choiceBox, Priority.ALWAYS); this.setCenter(content); <START> setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE); <END> }</code><technical_language>Do require this line if set minSize of dialogPane in AddRepositoryDialog</technical_language>

Target:
private void populate() { choiceBox = new ComboBox<>(repositoryChoices); choiceBox.setPromptText(tr("Please select the repository type you want to add")); choiceBox.setConverter(new StringConverter<RepositoryType>() { @Override public String toString(RepositoryType repositoryType) { return repositoryType.getLabel(); } @Override public RepositoryType fromString(String string) { return Arrays.stream(RepositoryType.values()).filter(type -> type.getLabel().equals(string)).findAny() .orElse(null); } }); choiceBox.setOnAction( event -> onRepositoryTypeSelection.accept(choiceBox.getSelectionModel().getSelectedItem())); Label choiceBoxLabel = new Label(tr("Repository type:")); choiceBoxLabel.setLabelFor(choiceBox); HBox content = new HBox(choiceBoxLabel, choiceBox); content.setId("repositoryTypeSelection"); HBox.setHgrow(choiceBox, Priority.ALWAYS); this.setCenter(content); }
Source:
<code><T> List<T> createInstrumentedRemoteProxies(Class<T> clazz, String name) { Set<String> remoteUris = PaxosRemotingUtils.getRemoteServerPaths(install()); Optional<TrustContext> trustContext = PaxosRemotingUtils .getSslConfigurationOptional(install()) .map(SslSocketFactories::createTrustContext); return remoteUris.stream() <START> .map(uri -> AtlasDbFeignTargetFactory.DEFAULT.createProxy( <END> trustContext, uri, clazz, name, false)) .map(proxy -> metrics().instrument(clazz, proxy, name)) .collect(Collectors.toList()); }</code><technical_language>prefer AtlasDbHttpClients#DEFAULT_TARGET_FACTORY opposed referencing Feign directly. ways of instrumenting is a concerning, I a solution a pile of work</technical_language>

Target:
<T> List<T> createInstrumentedRemoteProxies(Class<T> clazz, String name) { Set<String> remoteUris = PaxosRemotingUtils.getRemoteServerPaths(install()); Optional<TrustContext> trustContext = PaxosRemotingUtils .getSslConfigurationOptional(install()) .map(SslSocketFactories::createTrustContext); return remoteUris.stream() .map(uri -> AtlasDbHttpClients.DEFAULT_TARGET_FACTORY.createProxy( trustContext, uri, clazz, name, false)) .map(proxy -> metrics().instrument(clazz, proxy, name)) .collect(Collectors.toList()); }
Source:
<code>public void executionStarted(final TestIdentifier testIdentifier) { <START> if (!testIdentifier.isContainer()) { <END> final String testUniqueName = getUniqueTestName(testIdentifier); listener.onTestStart(testUniqueName); } }</code><technical_language>early return if (testIdent.isContainer())</technical_language>

Target:
public void executionStarted(final TestIdentifier testIdentifier) { if (testIdentifier.isContainer()) { return; } final String testUniqueName = getUniqueTestName(testIdentifier); listener.onTestStart(testUniqueName); }
Source:
<code>public void visitFeatureAnnotation(T annotation, FeatureInfo feature) { Closure condition = createCondition(annotation); try { Object result = evaluateCondition(condition); featureConditionResult(GroovyRuntimeUtil.isTruthy(result), annotation, feature); } catch (ExtensionException ee) { if (!(ee.getCause() instanceof MissingPropertyException)) { throw ee; } MissingPropertyException mpe = (MissingPropertyException) ee.getCause(); if (!feature.getDataVariables().contains(mpe.getProperty())) { throw ee; } feature.getFeatureMethod().addInterceptor(invocation -> { <START> List<String> dataVariables = invocation.getFeature().getDataVariables(); <END> Object[] dataValues = invocation.getIteration().getDataValues(); Object result = evaluateCondition(condition, dataVariables, dataValues); iterationConditionResult(GroovyRuntimeUtil.isTruthy(result), annotation, invocation); invocation.proceed(); }); } }</code><technical_language>method is complex, this extracted, preferably separate class, a method</technical_language>

Target:
public void visitFeatureAnnotation(T annotation, FeatureInfo feature) { Closure condition = createCondition(annotation); try { Object result = evaluateCondition(condition); featureConditionResult(GroovyRuntimeUtil.isTruthy(result), annotation, feature); } catch (ExtensionException ee) { if (!(ee.getCause() instanceof MissingPropertyException)) { throw ee; } MissingPropertyException mpe = (MissingPropertyException) ee.getCause(); if (!feature.getDataVariables().contains(mpe.getProperty())) { throw ee; } feature.getFeatureMethod().addInterceptor(new IterationCondition(condition, annotation)); } }
Source:
<code>private void startGattServer() { <START> BluetoothManager bluetoothManager = (BluetoothManager) getSystemService(BLUETOOTH_SERVICE); <END> mGattServer = bluetoothManager.openGattServer(this, gattServerCallback); BluetoothGattService batteryService = buildBatteryService(); mGattServer.addService(batteryService); }</code><technical_language>cache BluetoothManager in onCreate instead of BluetoothAdapter. both</technical_language>

Target:
private void startGattServer() { mGattServer = mBluetoothManager.openGattServer(this, mGattServerCallback); BluetoothGattService batteryService = buildBatteryService(); mGattServer.addService(batteryService); }
Source:
<code>public static <P extends VdcActionParametersBase> CommandBase<P> createCommand(VdcActionType action, P parameters, <START> CommandContext commandContext) { <END> try { Constructor<CommandBase<? extends VdcActionParametersBase>> commandConstructor = findCommandConstructor(getCommandClass(action.name()), parameters.getClass(), CommandContext.class); if (commandContext == null) { commandContext = CommandContext.createContext(parameters.getSessionId()); } else if (commandContext.getEngineContext().getSessionId() == null) { commandContext.getEngineContext().withSessionId(parameters.getSessionId()); } CommandBase<P> command = (CommandBase<P>) commandConstructor.newInstance(parameters, commandContext); return Injector.injectMembers(command); } catch (InvocationTargetException ex) { log.error("Error in invocating CTOR of command '{}': {}", action.name(), ex.getMessage()); log.debug("Exception", ex); return null; } catch (Exception ex) { log.error("An exception has occured while trying to create a command object for command '{}': {}", action.name(), ex.getMessage()); log.debug("Exception", ex); return null; } }</code><technical_language>nice for formatter.</technical_language>

Target:
public static <P extends VdcActionParametersBase> CommandBase<P> createCommand(VdcActionType action, P parameters, CommandContext commandContext) { try { Constructor<CommandBase<? extends VdcActionParametersBase>> commandConstructor = findCommandConstructor(getCommandClass(action.name()), parameters.getClass(), CommandContext.class); if (commandContext == null) { commandContext = CommandContext.createContext(parameters.getSessionId()); } else if (commandContext.getEngineContext().getSessionId() == null) { commandContext.getEngineContext().withSessionId(parameters.getSessionId()); } @SuppressWarnings("unchecked") CommandBase<P> command = (CommandBase<P>) commandConstructor.newInstance(parameters, commandContext); return Injector.injectMembers(command); } catch (InvocationTargetException ex) { log.error("Error in invocating CTOR of command '{}': {}", action.name(), ex.getMessage()); log.debug("Exception", ex); return null; } catch (Exception ex) { log.error("An exception has occured while trying to create a command object for command '{}': {}", action.name(), ex.getMessage()); log.debug("Exception", ex); return null; } }
Source:
<code>public void onTaskSelectionEvent(@Observes final TaskSelectionEvent event) { <START> boolean resetTabs = (taskId != event.getTaskId()); <END> taskId = event.getTaskId(); serverTemplateId = event.getServerTemplateId(); containerId = event.getContainerId(); processId = event.getTaskName(); if (!event.isForLog()) { taskFormPresenter.getTaskFormView().getDisplayerView().setOnCloseCommand(() -> closeDetails()); taskFormDisplayProvider.setup(new HumanTaskDisplayerConfig(new TaskKey(serverTemplateId, containerId, taskId)), taskFormPresenter.getTaskFormView().getDisplayerView()); } setIsForLog(event.isForLog()); setIsForAdmin(event.isForAdmin()); changeTitleWidgetEvent.fire(new ChangeTitleWidgetEvent(this.place, String.valueOf(taskId) + " - " + processId)); if (isForLog()) { view.displayOnlyLogTab(); disableTaskDetailsEdition(); } else { view.displayAllTabs(); } if (isForAdmin()) { view.setAdminTabVisible(true); } else { view.setAdminTabVisible(false); } if (resetTabs) { view.resetTabs(event.isForLog()); } }</code><technical_language>@nmirasch this comparison break findbugs, of reasons is comparing a _!=_ throw a NPE</technical_language>

Target:
public void onTaskSelectionEvent(@Observes final TaskSelectionEvent event) { boolean refreshDetails = (event != null && event.getTaskId() != null && event.getTaskId().equals(taskId)); taskId = event.getTaskId(); serverTemplateId = event.getServerTemplateId(); containerId = event.getContainerId(); processId = event.getTaskName(); if (!event.isForLog()) { taskFormPresenter.getTaskFormView().getDisplayerView().setOnCloseCommand(() -> closeDetails()); taskFormDisplayProvider.setup(new HumanTaskDisplayerConfig(new TaskKey(serverTemplateId, containerId, taskId)), taskFormPresenter.getTaskFormView().getDisplayerView()); } setIsForLog(event.isForLog()); setIsForAdmin(event.isForAdmin()); changeTitleWidgetEvent.fire(new ChangeTitleWidgetEvent(this.place, String.valueOf(taskId) + " - " + processId)); if (isForLog()) { view.displayOnlyLogTab(); disableTaskDetailsEdition(); } else { view.displayAllTabs(); } if (isForAdmin()) { view.setAdminTabVisible(true); } else { view.setAdminTabVisible(false); } if (!refreshDetails) { view.resetTabs(event.isForLog()); } }
Source:
<code>public void testConvertToMailgun() { EmailWrapper wrapper = getTypicalEmailWrapper(); try (FormDataMultiPart formData = new MailgunService().parseToEmail(wrapper)) { assertEquals(wrapper.getSenderName() + " <" + wrapper.getSenderEmail() + ">", formData.getField("from").getValue()); assertEquals(wrapper.getRecipient(), formData.getField("to").getValue()); assertEquals(wrapper.getBcc(), formData.getField("bcc").getValue()); assertEquals(wrapper.getReplyTo(), formData.getField("h:Reply-To").getValue()); assertEquals(wrapper.getSubject(), formData.getField("subject").getValue()); assertEquals(wrapper.getContent(), formData.getField("html").getValue()); } catch (IOException e) { <START> fail("Could not close email wrapper stream: " + TeammatesException.toStringWithStackTrace(e)); <END> } }</code><technical_language>Instead of catching Exception failing test anyway, throw Exception part of method</technical_language>

Target:
public void testConvertToMailgun() throws Exception { EmailWrapper wrapper = getTypicalEmailWrapper(); try (FormDataMultiPart formData = new MailgunService().parseToEmail(wrapper)) { assertEquals(wrapper.getSenderName() + " <" + wrapper.getSenderEmail() + ">", formData.getField("from").getValue()); assertEquals(wrapper.getRecipient(), formData.getField("to").getValue()); assertEquals(wrapper.getBcc(), formData.getField("bcc").getValue()); assertEquals(wrapper.getReplyTo(), formData.getField("h:Reply-To").getValue()); assertEquals(wrapper.getSubject(), formData.getField("subject").getValue()); assertEquals(wrapper.getContent(), formData.getField("html").getValue()); } }
Source:
<code>private CompletableFuture<PhysicalSlot> requestNewSlot( SlotRequestId slotRequestId, ResourceProfile resourceProfile, boolean willSlotBeOccupiedIndefinitely) { if (willSlotBeOccupiedIndefinitely) { return slotPool.requestNewAllocatedSlot(slotRequestId, resourceProfile, null); } else { <START> slotPool.disableBatchSlotRequestTimeoutCheck(); <END> return slotPool.requestNewAllocatedBatchSlot(slotRequestId, resourceProfile); } }</code><technical_language>this happen in constructor</technical_language>

Target:
private CompletableFuture<PhysicalSlot> requestNewSlot( SlotRequestId slotRequestId, ResourceProfile resourceProfile, boolean willSlotBeOccupiedIndefinitely) { if (willSlotBeOccupiedIndefinitely) { return slotPool.requestNewAllocatedSlot(slotRequestId, resourceProfile, null); } else { return slotPool.requestNewAllocatedBatchSlot(slotRequestId, resourceProfile); } }
Source:
<code><START> void writeSQLine(final SAMSequenceRecord sequenceRecord) { <END> final int numAttributes = sequenceRecord.getAttributes() != null ? sequenceRecord.getAttributes().size() : 0; final String[] fields = new String[3 + numAttributes]; fields[0] = HEADER_LINE_START + HeaderRecordType.SQ; fields[1] = SAMSequenceRecord.SEQUENCE_NAME_TAG + TAG_KEY_VALUE_SEPARATOR + sequenceRecord.getSequenceName(); fields[2] = SAMSequenceRecord.SEQUENCE_LENGTH_TAG + TAG_KEY_VALUE_SEPARATOR + Integer.toString(sequenceRecord.getSequenceLength()); encodeTags(sequenceRecord, fields, 3); println(StringUtil.join(FIELD_SEPARATOR, fields)); }</code><technical_language>hmmm. happy access change of this internal function. wrap a public function checks writer is null is more cognizant of package-protected status? For example, a java-doc good inform assumptions in place (like existence of a writer..)</technical_language>

Target:
private void writeSQLine(final SAMSequenceRecord sequenceRecord) { final int numAttributes = sequenceRecord.getAttributes() != null ? sequenceRecord.getAttributes().size() : 0; final String[] fields = new String[3 + numAttributes]; fields[0] = HEADER_LINE_START + HeaderRecordType.SQ; fields[1] = SAMSequenceRecord.SEQUENCE_NAME_TAG + TAG_KEY_VALUE_SEPARATOR + sequenceRecord.getSequenceName(); fields[2] = SAMSequenceRecord.SEQUENCE_LENGTH_TAG + TAG_KEY_VALUE_SEPARATOR + Integer.toString(sequenceRecord.getSequenceLength()); encodeTags(sequenceRecord, fields, 3); println(StringUtil.join(FIELD_SEPARATOR, fields)); }
Source:
<code>public void filtersOldItems() { final Domain dmn = Mockito.mock(Domain.class); Mockito.when(dmn.select(Mockito.any(SelectRequest.class))) .thenReturn( Arrays.asList( <START> create("item1", "2000"), <END> create("item2", "3000"), create("item3", "1000"), create("item4", "2500") ) ); final Region region = Mockito.mock(Region.class); Mockito.when(region.domain(Mockito.any(String.class))).thenReturn(dmn); final Set<String> set = new HashSet<String>(); for (Item item : new SanitizedDomains(region, 2300).domain("") .select(new SelectRequest())) { set.add(item.name()); } MatcherAssert.assertThat( set, Matchers.<Set<String>>allOf( Matchers.hasSize(2), Matchers.hasItems("item1", "item3") ) ); }</code><technical_language>this.create(...)</technical_language>

Target:
public void filtersOldItems() { final Domain dmn = Mockito.mock(Domain.class); final Set<String> cleared = new HashSet<String>(); final List<Item> list = new ArrayList<Item>( Arrays.asList( this.create("item1", 2000, cleared), this.create("item2", 3000, cleared), this.create("item3", 1000, cleared), this.create("item4", 2500, cleared) ) ); Mockito.when(dmn.select(Mockito.any(SelectRequest.class))) .thenReturn(list); final Region region = Mockito.mock(Region.class); Mockito.when(region.domain(Mockito.any(String.class))).thenReturn(dmn); final Set<String> set = new HashSet<String>(); for (Item item : new SanitizedDomains(region, 2300).domain("") .select(new SelectRequest())) { set.add(item.name()); } MatcherAssert.assertThat( set, Matchers.<Set<String>>allOf( Matchers.hasSize(2), Matchers.hasItems("item1", "item3") ) ); MatcherAssert.assertThat( cleared, Matchers.<Set<String>>allOf( Matchers.hasSize(2), Matchers.hasItems("item2", "item4") ) ); }
Source:
<code>public ActionResult execute() { String studentId; String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); String studentName = ""; if (studentEmail == null || courseId == null) { if (userInfo == null) { return new JsonResult("No student found", HttpStatus.SC_NOT_FOUND); } studentId = userInfo.id; } else { StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { return new JsonResult("No student found", HttpStatus.SC_NOT_FOUND); } studentId = student.getGoogleId(); studentName = student.getName(); } StudentProfileAttributes studentProfile; if (StringHelper.isEmpty(studentId)) { <START> studentProfile = StudentProfileAttributes.builder("placeholderId").build(); <END> } else { studentProfile = logic.getStudentProfile(studentId); studentName = logic.getAccount(studentId).name; } if (studentProfile == null) { studentProfile = StudentProfileAttributes.builder(studentId).build(); } StudentProfileData output = new StudentProfileData(studentName, studentProfile); if (userInfo == null || userInfo.isStudent && !userInfo.isInstructor && !studentId.equals(userInfo.id)) { output.hideInformationWhenViewedByOtherStudent(); } return new JsonResult(output); }</code><technical_language>empty string here</technical_language>

Target:
public ActionResult execute() { String studentId; String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); String studentName = ""; if (studentEmail == null || courseId == null) { if (userInfo == null) { return new JsonResult("No student found", HttpStatus.SC_NOT_FOUND); } studentId = userInfo.id; } else { StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { return new JsonResult("No student found", HttpStatus.SC_NOT_FOUND); } studentId = student.getGoogleId(); studentName = student.getName(); } StudentProfileAttributes studentProfile; if (StringHelper.isEmpty(studentId)) { studentProfile = StudentProfileAttributes.builder("").build(); } else { studentProfile = logic.getStudentProfile(studentId); studentName = logic.getAccount(studentId).name; } if (studentProfile == null) { studentProfile = StudentProfileAttributes.builder(studentId).build(); } StudentProfileData output = new StudentProfileData(studentName, studentProfile); if (userInfo == null || userInfo.isStudent && !userInfo.isInstructor && !studentId.equals(userInfo.id)) { output.hideInformationWhenViewedByOtherStudent(); } return new JsonResult(output); }
Source:
<code>private JPanel getPanel() { if (rootPanel == null) { about = new SonarLintAboutPanel(); rules = new RuleConfigurationPanel(); exclusions = new GlobalExclusionsPanel(); globalPanel = new SonarLintGlobalOptionsPanel(); serversPanel = new SonarQubeServerMgmtPanel(); JPanel settingsPanel = new JPanel(new BorderLayout()); settingsPanel.add(globalPanel.getComponent(), BorderLayout.NORTH); settingsPanel.add(serversPanel.getComponent(), BorderLayout.CENTER); rootPanel = new JPanel(new BorderLayout()); tabs = new JBTabbedPane(); tabs.insertTab("Settings", null, settingsPanel, "Configure SonarLint for all projects", 0); tabs.insertTab("File Exclusions", null, exclusions.getComponent(), "Configure which files should be excluded from analysis", 1); tabs.insertTab("Rules", null, rules.getComponent(), "Choose which rules are enabled when not connected to SonarQube", RULES_TAB_INDEX); tabs.insertTab("About", null, about.getComponent(), "About SonarLint", 3); rootPanel.add(tabs, BorderLayout.CENTER); <START> } <END> return rootPanel; }</code><technical_language>For consistency, I other tab indices extracted constants</technical_language>

Target:
private JPanel getPanel() { if (rootPanel == null) { about = new SonarLintAboutPanel(); rules = new RuleConfigurationPanel(); exclusions = new GlobalExclusionsPanel(); globalPanel = new SonarLintGlobalOptionsPanel(); serversPanel = new SonarQubeServerMgmtPanel(); JPanel settingsPanel = new JPanel(new BorderLayout()); settingsPanel.add(globalPanel.getComponent(), BorderLayout.NORTH); settingsPanel.add(serversPanel.getComponent(), BorderLayout.CENTER); rootPanel = new JPanel(new BorderLayout()); tabs = new JBTabbedPane(); tabs.insertTab("Settings", null, settingsPanel, "Configure SonarLint for all projects", SETTINGS_TAB_INDEX); tabs.insertTab("File Exclusions", null, exclusions.getComponent(), "Configure which files should be excluded from analysis", FILE_EXCLUSIONS_TAB_INDEX); tabs.insertTab("Rules", null, rules.getComponent(), "Choose which rules are enabled when not connected to SonarQube", RULES_TAB_INDEX); tabs.insertTab("About", null, about.getComponent(), "About SonarLint", ABOUT_TAB_INDEX); rootPanel.add(tabs, BorderLayout.CENTER); } return rootPanel; }
Source:
<code>public synchronized void release(long amount) { if (used - amount < 0) { <START> used = 0; <END> return; } used -= amount; }</code><technical_language>is a log</technical_language>

Target:
public ResourceQuota release(long amount) { return new ResourceQuota(name, Math.max(0, used - amount), limit); }
Source:
<code>public void write(SerializedPage page) throws IOException { retainedBytes += page.getRetainedSizeInBytes(); PageDataOutput pageDataOutput = new PageDataOutput(page); long writtenSize = pageDataOutput.size(); <START> if (maxBufferedBytes - bufferedBytes < writtenSize) { <END> dataSink.write(bufferedPages); bufferedPages.clear(); bufferedBytes = 0; retainedBytes = 0; } else { bufferedPages.add(new PageDataOutput(page)); bufferedBytes += writtenSize; } }</code><technical_language>current page lost</technical_language>

Target:
public void write(SerializedPage page) throws IOException { PageDataOutput pageDataOutput = new PageDataOutput(page); long writtenSize = pageDataOutput.size(); if (maxBufferedBytes - bufferedBytes < writtenSize) { dataSink.write(bufferedPages); bufferedPages.clear(); bufferedBytes = 0; retainedBytes = 0; } bufferedPages.add(pageDataOutput); bufferedBytes += writtenSize; retainedBytes += page.getRetainedSizeInBytes(); }
Source:
<code>protected void <START> addMacsFromDbToPool() <END> { List<VmNic> interfaces = getVmNicInterfacesFromDb(); for (VmNic iface : interfaces) { if (iface.getMacAddress() != null) { forceAddMacWithoutLocking(iface.getMacAddress()); } } }</code><technical_language>this private</technical_language>

Target:
private void addMacsFromDbToPool() { List<VmNic> interfaces = getVmNicInterfacesFromDb(); for (VmNic iface : interfaces) { if (iface.getMacAddress() != null) { forceAddMacWithoutLocking(iface.getMacAddress()); } } }
Source:
<code>public void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain ) throws ServletException, IOException { HttpServletRequest request = (HttpServletRequest) req; String requestId = Optional.ofNullable( request.getHeader( X_REQUEST_ID ) ).orElse( UUID.randomUUID().toString() ); try { logger.info( "received request with request id of: " + requestId ); MDC.put( REQUEST_ID, "rid-" + requestId ); chain.doFilter( req, resp ); } finally { logger.info( "Exiting request with request id of: " + requestId ); ( (HttpServletResponse) resp ).setHeader( X_REQUEST_ID, requestId ); <START> MDC.clear(); <END> } }</code><technical_language>do clear entries of MDC ,while filter is concerned REQUEST_ID key/entry</technical_language>

Target:
public void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain ) throws ServletException, IOException { HttpServletRequest request = (HttpServletRequest) req; String requestId = Optional.ofNullable( request.getHeader( X_REQUEST_ID ) ).orElse( UUID.randomUUID().toString() ); try { if ( logger.isDebugEnabled() ) { logger.debug( "received request with request id of: " + requestId ); } MDC.put( REQUEST_ID, String.format( REQUEST_ID_FORMAT, requestId ) ); chain.doFilter( req, resp ); } finally { if ( logger.isDebugEnabled() ) { logger.debug( "Exiting request with request id of: " + requestId ); } ( (HttpServletResponse) resp ).setHeader( X_REQUEST_ID, requestId ); MDC.remove( X_REQUEST_ID ); } }
Source:
<code>public synchronized void listen(BibDatabaseContextChangedEvent event) { <START> <END> if (event instanceof FieldChangedEvent) { FieldChangedEvent fieldChange = (FieldChangedEvent) event; totalDelta += fieldChange.getDelta(); boolean isNewEdit = lastFieldChanged.isEmpty(); boolean isEditChanged = !isNewEdit && !lastFieldChanged.get().equals(fieldChange.getField()); boolean isMajorChange = totalDelta >= 30; fieldChange.setFilteredOut(!(isEditChanged || isMajorChange)); eventPost(fieldChange); lastFieldChanged = Optional.of(fieldChange.getField()); } else { eventPost(event); } }</code><technical_language>Minor: checkstyle: empty line method</technical_language>

Target:
public synchronized void listen(BibDatabaseContextChangedEvent event) { if (event instanceof FieldChangedEvent) { FieldChangedEvent fieldChange = (FieldChangedEvent) event; boolean isNewEdit = lastFieldChanged.isEmpty() || lastEntryChanged.isEmpty(); boolean isChangedField = lastFieldChanged.filter(f -> !f.equals(fieldChange.getField())).isPresent(); boolean isChangedEntry = lastEntryChanged.filter(e -> !e.equals(fieldChange.getBibEntry())).isPresent(); boolean isEditChanged = !isNewEdit && (isChangedField || isChangedEntry); boolean isMajorChange = fieldChange.getDelta() > 1; fieldChange.setFilteredOut(!(isEditChanged || isMajorChange)); eventBus.post(fieldChange); lastFieldChanged = Optional.of(fieldChange.getField()); lastEntryChanged = Optional.of(fieldChange.getBibEntry()); } else { eventBus.post(event); } }
Source:
<code>public void setRetentionDiscovery(Integer retentionDiscovery) { if (retentionDiscovery!=null && (retentionDiscovery < DEFAULT_RETENTION_DISCOVERY || retentionDiscovery > MAX_RETENTION_DISCOVERY)) { <START> this.retentionDiscovery = DEFAULT_RETENTION_DISCOVERY; <END> } else { this.retentionDiscovery = retentionDiscovery; } }</code><technical_language>If customers send retention is 45 days, instead of 45 days (default value). This is customers a expire earlier default 45 days. For cases deliberately send test metrics want delete discovery a week. check is , cap retention period max_retention</technical_language>

Target:
public void setRetentionDiscovery(Integer retentionDiscovery) { if (retentionDiscovery != null) { if (retentionDiscovery > MAX_RETENTION_DISCOVERY_DAYS) { this.retentionDiscovery = MAX_RETENTION_DISCOVERY_DAYS; } else if (retentionDiscovery > 0) { this.retentionDiscovery = retentionDiscovery; } } else { this.retentionDiscovery = retentionDiscovery; } }
Source:
<code>public CategoryPill findCategoryOn(int position) { CategoryPill result = null; final List<WebElement> categoryPills = findCategoryPills(); if (position < categoryPills.size()) { result = new CategoryPill(categoryPills.get(position)); } <START> return result; <END> }</code><technical_language>final List<WebElement> categoryPills = findCategoryPills(); if (position < categoryPills.size()) { return new CategoryPill(categoryPills.get(position)); } else { return null; }</technical_language>

Target:
public CategoryPill findCategoryOn(int position) { final List<WebElement> categoryPills = findCategoryPills(); if (position < categoryPills.size()) { return new CategoryPill(categoryPills.get(position)); } else { return null; } }
Source:
<code>public WebElement getVisibilityOptionTableRow(int questionNumber, int optionRowNumber) { <START> return getVisibilityOptions(questionNumber).findElement(By.xpath("table/tbody/tr[" + optionRowNumber + "]")); <END> }</code><technical_language>This is fine, if possible, in future, try find a selector depend multiple xpath nesting levels</technical_language>

Target:
public WebElement getVisibilityOptionTableRow(int questionNumber, int optionRowNumber) { return getVisibilityOptions(questionNumber).findElement(By.xpath("(table/tbody/tr|table/tbody/hide)[" + optionRowNumber + "]")); }
Source:
<code>public void adsVuapCheckSlotSizesOasis(Page page, String slotName, String iframeId) throws InterruptedException { String slotSelector = AdsContent.getSlotSelector(slotName); AdsBaseObject ads = new AdsBaseObject(driver, urlBuilder.getUrlForPage(page), DESKTOP_SIZE); scrollToSlot(slotName, ads); <START> VideoFanTakeover videoFanTakeover = new VideoFanTakeover(driver, iframeId); <END> videoFanTakeover.waitForAdToLoad(); double imageHeight = videoFanTakeover.getAdSlotHeight(slotSelector); videoFanTakeover.play(); videoFanTakeover.waitForVideoStart(slotName); double videoHeight = videoFanTakeover.getAdVideoHeight(slotName); Assertion.assertTrue(videoFanTakeover.isVideoAdBiggerThanImageAdOasis(videoHeight, imageHeight )); videoFanTakeover.waitForVideoPlayerHidden(slotName); Assertion.assertTrue(videoFanTakeover.isImageAdInCorrectSize(imageHeight, slotSelector)); }</code><technical_language>nitpick: sense define variables top of function scope</technical_language>

Target:
public void adsVuapCheckSlotSizesOasis(Page page, String slotName, String iframeId) throws InterruptedException { String slotSelector = AdsContent.getSlotSelector(slotName); AdsBaseObject ads = new AdsBaseObject(driver, urlBuilder.getUrlForPage(page), DESKTOP_SIZE); scrollToSlot(slotName, ads); VideoFanTakeover videoFanTakeover = new VideoFanTakeover(driver, iframeId, slotName); videoFanTakeover.waitForAdToLoad(); double imageHeight = videoFanTakeover.getAdSlotHeight(slotSelector); videoFanTakeover.play(); double videoHeight = videoFanTakeover.getAdVideoHeight(); Assertion.assertTrue(videoFanTakeover.isVideoAdBiggerThanImageAdOasis(videoHeight, imageHeight )); videoFanTakeover.waitForVideoPlayerHidden(); Assertion.assertTrue(videoFanTakeover.isImageAdInCorrectSize(imageHeight, slotSelector)); }
Source:
<code>public void field_access_on_this() { <START> Expression.Variable x = UCFGBuilder.variableWithId("x"); <END> Expression.Variable aux0 = UCFGBuilder.variableWithId("%0"); Expression.Variable aux1 = UCFGBuilder.variableWithId("%1"); Expression.Variable aux2 = UCFGBuilder.variableWithId("%2"); Expression.Variable aux3 = UCFGBuilder.variableWithId("%3"); Expression.Variable aux4 = UCFGBuilder.variableWithId("%4"); UCFG expectedUCFG = UCFGBuilder.createUCFGForMethod("A#method()Ljava/lang/String;") .addBasicBlock(newBasicBlock("1") .assignTo(aux0, call("__id").withArgs(new Expression.FieldAccess(variableWithId("field"))), new LocationInFile(FILE_KEY, 5,15,5,25)) .assignTo(x, call("__id").withArgs(aux0), new LocationInFile(FILE_KEY, 5,4,5,26)) .assignTo(aux1, call("__id").withArgs(new Expression.FieldAccess(variableWithId("field"))), new LocationInFile(FILE_KEY, 6,11,6,16)) .assignTo(aux2, call("__id").withArgs(new Expression.FieldAccess(new Expression.ClassName("A"), variableWithId("FIELD"))), new LocationInFile(FILE_KEY, 6,19,6,24)) .assignTo(aux3, call("__concat").withArgs(aux1, aux2), new LocationInFile(FILE_KEY, 6,11,6,24)) .assignTo(aux4, call("__concat").withArgs(aux3, x), new LocationInFile(FILE_KEY, 6,11,6,28)) .ret(aux4, new LocationInFile(FILE_KEY, 6,4,6,29))) .build(); assertCodeToUCfg("class A {\n" + " String field;\n" + " static String FIELD;\n" + " String method() {\n" + " String x = this.field;\n" + " return field + FIELD + x;\n" + " }\n" + "}\n", expectedUCFG); }</code><technical_language>is a static import for variableWithId(), need UCFGBuilder.variableWithId</technical_language>

Target:
public void field_access_on_this() { Expression.Variable x = variableWithId("x"); Expression.Variable aux0 = variableWithId("%0"); Expression.Variable aux1 = variableWithId("%1"); Expression.Variable aux2 = variableWithId("%2"); Expression.Variable aux3 = variableWithId("%3"); Expression.Variable aux4 = variableWithId("%4"); UCFG expectedUCFG = UCFGBuilder.createUCFGForMethod("A#method()Ljava/lang/String;") .addBasicBlock(newBasicBlock("1") .assignTo(aux0, call("__id").withArgs(new Expression.FieldAccess(variableWithId("field"))), new LocationInFile(FILE_KEY, 5,15,5,25)) .assignTo(x, call("__id").withArgs(aux0), new LocationInFile(FILE_KEY, 5,4,5,26)) .assignTo(aux1, call("__id").withArgs(new Expression.FieldAccess(variableWithId("field"))), new LocationInFile(FILE_KEY, 6,11,6,16)) .assignTo(aux2, call("__id").withArgs(new Expression.FieldAccess(new Expression.ClassName("A"), variableWithId("FIELD"))), new LocationInFile(FILE_KEY, 6,19,6,24)) .assignTo(aux3, call("__concat").withArgs(aux1, aux2), new LocationInFile(FILE_KEY, 6,11,6,24)) .assignTo(aux4, call("__concat").withArgs(aux3, x), new LocationInFile(FILE_KEY, 6,11,6,28)) .ret(aux4, new LocationInFile(FILE_KEY, 6,4,6,29))) .build(); assertCodeToUCfg("class A {\n" + " String field;\n" + " static String FIELD;\n" + " String method() {\n" + " String x = this.field;\n" + " return field + FIELD + x;\n" + " }\n" + "}\n", expectedUCFG); }
Source:
<code>protected IStructuredSelection getSelection(ExecutionEvent event) throws ExecutionException { ISelection selection; if (event != null) selection = HandlerUtil.getCurrentSelectionChecked(event); else { IHandlerService hsr = (IHandlerService) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(IHandlerService.class); <START> IEvaluationContext ctx = hsr.createContextSnapshot(true); <END> selection = (ISelection) ctx.getVariable(ISources.ACTIVE_MENU_SELECTION_NAME); if (selection == null) throw new ExecutionException( UIText.RepositoryActionHandler_CouldNotGetSelection_message); } if (selection instanceof IStructuredSelection) return (IStructuredSelection) selection; return new StructuredSelection(); }</code><technical_language>do need a snapshot of world? getCurrentState() get selection</technical_language>

Target:
protected IStructuredSelection getSelection(ExecutionEvent event) throws ExecutionException { ISelection selection; if (event != null) selection = HandlerUtil.getCurrentSelectionChecked(event); else { IHandlerService hsr = (IHandlerService) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(IHandlerService.class); IEvaluationContext ctx = hsr.getCurrentState(); selection = (ISelection) ctx.getVariable(ISources.ACTIVE_MENU_SELECTION_NAME); if (selection == null) throw new ExecutionException( UIText.RepositoryActionHandler_CouldNotGetSelection_message); } if (selection instanceof IStructuredSelection) return (IStructuredSelection) selection; return new StructuredSelection(); }
Source:
<code>protected void enterRootModule() { Intent i; <START> if (useGridMenu("root")) { <END> i = new Intent(getApplicationContext(), MenuGrid.class); } else { i = new Intent(getApplicationContext(), MenuList.class); } startActivityForResult(i, GET_COMMAND); }</code><technical_language>"root" -> Menu.ROOT_MENU_ID</technical_language>

Target:
protected void enterRootModule() { Intent i; if (useGridMenu(org.commcare.suite.model.Menu.ROOT_MENU_ID)) { i = new Intent(getApplicationContext(), MenuGrid.class); } else { i = new Intent(getApplicationContext(), MenuList.class); } startActivityForResult(i, GET_COMMAND); }
Source:
<code>public BufferedImage run() throws Exception { final String request = new GetMapBuilder().endPoint(layer.getUrl()) .version(layer.getVersion()) .layer(layer.getName()) .bbox(bbox) .crs(srsName) .width(width) .height(height) .format(FORMAT) .transparent(true) .toKVP(); LOG.info(request); URL url = new URL(request); for (int i = 0; i < RETRY_COUNT - 1; i++) { try { return ImageIO.read(url); } catch (IOException e) { <START> LOG.warn(e); <END> } } return ImageIO.read(url); }</code><technical_language>this wait a while failure retrying? long user is waiting, ~50-100ms</technical_language>

Target:
public BufferedImage run() throws Exception { final String request = new GetMapBuilder().endPoint(layer.getUrl()) .version(layer.getVersion()) .layer(layer.getName()) .bbox(bbox) .crs(srsName) .width(width) .height(height) .format(FORMAT) .transparent(true) .toKVP(); return CommandLoadImageFromURL.load(request); }
Source:
<code>private String getBondOptionForPair(Entry<String, EntityModel> pair) { String res = pair.getKey(); if (res.equals("custom")) { <START> res = (String) pair.getValue().getEntity(); <END> } return res; }</code><technical_language>Please change return (String) pair.getValue().getEntity() instead if reusing 'res' (it is more readable)</technical_language>

Target:
private String getBondOptionForPair(Entry<String, EntityModel> pair) { String res = pair.getKey(); if ("custom".equals(res)) { return (String) pair.getValue().getEntity(); } return res; }