auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void visitToken(final DetailAST ast) { switch (ast.getType()) { case TokenTypes.VARIABLE_DEF: case TokenTypes.PARAMETER_DEF: case TokenTypes.PATTERN_VARIABLE_DEF: case TokenTypes.RECORD_COMPONENT_DEF: currentFrame.addField(ast); break; case TokenTypes.METHOD_CALL: processMethodCall(ast); break; case TokenTypes.SLIST: processSlist(ast); break; case TokenTypes.LITERAL_NEW: processLiteralNew(ast); break; <START> case TokenTypes.OBJBLOCK: <END> final int parentType = ast.getParent().getType(); if (parentType != TokenTypes.CLASS_DEF && parentType != TokenTypes.RECORD_DEF && parentType != TokenTypes.ENUM_DEF) { processFrame(ast); } break; default: processFrame(ast); } }</code><technical_language>Please move this code a helper method. boolean isClassOrEnumOrRecordDef(DetailAST ast) This triple check is performed times in file</technical_language>

Target:
public void visitToken(final DetailAST ast) { switch (ast.getType()) { case TokenTypes.VARIABLE_DEF: case TokenTypes.PARAMETER_DEF: case TokenTypes.PATTERN_VARIABLE_DEF: case TokenTypes.RECORD_COMPONENT_DEF: currentFrame.addField(ast); break; case TokenTypes.METHOD_CALL: processMethodCall(ast); break; case TokenTypes.SLIST: processSlist(ast); break; case TokenTypes.LITERAL_NEW: processLiteralNew(ast); break; case TokenTypes.OBJBLOCK: final int parentType = ast.getParent().getType(); if (!astTypeIsClassOrEnumOrRecordDef(parentType)) { processFrame(ast); } break; default: processFrame(ast); } }
Source:
<code>private void put(TableReference tableRef, Map<Cell, byte[]> values, long ttlDuration, TimeUnit ttlUnit) { Preconditions.checkArgument(!AtlasDbConstants.hiddenTables.contains(tableRef)); if (conflictDetectionManager.get(tableRef) == null) { <START> throw new IllegalArgumentException( <END> "Not a valid table for this transaction." + " Make sure this table name exists or has a valid namespace: " + tableRef); } if (values.isEmpty()) { return; } Map<Cell, byte[]> valuesToWrite = ttlDuration != Cell.INVALID_TTL && ttlUnit != Cell.INVALID_TTL_TYPE ? createExpiringValues(values, ttlDuration, ttlUnit) : values; numWriters.incrementAndGet(); try { Preconditions.checkState(state.get() == State.UNCOMMITTED, "Transaction must be uncommitted."); ConcurrentNavigableMap<Cell, byte[]> writes = getLocalWrites(tableRef); putWritesAndLogIfTooLarge(valuesToWrite, writes); } finally { numWriters.decrementAndGet(); } }</code><technical_language>this happen, return RETRY_ON_WRITE_WRITE a default value</technical_language>

Target:
private void put(TableReference tableRef, Map<Cell, byte[]> values, long ttlDuration, TimeUnit ttlUnit) { Preconditions.checkArgument(!AtlasDbConstants.hiddenTables.contains(tableRef)); if (values.isEmpty()) { return; } Map<Cell, byte[]> valuesToWrite = ttlDuration != Cell.INVALID_TTL && ttlUnit != Cell.INVALID_TTL_TYPE ? createExpiringValues(values, ttlDuration, ttlUnit) : values; numWriters.incrementAndGet(); try { Preconditions.checkState(state.get() == State.UNCOMMITTED, "Transaction must be uncommitted."); ConcurrentNavigableMap<Cell, byte[]> writes = getLocalWrites(tableRef); putWritesAndLogIfTooLarge(valuesToWrite, writes); } finally { numWriters.decrementAndGet(); } }
Source:
<code>public void testSendStatement() { AccountVO accountVO = new AccountVO(); accountVO.setId(2L); accountVO.setDomainId(1L); Mockito.when(accountDao.findById(Mockito.anyLong())).thenReturn(accountVO); QuotaAccountVO acc = new QuotaAccountVO(2L); acc.setQuotaBalance(new BigDecimal(404)); acc.setLastStatementDate(null); List<QuotaAccountVO> accounts = new ArrayList<>(); accounts.add(acc); Mockito.when(quotaAcc.listAllQuotaAccount()).thenReturn(accounts); Mockito.when(quotaUsage.findTotalQuotaUsage(Mockito.anyLong(), Mockito.anyLong(), Mockito.anyInt(), Mockito.any(Date.class), Mockito.any(Date.class))) .thenReturn(new BigDecimal(100)); <START> Mockito.doCallRealMethod().when(quotaStatement).sendStatement(); <END> }</code><technical_language>This test method asserts verify results of send statement operation. verify send statement operation succeeded simply failing</technical_language>

Target:
public void testSendStatement() throws UnsupportedEncodingException, MessagingException { Calendar date = Calendar.getInstance(); AccountVO accountVO = new AccountVO(); accountVO.setId(2L); accountVO.setDomainId(1L); Mockito.when(accountDao.findById(Mockito.anyLong())).thenReturn(accountVO); QuotaAccountVO acc = new QuotaAccountVO(2L); acc.setQuotaBalance(new BigDecimal(404)); acc.setLastStatementDate(null); List<QuotaAccountVO> accounts = new ArrayList<>(); accounts.add(acc); Mockito.when(quotaAcc.listAllQuotaAccount()).thenReturn(accounts); Mockito.when(quotaUsage.findTotalQuotaUsage(Mockito.anyLong(), Mockito.anyLong(), Mockito.anyInt(), Mockito.any(Date.class), Mockito.any(Date.class))) .thenReturn(new BigDecimal(100)); QuotaAlertManagerImpl.DeferredQuotaEmail email = new QuotaAlertManagerImpl.DeferredQuotaEmail(accountVO, acc, new BigDecimal(100), QuotaConfig.QuotaEmailTemplateTypes.QUOTA_LOW); Mockito.doCallRealMethod().when(quotaStatement).sendStatement(); Calendar period[] = quotaStatement.statementTime(date, STATEMENT_PERIODS.MONTHLY); if (period != null){ Mockito.verify(alertManager, Mockito.times(1)).sendQuotaAlert(email); } }
Source:
<code>public <T extends Annotation> AnnotatedTypeConfigurator<T> configureQualifier(Class<T> qualifier) { checkWithinObserverNotification(); AnnotatedTypeConfiguratorImpl<T> configurator = new AnnotatedTypeConfiguratorImpl<>(getBeanManager().createAnnotatedType(qualifier)); <START> additionalQualifiers.add(configurator); <END> return configurator; }</code><technical_language>Pls log extension actions - for example BeforeBeanDiscoveryImpl.addQualifier(AnnotatedType<? extends Annotation>): BootstrapLogger.LOG.addQualifierCalled(getReceiver(), qualifier);</technical_language>

Target:
public <T extends Annotation> AnnotatedTypeConfigurator<T> configureQualifier(Class<T> qualifier) { checkWithinObserverNotification(); AnnotatedTypeConfiguratorImpl<T> configurator = new AnnotatedTypeConfiguratorImpl<>(getBeanManager().createAnnotatedType(qualifier)); additionalQualifiers.add(configurator); BootstrapLogger.LOG.configureQualifierCalled(getReceiver(), qualifier); return configurator; }
Source:
<code>private void configureExistingWindows() { List<MArea> elements = modelService.findElements(window, null, MArea.class, null); for (MArea area : elements) { Object widget = area.getWidget(); if (widget instanceof Control) { <START> installAreaDropSupport((Control) widget); <END> } } }</code><technical_language>time I this code, check method is doing, understood : "for area install D&D support". However, installAreaDropSupport() a guard installed *per page*. Please add break; method change "for" loop snippet if(!elements.isEmpty()) { Object widget = elements.iterator.next(); ... }</technical_language>

Target:
private void configureExistingWindows() { List<MArea> elements = modelService.findElements(window, null, MArea.class, null); for (MArea area : elements) { Object widget = area.getWidget(); if (widget instanceof Control) { installAreaDropSupport((Control) widget); break; } } }
Source:
<code>protected void updateBlobTtl(final String blobIdStr, final String serviceId, long expiresAtMs, FutureResult<Void> futureResult, Callback<Void> callback) { boolean needGet = isMaybeMetadataBlob(blobIdStr); if (needGet) { Callback<GetBlobResultInternal> internalCallback = (GetBlobResultInternal result, Exception exception) -> { List<String> blobIdStrs = new ArrayList<>(); blobIdStrs.add(blobIdStr); if (exception != null) { completeOperation(futureResult, callback, null, exception, false); } else if (result.getBlobResult != null) { exception = new RouterException( "GET blob call returned the blob instead of just the store keys (before TTL update)", RouterErrorCode.UnexpectedInternalError); completeOperation(futureResult, callback, null, exception, false); } else if (result.storeKeys != null) { result.storeKeys.forEach(key -> blobIdStrs.add(key.getID())); } <START> currentOperationsCount.addAndGet(blobIdStrs.size()); <END> doUpdateTtlOperation(blobIdStrs, serviceId, expiresAtMs, futureResult, callback); }; GetBlobOptionsInternal options = new GetBlobOptionsInternal(new GetBlobOptions(GetBlobOptions.OperationType.All, GetOption.None, null), true, routerMetrics.ageAtTtlUpdate); try { getBlob(blobIdStr, options, internalCallback); } catch (RouterException e) { completeUpdateBlobTtlOperation(e, futureResult, callback); } } else { routerMetrics.skippedGetBlobCount.inc(); doUpdateTtlOperation(ImmutableList.of(blobIdStr), serviceId, expiresAtMs, futureResult, callback); } }</code><technical_language>this needs change (the bug fix)</technical_language>

Target:
protected void updateBlobTtl(final String blobIdStr, final String serviceId, long expiresAtMs, FutureResult<Void> futureResult, Callback<Void> callback) { if (isMaybeMetadataBlob(blobIdStr)) { Callback<GetBlobResultInternal> internalCallback = (GetBlobResultInternal result, Exception exception) -> { if (exception != null) { completeOperation(futureResult, callback, null, exception, false); } else if (result.getBlobResult != null) { exception = new RouterException( "GET blob call returned the blob instead of just the store keys (before TTL update)", RouterErrorCode.UnexpectedInternalError); completeOperation(futureResult, callback, null, exception, false); } else { List<String> blobIdStrs = new ArrayList<>(); blobIdStrs.add(blobIdStr); if (result.storeKeys != null) { result.storeKeys.forEach(key -> blobIdStrs.add(key.getID())); } currentOperationsCount.addAndGet(blobIdStrs.size()); doUpdateTtlOperation(blobIdStrs, serviceId, expiresAtMs, futureResult, callback); } }; GetBlobOptionsInternal options = new GetBlobOptionsInternal(new GetBlobOptions(GetBlobOptions.OperationType.All, GetOption.None, null), true, routerMetrics.ageAtTtlUpdate); try { getBlob(blobIdStr, options, internalCallback); } catch (RouterException e) { completeUpdateBlobTtlOperation(e, futureResult, callback); } } else { routerMetrics.skippedGetBlobCount.inc(); doUpdateTtlOperation(Collections.singletonList(blobIdStr), serviceId, expiresAtMs, futureResult, callback); } }
Source:
<code>public DataObject getAttributeValue(final DlmsConnectionHolder conn, final AttributeAddress attributeAddress) throws FunctionalException { Objects.requireNonNull(conn, "conn must not be null"); Objects.requireNonNull(attributeAddress, "attributeAddress must not be null"); try { final GetResult getResult = conn.getConnection().get(attributeAddress); final AccessResultCode resultCode = getResult.getResultCode(); if (AccessResultCode.SUCCESS == resultCode) { return getResult.getResultData(); } final String errorMessage = String.format("Retrieving attribute value for { %d, %s, %d }. Result: resultCode(" + "%d), with data: %s", attributeAddress.getClassId(), attributeAddress.getInstanceId().toObisCode(), attributeAddress.getId(), resultCode.getCode(), this.getDebugInfo(getResult.getResultData())); LOGGER.error(errorMessage); <START> throw new FunctionalException(FunctionalExceptionType.ERROR_RETRIEVING_ATTRIBUTE_VALUE, ComponentType.PROTOCOL_DLMS); <END> } catch (final IOException e) { throw new ConnectionException(e); } }</code><technical_language>information ProtocolAdapterException thrown is logged. problem solving quicker/easier if ProtocolAdapterException richer details in FuntionalException is thrown</technical_language>

Target:
public DataObject getAttributeValue(final DlmsConnectionHolder conn, final AttributeAddress attributeAddress) throws FunctionalException { Objects.requireNonNull(conn, "conn must not be null"); Objects.requireNonNull(attributeAddress, "attributeAddress must not be null"); try { final GetResult getResult = conn.getConnection().get(attributeAddress); final AccessResultCode resultCode = getResult.getResultCode(); if (AccessResultCode.SUCCESS == resultCode) { return getResult.getResultData(); } final String errorMessage = String.format("Retrieving attribute value for { %d, %s, %d }. Result: resultCode(" + "%d), with data: %s", attributeAddress.getClassId(), attributeAddress.getInstanceId().toObisCode(), attributeAddress.getId(), resultCode.getCode(), this.getDebugInfo(getResult.getResultData())); LOGGER.error(errorMessage); throw new FunctionalException(FunctionalExceptionType.ERROR_RETRIEVING_ATTRIBUTE_VALUE, ComponentType.PROTOCOL_DLMS, new ProtocolAdapterException(errorMessage)); } catch (final IOException e) { throw new ConnectionException(e); } }
Source:
<code>private void databaseCorruptionDetected() throws IndexException { String msg = <START> NLS.bind("Corrupted <END> database: {0}", new Object[] { this.fLocation.getName() }); throw new IndexException(new DBStatus(msg)); }</code><technical_language>need NLS message is localizable. simple concatenation</technical_language>

Target:
private void databaseCorruptionDetected() throws IndexException { String msg = "Corrupted database: " + this.fLocation.getName(); throw new IndexException(new DBStatus(msg)); }
Source:
<code>private static List<Trackable> loadInventory(final String geocode) { if (StringUtils.isBlank(geocode)) { return null; } init(); final List<Trackable> trackables = new ArrayList<>(); final Cursor cursor = database.query( dbTableTrackables, <START> new String[]{"_id", "updated", "tbcode", "guid", "title", "owner", "released", "goal", "description", "retrieved"}, <END> "geocode = ?", new String[]{geocode}, null, null, "title COLLATE NOCASE ASC", "100"); while (cursor.moveToNext()) { trackables.add(createTrackableFromDatabaseContent(cursor)); } cursor.close(); return trackables; }</code><technical_language>add colums disposition, disposition_type disposition_log_guid</technical_language>

Target:
private static List<Trackable> loadInventory(final String geocode) { if (StringUtils.isBlank(geocode)) { return null; } init(); final List<Trackable> trackables = new ArrayList<>(); final Cursor cursor = database.query( dbTableTrackables, new String[]{"_id", "updated", "tbcode", "guid", "title", "owner", "released", "goal", "description", "log_date", "log_type", "log_guid"}, "geocode = ?", new String[]{geocode}, null, null, "title COLLATE NOCASE ASC", "100"); while (cursor.moveToNext()) { trackables.add(createTrackableFromDatabaseContent(cursor)); } cursor.close(); return trackables; }
Source:
<code>@Override protected String getDescription(MBeanOperationInfo op, MBeanParameterInfo param, int seq) { String str = super.getDescription(op, param, seq); try { Method m = getMethod(op); MXBeanParametersDescriptions decsAnn = m.getAnnotation(MXBeanParametersDescriptions.class); if (decsAnn != null) { assert decsAnn.value() != null; assert seq < decsAnn.value().length; str = decsAnn.value()[seq]; assert str != null; assert !str.trim().isEmpty(); <START> assert Character.isUpperCase(str.charAt(0)) : str; <END> assert str.charAt(str.length() - 1) == '.' : str; } else { MXBeanParameterInfo argumentInfoAnnotation = getMXBeanArgumentAnnotation(m, seq); if (argumentInfoAnnotation != null) { str = argumentInfoAnnotation.description(); assert str != null; assert !str.trim().isEmpty(); assert Character.isUpperCase(str.charAt(0)) : str; assert str.charAt(str.length() - 1) == '.' : str; } } } catch (SecurityException | ClassNotFoundException ignored) { } return str; }</code><technical_language>please add clear message for case assert failed</technical_language>

Target:
@Override protected String getDescription(MBeanOperationInfo op, MBeanParameterInfo param, int seq) { String str = super.getDescription(op, param, seq); try { Method m = getMethod(op); MXBeanParametersDescriptions decsAnn = m.getAnnotation(MXBeanParametersDescriptions.class); if (decsAnn != null) { assert decsAnn.value() != null; assert seq < decsAnn.value().length; str = decsAnn.value()[seq]; assert str != null : DESC_MUST_BE_NOT_NULL + str; assert !str.trim().isEmpty() : DESC_MUST_BE_NOT_EMPTY + str; assert Character.isUpperCase(str.charAt(0)) : DESC_MUST_START_WITH_UPP_CASE + str; assert str.charAt(str.length() - 1) == '.' : DESC_MUST_END_WITH_PERIOD + str; } else { MXBeanParameter argInfoAnnotation = getMXBeanArgumentAnnotation(m, seq); if (argInfoAnnotation != null) { str = argInfoAnnotation.description(); assert str != null : DESC_MUST_BE_NOT_NULL + str; assert !str.trim().isEmpty() : DESC_MUST_BE_NOT_EMPTY + str; assert Character.isUpperCase(str.charAt(0)) : DESC_MUST_START_WITH_UPP_CASE + str; assert str.charAt(str.length() - 1) == '.' : DESC_MUST_END_WITH_PERIOD + str; } } } catch (SecurityException | ClassNotFoundException ignored) { } return str; }
Source:
<code>static int[] optimizedFoldOrbit(int r) { if (r >= ORBIT_MIN_VALUE) { return FOLD_MAP.get(r); <START> } else return null; <END> }</code><technical_language>{...} block, outdent else block: if (r < ORBIT_MIN_VALUE) { return null; } return FOLD_MAP.get(r);</technical_language>

Target:
static int[] optimizedFoldOrbit(int r) { if (r >= ORBIT_MIN_VALUE) { return FOLD_MAP.get(r); } return null; }
Source:
<code>private double computeTextToTagRatio(String line) { int tag = 0; int text = 0; for (int i = 0; i >= 0 && i < line.length(); i++) { if (line.charAt(i) == '<') { tag++; i = line.indexOf('>', i); if (i == -1) { break; } } else if (tag == 0 && line.charAt(i) == '>') { text = 0; tag++; } else { text++; } } if (tag == 0) { tag = 1; <START> } <END> if(text != 0){ } return (double) text / (double) tag; }</code><technical_language>If ensure tag is positive (i.e. >= 1), tag = Math.max(tag, 1); is more readable</technical_language>

Target:
private double computeTextToTagRatio(String line) { int tag = 0; int text = 0; for (int i = 0; i >= 0 && i < line.length(); i++) { if (line.charAt(i) == '<') { tag++; i = line.indexOf('>', i); if (i == -1) { break; } } else if (tag == 0 && line.charAt(i) == '>') { text = 0; tag++; } else { text++; } } tag = Math.max(tag, 1); return (double) text / (double) tag; }
Source:
<code>public Map<String, Long> getFormatCounts(AccessGroupSet accessGroups) { <START> HashMap<String, Long> counts = new HashMap<String, Long>(); <END> try { StringBuilder queryBuilder = new StringBuilder("*:*"); addAccessRestrictions(queryBuilder, accessGroups); SolrQuery query = new SolrQuery(); query.setQuery(queryBuilder.toString()); query.setRows(0); query.addFacetField("contentType"); query.setFacetLimit(-1); QueryResponse response = this.executeQuery(query); FacetField facetField = response.getFacetField("contentType"); for (Count count : facetField.getValues()) { if (count.getName().startsWith("^text")) counts.put("text", count.getCount()); else if (count.getName().startsWith("^image")) counts.put("image", count.getCount()); else if (count.getName().startsWith("^dataset")) counts.put("dataset", count.getCount()); else if (count.getName().startsWith("^audio")) counts.put("audio", count.getCount()); else if (count.getName().startsWith("^video")) counts.put("video", count.getCount()); } } catch (SolrServerException | AccessRestrictionException e) { LOG.error("Error retrieving format counts", e); } return counts; }</code><technical_language>newer syntax for declaring collections variables? HashMap<String, Long> counts = new HashMap<>();</technical_language>

Target:
public Map<String, Long> getFormatCounts(AccessGroupSet accessGroups) { Map<String, Long> counts = new HashMap<>(); try { StringBuilder queryBuilder = new StringBuilder("*:*"); addAccessRestrictions(queryBuilder, accessGroups); SolrQuery query = new SolrQuery(); query.setQuery(queryBuilder.toString()); query.setRows(0); query.addFacetField("contentType"); query.setFacetLimit(-1); QueryResponse response = this.executeQuery(query); FacetField facetField = response.getFacetField("contentType"); for (Count count : facetField.getValues()) { if (count.getName().startsWith("^text")) counts.put("text", count.getCount()); else if (count.getName().startsWith("^image")) counts.put("image", count.getCount()); else if (count.getName().startsWith("^dataset")) counts.put("dataset", count.getCount()); else if (count.getName().startsWith("^audio")) counts.put("audio", count.getCount()); else if (count.getName().startsWith("^video")) counts.put("video", count.getCount()); } } catch (SolrServerException | AccessRestrictionException e) { LOG.error("Error retrieving format counts", e); } return counts; }
Source:
<code>public void showChargesCreatedSuccessfully(Charges changes) { <START> Toast.makeText(getActivity(), R.string.change_created_success, Toast.LENGTH_LONG) <END> .show(); }</code><technical_language>change charge_created_successfully</technical_language>

Target:
public void showChargesCreatedSuccessfully(Charges changes) { Toast.makeText(getActivity(), R.string.charge_created_success, Toast.LENGTH_LONG) .show(); }
Source:
<code>public void anAlarmNotificationIsReceivedFromAnUnknownDevice() throws Throwable { <START> PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_G_LABEL, this.deviceId.getDeviceIdG()); <END> PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }</code><technical_language>SetPushSetupAlarm tested E-meter DEVICE_IDENTIFICATION_G_LABEL -> DEVICE_IDENTIFICATION_E_LABEL getDeviceIdG -> getDeviceIdE</technical_language>

Target:
public void anAlarmNotificationIsReceivedFromAnUnknownDevice() throws Throwable { try { SimulatePushedAlarmsHooks.simulateAlarm(UnknownDevice, new byte[] { 0x2C, 0x00, 0x00, 0x01, 0x02 }); SimulatePushedAlarmsHooks.simulateAlarm(UnknownDevice, new byte[] { 0x2C, 0x04, 0x20, 0x00, 0x00 }); } catch (final Exception e) { LOGGER.error("Error occured simulateAlarm: ", e); } PROPERTIES_MAP.put(DEVICE_IDENTIFICATION_E_LABEL, this.deviceId.getDeviceIdE()); PROPERTIES_MAP.put(ORGANISATION_IDENTIFICATION_LABEL, this.organisationId.getOrganisationId()); this.RequestRunner(PROPERTIES_MAP, TEST_CASE_NAME_REQUEST, TEST_CASE_XML, TEST_SUITE_XML); }
Source:
<code>public static void setup() { Igneous.duringTele.send(mecanum); BooleanMixing.whenBooleanBecomes(octocanumShifting, true).send(new EventOutput(){ public void event(){ Igneous.duringTele.unsend(mecanum); Igneous.duringTele.send(tankDrive); } }); BooleanMixing.whenBooleanBecomes(octocanumShifting, false).send(new EventOutput(){ public void event(){ Igneous.duringTele.unsend(tankDrive); <START> Igneous.duringTele.send(mecanum); <END> } }); }</code><technical_language>Interesting choice of switch. This work, I recommend filterEvent instead - clearer doing</technical_language>

Target:
public static void setup() { octocanumShifting.toggleWhen(octocanumShiftingButton); Igneous.duringTele.send(EventMixing.filterEvent(octocanumShifting, false, mecanum)); Igneous.duringTele.send(EventMixing.filterEvent(octocanumShifting, true, DriverImpls.createTankDriverEvent(leftJoystickChannelY, rightJoystickChannelY, leftMotors, rightMotors))); }
Source:
<code>public void bindComparisonOperator() throws StandardException{ boolean nullableResult; if (singleLeftOperand) { <START> if (!rightOperandList.comparable(getLeftOperand(), false)) { <END> addCastOnRightOperandForStringToNonStringComparison(); } rightOperandList.comparable(getLeftOperand(), true); } nullableResult= leftOperandList.isNullable() || rightOperandList.isNullable(); setType(new DataTypeDescriptor(TypeId.BOOLEAN_ID,nullableResult)); }</code><technical_language>ValueNodeList.comparable() is here, return a boolean explicitly raise exception (instead of adding extra boolean parameter), surprising comparable() raise exception instead of returning true/false</technical_language>

Target:
public void bindComparisonOperator() throws StandardException{ boolean nullableResult; if (singleLeftOperand) { if (!rightOperandList.comparable(getLeftOperand())) { addCastOnRightOperandForStringToNonStringComparison(); } rightOperandList.throwIfNotComparable(getLeftOperand()); } nullableResult= leftOperandList.isNullable() || rightOperandList.isNullable(); setType(new DataTypeDescriptor(TypeId.BOOLEAN_ID,nullableResult)); }
Source:
<code>public void elementShouldContain(String locator, String text, String...params) { <START> String message = robot.getParamsValue(params, 0, ""); <END> Boolean ignoreCase = robot.getParamsValue(params, 1, Boolean.FALSE); String actual = getText(locator); String textToCompare = text; if (ignoreCase) { actual = actual.toLowerCase(); textToCompare = textToCompare.toLowerCase(); } if (!actual.contains(textToCompare)) { if (StringUtils.isBlank(message)) { message = String.format("Element should have contained text '%s', but its text was %s.", text, actual); } logging.info(String.format("Element Should Contain: %s => FAILED", text)); throw new SeleniumLibraryNonFatalException(message); } else { logging.info(String.format("Element Should Contain: %s => OK", text)); } }</code><technical_language>StringUtils commons-lang3, perhaps, [EMPTY](<LINK_0> instead of "" here</technical_language>

Target:
public void elementShouldContain(String locator, String text, String...params) { String message = robot.getParamsValue(params, 0, StringUtils.EMPTY); Boolean ignoreCase = robot.getParamsValue(params, 1, Boolean.FALSE); String actual = getText(locator); if (!textContains(actual, text, ignoreCase)) { if (StringUtils.isEmpty(message)) { message = String.format("Element should have contained text '%s', but its text was %s.", text, actual); } logging.info(String.format("Element Should Contain: %s => FAILED", text)); throw new SeleniumLibraryNonFatalException(message); } else { logging.info(String.format("Element Should Contain: %s => OK", text)); } }
Source:
<code>void nonAmphibiousMarineWithAmphibiousAssault() { testData.addTech(new ImprovedArtillerySupportAdvance(testData.gameData)); final List<Unit> amphibUnits = new ArrayList<>(); amphibUnits.addAll(testData.tank(1)); amphibUnits.addAll(testData.artillery(1)); amphibUnits.addAll(testData.marine(1)); <START> amphibUnits.forEach( <END> unit -> { unit.getProperty(Unit.UNLOADED_AMPHIBIOUS) .ifPresent( property -> { try { property.setValue(true); } catch (final MutableProperty.InvalidValueException e) { } }); }); final List<Unit> attackingUnits = new ArrayList<>(amphibUnits); attackingUnits.addAll(testData.marine(1)); final List<Unit> result = CasualtyOrderOfLosses.sortUnitsForCasualtiesWithSupport( CasualtyOrderOfLosses.Parameters.builder() .targetsToPickFrom(attackingUnits) .combatModifiers( CombatModifiers.builder().defending(false).territoryEffects(List.of()).build()) .player(testData.british) .enemyUnits(List.of()) .battlesite(testData.france) .costs(testData.costMap) .data(testData.gameData) .build()); assertThat(result, hasSize(4)); assertThat( "Non amphibious marine only has attack of 2 since it doesn't get marine bonus", result.get(0), is(attackingUnits.get(3))); assertThat(result.get(1), is(attackingUnits.get(1))); assertThat("Amphibious marine has attack of 3", result.get(2), is(attackingUnits.get(2))); assertThat(result.get(3), is(attackingUnits.get(0))); }</code><technical_language>do set property for marine units? remove forEach loop</technical_language>

Target:
void nonAmphibiousMarineWithAmphibiousAssault() { testData.addTech(new ImprovedArtillerySupportAdvance(testData.gameData)); final List<Unit> attackingUnits = new ArrayList<>(); attackingUnits.addAll(testData.tank(1)); attackingUnits.addAll(testData.artillery(1)); attackingUnits.addAll(testData.marine(1)); final List<Unit> amphibMarines = new ArrayList<>(testData.marine(1)); amphibMarines .get(0) .getProperty(Unit.UNLOADED_AMPHIBIOUS) .ifPresent( property -> { try { property.setValue(true); } catch (final MutableProperty.InvalidValueException e) { } }); attackingUnits.addAll(amphibMarines); final List<Unit> result = CasualtyOrderOfLosses.sortUnitsForCasualtiesWithSupport( CasualtyOrderOfLosses.Parameters.builder() .targetsToPickFrom(attackingUnits) .combatModifiers( CombatModifiers.builder().defending(false).territoryEffects(List.of()).build()) .player(testData.british) .enemyUnits(List.of()) .battlesite(testData.france) .costs(testData.costMap) .data(testData.gameData) .build()); assertThat(result, hasSize(4)); assertThat( "Non amphibious marine only has attack of 2 since it doesn't get marine bonus", result.get(0), is(attackingUnits.get(2))); assertThat(result.get(1), is(attackingUnits.get(1))); assertThat("Amphibious marine has attack of 3", result.get(2), is(attackingUnits.get(3))); assertThat(result.get(3), is(attackingUnits.get(0))); }
Source:
<code>protected final IMethod[] getExtractedMethods(final ICompilationUnit unit) throws JavaModelException { Assert.isNotNull(unit); final List<IJavaElement> list= new ArrayList<>(); for (IMember <START> fMember : <END> fMembers) { if (fMember instanceof IMethod) { final IJavaElement element= JavaModelUtil.findInCompilationUnit(unit, fMember); if (element instanceof IMethod && !JdtFlags.isDefaultMethod((IMethod) element)) list.add(element); } } return list.toArray(new IMethod[list.size()]); }</code><technical_language>rename member</technical_language>

Target:
protected final IMethod[] getExtractedMethods(final ICompilationUnit unit) throws JavaModelException { Assert.isNotNull(unit); final List<IJavaElement> list= new ArrayList<>(); for (IMember member : fMembers) { if (member instanceof IMethod) { final IJavaElement element= JavaModelUtil.findInCompilationUnit(unit, member); if (element instanceof IMethod && !JdtFlags.isDefaultMethod((IMethod) element)) list.add(element); } } return list.toArray(new IMethod[list.size()]); }
Source:
<code>public void define(WebService.NewController context) { WebService.NewAction action = context.createAction("reset") .setDescription("Remove a setting value.<br>" + "It's not possible to try to reset settings defined in sonar.properties.<br/>" + "Requires one of the following permissions: " + "<ul>" + "<li>'Administer System'</li>" + "<li>'Administer' rights on the specified component</li>" + "</ul>") .setSince("6.1") <START> .setChangelog(new Change("7.1", "Settings from sonar.properties are explicitly forbidden")) <END> .setPost(true) .setHandler(this); action.createParam(PARAM_KEYS) .setDescription("Comma-separated list of keys") .setExampleValue("sonar.links.scm,sonar.debt.hoursInDay") .setRequired(true); action.createParam(PARAM_COMPONENT) .setDescription("Component key") .setDeprecatedKey("componentKey", "6.3") .setExampleValue(KEY_PROJECT_EXAMPLE_001); action.createParam(PARAM_BRANCH) .setDescription("Branch key") .setExampleValue(KEY_BRANCH_EXAMPLE_001) .setInternal(true) .setSince("6.6"); }</code><technical_language>I suggest: "The settings defined in config/sonar.properties read-only changed. HTTP status 400 is returned in this case."</technical_language>

Target:
public void define(WebService.NewController context) { WebService.NewAction action = context.createAction("reset") .setDescription("Remove a setting value.<br>" + "The settings defined in config/sonar.properties are read-only and can't be changed.<br/>" + "Requires one of the following permissions: " + "<ul>" + "<li>'Administer System'</li>" + "<li>'Administer' rights on the specified component</li>" + "</ul>") .setSince("6.1") .setChangelog(new Change("7.1", "The settings defined in config/sonar.properties are read-only and can't be changed")) .setPost(true) .setHandler(this); action.createParam(PARAM_KEYS) .setDescription("Comma-separated list of keys") .setExampleValue("sonar.links.scm,sonar.debt.hoursInDay") .setRequired(true); action.createParam(PARAM_COMPONENT) .setDescription("Component key") .setDeprecatedKey("componentKey", "6.3") .setExampleValue(KEY_PROJECT_EXAMPLE_001); action.createParam(PARAM_BRANCH) .setDescription("Branch key") .setExampleValue(KEY_BRANCH_EXAMPLE_001) .setInternal(true) .setSince("6.6"); }
Source:
<code>public boolean supports(EntityType entityType) { final boolean callingFromMinecraftThread = ServerUtils.isCallingFromMainThread(); for (Tuple<DataProcessor<M, I>, Timing> tuple : this.processors) { <START> if (callingFromMinecraftThread) { <END> tuple.getSecond().startTiming(); } if (tuple.getFirst().supports(entityType)) { if (callingFromMinecraftThread) { tuple.getSecond().stopTiming(); } return true; } if (callingFromMinecraftThread) { tuple.getSecond().stopTiming(); } } return false; }</code><technical_language>I write in a try so: java try (Timing timing = callingFromMainecraftThread ? tuple.getSecond().startTiming() : null) { if (tuple.getFirst().supports(entityType)) { return true; } } return false;</technical_language>

Target:
public boolean supports(EntityType entityType) { final boolean callingFromMinecraftThread = ServerUtils.isCallingFromMainThread(); for (Tuple<DataProcessor<M, I>, Timing> tuple : this.processors) { try (Timing timing = callingFromMinecraftThread ? tuple.getSecond().startTiming() : null) { if (tuple.getFirst().supports(entityType)) { return true; } } } return false; }
Source:
<code>private Pair<Integer, Integer> getAllValuesFromMmap(ByteBuffer mmap, StoreKey keyToFind, int positiveMatchInd, int totalEntries, NavigableSet<IndexValue> values) throws IOException { byte[] buf = new byte[valueSize]; int end = positiveMatchInd; StoreKey found; do { mmap.get(buf); values.add(new IndexValue(startOffset.getName(), ByteBuffer.wrap(buf), getVersion())); end++; if (end < totalEntries) { found = getKeyAt(mmap, end); logger.trace("Index Segment {}: found at {}", indexFile.getAbsolutePath(), found, end); } else { break; } } while (found.equals(keyToFind)); end--; <START> <END> int start = positiveMatchInd; while (start > 0) { found = getKeyAt(mmap, --start); logger.trace("Index Segment {}: found at {}", indexFile.getAbsolutePath(), found, start); if (found.equals(keyToFind)) { mmap.get(buf); values.add(new IndexValue(startOffset.getName(), ByteBuffer.wrap(buf), getVersion())); } else { start++; break; } } return new Pair<>(start, end); }</code><technical_language>I this simpler: java for (end = positiveMatchInd; end < totalEntries && getKeyAt(mmap, end).equals(keyToFind); end++) { mmap.get(buf); values.add(new IndexValue(startOffset.getName(), ByteBuffer.wrap(buf), getVersion())); } for (start = positiveMatchInd - 1; start >= 0 && getKeyAt(mmap, start).equals(keyToFind); start--) { mmap.get(buf); values.add(new IndexValue(startOffset.getName(), ByteBuffer.wrap(buf), getVersion())); }</technical_language>

Target:
private Pair<Integer, Integer> getAllValuesFromMmap(ByteBuffer mmap, StoreKey keyToFind, int positiveMatchInd, int totalEntries, NavigableSet<IndexValue> values) throws IOException { byte[] buf = new byte[valueSize]; int end = positiveMatchInd; for (; end < totalEntries && getKeyAt(mmap, end).equals(keyToFind); end++) { logger.trace("Index Segment {}: found at {}", indexFile.getAbsolutePath(), keyToFind, end); mmap.get(buf); values.add(new IndexValue(startOffset.getName(), ByteBuffer.wrap(buf), getVersion())); } end--; int start = positiveMatchInd - 1; for (; start >= 0 && getKeyAt(mmap, start).equals(keyToFind); start--) { logger.trace("Index Segment {}: found at {}", indexFile.getAbsolutePath(), keyToFind, start); mmap.get(buf); values.add(new IndexValue(startOffset.getName(), ByteBuffer.wrap(buf), getVersion())); } return new Pair<>(start, end); }
Source:
<code>private void writeNumaTune() { NumaTuneMode numaTune = vm.getNumaTuneMode(); if (numaTune == null) { return; } Map<String, Object> numaTuneSetting = NumaSettingFactory.buildVmNumatuneSetting( numaTune, vmNumaNodesSupplier.get()); if (numaTuneSetting.isEmpty()) { return; } <START> String nodeSet = (String) numaTuneSetting.get(VdsProperties.NUMA_TUNE_NODESET); <END> String mode = (String) numaTuneSetting.get(VdsProperties.NUMA_TUNE_MODE); @SuppressWarnings("unchecked") List<Map<String, String>> memNodes = (List<Map<String, String>>) numaTuneSetting.get(VdsProperties.NUMA_TUNE_MEMNODES); if (nodeSet != null || memNodes != null) { writer.writeStartElement("numatune"); if (memNodes != null) { for (Map<String, String> memnode : memNodes) { writer.writeStartElement("memnode"); writer.writeAttributeString("mode", mode); writer.writeAttributeString("cellid", (String) memnode.get(VdsProperties.NUMA_TUNE_VM_NODE_INDEX)); writer.writeAttributeString("nodeset", (String) memnode.get(VdsProperties.NUMA_TUNE_NODESET)); writer.writeEndElement(); } } writer.writeEndElement(); } }</code><technical_language>this removed</technical_language>

Target:
private void writeNumaTune() { NumaTuneMode numaTune = vm.getNumaTuneMode(); if (numaTune == null) { return; } Map<String, Object> numaTuneSetting = NumaSettingFactory.buildVmNumatuneSetting( numaTune, vmNumaNodesSupplier.get()); if (numaTuneSetting.isEmpty()) { return; } String mode = (String) numaTuneSetting.get(VdsProperties.NUMA_TUNE_MODE); @SuppressWarnings("unchecked") List<Map<String, String>> memNodes = (List<Map<String, String>>) numaTuneSetting.get(VdsProperties.NUMA_TUNE_MEMNODES); if (memNodes != null) { writer.writeStartElement("numatune"); if (memNodes != null) { for (Map<String, String> memnode : memNodes) { writer.writeStartElement("memnode"); writer.writeAttributeString("mode", mode); writer.writeAttributeString("cellid", (String) memnode.get(VdsProperties.NUMA_TUNE_VM_NODE_INDEX)); writer.writeAttributeString("nodeset", (String) memnode.get(VdsProperties.NUMA_TUNE_NODESET)); writer.writeEndElement(); } } writer.writeEndElement(); } }
Source:
<code>public void tryEvaluateWithAll(String expression, Type expectedType) { <START> executeProjectionWithAll(expression, expectedType, session, compiler); <END> }</code><technical_language>this call other tryEvaluateWithAll method</technical_language>

Target:
public void tryEvaluateWithAll(String expression, Type expectedType) { tryEvaluateWithAll(expression, expectedType, session); }
Source:
<code>private void waitUntilReadyToServeClients(List<String> clients) { Awaitility.await() .atMost(60, TimeUnit.SECONDS) .pollInterval(500, TimeUnit.MILLISECONDS) .until(() -> { try { clients.forEach(client -> timelockServiceForClient(client).getFreshTimestamp()); <START> timelockServiceForClient(defaultClient).getFreshTimestamp(); <END> return true; } catch (Throwable t) { return false; } }); }</code><technical_language>nit: a bit unexpected waitUntilReadyToServeClients(clients) talks default client, suggest factories pass ImmutableList.of(defaultClient) [defaultClient + additionalClients] (don't remember efficient syntax offhand), parameter named additionalClients</technical_language>

Target:
private void waitUntilReadyToServeClients(List<String> clients) { Awaitility.await() .atMost(60, TimeUnit.SECONDS) .pollInterval(500, TimeUnit.MILLISECONDS) .until(() -> { try { clients.forEach(name -> timelockServiceForClient(name).getFreshTimestamp()); return true; } catch (Throwable t) { return false; } }); }
Source:
<code>public boolean checkRootByBuildTags() { String buildTags = android.os.Build.TAGS; if (buildTags != null && buildTags.contains(SU_TAG)) { <START> if (Constants.DEBUG_MODE_ENABLED) { <END> Log.d(TAG, "Build tags are found in the device"); } return false; } return false; }</code><technical_language>This file revert.right</technical_language>

Target:
public boolean checkRootByBuildTags() { String buildTags = android.os.Build.TAGS; if (buildTags != null && buildTags.contains(SU_TAG)) { if (Constants.DEBUG_MODE_ENABLED) { Log.d(TAG, "Build tags are found in the device"); } return true; } return false; }
Source:
<code>public void selectNodeByXpath() { final DetailAST rootAST = (DetailAST) tree.getModel().getRoot(); if (rootAST.hasChildren()) { final String xpath = "/EOF" + xpathEditor.getText(); final Deque<DetailAST> nodes = new ArrayDeque<>(); if (search(rootAST, xpath, nodes)) { TreePath path = new TreePath(nodes.pop()); while (!nodes.isEmpty()) { path = path.pathByAddingChild(nodes.pop()); if (!tree.isExpanded(path)) { tree.expandPath(path); } tree.setSelectionPath(path); makeCodeSelection(); } } else { <START> xpathEditor.setText(xpathEditor.getText() + "- wrong xpath query"); <END> } } else { xpathEditor.setText("No file Opened"); } }</code><technical_language>\n^ wrong xpath query</technical_language>

Target:
public void selectNodeByXpath() { final DetailAST rootAST = (DetailAST) tree.getModel().getRoot(); if (rootAST.hasChildren()) { final String xpath = "/EOF" + xpathEditor.getText(); final Deque<DetailAST> nodes = new ArrayDeque<>(); if (search(rootAST, xpath, nodes)) { TreePath path = new TreePath(nodes.pop()); while (!nodes.isEmpty()) { path = path.pathByAddingChild(nodes.pop()); if (!tree.isExpanded(path)) { tree.expandPath(path); } tree.setSelectionPath(path); makeCodeSelection(); } } else { xpathEditor.setText(xpathEditor.getText() + "\n^ wrong xpath query"); } } else { xpathEditor.setText("No file Opened"); } }
Source:
<code>public void testBug487151_Classes(final Comparison comparison, final CompareTestSupport support) { final List<Diff> differences = comparison.getDifferences(); final List<Conflict> conflicts = comparison.getConflicts(); assertEquals(69, differences.size()); assertEquals(4, conflicts.size()); Iterable<Conflict> realConflicts = filter(conflicts, containsConflictOfTypes(ConflictKind.REAL)); assertEquals(2, size(realConflicts)); assertTrue(all(differences, hasState(DifferenceState.UNRESOLVED))); Iterable<Diff> nonConflictingDifferences = acceptNonConflictingChanges(comparison); assertFalse(isEmpty(nonConflictingDifferences)); final List<Diff> conflictingDifferences = collectDifferences(realConflicts); assertFalse(conflictingDifferences.isEmpty()); assertTrue(all(nonConflictingDifferences, hasState(DifferenceState.MERGED))); assertTrue(all(conflictingDifferences, hasState(DifferenceState.UNRESOLVED))); EObject root = getLeftUMLRoot(comparison); assertNotNull(root); assertTrue(root instanceof Model); Model model = (Model)root; Package package1 = (Package)model.getPackagedElement("Package1"); assertNotNull(package1); PackageableElement class1 = package1.getPackagedElement("Class1"); assertNull(class1); PackageableElement class2 = package1.getPackagedElement("Class2"); assertNotNull(class2); Class class2class = (Class)class2; assertEquals(1, class2class.getGeneralizations().size()); Generalization class2generalization = class2class.getGeneralizations().get(0); Classifier class2superclass = class2generalization.getGeneral(); <START> assertNull(class2superclass); <END> }</code><technical_language>inline this variable</technical_language>

Target:
public void testBug487151_Classes(final Comparison comparison, final CompareTestSupport support) { final List<Diff> differences = comparison.getDifferences(); final List<Conflict> conflicts = comparison.getConflicts(); Iterable<Conflict> realConflicts = filter(conflicts, containsConflictOfTypes(ConflictKind.REAL)); assertEquals(2, size(realConflicts)); assertTrue(all(differences, hasState(DifferenceState.UNRESOLVED))); Iterable<Diff> nonConflictingDifferences = acceptNonConflictingChanges(comparison); assertFalse(isEmpty(nonConflictingDifferences)); final List<Diff> conflictingDifferences = collectDifferences(realConflicts); assertFalse(conflictingDifferences.isEmpty()); assertTrue(all(nonConflictingDifferences, hasState(DifferenceState.MERGED))); assertTrue(all(conflictingDifferences, hasState(DifferenceState.UNRESOLVED))); EObject root = getLeftUMLRoot(comparison); assertNotNull(root); assertTrue(root instanceof Model); Model model = (Model)root; Package package1 = (Package)model.getPackagedElement("Package1"); assertNotNull(package1); PackageableElement class1 = package1.getPackagedElement("Class1"); assertNull(class1); PackageableElement class2 = package1.getPackagedElement("Class2"); assertNotNull(class2); Class class2class = (Class)class2; assertTrue(class2class.getGeneralizations().isEmpty()); }
Source:
<code>private static IResource getResource(String path) throws CoreException { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject project = root.getProject(TmfCommonConstants.DEFAULT_TRACE_PROJECT_NAME); IPath iPath = org.eclipse.core.runtime.Path.forPosix(path); String[] segments = iPath.segments(); IFolder folder = null; if (segments.length > 1) { folder = project.getFolder(segments[0]); if (!folder.exists()) { folder.create(true, true, null); } for (int i = 1; i < segments.length - 1; i++) { folder = folder.getFolder(segments[i]); if (!folder.exists()) { folder.create(true, true, null); } } } String lastSegment = segments[segments.length - 1]; IResource resource; if (iPath.toFile().isFile()) { IFile iFile = folder != null ? folder.getFile(lastSegment) : project.getFile(lastSegment); iFile.createLink(iPath, IResource.REPLACE, null); resource = iFile; } else { IFolder iFolder = folder != null ? folder.getFolder(lastSegment) : project.getFolder(lastSegment); iFolder.createLink(iPath, IResource.REPLACE, null); resource = iFolder; } String ws = root.getRawLocation().toOSString(); String suppFolder = <START> ws + resource.getFullPath().toString(); <END> File suppFile = new File(suppFolder); suppFile.mkdir(); resource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, suppFolder); return resource; }</code><technical_language>this result in file system path of trace in workspace. So, for CTF works a directory. File file traces wouldn't. subdirectory ws (e.g. .traccing) create suppl. that</technical_language>

Target:
private static IResource getResource(String path) throws CoreException { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject project = root.getProject(TmfCommonConstants.DEFAULT_TRACE_PROJECT_NAME); IPath iPath = org.eclipse.core.runtime.Path.forPosix(path); IResource resource = null; boolean isSuccess = false; if (new File(path).isFile()) { IFile file = project.getFile(path); createFolder((IFolder) file.getParent(), null); isSuccess = ResourceUtil.createSymbolicLink(file, iPath, true, null); resource = file; } else { IFolder folder = project.getFolder(path); createFolder((IFolder) folder.getParent(), null); isSuccess = ResourceUtil.createSymbolicLink(folder, iPath, true, null); resource = folder; } if (!isSuccess) { return null; } IFolder supplRootFolder = project.getFolder(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER_NAME); IFolder supplFolder = supplRootFolder.getFolder(path); createFolder(supplFolder, null); resource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, supplFolder.getLocation().toOSString()); return resource; }