auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ActionResult execute() { String studentId; String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); if (studentEmail == null || courseId == null) { studentId = userInfo.id; } else { StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); studentId = student.getGoogleId(); } if (StringHelper.isEmpty(studentId)) { return new JsonResult(MESSAGE_STUDENT_NOT_REGISTERED, HttpStatus.SC_NOT_FOUND); } StudentProfileAttributes studentProfile = logic.getStudentProfile(studentId); String name = logic.getAccount(studentId).name; if (studentProfile == null) { studentProfile = StudentProfileAttributes.builder(studentId).build(); } if (userInfo.isStudent && studentId.equals(userInfo.id)) { <START> studentProfile.email = null; <END> studentProfile.shortName = null; } StudentProfileData output = new StudentProfileData(name, studentProfile); return new JsonResult(output); }</code><technical_language>I change StudentProfileData instead. FeedbackSessionData is done</technical_language>

Target:
public ActionResult execute() { String studentId; String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); if (studentEmail == null || courseId == null) { studentId = userInfo.id; } else { StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); studentId = student.getGoogleId(); } if (StringHelper.isEmpty(studentId)) { return new JsonResult(MESSAGE_STUDENT_NOT_REGISTERED, HttpStatus.SC_NOT_FOUND); } StudentProfileAttributes studentProfile = logic.getStudentProfile(studentId); String name = logic.getAccount(studentId).name; if (studentProfile == null) { studentProfile = StudentProfileAttributes.builder(studentId).build(); } StudentProfileData output = new StudentProfileData(name, studentProfile); if (userInfo.isStudent && !studentId.equals(userInfo.id)) { output.hideInformationWhenViewedByOtherStudent(); } return new JsonResult(output); }
Source:
<code>public synchronized boolean assignFromUser(Set<TopicPartition> partitions) { setSubscriptionType(SubscriptionType.USER_ASSIGNED); if (this.assignment.partitionSet().equals(partitions)) return false; <START> Map<TopicPartition, TopicPartitionState> assignedPartitionStates = partitionToStateMap(partitions); <END> assignmentId++; Set<String> manualSubscribedTopics = new HashSet<>(); for (TopicPartition partition : partitions) { manualSubscribedTopics.add(partition.topic()); } this.assignment.set(assignedPartitionStates); return changeSubscription(manualSubscribedTopics); }</code><technical_language>Nit: declare final well</technical_language>

Target:
public synchronized boolean assignFromUser(Set<TopicPartition> partitions) { setSubscriptionType(SubscriptionType.USER_ASSIGNED); if (this.assignment.partitionSet().equals(partitions)) return false; assignmentId++; Set<String> manualSubscribedTopics = new HashSet<>(); Map<TopicPartition, TopicPartitionState> partitionToState = new HashMap<>(); for (TopicPartition partition : partitions) { TopicPartitionState state = assignment.stateValue(partition); if (state == null) state = new TopicPartitionState(); partitionToState.put(partition, state); manualSubscribedTopics.add(partition.topic()); } this.assignment.set(partitionToState); return changeSubscription(manualSubscribedTopics); }
Source:
<code><START> public void setWorkDirTree(File workDirTree) { <END> this.workDirTree = workDirTree; }</code><technical_language>Do call setGit setWorkDirTree? internal workDirTree same</technical_language>

Target:
public void setWorkDirTree(File workDirTree) throws IOException { this.workDirTree = workDirTree; setGit(); }
Source:
<code>public boolean isValueDependent() { <START> return getValue().isTypeDependent(); <END> }</code><technical_language>this meant isValueDependent()</technical_language>

Target:
public boolean isValueDependent() { return getTargetEvaluation().isValueDependent(); }
Source:
<code>public <T> Gauge<T> gauge(String name, Gauge<T> gauge) { checkNotNullOrEmpty(name); checkNotNull(gauge); String fullName = name(name); <START> Gauge<T> metric = (Gauge<T>) _metrics.get(fullName); <END> if (metric == null) { metric = _registry.register(fullName, gauge); } return metric; }</code><technical_language>Is this thread-safe</technical_language>

Target:
public synchronized <T> Gauge<T> gauge(String name, Gauge<T> gauge) { checkNotNullOrEmpty(name); checkNotNull(gauge); String fullName = name(name); Gauge<T> metric = (Gauge<T>) _metrics.get(fullName); if (metric == null) { metric = _registry.register(fullName, gauge); } return metric; }
Source:
<code>public EditorHandle openUrl(IWorkbenchPage page, String url, int customFlags) { for (TaskRepository repository : TasksUi.getRepositoryManager().getRepositories(GerritConnector.CONNECTOR_KIND)) { String taskId = getTaskId(repository, url); if (taskId != null) { int patchSetNumber = getPatchSetNumber(repository, url, taskId); <START> IReview review = checkIfReviewIsOpen(page, taskId); <END> if (patchSetNumber > 0 && review == null) { openWithCompareEditorForNewReview(page, taskId, patchSetNumber, getFilePath(repository, url, taskId, patchSetNumber)); } EditorHandle editorHandle = TasksUiUtil.openTaskWithResult(repository, taskId); if (patchSetNumber > 0) { if (review != null) { IFileItem file = getFileItemForReview(review, patchSetNumber, getFilePath(repository, url, taskId, patchSetNumber)); openWithCompareEditorForFile(file); } revealPatchSet(editorHandle, patchSetNumber); } return editorHandle; } } return null; }</code><technical_language>discussed, remove this reuse logic fromrevealPatchSet get review</technical_language>

Target:
public EditorHandle openUrl(IWorkbenchPage page, String url, int customFlags) { for (TaskRepository repository : TasksUi.getRepositoryManager().getRepositories(GerritConnector.CONNECTOR_KIND)) { String taskId = getTaskId(repository, url); if (taskId != null) { int patchSetNumber = getPatchSetNumber(repository, url, taskId); EditorHandle editorHandle = TasksUiUtil.openTaskWithResult(repository, taskId); if (patchSetNumber > 0) { IReview review = checkIfReviewIsOpen(page, taskId, repository.getUrl()); IFileItem file = getFileItem(review, patchSetNumber, getFilePath(repository, url, taskId, patchSetNumber)); openCompareEditor(file); revealPatchSet(editorHandle, patchSetNumber); } return editorHandle; } } return null; }
Source:
<code>void addCallback(ListenableFuture<List<MutateRowsResponse>> bulkFuture) { Futures.addCallback( bulkFuture, new FutureCallback<List<MutateRowsResponse>>() { @Override public void onSuccess(List<MutateRowsResponse> result) { handleResult(result); } @Override public void onFailure(Throwable t) { <START> perfromFullRetry(new AtomicReference<Long>(), t); <END> } }); }</code><technical_language>typo: perfrom -> perform</technical_language>

Target:
void addCallback(ListenableFuture<List<MutateRowsResponse>> bulkFuture) { Futures.addCallback( bulkFuture, new FutureCallback<List<MutateRowsResponse>>() { @Override public void onSuccess(List<MutateRowsResponse> result) { handleResult(result); } @Override public void onFailure(Throwable t) { performFullRetry(new AtomicReference<Long>(), t); } }); }
Source:
<code>protected void AddStoragePoolToDb() { getStoragePool().setId(Guid.NewGuid()); getStoragePool().setstatus(StoragePoolStatus.Uninitialized); <START> getStoragePool().setQuotaEnforcementType(QuotaEnforcmentTypeEnum.DISABLED); <END> DbFacade.getInstance().getStoragePoolDAO().save(getStoragePool()); Quota defaultStoragePoolQuota = QuotaHelper.getInstance().addDefaultQuota(getStoragePool()); DbFacade.getInstance().getQuotaDAO().save(defaultStoragePoolQuota); }</code><technical_language>if user another enf. type in params</technical_language>

Target:
protected void AddStoragePoolToDb() { getStoragePool().setId(Guid.NewGuid()); getStoragePool().setstatus(StoragePoolStatus.Uninitialized); Quota defaultStoragePoolQuota = generateQuotaForNewStoragePool(); DbFacade.getInstance().getStoragePoolDAO().save(getStoragePool()); createUnlimitedQuotaForEveryUser(defaultStoragePoolQuota); }
Source:
<code>public void writeTo(JsonWriter writer, ReplicationSpec additionalPropertiesProvider) throws SemanticException, IOException { String pksString, fksString, uksString, nnsString; pksString = fksString = uksString = nnsString = ""; if (pks != null) { pksString = MessageFactory.getInstance().buildAddPrimaryKeyMessage(pks).toString(); } if (fks != null) { fksString = MessageFactory.getInstance().buildAddForeignKeyMessage(fks).toString(); } if (uks != null) { uksString = MessageFactory.getInstance().buildAddUniqueConstraintMessage(uks).toString(); } <START> if (uks != null) { <END> nnsString = MessageFactory.getInstance().buildAddNotNullConstraintMessage(nns).toString(); } writer.jsonGenerator.writeStringField("pks", pksString); writer.jsonGenerator.writeStringField("fks", fksString); writer.jsonGenerator.writeStringField("uks", uksString); writer.jsonGenerator.writeStringField("nns", nnsString); }</code><technical_language>Need check for (nns != null)</technical_language>

Target:
public void writeTo(JsonWriter writer, ReplicationSpec additionalPropertiesProvider) throws SemanticException, IOException { String pksString, fksString, uksString, nnsString; pksString = fksString = uksString = nnsString = ""; if (pks != null) { pksString = MessageFactory.getInstance().buildAddPrimaryKeyMessage(pks).toString(); } if (fks != null) { fksString = MessageFactory.getInstance().buildAddForeignKeyMessage(fks).toString(); } if (uks != null) { uksString = MessageFactory.getInstance().buildAddUniqueConstraintMessage(uks).toString(); } if (nns != null) { nnsString = MessageFactory.getInstance().buildAddNotNullConstraintMessage(nns).toString(); } writer.jsonGenerator.writeStringField("pks", pksString); writer.jsonGenerator.writeStringField("fks", fksString); writer.jsonGenerator.writeStringField("uks", uksString); writer.jsonGenerator.writeStringField("nns", nnsString); }
Source:
<code>public void endElement(String uri, String localName, String qName) { if (qName.equals("XPrivacy")) { if (mListRestrictionUid.size() > 0) { int lastUid = mListRestrictionUid.get(mListRestrictionUid.size() - 1); mAppAdapter.setState(lastUid, STATE_SUCCESS, null); } for (int uid : mListRestartUid) mAppAdapter.setMessage(uid, getString(R.string.msg_restart)); mAppAdapter.notifyDataSetChanged(); <START> mAppAdapter.setMessage(mListAbortedUid.get(0), getString(R.string.msg_aborted)); <END> } }</code><technical_language>if list is empty</technical_language>

Target:
public void endElement(String uri, String localName, String qName) { if (qName.equals("XPrivacy")) { if (mListRestrictionUid.size() > 0) { int lastUid = mListRestrictionUid.get(mListRestrictionUid.size() - 1); mAppAdapter.setState(lastUid, STATE_SUCCESS, null); } for (int uid : mListRestartUid) mAppAdapter.setMessage(uid, getString(R.string.msg_restart)); if (mListAbortedUid.size() > 0) mAppAdapter.setMessage(mListAbortedUid.get(0), getString(R.string.msg_aborted)); mAppAdapter.notifyDataSetChanged(); } }
Source:
<code>private void addAll(Collection<?> collection) { <START> for (Object o: collection){ <END> this.myArrayList.add(JSONObject.wrap(o)); } }</code><technical_language>Add a new line: java this.myArrayList.ensureCapacity(this.myArrayList.size()+ collection.size());</technical_language>

Target:
private void addAll(Collection<?> collection) { this.myArrayList.ensureCapacity(this.myArrayList.size() + collection.size()); for (Object o: collection){ this.myArrayList.add(JSONObject.wrap(o)); } }
Source:
<code>public boolean equals(Object obj) { if (obj == this) { return true; <START> } else if (getClass().equals(obj.getClass()) && obj instanceof CommonProcessMemorySpec<?> ) { <END> CommonProcessMemorySpec<?> that = (CommonProcessMemorySpec<?>) obj; return Objects.equals(this.flinkMemory, that.flinkMemory) && Objects.equals(this.jvmMetaspaceAndOverhead, that.jvmMetaspaceAndOverhead); } return false; }</code><technical_language>Comparing classes of objects instanceof call obsolete. for getClass() instanceof considering slightly semantics outcome if getClass().equals(obj.getClass()) applies. I some research in matter: I evidence JobManagerProcessSpec TaskManagerProcessSpec in context. This case of equals non-symmetric dealing subclasses kind of theoretical. if want reduce risk of this coming I approaches: 1. Check equality of instance's classes (Keep in mind add a null check for obj in case). 2. move equals(Object) implementation JobProcessMemorySpec final. In case, instanceof</technical_language>

Target:
public boolean equals(Object obj) { if (obj == this) { return true; } else if (obj != null && getClass().equals(obj.getClass())) { CommonProcessMemorySpec<?> that = (CommonProcessMemorySpec<?>) obj; return Objects.equals(this.flinkMemory, that.flinkMemory) && Objects.equals(this.jvmMetaspaceAndOverhead, that.jvmMetaspaceAndOverhead); } return false; }
Source:
<code>public WagoBindingConfig(Item item, String conf) { this.item = item; try { String attributes[] = conf.split(":"); couplerName = attributes[0]; module = Integer.parseInt(attributes[1]) - 1; channel = Integer.parseInt(attributes[2]) - 1; } catch (Exception e) { <START> e.printStackTrace(); <END> } }</code><technical_language>please proper logging instead of printStackTrace()</technical_language>

Target:
public WagoBindingConfig(Item item, String conf) { this.item = item; String attributes[] = conf.split(":"); couplerName = attributes[0]; try { module = Integer.parseInt(attributes[1]) - 1; channel = Integer.parseInt(attributes[2]) - 1; } catch (NumberFormatException e) { logger.error("wago binding configuration invalid. Module or channel is not a number."); } }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof CommandSpec)) { return false; } CommandSpec that = (CommandSpec) o; <START> if (!this.args.equals(that.args)) { <END> return false; } if (!this.argumentParser.equals(that.argumentParser)) { return false; } if (this.description != null ? !this.description.equals(that.description) : that.description != null) { return false; } if (!this.executor.equals(that.executor)) { return false; } if (this.extendedDescription != null ? !this.extendedDescription.equals(that.extendedDescription) : that.extendedDescription != null) { return false; } if (this.permission != null ? !this.permission.equals(that.permission) : that.permission != null) { return false; } return true; }</code><technical_language>for Guava below, Objects.equal() handle null check for you: java return Objects.equal(this.args, that.args) && Objects.equal(this.argumentParser, that.argumentParser) && ...;</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CommandSpec that = (CommandSpec) o; return Objects.equal(this.args, that.args) && Objects.equal(this.executor, that.executor) && Objects.equal(this.description, that.description) && Objects.equal(this.extendedDescription, that.extendedDescription) && Objects.equal(this.permission, that.permission) && Objects.equal(this.argumentParser, that.argumentParser); }
Source:
<code>public void checkCertificationValidity() { try { if (!checkCertificate(EngineEncryptionUtils.getCertificate(EngineLocalConfig.getInstance().getPKICACert()), AuditLogType.ENGINE_CA_CERTIFICATION_HAS_EXPIRED, AuditLogType.ENGINE_CA_CERTIFICATION_IS_ABOUT_TO_EXPIRE_ALERT, AuditLogType.ENGINE_CA_CERTIFICATION_IS_ABOUT_TO_EXPIRE, null) ^ !checkCertificate((X509Certificate) EngineEncryptionUtils.getCertificate(), AuditLogType.ENGINE_CERTIFICATION_HAS_EXPIRED, AuditLogType.ENGINE_CERTIFICATION_IS_ABOUT_TO_EXPIRE_ALERT, AuditLogType.ENGINE_CERTIFICATION_IS_ABOUT_TO_EXPIRE, null)) { return; } if (!Config.<Boolean>getValue(ConfigValues.EncryptHostCommunication)) { return; } hostDao.getAll() .stream() .filter(host -> host.getStatus() == VDSStatus.Up || host.getStatus() == VDSStatus.NonOperational) <START> .forEach(host -> checkHostCertificateValidity(host)); <END> } catch (Exception e) { log.error("Failed to check certification validity: {}", e.getMessage()); log.error("Exception", e); } }</code><technical_language>This abbreviated, a method reference: .forEach(this::checkHostCertificateValidity)</technical_language>

Target:
public void checkCertificationValidity() { try { if (!checkCertificate(EngineEncryptionUtils.getCertificate(EngineLocalConfig.getInstance().getPKICACert()), AuditLogType.ENGINE_CA_CERTIFICATION_HAS_EXPIRED, AuditLogType.ENGINE_CA_CERTIFICATION_IS_ABOUT_TO_EXPIRE_ALERT, AuditLogType.ENGINE_CA_CERTIFICATION_IS_ABOUT_TO_EXPIRE, null) ^ !checkCertificate((X509Certificate) EngineEncryptionUtils.getCertificate(), AuditLogType.ENGINE_CERTIFICATION_HAS_EXPIRED, AuditLogType.ENGINE_CERTIFICATION_IS_ABOUT_TO_EXPIRE_ALERT, AuditLogType.ENGINE_CERTIFICATION_IS_ABOUT_TO_EXPIRE, null)) { return; } if (!Config.<Boolean>getValue(ConfigValues.EncryptHostCommunication)) { return; } hostDao.getAll() .stream() .filter(host -> host.getStatus() == VDSStatus.Up || host.getStatus() == VDSStatus.NonOperational) .forEach(this::checkHostCertificateValidity); } catch (Exception e) { log.error("Failed to check certification validity: {}", e.getMessage()); log.error("Exception", e); } }
Source:
<code>public boolean removeQueues(Queue... queues) { <START> removeQueues(Arrays.asList(queues) <END> .stream() .map(Queue::getName)); return super.removeQueues(queues); }</code><technical_language>Arrays.stream() applied well</technical_language>

Target:
public boolean removeQueues(Queue... queues) { removeQueues(Arrays.stream(queues) .map(Queue::getName)); return super.removeQueues(queues); }
Source:
<code>public void testTrackingUpdate() throws Exception { Repository db2 = createBareRepository(); String remote = "origin"; String branch = "refs/heads/master"; String trackingBranch = "refs/remotes/" + remote + "/master"; RefUpdate trackingBranchRefUpdate = db.updateRef(trackingBranch); trackingBranchRefUpdate.setNewObjectId(db.resolve(branch)); trackingBranchRefUpdate.update(); final StoredConfig config = db.getConfig(); RemoteConfig remoteConfig = new RemoteConfig(config, remote); URIish uri = new URIish(db2.getDirectory().toURI().toURL()); remoteConfig.addURI(uri); remoteConfig.addFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/" + remote + "/*")); remoteConfig.update(config); <START> config.setString(ConfigConstants.CONFIG_BRANCH_SECTION, "master", <END> ConfigConstants.CONFIG_KEY_REMOTE, remote); config.setString(ConfigConstants.CONFIG_BRANCH_SECTION, "master", ConfigConstants.CONFIG_KEY_MERGE, branch); config.save(); Git git = new Git(db); RevCommit commit = git.commit().setMessage("Commit to push").call(); RefSpec spec = new RefSpec(branch + ":" + branch); git.push().setRemote(remote).setRefSpecs(spec).call(); assertEquals(commit.getId(), db2.resolve(branch)); assertEquals(commit.getId(), db.resolve(trackingBranch)); }</code><technical_language>branch section necessary tracking ref update. Lets set test</technical_language>

Target:
public void testTrackingUpdate() throws Exception { Repository db2 = createBareRepository(); String remote = "origin"; String branch = "refs/heads/master"; String trackingBranch = "refs/remotes/" + remote + "/master"; Git git = new Git(db); RevCommit commit1 = git.commit().setMessage("Initial commit") .call(); RefUpdate branchRefUpdate = db.updateRef(branch); branchRefUpdate.setNewObjectId(commit1.getId()); branchRefUpdate.update(); RefUpdate trackingBranchRefUpdate = db.updateRef(trackingBranch); trackingBranchRefUpdate.setNewObjectId(commit1.getId()); trackingBranchRefUpdate.update(); final StoredConfig config = db.getConfig(); RemoteConfig remoteConfig = new RemoteConfig(config, remote); URIish uri = new URIish(db2.getDirectory().toURI().toURL()); remoteConfig.addURI(uri); remoteConfig.addFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/" + remote + "/*")); remoteConfig.update(config); config.save(); RevCommit commit2 = git.commit().setMessage("Commit to push").call(); RefSpec spec = new RefSpec(branch + ":" + branch); Iterable<PushResult> resultIterable = git.push().setRemote(remote) .setRefSpecs(spec).call(); PushResult result = resultIterable.iterator().next(); TrackingRefUpdate trackingRefUpdate = result .getTrackingRefUpdate(trackingBranch); assertNotNull(trackingRefUpdate); assertEquals(trackingBranch, trackingRefUpdate.getLocalName()); assertEquals(branch, trackingRefUpdate.getRemoteName()); assertEquals(commit2.getId(), trackingRefUpdate.getNewObjectId()); assertEquals(commit2.getId(), db.resolve(trackingBranch)); assertEquals(commit2.getId(), db2.resolve(branch)); }
Source:
<code>private boolean shouldRetryMethod(final Class<? extends Throwable> thrownClass, final Retryable retryable, final int attempts) { <START> if (attempts == retryable.maxAttempts()) { <END> return false; } final HashSet<Class<? extends Throwable>> failClasses = new HashSet<>(Arrays.asList(retryable .failImmediatelyOn())); failClasses.addAll(alwaysImmediateFailureExceptionClasses); for (final Class<? extends Throwable> failClass : failClasses) { if (failClass.isAssignableFrom(thrownClass)) { return false; } } return true; }</code><technical_language>">=" robust, code is now</technical_language>

Target:
private boolean shouldRetryMethod(final Class<? extends Throwable> thrownClass, final Retryable retryable, final int attempts) { if (attempts >= retryable.maxAttempts()) { return false; } final HashSet<Class<? extends Throwable>> failClasses = new HashSet<>(Arrays.asList(retryable .failImmediatelyOn())); failClasses.addAll(alwaysImmediateFailureExceptionClasses); for (final Class<? extends Throwable> failClass : failClasses) { if (failClass.isAssignableFrom(thrownClass)) { return false; } } return true; }
Source:
<code>public SubversionCredentialsDialogViewImpl(SubversionExtensionLocalizationConstants locale) { this.locale = locale; <START> Widget widget = uiBinder.createAndBindUi(this); <END> this.setWidget(widget); this.setTitle(locale.credentialsDialogTitle()); authenticateButton = createPrimaryButton(locale.credentialsDialogAuthenticateButton(), "svn-authentication-username", new ClickHandler() { @Override public void onClick(ClickEvent event) { delegate.onAuthenticateClicked(); } }); Button cancelButton = createButton(locale.credentialsDialogCancelButton(), "svn-authentication-password", new ClickHandler() { @Override public void onClick(ClickEvent event) { delegate.onCancelClicked(); } }); addButtonToFooter(authenticateButton); addButtonToFooter(cancelButton); }</code><technical_language>is need create odd variable</technical_language>

Target:
public SubversionCredentialsDialogViewImpl(SubversionExtensionLocalizationConstants locale) { this.locale = locale; this.setWidget(uiBinder.createAndBindUi(this)); this.setTitle(locale.credentialsDialogTitle()); authenticateButton = createPrimaryButton(locale.credentialsDialogAuthenticateButton(), "svn-authentication-username", new ClickHandler() { @Override public void onClick(ClickEvent event) { delegate.onAuthenticateClicked(); } }); Button cancelButton = createButton(locale.credentialsDialogCancelButton(), "svn-authentication-password", new ClickHandler() { @Override public void onClick(ClickEvent event) { delegate.onCancelClicked(); } }); addButtonToFooter(authenticateButton); addButtonToFooter(cancelButton); }
Source:
<code>public void emptyMapCausesException() { Map<Class<? extends AuthenticationException>, Class<? extends AbstractAuthenticationFailureEvent>> mappings = new HashMap<>(); publisher = new DefaultAuthenticationEventPublisher(); publisher.setAdditionalExceptionMappings(mappings); <START> ApplicationEventPublisher appPublisher = mock(ApplicationEventPublisher.class); <END> publisher.setApplicationEventPublisher(appPublisher); }</code><technical_language>lines of this test necessary? remove unnecessary lines of code</technical_language>

Target:
public void emptyMapCausesException() { Map<Class<? extends AuthenticationException>, Class<? extends AbstractAuthenticationFailureEvent>> mappings = new HashMap<>(); publisher = new DefaultAuthenticationEventPublisher(); publisher.setAdditionalExceptionMappings(mappings); }
Source:
<code>private void lruRemove(final Slot e) { Slot p = e.lruPrev; Slot n = e.lruNext; <START> if (p != null) <END> p.lruNext = n; else lruHead = n; if (n != null) n.lruPrev = p; else lruTail = p; }</code><technical_language>braces here, I guess</technical_language>

Target:
private void lruRemove(final Slot e) { Slot p = e.lruPrev; Slot n = e.lruNext; if (p != null) { p.lruNext = n; } else { lruHead = n; } if (n != null) { n.lruPrev = p; } else { lruTail = p; } }
Source:
<code><START> private void updateCountOfExaminedCellTsPairsInCurrentRow(List<CellTsPairInfo> results) { <END> byte[] currentRow = startRowInclusive; for (CellTsPairInfo cellTs : results) { if (!Arrays.equals(currentRow, cellTs.rowName)) { currentRow = cellTs.rowName; cellTsPairsAlreadyExaminedInCurrentRow = 0L; } cellTsPairsAlreadyExaminedInCurrentRow += 1; } }</code><technical_language>iterating results - bundle a CellTsPairInfo, figure out count of cellTsPairsAlreadyExaminedInCurrentRow. Is worth cutting this iteration time in updating cellTsPairsAlreadyExaminedInCurrentRow loadPage()</technical_language>

Target:
private void updateCountOfExaminedCellTsPairsInCurrentRow(List<CellTsPairInfo> results) { byte[] currentRow = token.startRowInclusive(); for (CellTsPairInfo cellTs : results) { if (!Arrays.equals(currentRow, cellTs.rowName)) { currentRow = cellTs.rowName; cellTsPairsAlreadyExaminedInCurrentRow = 0L; } cellTsPairsAlreadyExaminedInCurrentRow += 1; } }
Source:
<code>public boolean undo() { final StorageObject previousObject = gcsController.getObject(previousTopologyObjectName); if (previousObject != null) { try { gcsController.copyObject(previousTopologyObjectName, topologyObjectName, previousObject); } catch (IOException ioe) { <START> LOG.log(Level.SEVERE, "Reverting to previous topology version failed", ioe); <END> return false; } } return true; }</code><technical_language>include relevant version numbers in error message here</technical_language>

Target:
public boolean undo() { final StorageObject previousObject = gcsController.getStorageObject(previousTopologyObjectName); if (previousObject != null) { try { gcsController.copyStorageObject(previousTopologyObjectName, topologyObjectName, previousObject); } catch (IOException ioe) { LOG.log(Level.SEVERE, "Reverting to previous topology failed", ioe); return false; } } return true; }
Source:
<code>public void forget(Xid xid) throws XAException { <START> log.infof("forget xid:[%s]", xid); <END> }</code><technical_language>trace</technical_language>

Target:
public void forget(Xid xid) throws XAException { log.tracef("forget xid:[%s]", xid); }
Source:
<code><START> public boolean equals(Object o) <END> { if (o == this) { return true; } if (o == null || o.getClass() != getClass()) { return false; } IntervalBroadcastDistributionRule that = (IntervalBroadcastDistributionRule) o; return interval.equals(that.interval) && colocatedDatasource.equals(that.colocatedDatasource); }</code><technical_language>Override hashCode</technical_language>

Target:
public boolean equals(Object o) { if (o == this) { return true; } if (o == null || o.getClass() != getClass()) { return false; } IntervalBroadcastDistributionRule that = (IntervalBroadcastDistributionRule) o; if (!Objects.equals(interval, that.interval)) { return false; } return Objects.equals(colocatedDataSources, that.colocatedDataSources); }
Source:
<code>private void readTokens() { int nRead; String tags = null; try { char[] buff = new char[1 * 1024]; StringBuilder buffer = new StringBuilder(); while ((nRead = input.read(buff, 0, buff.length)) != -1) { buffer.append(buff, 0, nRead); } tags = buffer.toString(); } catch (IOException e) { <START> e.printStackTrace(); <END> } if (tags != null && !tags.isEmpty()) { int iValue = tags.indexOf(TagsBridge.VALUE); if (iValue > 0) { String tag = tags.substring(0, iValue); String value = tags.substring(iValue + TagsBridge.VALUE.length()); String token = tag + SEPARATOR + value; tokens = new String[2]; tokens[0] = tag; tokens[1] = token; } else { tokens = new String[1]; tokens[0] = tags; } } }</code><technical_language>printStackTrace stderr directly? else error processing</technical_language>

Target:
private void readTokens() { int nRead; String tags = null; try { char[] buff = new char[1 * 1024]; StringBuilder buffer = new StringBuilder(); while ((nRead = input.read(buff, 0, buff.length)) != -1) { buffer.append(buff, 0, nRead); } tags = buffer.toString(); } catch (IOException e) { log.error(e); } if (tags != null && !tags.isEmpty()) { int iValue = tags.indexOf(TagsBridge.VALUE); if (iValue > 0) { String tag = tags.substring(0, iValue); String value = tags.substring(iValue + TagsBridge.VALUE.length()); String token = tag + SEPARATOR + value; tokens = new String[2]; tokens[0] = tag; tokens[1] = token; } else { tokens = new String[1]; tokens[0] = tags; } } }
Source:
<code>private void UpdateDatacenters() { <START> Boolean isInVm = (Boolean) getIsInVm().getEntity(); <END> Boolean isInternal = (Boolean) getIsInternal().getEntity(); getDataCenter().setIsAvailable(!isInVm && !isInternal); if (isInternal || isInVm) { AsyncDataProvider.GetDataCenterById((new AsyncQuery(this, new INewAsyncCallback() { @Override public void OnSuccess(Object target, Object returnValue) { DiskModel diskModel = (DiskModel) target; storage_pool dataCenter = (storage_pool) returnValue; ArrayList<storage_pool> dataCenters = new ArrayList<storage_pool>(); dataCenters.add(dataCenter); diskModel.getDataCenter().setItems(dataCenters); } })), getDatacenterId()); } else { AsyncDataProvider.GetDataCentersWithPermittedActionOnClusters(new AsyncQuery(this, new INewAsyncCallback() { @Override public void OnSuccess(Object target, Object returnValue) { DiskModel diskModel = (DiskModel) target; ArrayList<storage_pool> dataCenters = (ArrayList<storage_pool>) returnValue; diskModel.getDataCenter().setItems(dataCenters); } }), ActionGroup.CREATE_DISK); } }</code><technical_language>isInVm means disk is attached VM user reached a VM context? (i.e. inVmContext)</technical_language>

Target:
private void UpdateDatacenters() { Boolean isInVm = (Boolean) getIsInVm().getEntity(); Boolean isInternal = (Boolean) getIsInternal().getEntity(); getDataCenter().setIsAvailable(!isInVm); if (isInternal || isInVm) { AsyncDataProvider.GetDataCenterById((new AsyncQuery(this, new INewAsyncCallback() { @Override public void OnSuccess(Object target, Object returnValue) { DiskModel diskModel = (DiskModel) target; storage_pool dataCenter = (storage_pool) returnValue; ArrayList<storage_pool> dataCenters = new ArrayList<storage_pool>(); dataCenters.add(dataCenter); diskModel.getDataCenter().setItems(dataCenters); } })), getDatacenterId()); } else { AsyncDataProvider.GetDataCentersWithPermittedActionOnClusters(new AsyncQuery(this, new INewAsyncCallback() { @Override public void OnSuccess(Object target, Object returnValue) { DiskModel diskModel = (DiskModel) target; ArrayList<storage_pool> dataCenters = (ArrayList<storage_pool>) returnValue; diskModel.getDataCenter().setItems(dataCenters); } }), ActionGroup.CREATE_DISK); } }
Source:
<code>public void shouldMoveBlobDocumentToColdStorage() throws IOException { DocumentModel documentModel = createDocument(true); documentModel = moveContentToColdStorage(session, documentModel.getRef()); <START> documentModel = session.getDocument(documentModel.getRef()); <END> assertTrue(documentModel.hasFacet(COLD_STORAGE)); checkBlobContent(documentModel, FILE_CONTENT_PROPERTY, DUMMY_THUMBNAIL_CONTENT); checkBlobContent(documentModel, COLD_STORAGE_CONTENT_PROPERTY, FILE_CONTENT); }</code><technical_language>useless</technical_language>

Target:
public void shouldMoveBlobDocumentToColdStorage() throws IOException { DocumentModel documentModel = createDocument(true); documentModel = moveContentToColdStorage(session, documentModel.getRef()); session.save(); assertTrue(documentModel.hasFacet(COLD_STORAGE)); checkBlobContent(documentModel, FILE_CONTENT_PROPERTY, DUMMY_THUMBNAIL_CONTENT); checkBlobContent(documentModel, COLD_STORAGE_CONTENT_PROPERTY, FILE_CONTENT); }
Source:
<code>public void activate() { if (!isActive()) { final IPermissionAuthority auth = PermissionAuthorityRegistry.getDefault().getPermissionAuthority(getEditingDomain().getResourceSet()); auth.addAuthorityListener(this.getEditPartAuthorityListener()); super.activate(); DiagramElementEditPartOperation.activate(this); } <START> EditPartAuthorityListener editModeUpdater = getEditPartAuthorityListener(); if (editModeUpdater.shouldRefresh()) { editModeUpdater.refreshEditMode(); } <END> }</code><technical_language>do do this in DiagramElementEditPartOperation.activate(this);</technical_language>

Target:
public void activate() { if (!isActive()) { final IPermissionAuthority auth = PermissionAuthorityRegistry.getDefault().getPermissionAuthority(getEditingDomain().getResourceSet()); auth.addAuthorityListener(this.getEditPartAuthorityListener()); super.activate(); DiagramElementEditPartOperation.activate(this); } }
Source:
<code>private QuestionWidget getPendingWidget() { QuestionWidget bestMatch = null; for (QuestionWidget q : ((ODKView)mCurrentView).getWidgets()) { if (q.getFormId().equals(mFormController.getPendingCalloutFormIndex())) { <START> bestMatch = q; <END> } } return bestMatch; }</code><technical_language>Do expect more widget a pending callout a time? happen. If don't, I change this method return match</technical_language>

Target:
private QuestionWidget getPendingWidget() { FormIndex pendingIndex = mFormController.getPendingCalloutFormIndex(); if (pendingIndex == null) { return null; } for (QuestionWidget q : ((ODKView)mCurrentView).getWidgets()) { if (q.getFormId().equals(pendingIndex)) { return q; } } return null; }
Source:
<code><START> public void accept(Event<EnvironmentDto> environmentDtoEvent) { <END> EnvironmentDto environmentDto = environmentDtoEvent.getData(); environmentService.findEnvironmentById(environmentDto.getId()) .ifPresentOrElse(environment -> { try { if (AZURE.name().equals(environmentDto.getCloudPlatform())) { deleteResourceGroupIfEmpty(environmentDto, environment); } else { LOGGER.debug("Cloudplatform not azure, not creating resource group."); } goToFinishedState(environmentDtoEvent); } catch (Exception e) { goToFailedState(environmentDtoEvent, e.getMessage()); } }, () -> goToFailedState(environmentDtoEvent, String.format("Environment was not found with id '%s'.", environmentDto.getId())) ); }</code><technical_language>Please remove if composite pattern determine specific cloud-api is needed delete prerequisites. Move azure specific implementation cloud-azure module</technical_language>

Target:
public void accept(Event<EnvironmentDto> environmentDtoEvent) { EnvironmentDto environmentDto = environmentDtoEvent.getData(); environmentService.findEnvironmentById(environmentDto.getId()) .ifPresentOrElse(environment -> { try { deletePrerequisites(environmentDto, environment); goToFinishedState(environmentDtoEvent); } catch (Exception e) { goToFailedState(environmentDtoEvent, e.getMessage()); } }, () -> goToFailedState(environmentDtoEvent, String.format("Environment was not found with id '%s'.", environmentDto.getId())) ); }
Source:
<code>public KeyValueFileReader(final File keyValueFile) { try { this.reader = new BufferedReader(new FileReader(keyValueFile)); this.fileName = keyValueFile.getName(); } catch (FileNotFoundException ex) { <START> throw new OsmosisRuntimeException("Unable to read from key.value file " + fileName + ".", ex); <END> } }</code><technical_language>conversion OsmosisRuntimeExceptions happen in task itself, in helper class (as helper class in unrelated context)</technical_language>

Target:
public KeyValueFileReader(final File keyValueFile) throws FileNotFoundException { this.reader = new BufferedReader(new FileReader(keyValueFile)); }
Source:
<code>protected org.uberfire.java.nio.file.Path parseCriteriaPath( DiagramLookupRequest request ) { String criteria = request.getCriteria(); if ( isEmpty( criteria ) ) { return getServiceImpl().getDiagramsPath(); } else { Map<String, String> criteriaMap = AbstractCriteriaLookupManager.parseCriteria( criteria ); String name = criteriaMap.get( "name" ); if ( !isEmpty( name) ) { Collection<Diagram> diagrams = getItemsByPath( getServiceImpl().getDiagramsPath() ); if ( null != diagrams && !diagrams.isEmpty() ) { for ( final Diagram diagram : diagrams ) { if ( diagram.getName().equals( name ) ) { return Paths.convert( diagram.getMetadata().getPath() ); } } } LOG.error( "Diagram with name [" + name + "] not found." ); return null; } } String m = "Criteria [" + criteria + "] not supported."; LOG.error( m ); <START> throw new UnsupportedOperationException( m ); <END> }</code><technical_language>right exception type, operation is supported</technical_language>

Target:
protected org.uberfire.java.nio.file.Path parseCriteriaPath( DiagramLookupRequest request ) { String criteria = request.getCriteria(); if ( StringUtils.isEmpty( criteria ) ) { return getServiceImpl().getDiagramsPath(); } else { Map<String, String> criteriaMap = AbstractCriteriaLookupManager.parseCriteria( criteria ); String name = criteriaMap.get( "name" ); if ( !StringUtils.isEmpty( name ) ) { Collection<Diagram> diagrams = getItemsByPath( getServiceImpl().getDiagramsPath() ); if ( null != diagrams ) { final Diagram d = diagrams .stream() .filter( diagram -> name.equals( diagram.getName() ) ) .findFirst() .orElse( null ); if ( null != d ) { return Paths.convert( d.getMetadata().getPath() ); } } LOG.error( "Diagram with name [" + name + "] not found." ); return null; } } String m = "Criteria [" + criteria + "] not supported."; LOG.error( m ); throw new IllegalArgumentException( m ); }
Source:
<code>private <V> V winrmCallRetryConnFailure(CallableFunction<V> winrmCall) throws SOAPFaultException { int retries = retriesForConnectionFailures != null ? retriesForConnectionFailures : 10; List<Throwable> exceptions = new ArrayList<>(); for (int i = 0; i < retries; i++) { try { return winrmCall.call(); } catch (SOAPFaultException soapFault) { throw soapFault; } catch (javax.xml.ws.WebServiceException wsException) { if (wsException.getCause() instanceof ConnectException) { if (i == (retries + 1)) { LOG.info("Propagating Connection RM exception (attempt " + (i + 1) + " of " + retries + ") {}", wsException); } else if (i == 0) { <START> LOG.warn("Ignoring exception and retrying (attempt " + (i + 1) + " of " + retries + ") {}", wsException); <END> } else { LOG.debug("Ignoring exception and retrying (attempt " + (i + 1) + " of " + retries + ") {}", wsException); } } exceptions.add(wsException); } } throw new RuntimeException("failed task "+winrmCall, exceptions.get(exceptions.size()-1)); }</code><technical_language>Throwing lead exception logged anyway, log cases debug level here</technical_language>

Target:
private <V> V winrmCallRetryConnFailure(CallableFunction<V> winrmCall) throws SOAPFaultException { int retries = retriesForConnectionFailures != null ? retriesForConnectionFailures : 5; List<Throwable> exceptions = new ArrayList<>(); for (int i = 0; i < retries + 1; i++) { try { return winrmCall.call(); } catch (SOAPFaultException soapFault) { throw soapFault; } catch (javax.xml.ws.WebServiceException wsException) { if (!(wsException.getCause() instanceof ConnectException || wsException.getCause() instanceof SocketTimeoutException)) { throw new RuntimeException("Exception occured while making winrm call", wsException); } LOG.debug("Ignoring exception and retrying (attempt " + (i + 1) + " of " + retries + ") {}", wsException); try { Thread.sleep(5 * 1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException("Exception occured while making winrm call", e.initCause(wsException)); } exceptions.add(wsException); } } throw new RuntimeException("failed task " + winrmCall, exceptions.get(0)); }
Source:
<code>public ProphecyEffect() { super(Outcome.GainLife); <START> this.staticText = "Reveal the top card of target opponent's library. If it's a land, you gain 1 life. Then that player shuffles his or her library"; <END> }</code><technical_language>"Then player shuffles library", oracle text in spoiler file is outdated. dragging feet updating of it</technical_language>

Target:
public ProphecyEffect() { super(Outcome.GainLife); this.staticText = "Reveal the top card of target opponent's library. If it's a land, you gain 1 life. Then that player shuffles their library"; }
Source:
<code>public void updateExternalExecutionId(long taskExecutionId, String externalExecutionId) { if(!this.taskExecutions.containsKey(taskExecutionId)) { throw new IllegalStateException("Invalid TaskExecution, ID " + taskExecutionId + " not found."); } <START> TaskExecution taskExecution = taskExecutions.get(taskExecutionId); <END> taskExecution.setExternalExecutionId(externalExecutionId); }</code><technical_language>This simplified / more robust (threadsafety) asserting get return null</technical_language>

Target:
public void updateExternalExecutionId(long taskExecutionId, String externalExecutionId) { TaskExecution taskExecution = taskExecutions.get(taskExecutionId); Assert.notNull(taskExecution, "Invalid TaskExecution, ID " + taskExecutionId + " not found."); taskExecution.setExternalExecutionId(externalExecutionId); }
Source:
<code>private boolean isManagerForListedProjects() { return projectService.isManager(projectListChoice.getModelObject().get(), <START> userRepository.getCurrentUser()) <END> || projects.getObject().stream().anyMatch( p -> projectService.isManager(p.get(), userRepository.getCurrentUser())); }</code><technical_language>current user retrieved re-used. part of disjunction (the currently selected project) implicitly covered part of disjunction (manager in accessible project?)</technical_language>

Target:
private boolean isManagerForListedProjects() { User currentUser = userRepository.getCurrentUser(); return projectService.isManager(projectListChoice.getModelObject().get(), currentUser) || projects.getObject().stream().anyMatch( p -> projectService.isManager(p.get(), currentUser)); }
Source:
<code>protected void run() <START> throws UnloggedFailure, Failure, Exception { <END> if (regex == null) { regex = "^*.*$"; } switch (level.toLowerCase()) { case RESET: reset(); break; case LEVEL_ALL: setLoggingLevel(Level.ALL); break; case LEVEL_TRACE: setLoggingLevel(Level.TRACE); break; case LEVEL_DEBUG: setLoggingLevel(Level.DEBUG); break; case LEVEL_INFO: setLoggingLevel(Level.INFO); break; case LEVEL_WARN: setLoggingLevel(Level.WARN); break; case LEVEL_ERROR: setLoggingLevel(Level.ERROR); break; case LEVEL_FATAL: setLoggingLevel(Level.FATAL); break; case LEVEL_OFF: setLoggingLevel(Level.OFF); break; default: stdout.println("Invalid argument"); break; } }</code><technical_language>needed</technical_language>

Target:
protected void run() { if (regex == null) { regex = "^*.*$"; } switch (level) { case RESET: reset(); break; default: setLoggingLevel(Level.toLevel(level.name())); break; } }
Source:
<code>protected void writeRecord(AggregateStateId id, EntityStorageRecord record) { final TypeUrl recordType = TypeUrl.of(record.getState() .getTypeUrl()); final TypeUrl recordTypeFromId = id.getStateType(); checkState( recordTypeFromId.equals(recordType), <START> String.format("The typeUrl of the record (%s) does not correspond to id (for type %s)", <END> recordType, recordTypeFromId)); recordStorage.write(id, record); }</code><technical_language>Please extract a string constant</technical_language>

Target:
protected void writeRecord(AggregateStateId id, EntityStorageRecord record) { final TypeUrl recordType = TypeUrl.of(record.getState() .getTypeUrl()); final TypeUrl recordTypeFromId = id.getStateType(); checkState( recordTypeFromId.equals(recordType), String.format(TYPE_URL_MISMATCH_MESSAGE_PATTERN, recordType, recordTypeFromId)); recordStorage.write(id, record); }
Source:
<code>private void loginCczDemoUser(OfflineUserRestore offlineUserRestore) { String username = offlineUserRestore.getUsername(); String password = offlineUserRestore.getPassword(); <START> performingCczDemoUserLogin = true; <END> tryLocalLogin(username, password, false, false, LoginMode.PASSWORD, true); }</code><technical_language>a bit worried this boolean's status a dependence of this class, I this class member variables for this kind of state. Is a specific reason this flag passed method instead</technical_language>

Target:
private void loginCczDemoUser(OfflineUserRestore offlineUserRestore) { String username = offlineUserRestore.getUsername(); String password = offlineUserRestore.getPassword(); tryLocalLogin(username, password, false, false, LoginMode.PASSWORD, true); }
Source:
<code>protected void executeCommand() { addVmToDb(); VM vm = getVm(); <START> if (vm.getImages().isEmpty()) { <END> endVmRelatedOps(); } else { processImages(); } setSucceeded(true); }</code><technical_language>again, wrapped</technical_language>

Target:
protected void executeCommand() { addVmToDb(); VM vm = getVm(); if (!hasSnappableDisks(vm)) { endVmRelatedOps(); } else { processImages(); } setSucceeded(true); }
Source:
<code>public String getMethodName() { <START> return "mcGetCPMembers"; <END> }</code><technical_language>Needs getCPMembers. method name in protocol definition. for other message tasks</technical_language>

Target:
public String getMethodName() { return "getCPMembers"; }
Source:
<code>public LocalOrRemoteNitroFetcher(ContentResolver resolver, NitroContentAdapter contentAdapter, ContentMerger contentMerger, Predicate<Broadcast> fullFetchPermitted) { this.resolver = resolver; this.contentAdapter = contentAdapter; this.fullFetchPermitted = fullFetchPermitted; <START> this.contentMerger = contentMerger; <END> }</code><technical_language>if a reason checkNotNull fields</technical_language>

Target:
public LocalOrRemoteNitroFetcher(ContentResolver resolver, NitroContentAdapter contentAdapter, ContentMerger contentMerger, Predicate<Broadcast> fullFetchPermitted) { this.resolver = checkNotNull(resolver); this.contentAdapter = checkNotNull(contentAdapter); this.fullFetchPermitted = checkNotNull(fullFetchPermitted); this.contentMerger = checkNotNull(contentMerger); }