auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void shouldSaveAndUpdateOrderSet() throws Exception { executeDataSet(ORDER_SET); OrderSet orderSet = orderSetBuilder(false, false); orderSet.setRetired(true); OrderSet orderSetObj = orderSetService.save(orderSet); assertEquals("OrderSet should contain orderSetmembers", 1, orderSetObj.getOrderSetMembers().size()); orderSetObj.setOperator(OrderSet.Operator.ONE); orderSetObj.setDescription("Test Order Set Description Updated"); orderSetObj.setOrderSetMembers(new HashSet<OrderSetMember>()); orderSetObj = orderSetService.save(orderSetObj); assertNotNull("OrderSet has a order_set_id", orderSetObj.getId().intValue()); assertEquals("OrderSet has updated description", "Test Order Set Description Updated", orderSetObj.getDescription()); assertEquals("OrderSet has updated operator", "ONE", orderSetObj.getOperator().toString()); <START> assertEquals("OrderSet should not contain orderSetmembers", 0, orderSetObj.getOrderSetMembers().size()); <END> }</code><technical_language>assert dateChanged changedBy set? need sanity checks saving ensure null</technical_language>

Target:
public void shouldSaveAndUpdateOrderSet() throws Exception { executeDataSet(ORDER_SET); OrderSet orderSet = orderSetBuilder(false, false); OrderSet orderSetObj = orderSetService.saveOrderSet(orderSet); orderSetObj.setOperator(OrderSet.Operator.ONE); orderSetObj.setDescription("Test Order Set Description Updated"); assertNull("OrderSet is new and is not changed", orderSetObj.getChangedBy()); assertNull("OrderSet is new and has no change date", orderSetObj.getDateChanged()); orderSetService.saveOrderSet(orderSetObj); Context.flushSession(); assertNotNull("OrderSet has a order_set_id", orderSetObj.getId().intValue()); assertEquals("OrderSet has updated description", "Test Order Set Description Updated", orderSetObj.getDescription()); assertEquals("OrderSet has updated operator", "ONE", orderSetObj.getOperator().toString()); assertNotNull("OrderSet has been changed", orderSetObj.getChangedBy()); assertNotNull("OrderSet has been changed on some date", orderSetObj.getDateChanged()); }
Source:
<code>private String[] getPathArray(String field) { if (field.equals(fPathAsString)) { return fPathAsArray; } StringBuilder sb = new StringBuilder(); List<String> list = new ArrayList<>(); for (int i = 1; i < field.length(); i++) { char charAt = field.charAt(i); if (charAt == SLASH) { list.add(sb.toString()); sb = new StringBuilder(); } else if (charAt == BACKSLASH) { if (i != field.length() - 1) { char nextChar = field.charAt(++i); if (nextChar == SLASH) { sb.append(SLASH); } else { sb.append(BACKSLASH); i--; } } else { sb.append(BACKSLASH); } } else { sb.append(charAt); } } <START> if (sb.toString() != null && sb.toString() != EMPTY_STRING ) { <END> list.add(sb.toString()); } String[] array = new String[list.size()]; list.toArray(array); fPathAsString = field; fPathAsArray = array; return array; }</code><technical_language>sb.toString() buffered created twice. sb.toString afaik null !sb.toString().isEmpty() please</technical_language>

Target:
private String[] getPathArray(String field) { if (field.equals(fPathAsString)) { return fPathAsArray; } StringBuilder sb = new StringBuilder(); List<String> list = new ArrayList<>(); for (int i = 1; i < field.length(); i++) { char charAt = field.charAt(i); if (charAt == SLASH) { list.add(sb.toString()); sb = new StringBuilder(); } else if (charAt == BACKSLASH) { if (i != field.length() - 1) { char nextChar = field.charAt(++i); if (nextChar == SLASH) { sb.append(SLASH); } else { sb.append(BACKSLASH); i--; } } else { sb.append(BACKSLASH); } } else { sb.append(charAt); } } list.add(sb.toString()); String[] array = new String[list.size()]; list.toArray(array); fPathAsString = field; fPathAsArray = array; return array; }
Source:
<code>private static int getNeededNumberOfUsbControllers(int numberOfSlots) { int numOfcontrollers = numberOfSlots / SLOTS_PER_CONTROLLER; if (numOfcontrollers == 0) { numOfcontrollers = 1; } <START> return numOfcontrollers; <END> }</code><technical_language>function return math.max(numberOfSlots / SLOTS_PER_CONTROLLER, 1);</technical_language>

Target:
private static int getNeededNumberOfUsbControllers(int numberOfSlots) { int numOfcontrollers = numberOfSlots / SLOTS_PER_CONTROLLER; if (numberOfSlots > 0 && numOfcontrollers == 0) { numOfcontrollers = 1; } return numOfcontrollers; }
Source:
<code>private Optional<ProcessResult> run(String[] command, Path dir) { ProcessRunner runner = new ProcessRunner(command, dir); try { return Optional.of(runner.call()); <START> } catch (Exception e) { <END> return Optional.absent(); } }</code><technical_language>catch relevant exceptions log</technical_language>

Target:
private Optional<ProcessResult> run(String[] command, Path dir) { ProcessRunner runner = new ProcessRunner(command, dir); try { return Optional.of(runner.call()); } catch (Exception e) { log.error("Running command {0} failed {1}", Arrays.deepToString(command), e); return Optional.absent(); } }
Source:
<code>protected ObjectField updateSort() { ObjectType selectedType = search.getSelectedType(); ToolUi ui = selectedType == null ? null : selectedType.as(ToolUi.class); if (search.getEffectiveSort() == null) { if (ui != null && ui.getDefaultSortField() != null) { <START> search.setSorts(ui.getDefaultSortField()); <END> } else if (!ObjectUtils.isBlank(search.getQueryString())) { search.setSorts(Search.RELEVANT_SORT_VALUE); } else { Map<String, String> f = search.getFieldFilters().get("cms.content.publishDate"); if (f != null && (f.get("") != null || f.get("x") != null)) { search.setSorts("cms.content.publishDate"); } else { search.setSorts("cms.content.updateDate"); } } } if (selectedType != null) { return selectedType.getFieldGlobally(search.getEffectiveSort()); } else { return Database.Static.getDefault().getEnvironment().getField(search.getEffectiveSort()); } }</code><technical_language>Search#setSort(String) API implementation changed encapsulate Search#setSorts(String) is doing? point 4 API calls need change. question applied Search#getSort Search#getEffectiveSort 3 more unchanged API calls</technical_language>

Target:
protected ObjectField updateSort() { ObjectType selectedType = search.getSelectedType(); ToolUi ui = selectedType == null ? null : selectedType.as(ToolUi.class); if (search.getSort() == null) { if (ui != null && ui.getDefaultSortField() != null) { search.setSort(ui.getDefaultSortField()); } else if (!ObjectUtils.isBlank(search.getQueryString())) { search.setSort(Search.RELEVANT_SORT_VALUE); } else { Map<String, String> f = search.getFieldFilters().get("cms.content.publishDate"); if (f != null && (f.get("") != null || f.get("x") != null)) { search.setSort("cms.content.publishDate"); } else { search.setSort("cms.content.updateDate"); } } } if (selectedType != null) { return selectedType.getFieldGlobally(search.getSort()); } else { return Database.Static.getDefault().getEnvironment().getField(search.getSort()); } }
Source:
<code>private void writeConfigToFile( Config config, File file ) { try { Writer fileWriter = new BufferedWriter( new FileWriter( file ) ); for ( Map.Entry<String,String> entry : config.getRaw().entrySet() ) { fileWriter.write( String.format( "%s=%s\n", entry.getKey(), entry.getValue() ) ); } fileWriter.close(); } catch ( IOException e ) { <START> e.printStackTrace(); <END> } }</code><technical_language>a good handling of exception? able continue if this fails</technical_language>

Target:
private void writeConfigToFile( Config config, File file ) throws IOException { try ( Writer fileWriter = new BufferedWriter( new FileWriter( file ) ) ) { for ( Map.Entry<String,String> entry : config.getRaw().entrySet() ) { fileWriter.write( String.format( "%s=%s\n", entry.getKey(), entry.getValue() ) ); } } }
Source:
<code>private static Map<Name, DataType> nameToDataType() { <START> Map<Name, DataType> dataTypesByDataTypeName = new HashMap<Name, DataType>(16); <END> for (DataType dataType : DataType.allPrimitiveTypes()) { dataTypesByDataTypeName.put(dataType.getName(), dataType); } return dataTypesByDataTypeName; }</code><technical_language>nameToDataType</technical_language>

Target:
private static Map<Name, DataType> nameToDataType() { Map<Name, DataType> nameToDataType = new HashMap<Name, DataType>(16); for (DataType dataType : DataType.allPrimitiveTypes()) { nameToDataType.put(dataType.getName(), dataType); } return nameToDataType; }
Source:
<code>public void compactTableHighDeltaPct() throws Exception { Table t = newTable("default", "cthdp", false); addBaseFile(t, null, 20L, 20); addDeltaFile(t, null, 21L, 22L, 2); addDeltaFile(t, null, 23L, 24L, 2); burnThroughTransactions("default", "cthdp", 23); long txnid = openTxn(); LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.TABLE, "default"); comp.setTablename("cthdp"); comp.setOperationType(DataOperationType.UPDATE); List<LockComponent> components = new ArrayList<LockComponent>(1); components.add(comp); LockRequest req = new LockRequest(components, "me", "localhost"); req.setTxnid(txnid); LockResponse res = txnHandler.lock(req); long writeid = allocateWriteId("default", "cthdp", txnid); <START> assert(writeid==txnid); <END> txnHandler.commitTxn(new CommitTxnRequest(txnid)); startInitiator(); ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest()); List<ShowCompactResponseElement> compacts = rsp.getCompacts(); Assert.assertEquals(1, compacts.size()); Assert.assertEquals("initiated", compacts.get(0).getState()); Assert.assertEquals("cthdp", compacts.get(0).getTablename()); Assert.assertEquals(CompactionType.MAJOR, compacts.get(0).getType()); }</code><technical_language>this assert mean? I in a places in this file</technical_language>

Target:
public void compactTableHighDeltaPct() throws Exception { Table t = newTable("default", "cthdp", false); addBaseFile(t, null, 20L, 20); addDeltaFile(t, null, 21L, 22L, 2); addDeltaFile(t, null, 23L, 24L, 2); burnThroughTransactions("default", "cthdp", 23); long txnid = openTxn(); LockComponent comp = new LockComponent(LockType.SHARED_WRITE, LockLevel.TABLE, "default"); comp.setTablename("cthdp"); comp.setOperationType(DataOperationType.UPDATE); List<LockComponent> components = new ArrayList<LockComponent>(1); components.add(comp); LockRequest req = new LockRequest(components, "me", "localhost"); req.setTxnid(txnid); LockResponse res = txnHandler.lock(req); long writeid = allocateWriteId("default", "cthdp", txnid); Assert.assertEquals(24, writeid); txnHandler.commitTxn(new CommitTxnRequest(txnid)); startInitiator(); ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest()); List<ShowCompactResponseElement> compacts = rsp.getCompacts(); Assert.assertEquals(1, compacts.size()); Assert.assertEquals("initiated", compacts.get(0).getState()); Assert.assertEquals("cthdp", compacts.get(0).getTablename()); Assert.assertEquals(CompactionType.MAJOR, compacts.get(0).getType()); }
Source:
<code>public Block getBlock(int x, int y, int z) { int chunkX = x >> 4; int chunkZ = z >> 4; <START> return getChunk(chunkX, chunkZ).getBlock(x - chunkX * 16, y, z - chunkZ * 16); <END> }</code><technical_language>if chunk fails? This throw a NP</technical_language>

Target:
public Block getBlock(int x, int y, int z) { return null; }
Source:
<code>public boolean isClosed() { <START> return "delete".equals(getAdditionalInfo("osmand_change")); <END> }</code><technical_language>If please define constant code</technical_language>

Target:
public boolean isClosed() { return OSM_DELETE_VALUE.equals(getAdditionalInfo(OSM_DELETE_TAG)); }
Source:
<code>public void updateHostStatusAfterSuccessfulUpgrade() { VdsDynamic dynamicHostData = hostDao.get(getVdsId()); dynamicHostData.setUpdateAvailable(false); hostDao.update(dynamicHostData); if (getVds().getVdsType() == VDSType.VDS) { reestablishConnectionIfNeeded(); if (getParameters().getInitialStatus() == VDSStatus.Maintenance) { setVdsStatus(VDSStatus.Maintenance); } else { <START> if (getVds().getHighlyAvailableIsConfigured()) { SetHaMaintenanceModeVDSCommandParameters param = new SetHaMaintenanceModeVDSCommandParameters(getVds(), HaMaintenanceMode.LOCAL, false); if (!runVdsCommand(VDSCommandType.SetHaMaintenanceMode, param).getSucceeded()) { <END> log.error("Failed to set local maintenance mode to none for host '{}' after upgrade has ended.", getVdsName()); } } setVdsStatus(VDSStatus.Initializing); } } }</code><technical_language>this is exist in ActivateVdsCommand, extracted a method in VdsCommand is base class of host commands</technical_language>

Target:
public void updateHostStatusAfterSuccessfulUpgrade() { VdsDynamic dynamicHostData = hostDao.get(getVdsId()); dynamicHostData.setUpdateAvailable(false); hostDao.update(dynamicHostData); if (getVds().getVdsType() == VDSType.VDS) { reestablishConnectionIfNeeded(); if (getParameters().getInitialStatus() == VDSStatus.Maintenance) { setVdsStatus(VDSStatus.Maintenance); } else { if (getVds().getHighlyAvailableIsConfigured()) { haMaintenanceFailed = setHaLocalMaintenanceMode(getVds(), false); } setVdsStatus(VDSStatus.Initializing); } } }
Source:
<code>public Map<String, PartitionStatistics> getPartitionStatistics(String databaseName, String tableName, Set<String> partitionNames) { <START> return getPartitionsByNames(databaseName, tableName, ImmutableList.copyOf(partitionNames)) <END> .entrySet() .stream() .map(entry -> new AbstractMap.SimpleImmutableEntry<>(entry.getKey(), entry.getValue() .orElseThrow(() -> new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), toPartitionValues(entry.getKey()))))) .collect(toImmutableMap(Entry::getKey, entry -> new PartitionStatistics(getHiveBasicStatistics(entry.getValue().getParameters()), ImmutableMap.of()))); }</code><technical_language>This is a bit hard follow. map() call creates a new Entry unnecessary is avoid a long expression call creating PartitionStatistics. replace collect() lambda a multi-line block variable, a normal loop immutable map builder</technical_language>

Target:
public synchronized Map<String, PartitionStatistics> getPartitionStatistics(String databaseName, String tableName, Set<String> partitionNames) { Table table = getRequiredTable(databaseName, tableName); ImmutableMap.Builder<String, PartitionStatistics> statistics = ImmutableMap.builder(); for (String partitionName : partitionNames) { List<String> partitionValues = extractPartitionKeyValues(partitionName); Path partitionDirectory = getPartitionMetadataDirectory(table, ImmutableList.copyOf(partitionValues)); PartitionMetadata partitionMetadata = readSchemaFile("partition", partitionDirectory, partitionCodec) .orElseThrow(() -> new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), partitionValues)); HiveBasicStatistics basicStatistics = getHiveBasicStatistics(partitionMetadata.getParameters()); statistics.put(partitionName, new PartitionStatistics(basicStatistics, partitionMetadata.getColumnStatistics())); } return statistics.build(); }
Source:
<code>public void testSetValue() { fixture.setValue("dummy"); String result = fixture.getValue(); assertNotNull(result); <START> assertEquals(result, "dummy"); <END> }</code><technical_language>order of arguments in assert*() is counter-intuitive... (expected, actual). Technically 'result' variables second</technical_language>

Target:
public void testSetValue() { fixture.setValue("dummy"); String result = fixture.getValue(); assertNotNull(result); assertEquals("dummy", result); }
Source:
<code><START> private int getVisibility(int memberIndex) throws CoreException { <END> int targetVisibilityBytes = memberIndex / VISIBILITY_VALUES_PER_BYTE; int visibilityBlockOffset = memberIndex % VISIBILITY_VALUES_PER_BYTE; int visibilityMask = VISIBILITY_MASK << visibilityBlockOffset * VISIBILITY_BITS; long visibilityOffset = record + MEMBER_VISIBILITIES + targetVisibilityBytes; int currentVisibility = getDB().getByte(visibilityOffset); int maskedVisibility = currentVisibility & visibilityMask; maskedVisibility >>>= visibilityBlockOffset * VISIBILITY_BITS; return maskedVisibility; }</code><technical_language>Apply changes similar setVisibility</technical_language>

Target:
private int getVisibility(int memberIndex) throws CoreException { int visibilityBitOffset = memberIndex % VISIBILITY_VALUES_PER_BYTE; long visibilityOffset = record + MEMBER_VISIBILITIES + memberIndex / VISIBILITY_VALUES_PER_BYTE; int visibility = getDB().getByte(visibilityOffset); visibility &= VISIBILITY_MASK << visibilityBitOffset * VISIBILITY_BITS; visibility >>>= visibilityBitOffset * VISIBILITY_BITS; return visibility; }
Source:
<code>public SystemTagInventory createNonInherentSystemTag(String resourceUuid, String tag, String resourceType) { if (isTagExisting(resourceUuid, tag, TagType.System, resourceType)) { return null; } validateSystemTag(resourceUuid, resourceType, tag); <START> String sql =String.format("select vo.uuid from %s vo where " + <END> " vo.uuid = :resourceUuid",resourceType); TypedQuery<String> q = dbf.getEntityManager().createQuery(sql, String.class); q.setParameter("resourceUuid",resourceUuid); List<String> resultUuids = q.getResultList(); if (resultUuids.size()<=0){ throw new OperationFailureException(errf.instantiateErrorCode( TagErrors.NOT_MATCH_UUID, "The argument :'resourceType' doesn't match uuid")); } SystemTagVO vo = new SystemTagVO(); vo.setResourceType(resourceType); vo.setUuid(Platform.getUuid()); vo.setResourceUuid(resourceUuid); vo.setInherent(false); vo.setTag(tag); vo.setType(TagType.System); preTagCreated(SystemTagInventory.valueOf(vo)); vo = dbf.persistAndRefresh(vo); SystemTagInventory inv = SystemTagInventory.valueOf(vo); final SystemTagVO finalVo = vo; Defer.guard(new Runnable() { @Override public void run() { dbf.remove(finalVo); } }); fireTagCreated(list(inv)); return inv; }</code><technical_language>select count(vo) %s vo vo.uuid = :resourceUuid long count;</technical_language>

Target:
public SystemTagInventory createNonInherentSystemTag(String resourceUuid, String tag, String resourceType) { if (isTagExisting(resourceUuid, tag, TagType.System, resourceType)) { return null; } validateSystemTag(resourceUuid, resourceType, tag); SystemTagVO vo = new SystemTagVO(); vo.setResourceType(resourceType); vo.setUuid(Platform.getUuid()); vo.setResourceUuid(resourceUuid); vo.setInherent(false); vo.setTag(tag); vo.setType(TagType.System); preTagCreated(SystemTagInventory.valueOf(vo)); vo = dbf.persistAndRefresh(vo); SystemTagInventory inv = SystemTagInventory.valueOf(vo); final SystemTagVO finalVo = vo; Defer.guard(new Runnable() { @Override public void run() { dbf.remove(finalVo); } }); fireTagCreated(list(inv)); return inv; }
Source:
<code>public ListenableFuture<List<Split>> getNextBatch(int maxSize) { <START> checkState(splitSchedulingStrategy == SplitSchedulingStrategy.ALL_AT_ONCE); <END> ListenableFuture<List<ConnectorSplit>> nextBatch = toListenableFuture(source.getNextBatch(maxSize)); return Futures.transform(nextBatch, splits -> Lists.transform(splits, split -> new Split(connectorId, transactionHandle, split))); }</code><technical_language>remove this force callers tot new style</technical_language>

Target:
public ListenableFuture<List<Split>> getNextBatch(int maxSize) { checkState(splitSchedulingStrategy == UNGROUPED_SCHEDULING); ListenableFuture<List<ConnectorSplit>> nextBatch = toListenableFuture(source.getNextBatch(maxSize)); return Futures.transform(nextBatch, splits -> Lists.transform(splits, split -> new Split(connectorId, transactionHandle, split))); }
Source:
<code>public void checkAttributeSemantics(PerunSessionImpl sess, Member member, Attribute attribute) throws InternalErrorException, WrongReferenceAttributeValueException { <START> if (!attribute.equals(getAttributeValue(sess, member, attribute))) throw new WrongReferenceAttributeValueException(attribute, member, "Attribute value is not the highest value from member's UserExtSources Loas."); <END> }</code><technical_language>Reference attribute is this attribute get method getAttributeValue(sess, member, attribute) is weird, it</technical_language>

Target:
public void checkAttributeSemantics(PerunSessionImpl sess, Member member, Attribute attribute) throws InternalErrorException, WrongReferenceAttributeValueException { Attribute currentAttribute = getAttributeValue(sess, member, attribute); if(!attribute.equals(currentAttribute)) throw new WrongReferenceAttributeValueException(attribute, currentAttribute, member, null, member, null, "Attribute value is not the highest value from member's UserExtSources Loas."); }
Source:
<code>public DockerImageName asCompatibleSubstituteFor(DockerImageName otherImageName) { <START> return new DockerImageName(rawName, registry, repo, versioning, otherImageName); <END> }</code><technical_language>Consider adding @With(AccessLevel.PRIVATE) otherImageName, do: suggestion return withOtherImageName(otherImageName);</technical_language>

Target:
public DockerImageName asCompatibleSubstituteFor(DockerImageName otherImageName) { return withCompatibleSubstituteFor(otherImageName); }
Source:
<code>public List<String> getInvalidityInfo() { FieldValidator validator = new FieldValidator(); List<String> errors = new ArrayList<String>(); errors.add(validator.getInvalidityInfoForFeedbackSessionName(feedbackSessionName)); errors.add(validator.getInvalidityInfoForCourseId(courseId)); String error = validator.getInvalidityInfoForEmail(creatorEmail); if (!error.isEmpty()) { <START> StringBuffer stringbuff = new StringBuffer(); <END> stringbuff.append("Invalid creator's email: ").append(error); error = stringbuff.toString(); } errors.add(error); errors.addAll(validator.getValidityInfoForFeedbackParticipantType(giverType, recipientType)); errors.addAll(validator.getValidityInfoForFeedbackResponseVisibility(showResponsesTo, showGiverNameTo, showRecipientNameTo)); return getNonEmptyErrors(errors); }</code><technical_language>stringbuff -> buffer</technical_language>

Target:
public List<String> getInvalidityInfo() { FieldValidator validator = new FieldValidator(); List<String> errors = new ArrayList<String>(); addNonEmptyError(validator.getInvalidityInfoForFeedbackSessionName(feedbackSessionName), errors); addNonEmptyError(validator.getInvalidityInfoForCourseId(courseId), errors); String error = validator.getInvalidityInfoForEmail(creatorEmail); if (!error.isEmpty()) { error = new StringBuffer() .append("Invalid creator's email: ") .append(error) .toString(); } addNonEmptyError(error, errors); errors.addAll(validator.getValidityInfoForFeedbackParticipantType(giverType, recipientType)); errors.addAll(validator.getValidityInfoForFeedbackResponseVisibility(showResponsesTo, showGiverNameTo, showRecipientNameTo)); return errors; }
Source:
<code>protected void checkAttributesMatch(EventEnvelope event) throws IllegalArgumentException { super.checkAttributesMatch(event); <START> ensureExternalMatch(event.context() <END> .getExternal()); }</code><technical_language>EventEnvelope.isExternal() for this, please</technical_language>

Target:
protected void checkAttributesMatch(EventEnvelope event) throws IllegalArgumentException { super.checkAttributesMatch(event); ensureExternalMatch(event.isExternal()); }
Source:
<code>void invalidateSessionSecure(String subjectName) { String cacheKey = cookieCache.getCacheKeyBySubjectName(subjectName, securityManager); if (cacheKey == null) { LOGGER.debug( "No cache element found for subject name {}; skipping invalidation.", subjectName); return; } LogoutState logoutState = new LogoutState(getActiveSps(cacheKey)); logoutState.setOriginalIssuer(""); logoutState.setNameId(subjectName); logoutState.setOriginalRequestId(UUID.randomUUID().toString()); <START> String relayState = UUID.randomUUID().toString(); <END> logoutState.setInitialRelayState(relayState); logoutStates.encode(cacheKey, logoutState); cookieCache.removeSamlAssertion(cacheKey); asyncLogoutService.submit(() -> asyncBackchannelLogout(cacheKey, logoutState)); }</code><technical_language>need validate relay state need save this somehow. Is true in this case for logout</technical_language>

Target:
void invalidateSessionSecure(String subjectName) { String cacheKey = cookieCache.getCacheKeyBySubjectName(subjectName, securityManager); if (cacheKey == null) { LOGGER.debug( "No cache element found for subject name {}; skipping invalidation.", subjectName); return; } LogoutState logoutState = new LogoutState(getActiveSps(cacheKey)); logoutState.setNameId(subjectName); logoutState.setOriginalRequestId(UUID.randomUUID().toString()); logoutStates.encode(cacheKey, logoutState); cookieCache.removeSamlAssertion(cacheKey); asyncLogoutService.submit(() -> asyncBackchannelLogout(cacheKey, logoutState)); }
Source:
<code>private static String resolveXDHome() { <START> String resolved = CommandLinePropertySourceOverridingListener.getCurrentEnvironment() <END> .resolvePlaceholders("${xd.home:.}/lib/*"); resolved = StringUtils.cleanPath(resolved).replace(" return "file://" + resolved; }</code><technical_language>do need worry null here? (this is retrieving a thread local is initially set instance of CommandLinePropertySourceOverridingListener receiving ApplicationEnvironmentPreparedEvent)</technical_language>

Target:
private static String resolveXDHome() { Assert.state( CommandLinePropertySourceOverridingListener.getCurrentEnvironment() != null, "Expected to be called in the control flow of " + CommandLinePropertySourceOverridingListener.class.getSimpleName() + ".onApplicationEvent()"); String resolved = CommandLinePropertySourceOverridingListener.getCurrentEnvironment() .resolvePlaceholders("${xd.home:.}/lib/*"); resolved = StringUtils.cleanPath(resolved).replace(" return "file://" + resolved; }
Source:
<code>private void populateSessionsMap(List<StorageDomainDR> storageDRs) { for (final StorageDomainDR storageDR : storageDRs) { if (!geoRepSessionsMap.containsKey(storageDR.getGeoRepSessionId())) { <START> Frontend.getInstance().runQuery(VdcQueryType.GetGlusterVolumeGeoRepSessionById, <END> new IdQueryParameters(storageDR.getGeoRepSessionId()), new AsyncQuery<>(new AsyncCallback<VdcQueryReturnValue>() { @Override public void onSuccess(VdcQueryReturnValue returnValue) { if (returnValue.getReturnValue() != null) { geoRepSessionsMap.put(storageDR.getGeoRepSessionId(), (GlusterGeoRepSession) returnValue.getReturnValue()); } } })); } } }</code><technical_language>move this AsyncDataProvider (for easy reusability..)</technical_language>

Target:
private void populateSessionsMap(List<StorageDomainDR> storageDRs) { for (final StorageDomainDR storageDR : storageDRs) { if (!geoRepSessionsMap.containsKey(storageDR.getGeoRepSessionId())) { AsyncDataProvider.getInstance() .getGlusterVolumeGeoRepSessionById(new AsyncQuery<>(new AsyncCallback<GlusterGeoRepSession>() { @Override public void onSuccess(GlusterGeoRepSession geoRepSession) { if (geoRepSession != null) { geoRepSessionsMap.put(storageDR.getGeoRepSessionId(), geoRepSession); } } }), storageDR.getGeoRepSessionId()); } } }
Source:
<code>private static <T> void validateEntry(ReferenceDataId<?> id, Object value) { if (!id.getReferenceDataType().isInstance(value)) { throw new ClassCastException(Messages.format( <START> "Value does not implement parameterized type for identifier '{}' of type '{}'", id, id.getClass().getSimpleName())); <END> } }</code><technical_language>Include type in message</technical_language>

Target:
private static <T> void validateEntry(ReferenceDataId<?> id, Object value) { if (!id.getReferenceDataType().isInstance(value)) { if (value == null) { throw new IllegalArgumentException(Messages.format( "Reference data must not be null for identifier '{}'", id)); } throw new ClassCastException(Messages.format( "Value '{}' does not implement parameterized type '{}' for identifier '{}'", value, id.getClass().getSimpleName(), id)); } }
Source:
<code>private XmlSuite createXmlSuite(Class<?> c) { XmlSuite xmlSuite = new XmlSuite(); xmlSuite.setName("TmpSuite"); <START> XmlTest xmlTest = new XmlTest(xmlSuite); <END> xmlTest.setName("TmpTest"); xmlTest.setXmlClasses(Collections.singletonList(new XmlClass(c))); return xmlSuite; }</code><technical_language>this change is part of this PR? Is necessary</technical_language>

Target:
private XmlSuite createXmlSuite(Class<?> c) { XmlSuite xmlSuite = new XmlSuite(); xmlSuite.setName("TmpSuite"); xmlSuite.setTimeOut(String.valueOf(defaultTestTimeoutMillis)); XmlTest xmlTest = new XmlTest(xmlSuite); xmlTest.setName("TmpTest"); xmlTest.setXmlClasses(Collections.singletonList(new XmlClass(c))); return xmlSuite; }
Source:
<code>public CondensedAnomalyTimelinesView compress() { if (timeStamps.size() == 0) { return this; } try { if (this.toJsonString().length() > DEFAULT_MAX_LENGTH) { <START> roundUp(); <END> } } catch (JsonProcessingException e) { throw new IllegalStateException("Unable to parse view to json string", e); } return compress(DEFAULT_MAX_LENGTH); }</code><technical_language>I roundup logic is added compress(DEFAULT_MAX_LENGTH), people call methods compress roundup run in cases</technical_language>

Target:
public CondensedAnomalyTimelinesView compress() { return compress(DEFAULT_MAX_LENGTH); }
Source:
<code>private Payment getPaymentAgainstAuthorization(String totalAmount) { Address billingAddress = AddressTestCase.createAddress(); CreditCard creditCard = new CreditCard(); creditCard.setBillingAddress(billingAddress); creditCard.setCvv2(617); creditCard.setExpireMonth(01); <START> creditCard.setExpireYear(2017); <END> creditCard.setFirstName("Joe"); creditCard.setLastName("Shopper"); creditCard.setNumber("4422009910903049"); creditCard.setType("visa"); Amount amount = new Amount(); amount.setCurrency("USD"); amount.setTotal(totalAmount); Transaction transaction = new Transaction(); transaction.setAmount(amount); transaction .setDescription("This is the payment transaction description."); List<Transaction> transactions = new ArrayList<Transaction>(); transactions.add(transaction); FundingInstrument fundingInstrument = new FundingInstrument(); fundingInstrument.setCreditCard(creditCard); List<FundingInstrument> fundingInstrumentList = new ArrayList<FundingInstrument>(); fundingInstrumentList.add(fundingInstrument); Payer payer = new Payer(); payer.setFundingInstruments(fundingInstrumentList); payer.setPaymentMethod("credit_card"); Payment payment = new Payment(); payment.setIntent("authorize"); payment.setPayer(payer); payment.setTransactions(transactions); return payment; }</code><technical_language>this year long in future. This test start failing next year in February</technical_language>

Target:
private Payment getPaymentAgainstAuthorization(String totalAmount) { Address billingAddress = AddressTestCase.createAddress(); CreditCard creditCard = new CreditCard(); creditCard.setBillingAddress(billingAddress); creditCard.setCvv2(617); creditCard.setExpireMonth(01); creditCard.setExpireYear(2020); creditCard.setFirstName("Joe"); creditCard.setLastName("Shopper"); creditCard.setNumber("4422009910903049"); creditCard.setType("visa"); Amount amount = new Amount(); amount.setCurrency("USD"); amount.setTotal(totalAmount); Transaction transaction = new Transaction(); transaction.setAmount(amount); transaction .setDescription("This is the payment transaction description."); List<Transaction> transactions = new ArrayList<Transaction>(); transactions.add(transaction); FundingInstrument fundingInstrument = new FundingInstrument(); fundingInstrument.setCreditCard(creditCard); List<FundingInstrument> fundingInstrumentList = new ArrayList<FundingInstrument>(); fundingInstrumentList.add(fundingInstrument); Payer payer = new Payer(); payer.setFundingInstruments(fundingInstrumentList); payer.setPaymentMethod("credit_card"); Payment payment = new Payment(); payment.setIntent("authorize"); payment.setPayer(payer); payment.setTransactions(transactions); return payment; }
Source:
<code>public Answer execute(final OvsVpcRoutingPolicyConfigCommand command, final LibvirtComputingResource libvirtComputingResource) { try { <START> final Script scriptCommand = new Script(libvirtComputingResource.getOvsTunnelPath(), libvirtComputingResource.getTimeout().getMillis(), s_logger); <END> scriptCommand.add("configure_ovs_bridge_for_routing_policies"); scriptCommand.add("--bridge", command.getBridgeName()); scriptCommand.add("--config", command.getVpcConfigInJson()); final String result = scriptCommand.execute(); if (result.equalsIgnoreCase("SUCCESS")) { return new Answer(command, true, result); } else { return new Answer(command, false, result); } } catch (final Exception e) { s_logger.warn("caught exception while updating host with latest VPC topology", e); return new Answer(command, false, e.getMessage()); } }</code><technical_language>Please consider adding overridden version of Script(String, int, Logger) constructor accepts Duration encapsulate this type conversion</technical_language>

Target:
public Answer execute(final OvsVpcRoutingPolicyConfigCommand command, final LibvirtComputingResource libvirtComputingResource) { try { final Script scriptCommand = new Script(libvirtComputingResource.getOvsTunnelPath(), libvirtComputingResource.getTimeout(), s_logger); scriptCommand.add("configure_ovs_bridge_for_routing_policies"); scriptCommand.add("--bridge", command.getBridgeName()); scriptCommand.add("--config", command.getVpcConfigInJson()); final String result = scriptCommand.execute(); if (result.equalsIgnoreCase("SUCCESS")) { return new Answer(command, true, result); } else { return new Answer(command, false, result); } } catch (final Exception e) { s_logger.warn("caught exception while updating host with latest VPC topology", e); return new Answer(command, false, e.getMessage()); } }
Source:
<code>public int compare(SiteNode sn1, SiteNode sn2) { String s1 = sn1.getNodeName(false); String s2 = sn2.getNodeName(false); int initialComparison = s1.compareToIgnoreCase(s2); if (initialComparison == 0) { s1 = sn1.getNodeName(true); s2 = sn2.getNodeName(true); return s1.compareToIgnoreCase(s2); <START> } else { <END> return initialComparison; } }</code><technical_language>else statement removed (the if-then returns)</technical_language>

Target:
public int compare(SiteNode sn1, SiteNode sn2) { String s1 = sn1.getName(); String s2 = sn2.getName(); int initialComparison = s1.compareToIgnoreCase(s2); if (initialComparison == 0) { s1 = sn1.getNodeName(); s2 = sn2.getNodeName(); return s1.compareToIgnoreCase(s2); } return initialComparison; }
Source:
<code>private boolean createProxyClassFiles(TypeMirrors typeMirrors) { boolean success = true; for (ClassMetaData metadata : classCollection.getClasses()) { RealmProxyInterfaceGenerator interfaceGenerator = new RealmProxyInterfaceGenerator(processingEnv, metadata); try { interfaceGenerator.generate(); } catch (IOException e) { <START> Utils.error(e.getMessage(), metadata.getClassElement()); <END> success = false; } RealmProxyClassGenerator sourceCodeGenerator = new RealmProxyClassGenerator(processingEnv, typeMirrors, metadata, classCollection); try { sourceCodeGenerator.generate(); } catch (IOException e) { Utils.error(e.getMessage(), metadata.getClassElement()); success = false; } catch (UnsupportedOperationException e) { Utils.error(e.getMessage(), metadata.getClassElement()); success = false; } } return success; }</code><technical_language>abort here? return false</technical_language>

Target:
private boolean createProxyClassFiles(TypeMirrors typeMirrors) { for (ClassMetaData metadata : classCollection.getClasses()) { RealmProxyInterfaceGenerator interfaceGenerator = new RealmProxyInterfaceGenerator(processingEnv, metadata); try { interfaceGenerator.generate(); } catch (IOException e) { Utils.error(e.getMessage(), metadata.getClassElement()); return false; } RealmProxyClassGenerator sourceCodeGenerator = new RealmProxyClassGenerator(processingEnv, typeMirrors, metadata, classCollection); try { sourceCodeGenerator.generate(); } catch (IOException | UnsupportedOperationException e) { Utils.error(e.getMessage(), metadata.getClassElement()); return false; } } return true; }
Source:
<code>private void deleteOldBarrierVersions(int numVersionsToLeave) { String path = keyBuilder.getJobModelVersionBarrierPrefix(); <START> LOG.info("jm path=" + path); <END> List<String> znodeIds = zkClient.getChildren(path); LOG.info("ids = " + znodeIds); deleteOldVersionPath(path, znodeIds, numVersionsToLeave, new Comparator<String>() { @Override public int compare(String o1, String o2) { return ZkBarrierForVersionUpgrade.getVersion(o1) - ZkBarrierForVersionUpgrade.getVersion(o2); } }); }</code><technical_language>s/jm path/barrier path</technical_language>

Target:
void deleteOldBarrierVersions(int numVersionsToLeave) { String path = keyBuilder.getJobModelVersionBarrierPrefix(); LOG.info("about to delete old barrier paths from " + path); List<String> znodeIds = zkClient.getChildren(path); LOG.info("List of all zkNodes: " + znodeIds); deleteOldVersionPath(path, znodeIds, numVersionsToLeave, new Comparator<String>() { @Override public int compare(String o1, String o2) { return ZkBarrierForVersionUpgrade.getVersion(o1) - ZkBarrierForVersionUpgrade.getVersion(o2); } }); }
Source:
<code>public void registerService( Object serviceInstance, ServiceProviderErrorMapper errorMapper, ServiceMessageDataDecoder dataDecoder) { Reflect.serviceInterfaces(serviceInstance) .forEach( serviceInterface -> Reflect.serviceMethods(serviceInterface) .forEach( (key, method) -> { Reflect.validateMethodOrThrow(method); MethodInfo methodInfo = new MethodInfo( Reflect.serviceName(serviceInterface), Reflect.methodName(method), Reflect.parameterizedReturnType(method), Reflect.communicationMode(method), method.getParameterCount(), Reflect.requestType(method)); String qualifier = methodInfo.qualifier(); ServiceMethodInvoker invoker = new ServiceMethodInvoker( method, serviceInstance, methodInfo, errorMapper, dataDecoder); if (methodInvokers.containsKey(qualifier)) { LOGGER.warn("<{}> for API <{}> will be replaced by the following methodInvoker: <{}>", methodInvokers.get(qualifier), qualifier, invoker); <START> } <END> methodInvokers.put(methodInfo.qualifier(), invoker); })); }</code><technical_language>Throw exception (IllegalStateException fine) instead of allowing client progress wrong state</technical_language>

Target:
public void registerService( Object serviceInstance, ServiceProviderErrorMapper errorMapper, ServiceMessageDataDecoder dataDecoder) { Reflect.serviceInterfaces(serviceInstance) .forEach( serviceInterface -> Reflect.serviceMethods(serviceInterface) .forEach( (key, method) -> { Reflect.validateMethodOrThrow(method); MethodInfo methodInfo = new MethodInfo( Reflect.serviceName(serviceInterface), Reflect.methodName(method), Reflect.parameterizedReturnType(method), Reflect.communicationMode(method), method.getParameterCount(), Reflect.requestType(method)); String qualifier = methodInfo.qualifier(); if (methodInvokers.containsKey(qualifier)) { throw new IllegalStateException( String.format( "MethodInvoker for api '%s' already exists", qualifier)); } ServiceMethodInvoker invoker = new ServiceMethodInvoker( method, serviceInstance, methodInfo, errorMapper, dataDecoder); methodInvokers.put(methodInfo.qualifier(), invoker); })); }
Source:
<code>private void notifyEventTypeSelectionListener(Event e){ <START> for(Listener <END> l : fEventTypeSelectedListeners){ l.handleEvent(e); } }</code><technical_language>format</technical_language>

Target:
private void notifyEventTypeSelectionListener(Event e) { for (Object o : fEventTypeSelectedListeners.getListeners()) { ((Listener) o).handleEvent(e); } }
Source:
<code><START> protected static <END> void removeNetworkFromHosts(Network network, CommandContext context, List<VdsNetworkInterface> nics) { RemoveNetworkParametersBuilder builder = new RemoveNetworkParametersBuilder(network, context); ArrayList<VdcActionParametersBase> parameters = builder.buildParameters(nics); if (!parameters.isEmpty()) { NetworkParametersBuilder.updateParametersSequencing(parameters); Backend.getInstance().runInternalMultipleActions(VdcActionType.PersistentSetupNetworks, parameters, context); } }</code><technical_language>protected private</technical_language>

Target:
private static void removeNetworkFromHosts(Network network, CommandContext context, List<VdsNetworkInterface> nics) { RemoveNetworkParametersBuilder builder = new RemoveNetworkParametersBuilder(network, context); ArrayList<VdcActionParametersBase> parameters = builder.buildParameters(nics); if (!parameters.isEmpty()) { NetworkParametersBuilder.updateParametersSequencing(parameters); Backend.getInstance().runInternalMultipleActions(VdcActionType.PersistentSetupNetworks, parameters, context); } }
Source:
<code>public S3AInputStream(S3AReadOpContext ctx, S3ObjectAttributes s3Attributes, long contentLength, AmazonS3 client) { Preconditions.checkArgument(isNotEmpty(s3Attributes.getBucket()), "No Bucket"); Preconditions.checkArgument(isNotEmpty(s3Attributes.getKey()), "No Key"); Preconditions.checkArgument(contentLength >= 0, "Negative content length"); this.context = ctx; this.bucket = s3Attributes.getBucket(); this.key = s3Attributes.getKey(); this.pathStr = ctx.dstFileStatus.getPath().toString(); this.contentLength = contentLength; this.client = client; this.uri = "s3a://" + this.bucket + "/" + this.key; this.streamStatistics = ctx.instrumentation.newInputStreamStatistics(); this.serverSideEncryptionAlgorithm = s3Attributes.getServerSideEncryptionAlgorithm(); this.serverSideEncryptionKey = s3Attributes.getServerSideEncryptionKey(); <START> ChangeDetectionPolicy changeDetectionPolicy = <END> ctx.getChangeDetectionPolicy(); this.changeTracker = new ChangeTracker(uri, changeDetectionPolicy, streamStatistics.getVersionMismatchCounter(), s3Attributes); setInputPolicy(ctx.getInputPolicy()); setReadahead(ctx.getReadahead()); }</code><technical_language>do this in new ChangeTracker() call</technical_language>

Target:
public S3AInputStream(S3AReadOpContext ctx, S3ObjectAttributes s3Attributes, long contentLength, AmazonS3 client) { Preconditions.checkArgument(isNotEmpty(s3Attributes.getBucket()), "No Bucket"); Preconditions.checkArgument(isNotEmpty(s3Attributes.getKey()), "No Key"); Preconditions.checkArgument(contentLength >= 0, "Negative content length"); this.context = ctx; this.bucket = s3Attributes.getBucket(); this.key = s3Attributes.getKey(); this.pathStr = ctx.dstFileStatus.getPath().toString(); this.contentLength = contentLength; this.client = client; this.uri = "s3a://" + this.bucket + "/" + this.key; this.streamStatistics = ctx.instrumentation.newInputStreamStatistics(); this.serverSideEncryptionAlgorithm = s3Attributes.getServerSideEncryptionAlgorithm(); this.serverSideEncryptionKey = s3Attributes.getServerSideEncryptionKey(); this.changeTracker = new ChangeTracker(uri, ctx.getChangeDetectionPolicy(), streamStatistics.getVersionMismatchCounter(), s3Attributes); setInputPolicy(ctx.getInputPolicy()); setReadahead(ctx.getReadahead()); }
Source:
<code>public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14, Object arg15, Object arg16, Object arg17) throws StandardException{ if(SanityManager.DEBUG){ <START> SanityManager.THROWASSERT("Fourteen-argument init() not implemented for "+getClass().getName()); <END> } }</code><technical_language>Error message "Seventeen-argement init()" instead of "Fourteen-argument init()"</technical_language>

Target:
public void init(Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13, Object arg14, Object arg15, Object arg16, Object arg17) throws StandardException{ if(SanityManager.DEBUG){ SanityManager.THROWASSERT("Seventeen-argument init() not implemented for "+getClass().getName()); } }
Source:
<code><START> public void deleteAll(){} <END></code><technical_language>@Override is missing - propose mark class OneTableJdbcKeyValueStorage deprecated - is more</technical_language>

Target:
public void deleteAll(){ jdbcTemplate.update("delete * from " + TABLE_NAME); }
Source:
<code>public void testFindQueryResponseTransformersSearchById() { mockQueryResponseTransformer( <START> new ImmutableMap.Builder<String, Object>().put(Constants.SERVICE_ID, "id1").build()); <END> QueryResponseTransformer transformer2 = mockQueryResponseTransformer( new ImmutableMap.Builder<String, Object>().put(Constants.SERVICE_ID, "id2").build()); List<QueryResponseTransformer> transformers = transformerLocator.findQueryResponseTransformers("id2"); assertThat(transformers, hasSize(1)); assertThat(transformers.get(0), is(transformer2)); }</code><technical_language>"id1" "id2" constants</technical_language>

Target:
public void testFindQueryResponseTransformersSearchById() { mockQueryResponseTransformer( new ImmutableMap.Builder<String, Object>().put(Constants.SERVICE_ID, ID1).build()); QueryResponseTransformer transformer2 = mockQueryResponseTransformer( new ImmutableMap.Builder<String, Object>().put(Constants.SERVICE_ID, ID2).build()); List<QueryResponseTransformer> transformers = transformerLocator.findQueryResponseTransformers(ID2); assertThat(transformers, hasSize(1)); assertThat(transformers.get(0), is(transformer2)); }
Source:
<code>private boolean isOriginalStale(int[] preparedTypes) { if (isPreparedTypesSet) { return false; } if (preparedTypes == null) { return false; } if (preparedTypes.length == 0) { return false; } if (preparedTypes.length < originalPreparedTypes.length) { return false; } int maxPos = originalPreparedTypes.length - 1; <START> for (int pos = 0; pos <= maxPos; pos += 1) { <END> if (originalPreparedTypes[pos] == UNSPECIFIED && preparedTypes[pos] != UNSPECIFIED) { return true; } } return false; }</code><technical_language>pos++ is a bit more normal increment</technical_language>

Target:
private boolean isOriginalStale(int[] preparedTypes) { if (isPreparedTypesSet) { return false; } if (preparedTypes == null) { return false; } if (preparedTypes.length == 0) { return false; } if (preparedTypes.length < originalPreparedTypes.length) { return false; } int maxPos = originalPreparedTypes.length - 1; for (int pos = 0; pos <= maxPos; pos++) { if (originalPreparedTypes[pos] == UNSPECIFIED && preparedTypes[pos] != UNSPECIFIED) { return true; } } return false; }