auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void accept(Event<CcmKeyDeregisterRequest> requestEvent) { CcmKeyDeregisterRequest request = requestEvent.getData(); Selectable result; try { Stack stack = stackService.getByIdWithListsInTransaction(request.getResourceId()); if (Boolean.TRUE.equals(request.getUseCcm())) { LOGGER.debug("De-registering key from CCM. Cluster CRN: {}", stack.getResourceCrn()); try { if (!entitlementService.ccmV2Enabled(request.getAccountId())) { ccmResourceTerminationListener.deregisterCcmSshTunnelingKey(request.getActorCrn(), request.getAccountId(), request.getKeyId(), stack.getMinaSshdServiceId()); } else { ccmV2AgentTerminationListener.deregisterInvertingProxyAgent(stack.getCcmV2AgentCrn()); } } catch (Exception ex) { LOGGER.warn("CCM key deregistration failed", ex); } } else { LOGGER.info("CCM is DISABLED, skipping de-registering of key from CCM. Cluster CRN: {}", stack.getResourceCrn()); } result = new CcmKeyDeregisterSuccess(stack.getId()); } catch (Exception ex) { LOGGER.error("Stack retrieval for CCM key deregistration failed", ex); result = new StackFailureEvent(StackTerminationEvent.CCM_KEY_DEREGISTER_FAILED_EVENT.event(), request.getResourceId(), ex); } eventBus.notify(result.selector(), new Event<>(requestEvent.getHeaders(), result)); }

Target:
public void accept(Event<CcmKeyDeregisterRequest> requestEvent) { CcmKeyDeregisterRequest request = requestEvent.getData(); Selectable result; try { Stack stack = stackService.getByIdWithListsInTransaction(request.getResourceId()); try { if (request.getTunnel().useCcmV1()) { LOGGER.debug("De-registering MinaSshdServiceId '{}' from CCM. Cluster CRN: {}", stack.getMinaSshdServiceId(), stack.getResourceCrn()); ccmResourceTerminationListener.deregisterCcmSshTunnelingKey(request.getActorCrn(), request.getAccountId(), request.getKeyId(), stack.getMinaSshdServiceId()); LOGGER.debug("De-registered MinaSshdServiceId '{}' from CCM. Cluster CRN: {}", stack.getMinaSshdServiceId(), stack.getResourceCrn()); } else if (request.getTunnel().useCcmV2()) { LOGGER.debug("De-registering CcmV2AgentCrn '{}' from CCM. Cluster CRN: {}", stack.getCcmV2AgentCrn(), stack.getResourceCrn()); ccmV2AgentTerminationListener.deregisterInvertingProxyAgent(stack.getCcmV2AgentCrn()); LOGGER.debug("De-registered CcmV2AgentCrn '{}' from CCM. Cluster CRN: {}", stack.getCcmV2AgentCrn(), stack.getResourceCrn()); } else { LOGGER.debug("CCM is DISABLED, skipping de-registering of key from CCM. Cluster CRN: {}", stack.getResourceCrn()); } } catch (Exception ex) { LOGGER.warn("CCM key deregistration failed", ex); } result = new CcmKeyDeregisterSuccess(stack.getId()); } catch (Exception ex) { LOGGER.error("Stack retrieval for CCM key deregistration failed", ex); result = new StackFailureEvent(StackTerminationEvent.CCM_KEY_DEREGISTER_FAILED_EVENT.event(), request.getResourceId(), ex); } eventBus.notify(result.selector(), new Event<>(requestEvent.getHeaders(), result)); }
Source:
public void dataCenterWithClusterSelectedItemChanged() { super.dataCenterWithClusterSelectedItemChanged(); if (getModel().getSelectedCluster() != null) { updateCpuProfile(getModel().getSelectedCluster().getId(), getCompatibilityVersion(), vm.getCpuProfileId()); } if (getVm().getStatus().isSuspended() && !getModel().getSelectedCluster().getCompatibilityVersion().equals(getVm().getCompatibilityVersion())) { getModel().getEditingEnabled().setMessage(getModel().constants.suspendedVMsWhenClusterChange()); } }

Target:
public void dataCenterWithClusterSelectedItemChanged() { super.dataCenterWithClusterSelectedItemChanged(); if (getModel().getSelectedCluster() != null) { updateCpuProfile(getModel().getSelectedCluster().getId(), getCompatibilityVersion(), vm.getCpuProfileId()); } if (isWithMemoryVolume(getVm()) && !isClusterCompatibleWithMemorySnapshot()) { getModel().getEditingEnabled().setMessage(getModel().constants.suspendedVMsWhenClusterChange()); } }
Source:
private void auth(ServletContextHandler ctx, Authenticator authType) { final String role = "can-access"; MappedLoginService users = new MappedLoginService() { @Override protected UserIdentity loadUser(String who) { return null; } @Override protected void loadUsers() throws IOException { putUser(username, new Password(password), new String[] { role }); } }; ConstraintMapping cm = new ConstraintMapping(); cm.setConstraint(new Constraint()); cm.getConstraint().setAuthenticate(true); cm.getConstraint().setDataConstraint(Constraint.DC_NONE); cm.getConstraint().setRoles(new String[] { role }); cm.setPathSpec("/*"); ConstraintSecurityHandler sec = new ConstraintSecurityHandler(); sec.setStrict(false); sec.setRealmName(realm); sec.setAuthenticator(authType); sec.setLoginService(users); ArrayList<ConstraintMapping> mappings = new ArrayList<ConstraintMapping>(); mappings.add(cm); sec.setConstraintMappings(mappings); sec.setHandler(ctx); contexts.removeHandler(ctx); contexts.addHandler(sec); }

Target:
private void auth(ServletContextHandler ctx, Authenticator authType) { final String role = "can-access"; MappedLoginService users = new MappedLoginService() { @Override protected UserIdentity loadUser(String who) { return null; } @Override protected void loadUsers() throws IOException { putUser(username, new Password(password), new String[] { role }); } }; ConstraintMapping cm = new ConstraintMapping(); cm.setConstraint(new Constraint()); cm.getConstraint().setAuthenticate(true); cm.getConstraint().setDataConstraint(Constraint.DC_NONE); cm.getConstraint().setRoles(new String[] { role }); cm.setPathSpec("/*"); ConstraintSecurityHandler sec = new ConstraintSecurityHandler(); sec.setStrict(false); sec.setRealmName(realm); sec.setAuthenticator(authType); sec.setLoginService(users); sec.setConstraintMappings(new ConstraintMapping[] { cm }); sec.setHandler(ctx); contexts.removeHandler(ctx); contexts.addHandler(sec); }
Source:
public CauseOfBlockage getCauseOfBlockage() { Jenkins jenkins = Jenkins.getInstance(); if(isBlockedByShutdown(task)) return CauseOfBlockage.fromMessage(Messages._Queue_HudsonIsAboutToShutDown()); Label label = getAssignedLabel(); List<Node> allNodes = jenkins.getNodes(); if (allNodes.isEmpty()) label = null; if (label != null) { Set<Node> nodes = label.getNodes(); if (label.isOffline()) { if (nodes.size() != 1) return new BecauseLabelIsOffline(label); else return new BecauseNodeIsOffline(nodes.iterator().next()); } else { if (transientCausesOfBlockage != null && label.getIdleExecutors() > 0) { return new CompositeCauseOfBlockage(transientCausesOfBlockage); } if (nodes.size() != 1) return new BecauseLabelIsBusy(label); else return new BecauseNodeIsBusy(nodes.iterator().next()); } } else if (transientCausesOfBlockage != null && new ComputerSet().getIdleExecutors() > 0) { return new CompositeCauseOfBlockage(transientCausesOfBlockage); } else { return CauseOfBlockage.createNeedsMoreExecutor(Messages._Queue_WaitingForNextAvailableExecutor()); } }

Target:
public CauseOfBlockage getCauseOfBlockage() { Jenkins jenkins = Jenkins.getInstance(); if(isBlockedByShutdown(task)) return CauseOfBlockage.fromMessage(Messages._Queue_HudsonIsAboutToShutDown()); List<CauseOfBlockage> causesOfBlockage = transientCausesOfBlockage; Label label = getAssignedLabel(); List<Node> allNodes = jenkins.getNodes(); if (allNodes.isEmpty()) label = null; if (label != null) { Set<Node> nodes = label.getNodes(); if (label.isOffline()) { if (nodes.size() != 1) return new BecauseLabelIsOffline(label); else return new BecauseNodeIsOffline(nodes.iterator().next()); } else { if (causesOfBlockage != null && label.getIdleExecutors() > 0) { return new CompositeCauseOfBlockage(causesOfBlockage); } if (nodes.size() != 1) return new BecauseLabelIsBusy(label); else return new BecauseNodeIsBusy(nodes.iterator().next()); } } else if (causesOfBlockage != null && new ComputerSet().getIdleExecutors() > 0) { return new CompositeCauseOfBlockage(causesOfBlockage); } else { return CauseOfBlockage.createNeedsMoreExecutor(Messages._Queue_WaitingForNextAvailableExecutor()); } }
Source:
private TimestampsToSweep getTimestampsToSweepDescendingAndCleanupAborted(ShardAndStrategy shardStrategy, long minTsExclusive, long sweepTs, Multimap<Long, WriteInfo> writesByStartTs) { Map<Long, Long> startToCommitTs = commitTsCache.loadBatch(writesByStartTs.keySet()); Map<TableReference, Multimap<Cell, Long>> cellsToDelete = new HashMap<>(); List<Long> committedTimestamps = new ArrayList<>(); long lastSweptTs = minTsExclusive; boolean processedAll = true; List<Long> sortedStartTimestamps = startToCommitTs.keySet().stream().sorted().collect(Collectors.toList()); for (long startTs : sortedStartTimestamps) { long commitTs = startToCommitTs.get(startTs); if (commitTs == TransactionConstants.FAILED_COMMIT_TS) { lastSweptTs = startTs; writesByStartTs.get(startTs) .forEach(write -> cellsToDelete .computeIfAbsent(write.tableRef(), ignore -> HashMultimap.create()) .put(write.cell(), write.timestamp())); } else if (commitTs < sweepTs) { lastSweptTs = startTs; committedTimestamps.add(startTs); } else { processedAll = false; break; } } cellsToDelete.forEach((tableRef, multimap) -> { kvs.delete(tableRef, multimap); maybeMetrics.ifPresent(metrics -> metrics.updateAbortedWritesDeleted(shardStrategy, multimap.size())); log.info("Deleted aborted writes from the KVS.", SafeArg.of("number", multimap.size())); }); committedTimestamps.sort(Comparator.reverseOrder()); return TimestampsToSweep.of(committedTimestamps, lastSweptTs, processedAll); }

Target:
private TimestampsToSweep getTimestampsToSweepDescendingAndCleanupAborted(ShardAndStrategy shardStrategy, long minTsExclusive, long sweepTs, Multimap<Long, WriteInfo> writesByStartTs) { Map<Long, Long> startToCommitTs = commitTsCache.loadBatch(writesByStartTs.keySet()); Map<TableReference, Multimap<Cell, Long>> cellsToDelete = new HashMap<>(); List<Long> committedTimestamps = new ArrayList<>(); long lastSweptTs = minTsExclusive; boolean processedAll = true; List<Long> sortedStartTimestamps = startToCommitTs.keySet().stream().sorted().collect(Collectors.toList()); for (long startTs : sortedStartTimestamps) { long commitTs = startToCommitTs.get(startTs); if (commitTs == TransactionConstants.FAILED_COMMIT_TS) { lastSweptTs = startTs; writesByStartTs.get(startTs) .forEach(write -> cellsToDelete .computeIfAbsent(write.tableRef(), ignore -> HashMultimap.create()) .put(write.cell(), write.timestamp())); } else if (commitTs < sweepTs) { lastSweptTs = startTs; committedTimestamps.add(startTs); } else { processedAll = false; break; } } cellsToDelete.forEach((tableRef, multimap) -> { kvs.delete(tableRef, multimap); maybeMetrics.ifPresent(metrics -> metrics.updateAbortedWritesDeleted(shardStrategy, multimap.size())); log.info("Deleted aborted writes from table {}.", SafeArg.of("number", multimap.size()), LoggingArgs.tableRef(tableRef)); }); return TimestampsToSweep.of(Lists.reverse(committedTimestamps), lastSweptTs, processedAll); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } CTFCallsite other = (CTFCallsite) obj; if (!equalsNullable(fEventName, other.fEventName)) { return false; } if (!equalsNullable(fFileName, other.fFileName)) { return false; } if (!equalsNullable(fFunctionName, other.fFunctionName)) { return false; } if (fIp != other.fIp) { return false; } return (fLineNumber == other.fLineNumber); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } CTFCallsite other = (CTFCallsite) obj; if (!equalsNullable(fEventName, other.fEventName)) { return false; } if (!equalsNullable(fFileName, other.fFileName)) { return false; } if (!equalsNullable(fFunctionName, other.fFunctionName)) { return false; } if (fIp != other.fIp) { return false; } if (fLineNumber != other.fLineNumber){ return false; } return true; }
Source:
public String toString() { return "IlluminaNotificationDto [numCycles=" + numCycles + ", ImgCycle=" + ImgCycle + ", ScoreCycle=" + ScoreCycle + ", CallCycle=" + CallCycle + ", getRunName()=" + getRunAlias() + ", getSequencerName()=" + getSequencerName() + ", getCompletionDate()=" + getCompletionDate() + ", getStartDate()=" + getStartDate() + ", getContainerId()=" + getContainerSerialNumber() + ", getLaneCount()=" + getLaneCount() + ", getHealthType()=" + getHealthType() + ", getSequencerFolderPath()=" + getSequencerFolderPath() + ", isPairedEndRun()=" + isPairedEndRun() + ", getSoftware()=" + getSoftware() + "]"; }

Target:
public String toString() { return "IlluminaNotificationDto [numCycles=" + numCycles + ", ImgCycle=" + ImgCycle + ", ScoreCycle=" + ScoreCycle + ", CallCycle=" + CallCycle + ", getRunAlias()=" + getRunAlias() + ", getSequencerName()=" + getSequencerName() + ", getContainerSerialNumber()=" + getContainerSerialNumber() + ", getLaneCount()=" + getLaneCount() + ", getHealthType()=" + getHealthType() + ", getSequencerFolderPath()=" + getSequencerFolderPath() + ", isPairedEndRun()=" + isPairedEndRun() + ", getSoftware()=" + getSoftware() + ", getStartDate()=" + getStartDate() + ", getCompletionDate()=" + getCompletionDate() + "]"; }
Source:
private void addUsername(EditText editText, ValidationEndListener validationEndListener) { String username = removeDelimiterFromUsername(editText.getText().toString()); editText.setText(" "); if (username.isEmpty() || mUsernameButtons.keySet().contains(username)) { if (validationEndListener != null) { validationEndListener.onValidationEnd(); } return; } final ViewGroup usernameButton = buttonizeUsername(username); mUsernameButtons.put(username, usernameButton); validateAndStyleUsername(Arrays.asList(new String[]{username}), validationEndListener); }

Target:
private void addUsername(EditText editText, ValidationEndListener validationEndListener) { String username = removeDelimiterFromUsername(editText.getText().toString()); resetEditTextContent(editText); if (username.isEmpty() || mUsernameButtons.keySet().contains(username)) { if (validationEndListener != null) { validationEndListener.onValidationEnd(); } return; } final ViewGroup usernameButton = buttonizeUsername(username); mUsernameButtons.put(username, usernameButton); validateAndStyleUsername(Collections.singletonList(username), validationEndListener); }
Source:
private void showTreeViewer() { if (treeViewer != null) { return; } if (label != null) { label.dispose(); label = null; } treeViewer = new TreeViewer(composite, SWT.NONE); composite.layout(); final DocumentType doctype = vexEditor.getDocumentType(); if (doctype == null) { return; } final String ns = doctype.getConfig().getUniqueIdentifer(); final Bundle bundle = Platform.getBundle(ns); final String providerClassName = doctype.getOutlineProvider(); if (bundle != null && providerClassName != null) { try { final Class<?> clazz = bundle.loadClass(providerClassName); outlineProvider = (IOutlineProvider) clazz.newInstance(); } catch (final Exception ex) { final String message = Messages.getString("DocumentOutlinePage.loadingError"); VexPlugin.getDefault().log(IStatus.WARNING, MessageFormat.format(message, new Object[] { providerClassName, ns, ex })); } } if (outlineProvider == null) { outlineProvider = new DefaultOutlineProvider(); if (outlineProvider instanceof IToolBarContributor) { ((IToolBarContributor) outlineProvider).registerToolBarActions(this, getSite().getActionBars()); } } outlineProvider.init(vexEditor); treeViewer.setContentProvider(outlineProvider.getContentProvider()); treeViewer.setLabelProvider(outlineProvider.getLabelProvider()); treeViewer.setAutoExpandLevel(2); filterActionGroup.setViewer(treeViewer); treeViewer.setUseHashlookup(true); final IDocument document = vexEditor.getVexWidget().getDocument(); treeViewer.setInput(document); document.addDocumentListener(documentListener); treeViewer.addSelectionChangedListener(selectionListener); }

Target:
private void showTreeViewer() { if (treeViewer != null) { return; } if (label != null) { label.dispose(); label = null; } treeViewer = new TreeViewer(composite, SWT.NONE); composite.layout(); final DocumentType doctype = vexEditor.getDocumentType(); if (doctype == null) { return; } final String ns = doctype.getConfig().getUniqueIdentifer(); final Bundle bundle = Platform.getBundle(ns); final String providerClassName = doctype.getOutlineProvider(); if (bundle != null && providerClassName != null) { try { final Class<?> clazz = bundle.loadClass(providerClassName); outlineProvider = (IOutlineProvider) clazz.newInstance(); } catch (final Exception ex) { final String message = Messages.getString("DocumentOutlinePage.loadingError"); VexPlugin.getDefault().log(IStatus.WARNING, MessageFormat.format(message, new Object[] { providerClassName, ns, ex })); } } if (outlineProvider == null) { outlineProvider = new DefaultOutlineProvider(); } if (outlineProvider instanceof IToolBarContributor) { ((IToolBarContributor) outlineProvider).registerToolBarActions(this, getSite().getActionBars()); } outlineProvider.init(vexEditor); treeViewer.setContentProvider(outlineProvider.getContentProvider()); treeViewer.setLabelProvider(outlineProvider.getLabelProvider()); treeViewer.setAutoExpandLevel(2); filterActionGroup.setViewer(treeViewer); treeViewer.setUseHashlookup(true); final IDocument document = vexEditor.getVexWidget().getDocument(); treeViewer.setInput(document); document.addDocumentListener(documentListener); treeViewer.addSelectionChangedListener(selectionListener); }
Source:
public Map<String, Object> getMetaData(String iconName) throws IconException { return this.getMetaData(iconName, getIconSet(iconName).getName()); }

Target:
public Map<String, Object> getMetaData(String iconName) throws IconException { return this.getMetaData(iconName, getIconSet(iconName)); }
Source:
protected TaxRule determineTaxRuleToUseForDataPopulation(PaymentWorksVendor pmwVendor, String pmwVendorFipsTaxCountryCode) { TaxRule foundRule = TaxRule.OTHER; if (isIndividualUsSsn(pmwVendor, pmwVendorFipsTaxCountryCode)) { foundRule = TaxRule.INDIVIDUAL_US_SSN; } else if (isIndividualUsEin(pmwVendor, pmwVendorFipsTaxCountryCode)) { foundRule = TaxRule.INDIVIDUAL_US_EIN; } else if (isNotIndividualUs(pmwVendor, pmwVendorFipsTaxCountryCode)) { foundRule = TaxRule.NOT_INDIVIDUAL_US; } else if (isForeignIndividual(pmwVendor, pmwVendorFipsTaxCountryCode)) { foundRule = TaxRule.FOREIGN_INDIVIDUAL; } else if (isForeignEntity(pmwVendor, pmwVendorFipsTaxCountryCode)) { foundRule = TaxRule.FOREIGN_ENTITY; } else { LOG.error("determineTaxRuleToUseForDataPopulation, unknown tax rule for request " + pmwVendor.getId()); } return foundRule; }

Target:
protected TaxRule determineTaxRuleToUseForDataPopulation(PaymentWorksVendor pmwVendor, String pmwVendorFipsTaxCountryCode) { TaxRule taxRule = TaxRule.OTHER; if (isIndividualUsSsn(pmwVendor, pmwVendorFipsTaxCountryCode)) { taxRule = TaxRule.INDIVIDUAL_US_SSN; } else if (isIndividualUsEin(pmwVendor, pmwVendorFipsTaxCountryCode)) { taxRule = TaxRule.INDIVIDUAL_US_EIN; } else if (isNotIndividualUs(pmwVendor, pmwVendorFipsTaxCountryCode)) { taxRule = TaxRule.NOT_INDIVIDUAL_US; } else if (isForeignIndividualWithSSN(pmwVendor, pmwVendorFipsTaxCountryCode)) { taxRule = TaxRule.FOREIGN_INDIVIDUAL_US_TAX_PAYER; } else if (isForeignIndividual(pmwVendor, pmwVendorFipsTaxCountryCode)) { taxRule = TaxRule.FOREIGN_INDIVIDUAL; } else if (isForeignEntity(pmwVendor, pmwVendorFipsTaxCountryCode)) { taxRule = TaxRule.FOREIGN_ENTITY; } else { LOG.error("determineTaxRuleToUseForDataPopulation, unknown tax rule for request " + pmwVendor.getId()); } return taxRule; }
Source:
public void validateAmountsIncorrectDebitCredit() { file.getConcurStandardAccountingExtractDetailLines().get(0).setJounalDebitCredit("foo"); String message = "The should throw an error due to incorrect debitCredit field"; assertFalse("The should throw an error due to incorrect debitCredit field", concurStandardAccountingExtractService.validateAmounts(file)); }

Target:
public void validateAmountsIncorrectDebitCredit() { setBadDebitCredit(); assertFalse("The should throw an error due to incorrect debitCredit field", concurStandardAccountingValidationService.validateAmountsAndDebitCreditCode(file)); }
Source:
public Server deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException { Server serverBase = null; if (jsonElement.getAsJsonObject().get("image").isJsonObject()) { serverBase = apply((ServerInternal) context.deserialize(jsonElement, ServerInternal.class)); } else { serverBase = apply((ServerInternalWithoutImage) context.deserialize(jsonElement, ServerInternalWithoutImage.class)); } Server.Builder<?> result = Server.builder().fromServer(serverBase); ServerExtendedStatus extendedStatus = context.deserialize(jsonElement, ServerExtendedStatus.class); if (!Objects.equal(extendedStatus, ServerExtendedStatus.builder().build())) { result.extendedStatus(extendedStatus); } ServerExtendedAttributes extraAttributes = context.deserialize(jsonElement, ServerExtendedAttributes.class); if (!Objects.equal(extraAttributes, ServerExtendedAttributes.builder().build())) { result.extendedAttributes(extraAttributes); } return result.build(); }

Target:
public Server deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException { Server serverBase; if (jsonElement.getAsJsonObject().get("image").isJsonObject()) { serverBase = apply((ServerInternal) context.deserialize(jsonElement, ServerInternal.class)); } else { serverBase = apply((ServerInternalWithoutImage) context.deserialize(jsonElement, ServerInternalWithoutImage.class)); } Server.Builder<?> result = Server.builder().fromServer(serverBase); ServerExtendedStatus extendedStatus = context.deserialize(jsonElement, ServerExtendedStatus.class); if (!Objects.equal(extendedStatus, ServerExtendedStatus.builder().build())) { result.extendedStatus(extendedStatus); } ServerExtendedAttributes extraAttributes = context.deserialize(jsonElement, ServerExtendedAttributes.class); if (!Objects.equal(extraAttributes, ServerExtendedAttributes.builder().build())) { result.extendedAttributes(extraAttributes); } return result.build(); }
Source:
public final static boolean verify(HashResult hash1, HashResult hash2){ if(hash1.compareTo(hash2) == 0){ return true; } return false; }

Target:
public final static boolean verify(HashResult hash1, HashResult hash2){ return hash1.equals(hash2); }
Source:
public DocumentRevision createDocumentFromRevision(MutableDocumentRevision rev) throws IOException { if (rev.docId == null) { rev.docId = CouchUtils.generateDocumentId(); } try { this.getSQLDatabase().beginTransaction(); BasicDocumentRevision saved = createDocument(rev.docId, rev.body); this.attachmentManager.setAttachments(saved, rev.attachments); this.getSQLDatabase().setTransactionSuccessful(); DocumentRevision updatedWithAttachments = this.getDocument(saved.getId(), saved.getRevision()); return updatedWithAttachments; } finally { this.getSQLDatabase().endTransaction(); } }

Target:
public BasicDocumentRevision createDocumentFromRevision(MutableDocumentRevision rev) throws IOException { Preconditions.checkNotNull(rev, "DocumentRevision can not be null"); if (rev.docId == null) { rev.docId = CouchUtils.generateDocumentId(); } AttachmentManager.PreparedAndSavedAttachments preparedAndSavedAttachments = this.attachmentManager.prepareAttachments(rev.attachments != null ? rev.attachments.values() : null); try { this.getSQLDatabase().beginTransaction(); BasicDocumentRevision saved = createDocument(rev.docId, rev.body); this.attachmentManager.setAttachments(saved, preparedAndSavedAttachments); this.getSQLDatabase().setTransactionSuccessful(); BasicDocumentRevision updatedWithAttachments = this.getDocument(saved.getId(), saved.getRevision()); return updatedWithAttachments; } finally { this.getSQLDatabase().endTransaction(); } }
Source:
public void onCompletion(Void result, Exception exception) { long processingStartTimeMs = SystemTime.getInstance().milliseconds(); metrics.getPeersSecurityProcessingTimeInMs.update(processingStartTimeMs - operationStartTimeMs); try { if (exception == null) { DataNodeId dataNodeId = getDataNodeId(restRequest); LOGGER.trace("Getting peer hosts for {}:{}", dataNodeId.getHostname(), dataNodeId.getPort()); Set<DataNodeId> peerDataNodeIds = new HashSet<>(); List<? extends ReplicaId> replicaIdList = clusterMap.getReplicaIds(dataNodeId); for (ReplicaId replicaId : replicaIdList) { List<? extends ReplicaId> peerReplicaIds = replicaId.getPeerReplicaIds(); for (ReplicaId peerReplicaId : peerReplicaIds) { peerDataNodeIds.add(peerReplicaId.getDataNodeId()); } } StringBuilder peerSb = new StringBuilder(); for (DataNodeId peerDataNodeId : peerDataNodeIds) { peerSb.append(peerDataNodeId.getHostname()).append(":").append(peerDataNodeId.getPort()).append(","); } if (peerSb.length() > 0) { peerSb.deleteCharAt(peerSb.length() - 1); } String peerStr = peerSb.toString(); ReadableStreamChannel channel = new ByteBufferReadableStreamChannel(ByteBuffer.wrap(peerStr.getBytes())); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_TYPE, "text/plain"); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, channel.getSize()); callback.onCompletion(channel, null); } else { callback.onCompletion(null, exception); } } catch (Exception e) { callback.onCompletion(null, e); } finally { metrics.getPeersProcessingTimeInMs.update(SystemTime.getInstance().milliseconds() - processingStartTimeMs); } }

Target:
public void onCompletion(Void result, Exception exception) { long processingStartTimeMs = SystemTime.getInstance().milliseconds(); metrics.getPeersSecurityRequestTimeInMs.update(processingStartTimeMs - operationStartTimeMs); ReadableStreamChannel channel = null; try { if (exception == null) { DataNodeId dataNodeId = getDataNodeId(restRequest); LOGGER.trace("Getting peer hosts for {}:{}", dataNodeId.getHostname(), dataNodeId.getPort()); Set<DataNodeId> peerDataNodeIds = new HashSet<>(); List<? extends ReplicaId> replicaIdList = clusterMap.getReplicaIds(dataNodeId); for (ReplicaId replicaId : replicaIdList) { List<? extends ReplicaId> peerReplicaIds = replicaId.getPeerReplicaIds(); for (ReplicaId peerReplicaId : peerReplicaIds) { peerDataNodeIds.add(peerReplicaId.getDataNodeId()); } } channel = getResponseBody(peerDataNodeIds); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_TYPE, "application/json"); restResponseChannel.setHeader(RestUtils.Headers.CONTENT_LENGTH, channel.getSize()); } } catch (Exception e) { exception = e; } finally { metrics.getPeersProcessingTimeInMs.update(SystemTime.getInstance().milliseconds() - processingStartTimeMs); callback.onCompletion(exception == null ? channel : null, exception); } }
Source:
public void offerProducerCredit(final SimpleString address, final int credits, final int threshold, final Receiver receiver) { try { if (creditRunnable != null && !creditRunnable.isRun()) return; PagingManager pagingManager = manager.getServer().getPagingManager(); creditRunnable = new CreditRunnable() { boolean isRun = false; @Override public boolean isRun() { return isRun; } @Override public void run() { connection.lock(); try { if (receiver.getCredit() <= threshold) { int topUp = credits - receiver.getCredit(); System.out.println("topUp = " + topUp); if (topUp > 0) { receiver.flow(topUp); } } } finally { isRun = true; connection.unlock(); } connection.flush(); } }; if (address == null) { pagingManager.checkMemory(creditRunnable); } else { final PagingStore store = manager.getServer().getPagingManager().getPageStore(address); store.checkMemory(creditRunnable); } } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public void offerProducerCredit(final SimpleString address, final int credits, final int threshold, final Receiver receiver) { try { if (creditRunnable != null && !creditRunnable.isRun()) return; PagingManager pagingManager = manager.getServer().getPagingManager(); creditRunnable = new CreditRunnable() { boolean isRun = false; @Override public boolean isRun() { return isRun; } @Override public void run() { connection.lock(); try { if (receiver.getCredit() <= threshold) { int topUp = credits - receiver.getCredit(); if (topUp > 0) { receiver.flow(topUp); } } } finally { isRun = true; connection.unlock(); } connection.flush(); } }; if (address == null) { pagingManager.checkMemory(creditRunnable); } else { final PagingStore store = manager.getServer().getPagingManager().getPageStore(address); store.checkMemory(creditRunnable); } } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; InDoubtTxInfoImpl that = (InDoubtTxInfoImpl) o; return status == that.status && isLocal == that.isLocal && Objects.equals(xid, that.xid) && Objects.equals(internalId, that.internalId) && Objects.equals(owners, that.owners); }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; InDoubtTxInfoImpl that = (InDoubtTxInfoImpl) o; return internalId == that.internalId && status == that.status && isLocal == that.isLocal && Objects.equals(xid, that.xid) && Objects.equals(owners, that.owners); }
Source:
public void migrateWithRetry() { final int max_retry = 3; for (int i = 0; i < max_retry; i++) { try { logger.info("Database migration started"); migrate(); logger.info("Database migration successfully finished."); return; } catch (RuntimeException re) { logger.warn(re.toString()); if (i == max_retry - 1) { logger.error("Critical error!!. Database migration failed."); } else { logger.warn("Database migration failed. Retry"); try { Thread.sleep(30 * 1000); } catch (InterruptedException ie) { } } } } logger.error("Database migration aborted."); }

Target:
public void migrateWithRetry() { final int maxRetry = 3; for (int i = 0; i < maxRetry; i++) { try { logger.info("Database migration started"); migrate(); logger.info("Database migration successfully finished."); return; } catch (RuntimeException re) { logger.warn(re.toString()); if (i == maxRetry - 1) { logger.error("Critical error!!. Database migration failed."); } else { logger.warn("Database migration failed. Retry"); try { Thread.sleep(30 * 1000); } catch (InterruptedException ie) { } } } } logger.error("Database migration aborted."); }
Source:
public void initializeFrom(ILaunchConfiguration config) { String remoteConnection = null; try { remoteConnection = config.getAttribute( IRemoteConnectionConfigurationConstants.ATTR_REMOTE_CONNECTION, EMPTY_STRING); } catch (CoreException ce) { logError(ce); remoteConnection = EMPTY_STRING; } String[] items = fConnectionCombo.getItems(); int i = 0; for (i = 0; i < items.length; i++) if (items[i].equals(remoteConnection)) break; if (i < items.length) { fConnectionCombo.select(i); } else { setErrorMessage(MessageFormat.format( Messages.RemoteSystemTab_Error_ConnectionNotFound, remoteConnection)); setDefaultConnection(); setDirty(true); } updateConnectionButtons(); }

Target:
public void initializeFrom(ILaunchConfiguration config) { String remoteConnection = null; try { remoteConnection = config.getAttribute( IRemoteConnectionConfigurationConstants.ATTR_REMOTE_CONNECTION, EMPTY_STRING); } catch (CoreException ce) { logError(ce); remoteConnection = EMPTY_STRING; } String[] items = fConnectionCombo.getItems(); int i = 0; for (i = 0; i < items.length; i++) { if (items[i].equals(remoteConnection)) { break; } } if (i < items.length) { fConnectionCombo.select(i); } else { setErrorMessage(MessageFormat.format( Messages.RemoteSystemTab_Error_ConnectionNotFound, remoteConnection)); setDefaultConnection(); setDirty(true); } updateConnectionButtons(); if(fShowSystemInfoCheck != null && ! fShowSystemInfoCheck.isDisposed() && fShowSystemInfoCheck.getSelection() == false) { fSystemInfoText.setText(Messages.RemoteSystemTab_ShowSystemInfo_NoInformation); } }
Source:
@Override public void onResponse(Call<AggregatedFeedContent> call, Response<AggregatedFeedContent> response) { if (response.isSuccessful()) { List<Card> cards = new ArrayList<>(); AggregatedFeedContent content = response.body(); cards.add(new FeaturedArticleCard(content.tfa(), DATE, site)); cards.add(new NewsListCard(content.news(), DATE, site)); cb.success(cards); } else { L.v(response.message()); cb.error(new IOException(response.message())); } }

Target:
@Override public void onResponse(Call<AggregatedFeedContent> call, Response<AggregatedFeedContent> response) { if (response.isSuccessful()) { List<Card> cards = new ArrayList<>(); AggregatedFeedContent content = response.body(); if (content.tfa() != null) { cards.add(new FeaturedArticleCard(content.tfa(), DATE, site)); } if (content.news() != null) { cards.add(new NewsListCard(content.news(), DATE, site)); } cb.success(cards); } else { L.v(response.message()); cb.error(new IOException(response.message())); } }
Source:
public Expression visitExpression(ManifoldParser.ExpressionContext context) { if (context.expression().size() == 2) { return new FunctionInvocationExpression( visit(context.expression(0)), visit(context.expression(1)) ); } else { return visitChildren(context); } }

Target:
public Expression visitExpression(ManifoldParser.ExpressionContext context) { if (context.getChildCount() == 3 && context.getChild(1).getText().equals("=")) { return new VariableAssignmentExpression( visit(context.expression(0)), visit(context.expression(1)) ); } else if (context.expression().size() == 2) { return new FunctionInvocationExpression( visit(context.expression(0)), visit(context.expression(1)) ); } else { return visitChildren(context); } }
Source:
public static ServicePolicyInterface getServicePolicyForVds(VDS vds) { ServicePolicyInterface retVal = null; Guid vdsGroupId = vds.getvds_group_id(); VDSGroup vdsGroup = vdsGroupDao.get(vdsGroupId); if (vdsGroup != null) { retVal = virtServicePolicy; } return retVal; }

Target:
public static ServicePolicyInterface getServicePolicyForVds(VDS vds) { Guid vdsGroupId = vds.getvds_group_id(); VDSGroup vdsGroup = vdsGroupDao.get(vdsGroupId); return virtServicePolicy; }
Source:
public DiscoveryJerseyProvider(EncoderWrapper jsonEncoder, DecoderWrapper jsonDecoder) { this.jsonEncoder = jsonEncoder == null ? CodecWrappers.getEncoder(LegacyJacksonJson.class) : jsonEncoder; this.jsonDecoder = jsonDecoder == null ? CodecWrappers.getDecoder(LegacyJacksonJson.class) : jsonDecoder; LOGGER.info("Using JSON encoding codec {}", this.jsonEncoder.codecName()); LOGGER.info("Using JSON decoding codec {}", this.jsonDecoder.codecName()); if (jsonEncoder instanceof CodecWrappers.JacksonJsonMini) { throw new UnsupportedOperationException("Encoder: " + jsonEncoder.codecName() + "is not supported for the client"); } if (isJacksonXmlOnClasspath()) { this.xmlEncoder = CodecWrappers.getEncoder("JacksonXml"); this.xmlDecoder = CodecWrappers.getDecoder("JacksonXml"); LOGGER.info("Using XML encoding codec {}", this.xmlEncoder.codecName()); LOGGER.info("Using XML decoding codec {}", this.xmlDecoder.codecName()); } else { this.xmlEncoder = null; this.xmlDecoder = null; } }

Target:
public DiscoveryJerseyProvider(EncoderWrapper jsonEncoder, DecoderWrapper jsonDecoder) { this.jsonEncoder = jsonEncoder == null ? CodecWrappers.getEncoder(LegacyJacksonJson.class) : jsonEncoder; this.jsonDecoder = jsonDecoder == null ? CodecWrappers.getDecoder(LegacyJacksonJson.class) : jsonDecoder; LOGGER.info("Using JSON encoding codec {}", this.jsonEncoder.codecName()); LOGGER.info("Using JSON decoding codec {}", this.jsonDecoder.codecName()); if (jsonEncoder instanceof CodecWrappers.JacksonJsonMini) { throw new UnsupportedOperationException("Encoder: " + jsonEncoder.codecName() + "is not supported for the client"); } this.xmlEncoder = CodecWrappers.getEncoder(CodecWrappers.XStreamXml.class); this.xmlDecoder = CodecWrappers.getDecoder(CodecWrappers.XStreamXml.class); LOGGER.info("Using XML encoding codec {}", this.xmlEncoder.codecName()); LOGGER.info("Using XML decoding codec {}", this.xmlDecoder.codecName()); }
Source:
public KafkaMessage nextRecord(String topic, long timeout) throws InterruptedException { KafkaMessage message = null; BlockingQueue<KafkaMessage> queue = topicQueue.get(topic); if (queue != null) { message = queue.poll(timeout, TimeUnit.MILLISECONDS); } return message; }

Target:
public KafkaMessage nextRecord(String topic, long timeout) throws InterruptedException { KafkaMessage message = null; BlockingQueue<KafkaMessage> queue = topicQueue.get(topic); if (queue != null) { message = queue.poll(timeout, TimeUnit.MILLISECONDS); } else { log.warn("Tried to take record from non-existant topic queue: {}", topic); } return message; }
Source:
public void test() throws Exception { TestInvokable invokable = new TestInvokable(); CheckpointBarrierUnaligner unaligner = new CheckpointBarrierUnaligner(new int[]{1}, ChannelStateWriter.NO_OP, "test", invokable); for (RuntimeEvent e : events) { if (e instanceof CancelCheckpointMarker) { unaligner.processCancellationBarrier((CancelCheckpointMarker) e); } else if (e instanceof CheckpointBarrier) { unaligner.processBarrier((CheckpointBarrier) e, 0, 0); } else { throw new IllegalArgumentException("unexpected event type: " + e); } } assertEquals(shouldAbortCheckpoint, invokable.checkpointAborted); assertEquals(shouldTriggerCheckpoint, invokable.checkpointTriggered); }

Target:
public void test() throws Exception { TestInvokable invokable = new TestInvokable(); CheckpointBarrierUnaligner unaligner = new CheckpointBarrierUnaligner(new int[]{numChannels}, ChannelStateWriter.NO_OP, "test", invokable); for (RuntimeEvent e : events) { if (e instanceof CancelCheckpointMarker) { unaligner.processCancellationBarrier((CancelCheckpointMarker) e); } else if (e instanceof CheckpointBarrier) { unaligner.processBarrier((CheckpointBarrier) e, channel, 0); } else { throw new IllegalArgumentException("unexpected event type: " + e); } } assertEquals("expectAbortCheckpoint", expectAbortCheckpoint, invokable.checkpointAborted); assertEquals("expectTriggerCheckpoint", expectTriggerCheckpoint, invokable.checkpointTriggered); }
Source:
public void update(String body) throws IOException { owner.root.retrieve() .method("POST") .with("body", body) .method("PATCH") .withUrlPath(getApiRoute()) .to(GHIssueComment.class); this.body = body; }

Target:
public void update(String body) throws IOException { owner.root.createRequest() .method("PATCH") .with("body", body) .withUrlPath(getApiRoute()) .fetch(GHIssueComment.class); this.body = body; }
Source:
public final View getView(int position, View convertView, ViewGroup parent) { int type = getItemViewType(position); switch (type) { case SectionRow.ITEM: { convertView = mInflater.inflate(R.layout.row_course_outline_list, parent, false); ViewHolder tag = getTag(convertView); convertView.setTag(tag); break; } case SectionRow.SECTION: { convertView = mInflater.inflate(R.layout.row_section_header, parent, false); break; } case SectionRow.COURSE_CARD: { if (convertView == null) { convertView = mInflater.inflate(R.layout.row_course_card, parent, false); } break; } case SectionRow.LAST_ACCESSED_ITEM: { if (convertView == null) { convertView = mInflater.inflate(R.layout.row_last_accessed, parent, false); } break; } default: { throw new IllegalArgumentException(String.valueOf(type)); } } switch (type) { case SectionRow.ITEM: { return getRowView(position, convertView); } case SectionRow.SECTION: { return getHeaderView(position, convertView); } case SectionRow.COURSE_CARD: { return getCardView(convertView); } case SectionRow.LAST_ACCESSED_ITEM: { return getLastAccessedView(position, convertView); } default: { throw new IllegalArgumentException(String.valueOf(type)); } } }

Target:
public final View getView(int position, View convertView, ViewGroup parent) { final int type = getItemViewType(position); switch (type) { case SectionRow.ITEM: { convertView = inflater.inflate(R.layout.row_course_outline_list, parent, false); ViewHolder tag = getTag(convertView); convertView.setTag(tag); return getRowView(position, convertView); } case SectionRow.SECTION: { convertView = inflater.inflate(R.layout.row_section_header, parent, false); return getHeaderView(position, convertView); } case SectionRow.COURSE_CARD: { if (convertView == null) { convertView = inflater.inflate(R.layout.row_course_card, parent, false); } return getCardView(convertView); } case SectionRow.LAST_ACCESSED_ITEM: { if (convertView == null) { convertView = inflater.inflate(R.layout.row_last_accessed, parent, false); } return getLastAccessedView(position, convertView); } default: { throw new IllegalArgumentException(String.valueOf(type)); } } }
Source:
protected void initTemplateDisks(List<DiskImage> disks) { Collections.sort(disks, new Linq.DiskByAliasComparer()); ArrayList<DiskModel> list = new ArrayList<>(); for (Disk disk : disks) { DiskModel diskModel = new DiskModel(); diskModel.getAlias().setEntity(disk.getDiskAlias()); diskModel.getVolumeType().setIsAvailable(false); switch (disk.getDiskStorageType()) { case IMAGE: DiskImage diskImage = (DiskImage) disk; diskModel.setSize(new EntityModel<>((int) diskImage.getSizeInGigabytes())); ListModel volumes = new ListModel(); volumes.setItems((diskImage.getVolumeType() == VolumeType.Preallocated ? new ArrayList<>(Arrays.asList(new VolumeType[]{VolumeType.Preallocated})) : AsyncDataProvider.getInstance().getVolumeTypeList()), diskImage.getVolumeType()); diskModel.setVolumeType(volumes); break; case CINDER: CinderDisk cinderDisk = (CinderDisk) disk; diskModel.setSize(new EntityModel<>((int) cinderDisk.getSizeInGigabytes())); ListModel volumeTypes = new ListModel(); volumeTypes.setItems(new ArrayList<>(Arrays.asList(cinderDisk.getVolumeType())), cinderDisk.getVolumeType()); diskModel.setVolumeType(volumeTypes); break; } diskModel.setDisk(disk); list.add(diskModel); } getModel().setDisks(list); updateIsDisksAvailable(); initStorageDomains(); }

Target:
protected void initTemplateDisks(List<DiskImage> disks) { Collections.sort(disks, new Linq.DiskByAliasComparer()); ArrayList<DiskModel> list = new ArrayList<>(); for (DiskImage disk : disks) { DiskModel diskModel = new DiskModel(); diskModel.getAlias().setEntity(disk.getDiskAlias()); diskModel.getVolumeType().setIsAvailable(false); switch (disk.getDiskStorageType()) { case IMAGE: diskModel.setSize(new EntityModel<>((int) disk.getSizeInGigabytes())); ListModel volumes = new ListModel(); volumes.setItems((disk.getVolumeType() == VolumeType.Preallocated ? new ArrayList<>(Arrays.asList(new VolumeType[]{VolumeType.Preallocated})) : AsyncDataProvider.getInstance().getVolumeTypeList()), disk.getVolumeType()); diskModel.setVolumeType(volumes); break; case CINDER: CinderDisk cinderDisk = (CinderDisk) disk; diskModel.setSize(new EntityModel<>((int) cinderDisk.getSizeInGigabytes())); ListModel volumeTypes = new ListModel(); volumeTypes.setItems(new ArrayList<>(Arrays.asList(cinderDisk.getVolumeType())), cinderDisk.getVolumeType()); diskModel.setVolumeType(volumeTypes); break; } diskModel.setDisk(disk); list.add(diskModel); } getModel().setDisks(list); updateIsDisksAvailable(); initStorageDomains(); }
Source:
public void doUserCancel_chargeStatusDuringAuthorisation_DoesNotNeedCancellationWithProvider(String chargeStatus) throws Exception { var status = ChargeStatus.fromString(chargeStatus); String externalChargeId = "external-charge-id"; ChargeEntity chargeEntity = aValidChargeEntity() .withExternalId(externalChargeId) .withTransactionId("transaction-id") .withStatus(status) .build(); when(mockQueryService.isTerminableWithGateway(chargeEntity)).thenReturn(false); when(mockChargeDao.findByExternalId(externalChargeId)).thenReturn(Optional.of(chargeEntity)); chargeCancelService.doUserCancel(externalChargeId); verify(mockPaymentProvider, never()).cancel(any()); verify(chargeService).transitionChargeState(externalChargeId, USER_CANCELLED); verifyNoMoreInteractions(ignoreStubs(mockChargeDao)); }

Target:
public void doUserCancel_chargeStatusDuringAuthorisation_DoesNotNeedCancellationWithProvider(String chargeStatus) throws Exception { var status = ChargeStatus.fromString(chargeStatus); String externalChargeId = "external-charge-id"; ChargeEntity chargeEntity = aValidChargeEntity() .withExternalId(externalChargeId) .withTransactionId("transaction-id") .withStatus(status) .build(); when(mockQueryService.isTerminableWithGateway(chargeEntity)).thenReturn(false); when(mockChargeDao.findByExternalId(externalChargeId)).thenReturn(Optional.of(chargeEntity)); chargeCancelService.doUserCancel(externalChargeId); verify(mockPaymentProvider, never()).cancel(any()); verify(chargeService).transitionChargeState(externalChargeId, USER_CANCELLED); }
Source:
private void maybeDeleteActiveConsumers(final String groupId, final Admin adminClient) throws ExecutionException, InterruptedException { final DescribeConsumerGroupsResult describeResult = adminClient.describeConsumerGroups( Collections.singleton(groupId), new DescribeConsumerGroupsOptions().timeoutMs(10 * 1000)); final List<MemberDescription> members = new ArrayList<>(describeResult.describedGroups().get(groupId).get().members()); if (!members.isEmpty()) { if (options.has(forceOption)) { System.out.println("Force deleting all active members in the group: " + groupId); adminClient.removeMembersFromConsumerGroup(groupId, new RemoveMembersFromConsumerGroupOptions()).all(); } else { throw new IllegalStateException("Consumer group '" + groupId + "' is still active " + "and has following members: " + members + ". " + "Make sure to stop all running application instances before running the reset tool." + "Try set '--force' in the cmdline to force delete active members."); } } }

Target:
private void maybeDeleteActiveConsumers(final String groupId, final Admin adminClient) throws ExecutionException, InterruptedException { final DescribeConsumerGroupsResult describeResult = adminClient.describeConsumerGroups( Collections.singleton(groupId), new DescribeConsumerGroupsOptions().timeoutMs(10 * 1000)); final List<MemberDescription> members = new ArrayList<>(describeResult.describedGroups().get(groupId).get().members()); if (!members.isEmpty()) { if (options.has(forceOption)) { System.out.println("Force deleting all active members in the group: " + groupId); try { adminClient.removeMembersFromConsumerGroup(groupId, new RemoveMembersFromConsumerGroupOptions()).all().get(); } catch (Exception e) { throw e; } } else { throw new IllegalStateException("Consumer group '" + groupId + "' is still active " + "and has following members: " + members + ". " + "Make sure to stop all running application instances before running the reset tool." + " You can use option '--force' to remove active members from the group."); } } }
Source:
public List<SongMetadata> getLibrary() { synchronized(metadataMutex) { ArrayList<SongMetadata> music = new ArrayList<SongMetadata>(metadataList); Collections.sort(music); return Collections.unmodifiableList(music); } }

Target:
public List<SongMetadata> getLibrary() { synchronized(metadataMutex) { return Collections.unmodifiableList(new ArrayList<SongMetadata>(metadataList)); } }
Source:
public ClusterHealthStatus getHealthStatus(String[] indexNames) { try { Response response = lowLevelClient.performRequest("GET", String.format("/_cluster/health/%s", getIndexesAsString(indexNames))); try (InputStream is = response.getEntity().getContent()) { Map<String, Object> map = XContentHelper.convertToMap(XContentType.JSON.xContent(), is, true); return ClusterHealthStatus.fromString((String) map.get("status")); } } catch (IOException e) { throw new RuntimeException(e); } }

Target:
public ClusterHealthStatus getHealthStatus(String[] indexNames) { try { Response response = lowLevelClient.performRequest("GET", String.format("/_cluster/health/%s", getIndexesAsString(indexNames))); try (InputStream is = response.getEntity().getContent()) { Map<String, Object> map = XContentHelper.convertToMap(XContentType.JSON.xContent(), is, true); return ClusterHealthStatus.fromString((String) map.get("status")); } } catch (IOException e) { throw new NuxeoException(e); } }
Source:
private UserAnonymized getUserAnonymizedByID(UUID id) { UserAnonymized entity = UserAnonymized.getRepository().findOne(id); if (entity == null) { throw InvalidDataException.analysisUserNotFound(id); } return entity; }

Target:
private UserAnonymized getUserAnonymizedByID(UUID id) { UserAnonymized entity = UserAnonymized.getRepository().findOne(id); if (entity == null) { throw InvalidDataException.loginIDNotFound(id); } return entity; }