auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static int positionToDragCursor(int swtPositionConstant) { switch (swtPositionConstant) { case SWT.LEFT: return LEFT; case SWT.RIGHT: return RIGHT; case SWT.TOP: return TOP; case SWT.BOTTOM: return BOTTOM; case SWT.CENTER: return <START> CENTER; <END> } return INVALID; }</code><technical_language>default</technical_language>

Target:
public static int positionToDragCursor(int swtPositionConstant) { switch (swtPositionConstant) { case SWT.LEFT: return LEFT; case SWT.RIGHT: return RIGHT; case SWT.TOP: return TOP; case SWT.BOTTOM: return BOTTOM; case SWT.CENTER: return CENTER; default: return INVALID; } }
Source:
<code>public static boolean shouldCaptureIncrementalChanges(FileSystem fs,Path rootDir) throws StandardException{ boolean shouldRegister = false; try { boolean enabled = incrementalBackupEnabled(); if (enabled) { RecoverableZooKeeper zooKeeper = ZkUtils.getRecoverableZooKeeper(); String spliceBackupPath = BackupUtils.getBackupPath(); if (zooKeeper.exists(spliceBackupPath, false)==null){ return false; } boolean isRestoreMode = SIDriver.driver().lifecycleManager().isRestoreMode(); if (!isRestoreMode) { if (BackupUtils.existsDatabaseBackup(fs, rootDir)) { if (LOG.isDebugEnabled()) { SpliceLogUtils.debug(LOG, "There exists a successful full or incremental backup in the system"); } shouldRegister = true; } else { List<String> backupJobs = zooKeeper.getChildren(spliceBackupPath, false); for (String backupId : backupJobs) { String path = spliceBackupPath + "/" + backupId; byte[] data = zooKeeper.getData(path, false, null); BackupJobStatus status = BackupJobStatus.parseFrom(data); <START> if (status.getScope() == BackupJobStatus.BackupScope.DATABASE.DATABASE) { <END> if (LOG.isDebugEnabled()) { SpliceLogUtils.debug(LOG, "A database backup is running"); } shouldRegister = true; } } } } } return shouldRegister; } catch (Exception e) { e.printStackTrace(); throw StandardException.plainWrapException(e); } }</code><technical_language>Please remove extra DATABASE in "BackupJobStatus.BackupScope.DATABASE.DATABASE"</technical_language>

Target:
public static boolean shouldCaptureIncrementalChanges(FileSystem fs,Path rootDir) throws StandardException{ boolean shouldRegister = false; try { boolean enabled = incrementalBackupEnabled(); if (enabled) { RecoverableZooKeeper zooKeeper = ZkUtils.getRecoverableZooKeeper(); String spliceBackupPath = BackupUtils.getBackupPath(); if (zooKeeper.exists(spliceBackupPath, false)==null){ return false; } boolean isRestoreMode = SIDriver.driver().lifecycleManager().isRestoreMode(); if (!isRestoreMode) { if (BackupUtils.existsDatabaseBackup(fs, rootDir)) { if (LOG.isDebugEnabled()) { SpliceLogUtils.debug(LOG, "There exists a successful full or incremental backup in the system"); } shouldRegister = true; } else { List<String> backupJobs = zooKeeper.getChildren(spliceBackupPath, false); for (String backupId : backupJobs) { String path = spliceBackupPath + "/" + backupId; byte[] data = zooKeeper.getData(path, false, null); BackupJobStatus status = BackupJobStatus.parseFrom(data); if (status.getScope() == BackupJobStatus.BackupScope.DATABASE) { if (LOG.isDebugEnabled()) { SpliceLogUtils.debug(LOG, "A database backup is running"); } shouldRegister = true; } } } } } return shouldRegister; } catch (Exception e) { e.printStackTrace(); throw StandardException.plainWrapException(e); } }
Source:
<code>public synchronized void onCompleted(AbstractBuild r, TaskListener listener) { GerritCause cause = getCause(r); logger.info("Completed. Build: Cause: {}", r, cause); if (cause != null) { cleanUpGerritCauses(cause, r); PatchsetCreated event = cause.getEvent(); if (GerritTrigger.getTrigger(r.getProject()) != null) { GerritTrigger.getTrigger(r.getProject()).notifyBuildEnded(event); } event.fireBuildCompleted(r); if (!cause.isSilentMode()) { PatchSetKey key = memory.completed(event, r); if (r.getResult() != Result.SUCCESS) { try { String failureMessage = this.obtainFailureMessage(event, r, listener); memory.setEntryFailureMessage(key, r, failureMessage); } catch (IOException e) { <START> e.printStackTrace(listener.getLogger()); <END> } catch (InterruptedException e) { e.printStackTrace(listener.getLogger()); } } updateTriggerContexts(r, key); if (memory.isAllBuildsCompleted(key)) { try { logger.info("All Builds are completed for cause: {}", cause); event.fireAllBuildsCompleted(); NotificationFactory.getInstance().queueBuildCompleted(memory.getMemoryImprint(key), listener); } finally { memory.forget(key); } } else { logger.info("Waiting for more builds to complete for cause [{}]. Status: \n{}", cause, memory.getStatusReport(key)); } } } }</code><technical_language>I prefer a more comprehensive message user build log. stacktrace logger admin is (naming build context is lost there)</technical_language>

Target:
public synchronized void onCompleted(AbstractBuild r, TaskListener listener) { GerritCause cause = getCause(r); logger.info("Completed. Build: Cause: {}", r, cause); if (cause != null) { cleanUpGerritCauses(cause, r); PatchsetCreated event = cause.getEvent(); if (GerritTrigger.getTrigger(r.getProject()) != null) { GerritTrigger.getTrigger(r.getProject()).notifyBuildEnded(event); } event.fireBuildCompleted(r); if (!cause.isSilentMode()) { PatchSetKey key = memory.completed(event, r); if (r.getResult().isWorseThan(Result.SUCCESS)) { try { String failureMessage = this.obtainFailureMessage(event, r, listener); logger.info("Obtained failure message: {}", failureMessage); memory.setEntryFailureMessage(key, r, failureMessage); } catch (IOException e) { listener.error("[gerrit-trigger] Unable to read failure message from the workspace."); logger.warn("IOException while obtaining failure message for build: " + r.getDisplayName(), e); } catch (InterruptedException e) { listener.error("[gerrit-trigger] Unable to read failure message from the workspace."); logger.warn("InterruptedException while obtaining failure message for build: " + r.getDisplayName(), e); } } updateTriggerContexts(r, key); if (memory.isAllBuildsCompleted(key)) { try { logger.info("All Builds are completed for cause: {}", cause); event.fireAllBuildsCompleted(); NotificationFactory.getInstance().queueBuildCompleted(memory.getMemoryImprint(key), listener); } finally { memory.forget(key); } } else { logger.info("Waiting for more builds to complete for cause [{}]. Status: \n{}", cause, memory.getStatusReport(key)); } } } }
Source:
<code>public void testVerifyByteArrayByteArray() { for(int i = 0; i < types.length; i++){ Hash hash = new Hash(types[i]); <START> boolean verified = hash.verify(Hex.decode(trueHashes[i]), helloWorld); <END> assertTrue("HashType: "+types[i].name(), verified); } }</code><technical_language>Some places this separate boolean assert others put entire condition in assert statement. preferable consistently. one</technical_language>

Target:
public void testVerifyByteArrayByteArray() { for(int i = 0; i < types.length; i++){ Hash hash = new Hash(types[i]); assertTrue("HashType: "+types[i].name(), hash.verify(Hex.decode(trueHashes[i]), helloWorld)); } }
Source:
<code>public boolean advance() { if (state.get() != State.RUNNING) { return false; } URI nextUri = currentStatusInfo().getNextUri(); if (nextUri == null) { state.compareAndSet(State.RUNNING, State.FINISHED); return false; } Request request = prepareRequest(HttpUrl.get(nextUri)).build(); Exception cause = null; long start = System.nanoTime(); long attempts = 0; while (true) { if (attempts > 0) { try { MILLISECONDS.sleep(attempts * 100); } catch (InterruptedException e) { try { close(); } finally { Thread.currentThread().interrupt(); } state.compareAndSet(State.RUNNING, State.COMMUNICATION_FAILURE); throw new RuntimeException("StatementClient thread was interrupted"); } } attempts++; JsonResponse<QueryResults> response; try { response = JsonResponse.execute(QUERY_RESULTS_CODEC, httpClient, request); } catch (RuntimeException e) { cause = e; continue; } if ((response.getStatusCode() == HTTP_OK) && response.hasValue()) { processResponse(response.getHeaders(), response.getValue()); return true; } if (response.getStatusCode() != HTTP_UNAVAILABLE) { state.compareAndSet(State.RUNNING, State.COMMUNICATION_FAILURE); throw requestFailedException("fetching next", request, response); } <START> if (System.nanoTime() - start >= requestTimeoutNanos) { <END> state.compareAndSet(State.RUNNING, State.COMMUNICATION_FAILURE); throw new RuntimeException("Time out fetching next", cause); } if (isAborted()) { return false; } } }</code><technical_language>switch requestTimeoutNanos Duration nanosSince() compareTo()</technical_language>

Target:
public boolean advance() { if (!isRunning()) { return false; } URI nextUri = currentStatusInfo().getNextUri(); if (nextUri == null) { state.compareAndSet(State.RUNNING, State.FINISHED); return false; } Request request = prepareRequest(HttpUrl.get(nextUri)).build(); Exception cause = null; long start = System.nanoTime(); long attempts = 0; while (true) { if (attempts > 0) { try { MILLISECONDS.sleep(attempts * 100); } catch (InterruptedException e) { try { close(); } finally { Thread.currentThread().interrupt(); } state.compareAndSet(State.RUNNING, State.CLIENT_ERROR); throw new RuntimeException("StatementClient thread was interrupted"); } } attempts++; JsonResponse<QueryResults> response; try { response = JsonResponse.execute(QUERY_RESULTS_CODEC, httpClient, request); } catch (RuntimeException e) { cause = e; continue; } if ((response.getStatusCode() == HTTP_OK) && response.hasValue()) { processResponse(response.getHeaders(), response.getValue()); return true; } if (response.getStatusCode() != HTTP_UNAVAILABLE) { state.compareAndSet(State.RUNNING, State.CLIENT_ERROR); throw requestFailedException("fetching next", request, response); } if (Duration.nanosSince(start).compareTo(requestTimeoutNanos) > 0) { state.compareAndSet(State.RUNNING, State.CLIENT_ERROR); throw new RuntimeException("Error fetching next", cause); } if (isClientAborted()) { return false; } } }
Source:
<code>public void visitNode(Tree tree) { <START> if (hasSemantic()) { <END> MethodTree methodTree = (MethodTree) tree; if (methodTree.block() != null && "equals".equals(methodTree.symbol().name()) && methodTree.parameters().size() == 1) { Symbol parameterSymbol = methodTree.parameters().get(0).symbol(); if (parameterSymbol.type().is("java.lang.Object")) { typeChecked = false; methodTree.accept(new EqualsMethodVisitor(parameterSymbol)); if (!typeChecked) { addIssue(tree, "Add a type test to this method."); } } } } }</code><technical_language>code a bit more readable avoid 4 (or more) nested ifs, I preferably start of method: <pre> if (!hasSemantic()) { return; }</pre></technical_language>

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; if (methodTree.block() != null && "equals".equals(methodTree.symbol().name()) && methodTree.parameters().size() == 1) { Symbol parameterSymbol = methodTree.parameters().get(0).symbol(); if (parameterSymbol.type().is("java.lang.Object")) { ExpressionVisitor visitor = new ExpressionVisitor(parameterSymbol); methodTree.accept(visitor); if (!visitor.typeChecked) { addIssue(tree, "Add a type test to this method."); } } } }
Source:
<code>protected void finishFeature() { final SWTBotTree projectExplorerTree = TestUtil.getExplorerTree(); getProjectItem(projectExplorerTree, PROJ1).select(); final String[] menuPath = new String[] { util.getPluginLocalizedValue("TeamMenu.label"), util.getPluginLocalizedValue("TeamGitFlowMenu.name", false, Activator.getDefault().getBundle()), util.getPluginLocalizedValue("TeamGitFlowFeatureFinish.name", false, Activator.getDefault().getBundle()) }; ContextMenuHelper.clickContextMenu(projectExplorerTree, menuPath); bot.waitUntil(shellIsActive(UIText.FinishFeatureDialog_title)); selectOptions(); bot.checkBox(UIText.FinishFeatureDialog_saveAsDefault).click(); <START> bot.button("Finish").click(); <END> preFinish(); bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs")); }</code><technical_language>constant in other tests ? changing property break tests</technical_language>

Target:
protected void finishFeature() { final SWTBotTree projectExplorerTree = TestUtil.getExplorerTree(); getProjectItem(projectExplorerTree, PROJ1).select(); final String[] menuPath = new String[] { util.getPluginLocalizedValue("TeamMenu.label"), util.getPluginLocalizedValue("TeamGitFlowMenu.name", false, Activator.getDefault().getBundle()), util.getPluginLocalizedValue("TeamGitFlowFeatureFinish.name", false, Activator.getDefault().getBundle()) }; ContextMenuHelper.clickContextMenu(projectExplorerTree, menuPath); bot.waitUntil(shellIsActive(UIText.FinishFeatureDialog_title)); selectOptions(); bot.checkBox(UIText.FinishFeatureDialog_saveAsDefault).click(); bot.button(UIText.FinishFeatureDialog_ButtonOK).click(); preFinish(); bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs")); }
Source:
<code>public void setUp() { spyMap = spy(newConcurrentMap()); registry = DefaultStateRegistry.getInstance(); try { final Field defaultStates = registry.getClass() .getDeclaredField(DEFAULT_STATES_FIELD_NAME); defaultStates.setAccessible(true); defaultStates.set(registry, spyMap); } catch (NoSuchFieldException | IllegalAccessException ignored) { <START> } <END> }</code><technical_language>I suppose in this case fail test, ignore exception</technical_language>

Target:
public void setUp() { spyMap = spy(newConcurrentMap()); registry = DefaultStateRegistry.getInstance(); injectField(registry, DEFAULT_STATES_FIELD_NAME, spyMap); }
Source:
<code>protected AwardAccount createDefaultAwardAccount(RassXmlAwardEntry xmlAward) { Map<String, String> defaultAwardAccountAttributes = getDefaultAwardAccountAttributes(); String directorPrincipalId = parameterService.getParameterValueAsString(RassStep.class, RassParameterConstants.DEFAULT_PROJECT_DIRECTOR); if (StringUtils.isBlank(directorPrincipalId)) { throw new RuntimeException("Default project director parameter cannot be blank"); } AwardAccount awardAccount = new AwardAccount(); awardAccount.setProposalNumber(xmlAward.getProposalNumber()); awardAccount.setPrincipalId(directorPrincipalId); awardAccount.setChartOfAccountsCode(defaultAwardAccountAttributes.get(KFSPropertyConstants.CHART)); awardAccount.setAccountNumber(defaultAwardAccountAttributes.get(KFSPropertyConstants.ACCOUNT_NUMBER)); <START> awardAccount.setActive(defaultAccountIndicatorIsActive(KFSPropertyConstants.ACCOUNT_ACTIVE_INDICATOR)); <END> return awardAccount; }</code><technical_language>This call indicator-is-active method is passing in property key itself. I instead passing in is key, method treats argument key</technical_language>

Target:
protected AwardAccount createDefaultAwardAccount(RassXmlAwardEntry xmlAward) { Map<String, String> defaultAwardAccountAttributes = getDefaultAwardAccountAttributes(); String directorPrincipalId = parameterService.getParameterValueAsString(RassStep.class, RassParameterConstants.DEFAULT_PROJECT_DIRECTOR); if (StringUtils.isBlank(directorPrincipalId)) { throw new RuntimeException("Default project director parameter cannot be blank"); } AwardAccount awardAccount = new AwardAccount(); awardAccount.setProposalNumber(xmlAward.getProposalNumber()); awardAccount.setPrincipalId(directorPrincipalId); awardAccount.setChartOfAccountsCode(defaultAwardAccountAttributes.get(KFSPropertyConstants.CHART)); awardAccount.setAccountNumber(defaultAwardAccountAttributes.get(KFSPropertyConstants.ACCOUNT_NUMBER)); awardAccount.setActive(defaultAccountIndicatorIsActive(defaultAwardAccountAttributes.get(KFSPropertyConstants.ACCOUNT_ACTIVE_INDICATOR))); return awardAccount; }
Source:
<code>protected String[] getListOfPackageJsonFiles(String baseDir, String filename) { <START> DirectoryScanner scanner = new DirectoryScanner(); <END> scanner.setIncludes(new String[] {"**/*" + filename}); scanner.setExcludes(EXCLUDED_DIRECTORIES); scanner.setBasedir(baseDir); scanner.scan(); return scanner.getIncludedFiles(); }</code><technical_language>Do need this dependency? I a directory stream included Java work return a nice collection instead of array. <LINK_1> <LINK_0></technical_language>

Target:
private String[] getListOfPackageJsonFiles(String baseDir, String filename) { DirectoryScanner scanner = new DirectoryScanner(); scanner.setIncludes(new String[] {"**/*" + filename}); scanner.setExcludes(EXCLUDED_DIRECTORIES); scanner.setBasedir(baseDir); scanner.scan(); return scanner.getIncludedFiles(); }
Source:
<code>public void handle(@Nonnull CorfuPayloadMsg<OrchestratorMsg> msg, @Nonnull ChannelHandlerContext ctx, @Nonnull IServerRouter r) { OrchestratorMsg orchReq = msg.getPayload(); IWorkflow workflow; switch (orchReq.getRequest().getType()) { case QUERY: query(msg, ctx, r); break; case ADD_NODE: workflow = new AddNodeWorkflow((AddNodeRequest) orchReq.getRequest()); dispatch(workflow, msg, ctx, r); break; case REMOVE_NODE: workflow = new RemoveNodeWorkflow((RemoveNodeRequest) orchReq.getRequest()); dispatch(workflow, msg, ctx, r); break; case HEAL_NODE: workflow = new HealNodeWorkflow((HealNodeRequest) orchReq.getRequest()); dispatch(workflow, msg, ctx, r); break; case FORCE_REMOVE_NODE: workflow = new ForceRemoveWorkflow((ForceRemoveNodeRequest) orchReq.getRequest()); dispatch(workflow, msg, ctx, r); break; case MERGE_SEGMENTS: <START> workflow = new MergeSegmentsWorkflow((MergeSegmentsRequest) orchReq.getRequest()); <END> dispatch(workflow, msg, ctx, r); break; default: log.error("handle: Unknown request type {}", orchReq.getRequest().getType()); } }</code><technical_language>is this more a replicate_merge_segments</technical_language>

Target:
public void handle(@Nonnull CorfuPayloadMsg<OrchestratorMsg> msg, @Nonnull ChannelHandlerContext ctx, @Nonnull IServerRouter r) { OrchestratorMsg orchReq = msg.getPayload(); IWorkflow workflow; switch (orchReq.getRequest().getType()) { case QUERY: query(msg, ctx, r); break; case ADD_NODE: workflow = new AddNodeWorkflow((AddNodeRequest) orchReq.getRequest()); dispatch(workflow, msg, ctx, r); break; case REMOVE_NODE: workflow = new RemoveNodeWorkflow((RemoveNodeRequest) orchReq.getRequest()); dispatch(workflow, msg, ctx, r); break; case HEAL_NODE: workflow = new HealNodeWorkflow((HealNodeRequest) orchReq.getRequest()); dispatch(workflow, msg, ctx, r); break; case FORCE_REMOVE_NODE: workflow = new ForceRemoveWorkflow((ForceRemoveNodeRequest) orchReq.getRequest()); dispatch(workflow, msg, ctx, r); break; case RESTORE_REDUNDANCY_MERGE_SEGMENTS: workflow = new RestoreRedundancyMergeSegmentsWorkflow((RestoreRedundancyMergeSegmentsRequest) orchReq.getRequest()); dispatch(workflow, msg, ctx, r); break; default: log.error("handle: Unknown request type {}", orchReq.getRequest().getType()); } }
Source:
<code>void inject(@ComponentName(KnownComponentNames.NON_BLOCKING_EXECUTOR) Executor nonBlockingExecutor, TimeService timeService) { for (int i = 0; i < sharedLocks.length; i++) { <START> sharedLocks[i] = new InfinispanLock(nonBlockingExecutor, timeService); <END> } }</code><technical_language>starting figuring out a lock unlocked a BasicComponentRegistry.rewire() is hard, tests replace executors anyway, master version of method is safer</technical_language>

Target:
void inject(@ComponentName(KnownComponentNames.NON_BLOCKING_EXECUTOR) Executor nonBlockingExecutor, TimeService timeService) { for (int i = 0; i < sharedLocks.length; i++) { if (sharedLocks[i] == null) { sharedLocks[i] = new InfinispanLock(nonBlockingExecutor, timeService); } else { sharedLocks[i].setTimeService(timeService); } } }
Source:
<code>public void onPartitionBecomeInactiveFromStandby(String partitionName) { PartitionStateChangeListener storageManagerListener = partitionStateChangeListeners.get(StateModelListenerType.StorageManagerListener); if (storageManagerListener != null) { try { storageManagerListener.onPartitionBecomeInactiveFromStandby(partitionName); } catch (Exception e) { <START> participantMetrics.standbyCount.addAndGet(-1); <END> participantMetrics.errorStateCount.addAndGet(1); throw e; } } PartitionStateChangeListener replicationManagerListener = partitionStateChangeListeners.get(StateModelListenerType.ReplicationManagerListener); if (replicationManagerListener != null) { try { replicationManagerListener.onPartitionBecomeInactiveFromStandby(partitionName); replicaSyncUpManager.waitDeactivationCompleted(partitionName); } catch (InterruptedException e) { logger.error("Deactivation was interrupted on partition {}", partitionName); participantMetrics.standbyCount.addAndGet(-1); participantMetrics.errorStateCount.addAndGet(1); throw new StateTransitionException("Deactivation failed or was interrupted", DeactivationFailure); } catch (StateTransitionException e) { logger.error("Deactivation didn't complete on partition {}", partitionName, e); participantMetrics.standbyCount.addAndGet(-1); participantMetrics.errorStateCount.addAndGet(1); throw e; } } participantMetrics.standbyCount.addAndGet(-1); participantMetrics.inactiveCount.addAndGet(1); }</code><technical_language>finally</technical_language>

Target:
public void onPartitionBecomeInactiveFromStandby(String partitionName) { PartitionStateChangeListener storageManagerListener = partitionStateChangeListeners.get(StateModelListenerType.StorageManagerListener); if (storageManagerListener != null) { try { storageManagerListener.onPartitionBecomeInactiveFromStandby(partitionName); } catch (Exception e) { participantMetrics.standbyCount.addAndGet(-1); participantMetrics.errorStateCount.addAndGet(1); throw e; } } PartitionStateChangeListener replicationManagerListener = partitionStateChangeListeners.get(StateModelListenerType.ReplicationManagerListener); try { if (replicationManagerListener != null) { replicationManagerListener.onPartitionBecomeInactiveFromStandby(partitionName); replicaSyncUpManager.waitDeactivationCompleted(partitionName); } } catch (InterruptedException e) { logger.error("Deactivation was interrupted on partition {}", partitionName); participantMetrics.errorStateCount.addAndGet(1); throw new StateTransitionException("Deactivation failed or was interrupted", DeactivationFailure); } catch (StateTransitionException e) { logger.error("Deactivation didn't complete on partition {}", partitionName, e); participantMetrics.errorStateCount.addAndGet(1); throw e; } finally { participantMetrics.standbyCount.addAndGet(-1); } participantMetrics.inactiveCount.addAndGet(1); }
Source:
<code>public Seq<Binding<?>> bindings(final Environment environment, final play.api.Configuration configuration) { return seq( bind(CountryCode.class).qualifiedWith("default").toInstance(defaultCountry(configuration)), bind(PlayJavaSphereClient.class).toProvider(PlayJavaSphereClientProvider.class).in(Singleton.class), <START> bind(CategoryTree.class).toProvider(CategoryTreeProvider.class), <END> bind(TemplateService.class).toProvider(TemplateServiceProvider.class), bind(CmsService.class).toProvider(CmsServiceProvider.class) ); }</code><technical_language>I Providers cool is danger expect a singleton isn't. (at-Singleton provider reuses provider). Suppose multiple controllers, copy of a CategoryTree, TemplateService CmsService share instance? bind(Hello.class).toProvider(HelloProvider.class).in(Singleton.class) //make singleton if class annotation</technical_language>

Target:
public Seq<Binding<?>> bindings(final Environment environment, final play.api.Configuration configuration) { return seq( bind(CountryCode.class).qualifiedWith("default").toInstance(defaultCountry(configuration)), bind(PlayJavaSphereClient.class).toProvider(PlayJavaSphereClientProvider.class).in(Singleton.class), bind(CategoryTree.class).toProvider(CategoryTreeProvider.class).in(Singleton.class), bind(TemplateService.class).toProvider(TemplateServiceProvider.class).in(Singleton.class), bind(CmsService.class).toProvider(CmsServiceProvider.class).in(Singleton.class) ); }
Source:
<code>public void updateEntriesOnSend(S38PacketPlayerListItem packet) { for (S38PacketPlayerListItem.AddPlayerData data : packet.players) { if (packet.action == S38PacketPlayerListItem.Action.ADD_PLAYER) { this.addEntry(data); } else if (packet.action == S38PacketPlayerListItem.Action.REMOVE_PLAYER) { this.removeEntry(data.getProfile().getId()); <START> } else if (packet.action == S38PacketPlayerListItem.Action.UPDATE_GAME_MODE <END> || packet.action == S38PacketPlayerListItem.Action.UPDATE_LATENCY || packet.action == S38PacketPlayerListItem.Action.UPDATE_DISPLAY_NAME) { this.getEntry(data.getProfile().getId()).ifPresent(entry -> { if (packet.action == S38PacketPlayerListItem.Action.UPDATE_DISPLAY_NAME) { ((SpongeTabListEntry) entry).updateWithoutSend(); entry.setDisplayName(data.getDisplayName() == null ? null : SpongeTexts.toText(data.getDisplayName())); } else if (packet.action == S38PacketPlayerListItem.Action.UPDATE_LATENCY) { ((SpongeTabListEntry) entry).updateWithoutSend(); entry.setLatency(data.getPing()); } else if (packet.action == S38PacketPlayerListItem.Action.UPDATE_GAME_MODE) { ((SpongeTabListEntry) entry).updateWithoutSend(); entry.setGameMode((GameMode) (Object) data.getGameMode()); } }); } else { throw new IllegalArgumentException("unknown packet action: " + packet.action); } } }</code><technical_language>need this, other options</technical_language>

Target:
public void updateEntriesOnSend(S38PacketPlayerListItem packet) { for (S38PacketPlayerListItem.AddPlayerData data : packet.players) { if (packet.action == S38PacketPlayerListItem.Action.ADD_PLAYER) { this.addEntry(data); } else if (packet.action == S38PacketPlayerListItem.Action.REMOVE_PLAYER) { this.removeEntry(data.getProfile().getId()); } else { this.getEntry(data.getProfile().getId()).ifPresent(entry -> { if (packet.action == S38PacketPlayerListItem.Action.UPDATE_DISPLAY_NAME) { ((SpongeTabListEntry) entry).updateWithoutSend(); entry.setDisplayName(data.getDisplayName() == null ? null : SpongeTexts.toText(data.getDisplayName())); } else if (packet.action == S38PacketPlayerListItem.Action.UPDATE_LATENCY) { ((SpongeTabListEntry) entry).updateWithoutSend(); entry.setLatency(data.getPing()); } else if (packet.action == S38PacketPlayerListItem.Action.UPDATE_GAME_MODE) { ((SpongeTabListEntry) entry).updateWithoutSend(); entry.setGameMode((GameMode) (Object) data.getGameMode()); } else { throw new IllegalArgumentException("unknown packet action: " + packet.action); } }); } } }
Source:
<code>protected void executeQueryCommand() { List<Disk> diskList = DbFacade.getInstance() .getDiskDao() .getAllAttachableDisksByPoolId(getParameters().getStoragePoolId(), getParameters().getVmId(), getUserID(), getParameters().isFiltered()); if (CollectionUtils.isEmpty(diskList)) { <START> setReturnValue(new ArrayList<>()); <END> return; } setReturnValue(filterDisks(diskList)); }</code><technical_language>return diskList? If mistaken DbFacade return null lists, empty</technical_language>

Target:
protected void executeQueryCommand() { List<Disk> diskList = DbFacade.getInstance() .getDiskDao() .getAllAttachableDisksByPoolId(getParameters().getStoragePoolId(), getParameters().getVmId(), getUserID(), getParameters().isFiltered()); if (CollectionUtils.isEmpty(diskList)) { setReturnValue(diskList); return; } setReturnValue(filterDisks(diskList)); }
Source:
<code><START> public OfferAutoscaleSettings getOfferAutoscaleProperties() { <END> return this.offer.getOfferAutoScaleSettings(); }</code><technical_language>inling auto-scale related entries? What;s of nesting type</technical_language>

Target:
OfferAutoscaleSettings getOfferAutoscaleProperties() { return this.offer.getOfferAutoScaleSettings(); }
Source:
<code>public ITmfStateInterval doSingularQuery(long t, int attributeQuark) throws TimeRangeException, StateSystemDisposedException { ITmfStateInterval ret = super.doSingularQuery(t, attributeQuark); if (ret != null) { return ret; } synchronized (intervalQueue) { if (fCurrentInterval.getAttribute() == attributeQuark && fCurrentInterval.intersects(t)) { <START> return fCurrentInterval; <END> } for (ITmfStateInterval interval : intervalQueue) { if (interval.getAttribute() == attributeQuark && interval.intersects(t)) { return interval; } } } return super.doSingularQuery(t, attributeQuark); }</code><technical_language>fCurrentInterval is chronologically "after" interval queue, I add this check right for loop instead</technical_language>

Target:
public ITmfStateInterval doSingularQuery(long t, int attributeQuark) throws TimeRangeException, StateSystemDisposedException { ITmfStateInterval ret = super.doSingularQuery(t, attributeQuark); if (ret != null) { return ret; } for (ITmfStateInterval interval : intervalQueue) { if (interval.getAttribute() == attributeQuark && interval.intersects(t)) { return interval; } } HTInterval interval = currentInterval; if (interval != null && interval.getAttribute() == attributeQuark && interval.intersects(t)) { return interval; } return super.doSingularQuery(t, attributeQuark); }
Source:
<code>public GuestMigration buildMigrationManifest(ConsumerDTO incoming, Consumer existing) { if (incoming.getGuestIds() == null) { log.debug("Guests not included in this consumer update, skipping update."); migrationPending = false; return this; } <START> Consumer incomingConsumerEntity = new Consumer(); <END> List<GuestId> guestIds = new ArrayList<>(); for (GuestIdDTO dto : incoming.getGuestIds()) { GuestId entity = new GuestId(); GuestIdResource.populateEntity(entity, dto); guestIds.add(entity); } incomingConsumerEntity.setGuestIds(guestIds); return this.buildMigrationManifest(incomingConsumerEntity, existing); }</code><technical_language>is work done convert consumer if DTO directly. This is type of want avoid</technical_language>

Target:
public GuestMigration buildMigrationManifest(ConsumerDTO incoming, Consumer existing) { if (incoming.getGuestIds() == null) { log.debug("Guests not included in this consumer update, skipping update."); migrationPending = false; return this; } manifest = new MigrationManifest(existing); log.debug("Updating guest IDs.", incoming.getGuestIds().size()); List<GuestId> existingGuests = existing.getGuestIds(); List<GuestId> incomingGuestIds = incoming.getGuestIds().stream().filter(Objects::nonNull) .map(guestIdDTO -> new GuestId(guestIdDTO.getGuestId(), existing, guestIdDTO.getAttributes())) .collect(Collectors.toList()); List<GuestId> removedGuests = getRemovedGuestIds(existing, incomingGuestIds); List<GuestId> addedGuests = getAddedGuestIds(existing, incomingGuestIds); if (existingGuests != null) { for (GuestId guestId : removedGuests) { existingGuests.remove(guestId); log.debug("Guest ID removed: {}", guestId); } } for (GuestId guestId : incomingGuestIds) { if (addedGuests.contains(guestId)) { manifest.addGuestId(guestId); log.debug("New guest ID added: {}", guestId); } } migrationPending = removedGuests.size() != 0 || addedGuests.size() != 0; return this; }
Source:
<code>public void run() { while (!_shutdownRequested) { try { Thread.sleep(_periodMs); } catch (InterruptedException e) { <START> break; <END> } flushAndMakeCheckpoints(); } LOG.info(String.format("Checkpoint handler exited, tasks = [%s].", _taskDesc)); }</code><technical_language>Log error</technical_language>

Target:
public void run() { if (_shutdownRequested) { return; } try { flushAndMakeCheckpoints(); LOG.info(String.format("Checkpoint handler exited, tasks = [%s].", _taskDesc)); } catch (Throwable t){ LOG.error(String.format("Checkpoint failed, will retry after %d ms, reason = %s", _periodMs, t.getMessage()), t); } }
Source:
<code>public @ResponseBody CertifiedProductSearchDetails getCertifiedProductByChplProductNumberBasic2( @PathVariable("chplPrefix") final String chplPrefix, @PathVariable("identifier") final String identifier) throws EntityRetrievalException { String chplProductNumber = chplProductNumberUtil.getChplProductNumber(chplPrefix, identifier); CertifiedProductSearchDetails certifiedProduct = cpdManager.getCertifiedProductDetailsBasicByChplProductNumber(chplProductNumber); certifiedProduct = validateCertifiedProduct(certifiedProduct); removeNonBasicCertifiedProductSearchDetails(certifiedProduct); <START> return certifiedProduct; <END> }</code><technical_language>If returning type of object, keys want removed</technical_language>

Target:
public @ResponseBody CertifiedProductSearchBasicDetails getCertifiedProductByChplProductNumberBasic2( @PathVariable("chplPrefix") final String chplPrefix, @PathVariable("identifier") final String identifier) throws EntityRetrievalException { String chplProductNumber = chplProductNumberUtil.getChplProductNumber(chplPrefix, identifier); CertifiedProductSearchDetails certifiedProduct = cpdManager.getCertifiedProductDetailsBasicByChplProductNumber(chplProductNumber); return mapCertifiedProductDetailsToBasic.apply(certifiedProduct); }
Source:
<code>public ResponseEntity<ResourceSupport> postAdminGroup(@PathVariable UUID uuid, HttpServletResponse response, HttpServletRequest request) throws SQLException, AuthorizeException { Context context = ContextUtil.obtainContext(request); Community community = communityService.find(context, uuid); if (community == null) { throw new ResourceNotFoundException("No such community: " + uuid); } <START> if (!authorizeService.isAdmin(context) && !authorizeService.authorizeActionBoolean(context, community, <END> Constants.ADMIN, true)) { throw new AccessDeniedException("The current user was not allowed to retrieve the AdminGroup for" + " community: " + uuid); } if (community.getAdministrators() != null) { throw new UnprocessableEntityException("The community with UUID: " + uuid + " already has " + "an admin group"); } GroupRest adminGroup = communityRestRepository.createAdminGroup(context, request, community); context.complete(); GroupResource groupResource = converterService.toResource(adminGroup); return ControllerUtils.toResponseEntity(HttpStatus.CREATED, new HttpHeaders(), groupResource); }</code><technical_language>org.dspace.app.util.AuthorizeUtil.authorizeManageAdminGroup(Context, Community)</technical_language>

Target:
public ResponseEntity<ResourceSupport> postAdminGroup(@PathVariable UUID uuid, HttpServletResponse response, HttpServletRequest request) throws SQLException, AuthorizeException { Context context = ContextUtil.obtainContext(request); Community community = communityService.find(context, uuid); if (community == null) { throw new ResourceNotFoundException("No such community: " + uuid); } AuthorizeUtil.authorizeManageAdminGroup(context, community); if (community.getAdministrators() != null) { throw new UnprocessableEntityException("The community with UUID: " + uuid + " already has " + "an admin group"); } GroupRest adminGroup = communityRestRepository.createAdminGroup(context, request, community); context.complete(); GroupResource groupResource = converterService.toResource(adminGroup); return ControllerUtils.toResponseEntity(HttpStatus.CREATED, new HttpHeaders(), groupResource); }
Source:
<code>public ByteBuf processFrame(ByteBuf inputBuffer) throws TException, IOException { byte[] encodedBytes = new byte[inputBuffer.readableBytes()]; inputBuffer.readBytes(encodedBytes); byte[] inputBytes = Base64.decodeBase64(encodedBytes); if (inputBytes.length < 4) { throw new IOException("Invalid request size " + inputBytes.length); } ByteBuffer buff = ByteBuffer.wrap(inputBytes); <START> int sz = buff.getInt(); <END> if (sz != buff.remaining()) { throw new IOException( String.format("Mismatch between expected frame size (%d) and actual size (%d)", sz, inputBytes.length - 4) ); } byte[] inputFrame = Arrays.copyOfRange(inputBytes, 4, inputBytes.length); TTransport inTransport = new TMemoryInputTransport(inputFrame); TMemoryOutputBuffer outTransport = new TMemoryOutputBuffer(); processor.process(inProtocolFactory.getProtocol(inTransport), outProtocolFactory.getProtocol(outTransport)); byte[] outputBytes = Base64.encodeBase64(outTransport.getWriteBytes()); return Unpooled.copiedBuffer(outputBytes); }</code><technical_language>I get rid of previous len < 4check simply catch BufferUnderflowException thrown [getInt](<LINK_0> line 186</technical_language>

Target:
public ByteBuf processFrame(ByteBuf inputBuffer) throws TException, IOException { byte[] encodedBytes = new byte[inputBuffer.readableBytes()]; inputBuffer.readBytes(encodedBytes); byte[] inputBytes = Base64.decodeBase64(encodedBytes); ByteBuffer buff = ByteBuffer.wrap(inputBytes); int sz; try { sz = buff.getInt(); } catch (BufferUnderflowException e) { throw new IOException("Invalid request size " + inputBytes.length); } if (sz != buff.remaining()) { throw new IOException( String.format("Mismatch between expected frame size (%d) and actual size (%d)", sz, inputBytes.length - 4) ); } byte[] inputFrame = Arrays.copyOfRange(inputBytes, 4, inputBytes.length); TTransport inTransport = new TMemoryInputTransport(inputFrame); TMemoryOutputBuffer outTransport = new TMemoryOutputBuffer(); processor.process(inProtocolFactory.getProtocol(inTransport), outProtocolFactory.getProtocol(outTransport)); byte[] outputBytes = Base64.encodeBase64(outTransport.getWriteBytes()); return Unpooled.copiedBuffer(outputBytes); }
Source:
<code>public FeatureScenario(){ <START> super(); <END> }</code><technical_language>needed</technical_language>

Target:
public FeatureScenario(){ }
Source:
<code>public long getLowWatermark() { Map<String, Long> watermarks = new HashMap<>(pools.size()); Set<String> roots = topology.getRoots(); Map<String, Long> watermarkTrees = new HashMap<>(roots.size()); pools.forEach(pool -> watermarks.put(pool.getComputationName(), pool.getLowWatermark())); for (String root : roots) { watermarkTrees.put(root, topology.getDescendantComputationNames(root).stream().map(watermarks::get) .min(Comparator.naturalOrder()).orElse(0L)); } long ret = watermarkTrees.values().stream() <START> .filter(wm -> wm > 1).min(Comparator.naturalOrder()).orElse(0L); <END> if (log.isTraceEnabled()) { log.trace("lowWatermark: " + ret); watermarkTrees.forEach((k, v) -> log.trace("tree " + k + ": " + v)); } return ret; }</code><technical_language>Switch LongStream soon possible: watermarkTrees.values().stream().mapToLong(Long::longValue).filter(wm -> wm > 1).min().orElse(0) this wm > 0</technical_language>

Target:
public long getLowWatermark() { Map<String, Long> watermarks = new HashMap<>(pools.size()); Set<String> roots = topology.getRoots(); Map<String, Long> watermarkTrees = new HashMap<>(roots.size()); pools.forEach(pool -> watermarks.put(pool.getComputationName(), pool.getLowWatermark())); for (String root : roots) { watermarkTrees.put(root, topology.getDescendantComputationNames(root).stream().mapToLong(watermarks::get).min().orElse(0)); } long ret = watermarkTrees.values().stream().filter(wm -> wm > 1).mapToLong(Long::new).min().orElse(0); if (log.isTraceEnabled()) { log.trace("lowWatermark: " + ret); watermarkTrees.forEach((k, v) -> log.trace("tree " + k + ": " + v)); } return ret; }
Source:
<code>private void printGroupRecord(ExtMap extMap) { if (extMap != null) { <START> logger.info(String.format("GroupRecord: ID %s, name: %s, Display name: %s", <END> extMap.get(Authz.GroupRecord.ID, ""), extMap.get(Authz.GroupRecord.NAME, ""), extMap.get(Authz.GroupRecord.DISPLAY_NAME, "") )); } }</code><technical_language>missing NAMESPACE</technical_language>

Target:
private void printGroupRecord(ExtMap extMap) { if (extMap != null) { do { logger.info(String.format("GroupRecord: ID '%s', name: '%s', namespace: '%s', display name: '%s'", extMap.get(Authz.GroupRecord.ID, ""), extMap.get(Authz.GroupRecord.NAME, ""), extMap.get(Authz.GroupRecord.NAMESPACE, ""), extMap.get(Authz.GroupRecord.DISPLAY_NAME, "") )); } while((extMap = extMap.get(Authz.GroupRecord.GROUPS)) != null); } }
Source:
<code>public static boolean deleteDir(File dir) { if (dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i < children.length; i++) { boolean success = deleteDir(new File(dir, children[i])); if (!success) { <START> return false; <END> } } } return dir.delete(); }</code><technical_language>This a failure some children deleted others not, clear a caller recover. instead this return void throw IOException includes failed path</technical_language>

Target:
public static boolean deleteDir(File dir) { if (dir.isDirectory()) { String[] children = dir.list(); for (String child : children) { boolean success = deleteDir(new File(dir, child)); if (!success) { return false; } } } return dir.delete(); }
Source:
<code>private List<EmailWrapper> getEmailsToInstructor(InstructorAttributes instructor, List<EmailWrapper> emailsSent) { List<EmailWrapper> emailsToInstructor = new ArrayList<EmailWrapper>(); for (EmailWrapper email : emailsSent) { <START> boolean emailSentToThisInstructor = email.getFirstRecipient().equalsIgnoreCase(instructor.email); <END> if (emailSentToThisInstructor) { emailsToInstructor.add(email); } } return emailsToInstructor; }</code><technical_language>for this, get rename this variable prefix is</technical_language>

Target:
private List<EmailWrapper> getEmailsToInstructor(InstructorAttributes instructor, List<EmailWrapper> emailsSent) { List<EmailWrapper> emailsToInstructor = new ArrayList<EmailWrapper>(); for (EmailWrapper email : emailsSent) { boolean isEmailSentToThisInstructor = email.getFirstRecipient().equalsIgnoreCase(instructor.email); if (isEmailSentToThisInstructor) { emailsToInstructor.add(email); } } return emailsToInstructor; }
Source:
<code>private void dropItem(CommandSender sender, String world, String x, String y, String z, SlimefunItem sfItem, String[] args) { if (sfItem instanceof MultiBlockMachine) { SlimefunPlugin.getLocalization().sendMessage(sender, "guide.cheat.no-multiblocks"); } else { int amount = parseAmount(args); if (amount > 0) { Bukkit.getWorld(world).dropItem(new Location(Bukkit.getWorld(world), Integer.parseInt(x), Integer.parseInt(y), Integer.parseInt(z)), new CustomItem(sfItem.getItem(), amount)); SlimefunPlugin.getLocalization().sendMessage(sender, "messages.drop-item", true, msg -> msg.replace(PLACEHOLDER_WORLD, args[1]).replace(PLACEHOLDER_X, args[2]).replace(PLACEHOLDER_Y, args[3]).replace(PLACEHOLDER_Z, args[4]).replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount))); } else { <START> SlimefunPlugin.getLocalization().sendMessage(sender, "messages.not-valid-amount", true, msg -> msg.replace(PLACEHOLDER_AMOUNT, args[3])); <END> } } }</code><technical_language>suggestion SlimefunPlugin.getLocalization().sendMessage(sender, "messages.invalid-amount", true, msg -> msg.replace(PLACEHOLDER_AMOUNT, args[3]));</technical_language>

Target:
private void dropItem(CommandSender sender, String world, String x, String y, String z, SlimefunItem sfItem, String[] args) { if (sfItem instanceof MultiBlockMachine) { SlimefunPlugin.getLocalization().sendMessage(sender, "guide.cheat.no-multiblocks"); } else { int amount = parseAmount(args); if (amount > 0) { Bukkit.getWorld(world).dropItem(new Location(Bukkit.getWorld(world), Integer.parseInt(x), Integer.parseInt(y), Integer.parseInt(z)), new CustomItem(sfItem.getItem(), amount)); SlimefunPlugin.getLocalization().sendMessage(sender, "messages.drop-item", true, msg -> msg.replace(PLACEHOLDER_WORLD, args[1]).replace(PLACEHOLDER_X, args[2]).replace(PLACEHOLDER_Y, args[3]).replace(PLACEHOLDER_Z, args[4]).replace(PLACEHOLDER_ITEM, sfItem.getItemName()).replace(PLACEHOLDER_AMOUNT, String.valueOf(amount))); } else { SlimefunPlugin.getLocalization().sendMessage(sender, "messages.invalid-amount", true, msg -> msg.replace(PLACEHOLDER_AMOUNT, args[3])); } } }
Source:
<code>public boolean pollSocketsInfo() { if (!isTcpInfoSupported()) return false; boolean result = false; <START> FileDescriptor fd = null; <END> try { long time = SystemClock.elapsedRealtime(); fd = connectToKernel(); mTcpStats.clear(); for (int family : ADDRESS_FAMILIES) { if (!sendPollingRequest(fd, family)) continue; StructNlMsgHdr nlmsghdr = new StructNlMsgHdr(); do { final ByteBuffer bytes = recvMesssage(fd); log("pollSocketsInfo: recv size=" + bytes.limit()); int curPos = 0; while (isValidNlMsg(bytes)) { nlmsghdr = StructNlMsgHdr.parse(bytes); final int nlmsgLen = nlmsghdr.nlmsg_len; log("pollSocketsInfo: nlmsgLen=" + nlmsgLen); if (isValidInetDiagMsgSize(nlmsgLen)) { final int cookiePos = curPos + SOCKDIAG_MSG_HEADER_SIZE - 2 * Integer.BYTES; final long cookie = getSocketCookie(bytes, cookiePos); bytes.position(cookiePos + 2 * Integer.BYTES); final SocketInfo info = parseSockInfo(bytes, curPos, family, nlmsgLen, time); mTcpStats.put(cookie, makeTcpStat(info, mSocketInfos.get(cookie))); storeSocketInfo(cookie, info); } bytes.position(curPos + nlmsgLen); curPos = bytes.position(); } } while (nlmsghdr.nlmsg_type != NLMSG_DONE); } cleanupSocketInfo(time); result = true; } catch (ErrnoException | SocketException | InterruptedIOException e) { Log.e(TAG, "Fail to get TCP info via netlink.", e); } finally { NetworkStackUtils.closeSocketQuietly(fd); } return result; }</code><technical_language>accessed out of try{} block : move declaration final</technical_language>

Target:
public boolean pollSocketsInfo() { if (!isTcpInfoSupported()) return false; FileDescriptor fd = null; try { final long time = SystemClock.elapsedRealtime(); fd = connectToKernel(); mTcpStats.clear(); for (final int family : ADDRESS_FAMILIES) { if (!sendPollingRequest(fd, family)) continue; final ByteBuffer bytes = recvMesssage(fd); log("pollSocketsInfo: recv size=" + bytes.limit()); while (enoughBytesRemainForValidNlMsg(bytes)) { StructNlMsgHdr nlmsghdr = StructNlMsgHdr.parse(bytes); final int nlmsgLen = nlmsghdr.nlmsg_len; log("pollSocketsInfo: nlmsgLen=" + nlmsgLen); if (isValidInetDiagMsgSize(nlmsgLen)) { bytes.position(bytes.position() + StructInetDiagMsg.STRUCT_SIZE - 7 * Integer.BYTES); final long cookie = ((long) bytes.getInt() << 32) | (long) bytes.getInt(); bytes.position(bytes.position() + 5 * Integer.BYTES); final SocketInfo info = parseSockInfo(bytes, family, nlmsgLen, time); mTcpStats.put(cookie, makeTcpStat(info, mSocketInfos.get(cookie))); mSocketInfos.put(cookie, info); } if (nlmsghdr.nlmsg_type == NLMSG_DONE) break; } } cleanupSocketInfo(time); return true; } catch (ErrnoException | SocketException | InterruptedIOException e) { Log.e(TAG, "Fail to get TCP info via netlink.", e); } finally { NetworkStackUtils.closeSocketQuietly(fd); } return false; }
Source:
<code><START> public HostAssert host(String hostAddress) { <END> int port = actual.getConfiguration().getProtocolOptions().getPort(); InetSocketAddress socketAddress = new InetSocketAddress(hostAddress, port); Host host = actual.getMetadata().getHost(socketAddress); return new HostAssert(host, actual); }</code><technical_language>this refactored a new method TestUtils.findHost(Cluster, String) TestUtils.findHost(Cluster, int) call it? Also, caveat applies here: assertions a host joined cluster left it</technical_language>

Target:
public HostAssert host(String hostAddress) { return new HostAssert( TestUtils.findHost(actual, hostAddress), actual); }
Source:
<code>public List<Index> listIndices() { InputStream response = null; try { <START> URI uri = new DatabaseURIHelper(db.getDBUri()).path("_index/").build(); <END> response = client.couchDbClient.get(uri); return getResponseList(response, client.getGson(), new TypeToken<List<Index>>() { }.getType()); } finally { close(response); } }</code><technical_language>Remove trailing "/"</technical_language>

Target:
public List<Index> listIndices() { InputStream response = null; try { URI uri = new DatabaseURIHelper(db.getDBUri()).path("_index").build(); response = client.couchDbClient.get(uri); return getResponseList(response, client.getGson(), new TypeToken<List<Index>>() { }.getType()); } finally { close(response); } }