auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testOutOfOrderCreatedInCurrentTimeIsDisplayedInHomeNowTile() { String startDate = testData.get(3).get("Start date (days to add)"); String endDate = testData.get(3).get("End date (days to add)"); String startTime = testData.get(3).get("Start time (minutes to add)"); String endTime = testData.get(3).get("End time (minutes to add)"); String description = testData.get(3).get("Description"); HomeAdminPage homeAdminPage = new HomeAdminPage(); RoomsPage conferenceRoom = homeAdminPage.clickConferenceRoomsLink(); <START> RoomOutOfOrderPlanningPage outOfOrder = conferenceRoom <END> .doubleClickOverRoomName(roomName) .clickOutOfOrderPlanningLink(); conferenceRoom = outOfOrder .setOutOfOrderPeriodInformation(startDate, endDate, startTime, endTime, title, description) .activateOutOfOrder() .clickSaveOutOfOrderBtn(); HomeTabletPage homeTabletPage = new HomeTabletPage(); SettingsPage settingsPage = homeTabletPage.clickSettingsBtn(); homeTabletPage = settingsPage.selectRoom(roomName); Assert.assertEquals(homeTabletPage.getNowTileLbl(), title); }</code><technical_language>RoomInfoPage roomInfoPage = roomsPage.doubleClickOverRoomName(roomName); is missin</technical_language>

Target:
public void testOutOfOrderCreatedInCurrentTimeIsDisplayedInHomeNowTile() { String startDate = testData.get(3).get("Start date (days to add)"); String endDate = testData.get(3).get("End date (days to add)"); String startTime = testData.get(3).get("Start time (minutes to add)"); String endTime = testData.get(3).get("End time (minutes to add)"); String description = testData.get(3).get("Description"); HomeAdminPage homeAdminPage = new HomeAdminPage(); RoomsPage roomsPage = homeAdminPage.clickConferenceRoomsLink(); RoomInfoPage roomInfoPage = roomsPage.doubleClickOverRoomName(roomName); RoomOutOfOrderPlanningPage outOfOrderPage = roomInfoPage.clickOutOfOrderPlanningLink(); roomsPage = outOfOrderPage .setOutOfOrderPeriodInformation(startDate, endDate, startTime, endTime, title, description) .activateOutOfOrder() .clickSaveOutOfOrderBtn(); HomeTabletPage homeTabletPage = new HomeTabletPage(); SettingsPage settingsPage = homeTabletPage.clickSettingsBtn(); homeTabletPage = settingsPage.selectRoom(roomName); Assert.assertEquals(homeTabletPage.getNowTileLbl(), title); }
Source:
<code>private List<Artifact> getNewDependencies(List<Dependency> dependencies, List<Dependency> existingDependencies) throws MojoExecutionException { List<Artifact> updatedArtifacts = new ArrayList<Artifact>(); for (Dependency dep : dependencies) { boolean newDependency = true; for (Dependency existingDep : existingDependencies) { if (dep.getArtifactId().equals(existingDep.getArtifactId())) { <START> newDependency = false; <END> } } if (newDependency) { log.debug("New dependency found: " + dep.getArtifactId()); Artifact artifact = getArtifact(dep.getGroupId(), dep.getArtifactId(), dep.getType(), dep.getVersion()); updatedArtifacts.add(artifact); } } return updatedArtifacts; }</code><technical_language>break out of for loop set newDependency false</technical_language>

Target:
private List<Artifact> getNewDependencies(List<Dependency> dependencies, List<Dependency> existingDependencies) throws MojoExecutionException { List<Artifact> updatedArtifacts = new ArrayList<Artifact>(); for (Dependency dep : dependencies) { boolean newDependency = true; for (Dependency existingDep : existingDependencies) { if (dep.getArtifactId().equals(existingDep.getArtifactId())) { newDependency = false; break; } } if (newDependency) { log.debug("New dependency found: " + dep.getArtifactId()); Artifact artifact = getArtifact(dep.getGroupId(), dep.getArtifactId(), dep.getType(), dep.getVersion()); updatedArtifacts.add(artifact); } } return updatedArtifacts; }
Source:
<code><START> synchronized boolean update() { <END> if(numberOfCommandsInHistory < commands.size()) { if(tabs == null) return true; final Command c = commands.get(numberOfCommandsInHistory++); TabForm form = init(c); final TabForm finalForm = form; Display display = PlatformUI.getWorkbench().getDisplay(); Runnable run = new Runnable() { public void run() { Activator.log("redraw after adding "+c.text); int j=0; for(int i=0;i<NENTRIES-1;i++) { if(finalForm.rows[i].check.getSelection()) { if(i > j) { finalForm.swap(i,j); } j++; } } for(int i=NENTRIES-1;i > j;i--) { if(!finalForm.rows[i-1].txt.getText().equals("")) { finalForm.swap(i,i-1); } } if(numberOfCommandsInHistory > 1) finalForm.rows[j].txt.setText(c.text.trim()); tabs.pack(); tabs.redraw(); } }; display.syncExec(run); return true; } else { return false; } }</code><technical_language>Methods marked private/protected/etc</technical_language>

Target:
private synchronized void update() { if(fTabs == null || !fTabs.isEnabled() || fTabs.isDisposed()) return; while(numberOfCommandsInHistory < commands.size()) { Command c = commands.get(numberOfCommandsInHistory++); TabForm form = init(c); int j=0; for(int i=0;i<NENTRIES-1;i++) { if(form.rows[i].fCheck.getSelection()) { if(i > j) { form.swap(i,j); } j++; } } for(int i=NENTRIES-1;i > j;i--) { if(!form.rows[i-1].fText.getText().equals("")) { form.swap(i,i-1); } } if(numberOfCommandsInHistory > 1) form.rows[j].fText.setText(c.text.trim()); } fTabs.pack(); fTabs.redraw(); }
Source:
<code>public static ErlangExpression getFunctionCallArgument(@NotNull ErlangFunctionCallExpression call, @Nullable PsiElement child) { ErlangExpression argument = PsiTreeUtil.getParentOfType(child, ErlangExpression.class, false); while (argument != null && !(argument.getParent() instanceof ErlangArgumentList)) { argument = ObjectUtils.tryCast(argument.getParent(), ErlangExpression.class); } return argument != null && call.getArgumentList() != argument.getParent() ? getFunctionCallArgument(call, argument.getParent()) : argument; <START> } <END></code><technical_language>this function complex? a function call expression, a psi element is supposed a child of argument of this call - casts, instanceof checks, recursion</technical_language>

Target:
public static ErlangExpression getFunctionCallArgument(@NotNull ErlangFunctionCallExpression call, @Nullable PsiElement child) { ErlangArgumentList argumentList = call.getArgumentList(); PsiElement argument = child; PsiElement parent; while (argument != null && (parent = argument.getParent()) != argumentList) { argument = parent; } return ObjectUtils.tryCast(argument, ErlangExpression.class); }
Source:
<code>protected final boolean perform(BuildStep bs, BuildListener listener) throws InterruptedException, IOException { BuildStepMonitor mon; try { mon = bs.getRequiredMonitorService(); } catch (AbstractMethodError e) { mon = BuildStepMonitor.BUILD; } Result oldResult = AbstractBuild.this.getResult(); for (BuildStepListener bsl : BuildStepListener.all()) { bsl.started(AbstractBuild.this, bs, listener); } boolean canContinue = false; try { canContinue = mon.perform(bs, AbstractBuild.this, launcher, listener); } catch (RequestAbortedException ex) { listener.error("Slave went offline during the build."); final OfflineCause offlineCause = getCurrentNode().toComputer().getOfflineCause(); if (offlineCause != null) { listener.error(offlineCause.toString()); } } catch (RuntimeException ex) { <START> ex.printStackTrace(listener.error("Build step failed with excepiton")); <END> } for (BuildStepListener bsl : BuildStepListener.all()) { bsl.finished(AbstractBuild.this, bs, listener, canContinue); } Result newResult = AbstractBuild.this.getResult(); if (newResult != oldResult) { String buildStepName = getBuildStepName(bs); listener.getLogger().format("Build step '%s' changed build result to %s%n", buildStepName, newResult); } if (!canContinue) { String buildStepName = getBuildStepName(bs); listener.getLogger().format("Build step '%s' marked build as failure%n", buildStepName); } return canContinue; }</code><technical_language>Typo</technical_language>

Target:
protected final boolean perform(BuildStep bs, BuildListener listener) throws InterruptedException, IOException { BuildStepMonitor mon; try { mon = bs.getRequiredMonitorService(); } catch (AbstractMethodError e) { mon = BuildStepMonitor.BUILD; } Result oldResult = AbstractBuild.this.getResult(); for (BuildStepListener bsl : BuildStepListener.all()) { bsl.started(AbstractBuild.this, bs, listener); } boolean canContinue = false; try { canContinue = mon.perform(bs, AbstractBuild.this, launcher, listener); } catch (RequestAbortedException ex) { reportBrokenChannel(listener); } catch (ChannelClosedException ex) { reportBrokenChannel(listener); } catch (RuntimeException ex) { ex.printStackTrace(listener.error("Build step failed with exception")); } for (BuildStepListener bsl : BuildStepListener.all()) { bsl.finished(AbstractBuild.this, bs, listener, canContinue); } Result newResult = AbstractBuild.this.getResult(); if (newResult != oldResult) { String buildStepName = getBuildStepName(bs); listener.getLogger().format("Build step '%s' changed build result to %s%n", buildStepName, newResult); } if (!canContinue) { String buildStepName = getBuildStepName(bs); listener.getLogger().format("Build step '%s' marked build as failure%n", buildStepName); } return canContinue; }
Source:
<code>public void close() throws InterruptedException, NoConnectionsException { while (m_processedCount.get() != m_totalRowCount.get()) { m_client.drain(); <START> Thread.sleep(500); <END> } m_reinsertExecutor.shutdown(); m_reinsertExecutor.awaitTermination(365, TimeUnit.DAYS); }</code><technical_language>do need this sleep</technical_language>

Target:
public void close() throws InterruptedException, NoConnectionsException { while (m_processedCount.get() != m_totalRowCount.get()) { m_client.drain(); Thread.yield(); } if (m_reinsertExecutor != null) { m_reinsertExecutor.shutdown(); m_reinsertExecutor.awaitTermination(365, TimeUnit.DAYS); } }
Source:
<code>public void default_threshold() throws Exception { SourceFile file = PythonAstScanner.scanSingleFile("src/test/resources/checks/fileComplexity.py", check); CheckMessagesVerifier.verify(file.getCheckMessages()) <START> .noMore(); <END> }</code><technical_language>@vilchik-elena I prefer a dedicated test file for default threshold function "max value" function is "max + 1"</technical_language>

Target:
public void default_threshold() throws Exception { PythonCheckVerifier.verify("src/test/resources/checks/cognitiveComplexityFunctionDefault.py", check); }
Source:
<code>public boolean checkForCloudProfileFacts(Map<String, String> incomingFacts) { if (incomingFacts == null) { return false; } <START> if (this.facts != null && incomingFacts != null && this.facts.equals(incomingFacts)) { <END> return false; } for (Entry<String, String> entry : incomingFacts.entrySet()) { if (CloudProfileFacts.containsFact(entry.getKey())) { if (this.facts == null) { return true; } else if (!this.facts.containsKey(entry.getKey())) { return true; } else if (this.facts.containsKey(entry.getKey()) && !this.facts.get(entry.getKey()).equals(entry.getValue())) { return true; } } } return false; }</code><technical_language>incomingFacts is null here, if returned false, is need for this check</technical_language>

Target:
public boolean checkForCloudProfileFacts(Map<String, String> incomingFacts) { if (incomingFacts == null) { return false; } if (this.facts != null && this.facts.equals(incomingFacts)) { return false; } for (CloudProfileFacts profileFact : CloudProfileFacts.values()) { if (incomingFacts.containsKey(profileFact.getFact())) { if (this.facts == null || !this.facts.containsKey(profileFact.getFact()) || !this.facts.get(profileFact.getFact()).equals(incomingFacts.get(profileFact.getFact()))) { return true; } } } return false; }
Source:
<code>public void onResponseReceived(Request req, Response res) { String text = res.getText(); <START> if (text.startsWith("token=")) { <END> RestApi.this.sendPost(cb, text); return; } RpcStatus.INSTANCE.onRpcComplete(); int status = res.getStatusCode(); if (status != 200) { if ((400 <= status && status < 500) && isTextBody(res)) { cb.onFailure(new RemoteJsonException(res.getText(), status, null)); } else { cb.onFailure(new StatusCodeException(status, res.getStatusText())); } return; } if (!isJsonBody(res)) { cb.onFailure(new RemoteJsonException("Invalid JSON")); return; } String json = res.getText(); if (!json.startsWith(JSON_MAGIC)) { cb.onFailure(new RemoteJsonException("Invalid JSON")); return; } T data; try { data = Natives.<T> parseJSON(json.substring(JSON_MAGIC.length())); } catch (RuntimeException e) { cb.onFailure(new RemoteJsonException("Invalid JSON")); return; } cb.onSuccess(data); }</code><technical_language>This check res.getStatusCode() returned 200 else</technical_language>

Target:
public void onResponseReceived(Request req, Response res) { int status = res.getStatusCode(); if (status != 200) { RpcStatus.INSTANCE.onRpcComplete(); if ((400 <= status && status < 500) && isTextBody(res)) { cb.onFailure(new RemoteJsonException(res.getText(), status, null)); } else { cb.onFailure(new StatusCodeException(status, res.getStatusText())); } return; } String text = res.getText(); if (text.startsWith("_token=")) { RestApi.this.sendPost(cb, text); return; } RpcStatus.INSTANCE.onRpcComplete(); if (!isJsonBody(res)) { cb.onFailure(new RemoteJsonException("Invalid JSON")); return; } String json = res.getText(); if (!json.startsWith(JSON_MAGIC)) { cb.onFailure(new RemoteJsonException("Invalid JSON")); return; } T data; try { data = Natives.<T> parseJSON(json.substring(JSON_MAGIC.length())); } catch (RuntimeException e) { cb.onFailure(new RemoteJsonException("Invalid JSON")); return; } cb.onSuccess(data); }
Source:
<code>public void scanQrCode() { try { <START> Intent intent = new Intent("com.google.zxing.client.android.SCAN"); <END> intent.putExtra("SCAN_MODE", "QR_CODE_MODE"); startActivityForResult(intent, REQUEST_CODE_QR_CODE); } catch(ActivityNotFoundException e) { Log.i(TAG, "scanQrCode() exception", e); Toast.makeText(this, "Please install QR-code scanner", Toast.LENGTH_LONG).show(); Uri marketUri = Uri.parse("market://details?id=com.google.zxing.client.android"); Intent marketIntent = new Intent(Intent.ACTION_VIEW, marketUri); startActivity(marketIntent); } catch(Exception e) { Log.e(TAG, "scanQrCode() exception", e); } }</code><technical_language>enforce a specific QR scanner client</technical_language>

Target:
private void scanQrCode() { try { Intent intent = new Intent("com.google.zxing.client.android.SCAN"); intent.putExtra("SCAN_MODE", "QR_CODE_MODE"); startActivityForResult(intent, REQUEST_CODE_QR_CODE); } catch(ActivityNotFoundException e) { Log.i(TAG, "scanQrCode() exception", e); Toast.makeText(this, R.string.connectionWizard_misc_installQrCodeScanner, Toast.LENGTH_LONG).show(); Uri marketUri = Uri.parse("market://details?id=de.markusfisch.android.binaryeye"); Intent marketIntent = new Intent(Intent.ACTION_VIEW, marketUri); startActivity(marketIntent); } catch(Exception e) { Log.w(TAG, "scanQrCode() exception", e); } }
Source:
<code>private CompletionStage<BeamFnApi.StateResponse.Builder> handleMapGetRequest(BeamFnApi.StateRequest request) throws Exception { byte[] getRequest = request.getGet().getContinuationToken().toByteArray(); byte getFlag = getRequest[0]; if (reuseByteArrayWrapper == null) { <START> reuseByteArrayWrapper = new ByteArrayWrapper(getRequest, 1); <END> } else { reuseByteArrayWrapper.setData(getRequest); reuseByteArrayWrapper.setOffset(1); reuseByteArrayWrapper.setLimit(getRequest.length); } MapState<ByteArrayWrapper, byte[]> mapState = getMapState(request); BeamFnApi.StateGetResponse.Builder response; switch (getFlag) { case GET_FLAG: response = handleMapGetValueRequest(reuseByteArrayWrapper, mapState); break; case CHECK_EMPTY_FLAG: response = handleMapCheckEmptyRequest(mapState); break; default: throw new RuntimeException(String.format( "Unsupported get request type: '%d' for map state.", getFlag)); } return CompletableFuture.completedFuture( BeamFnApi.StateResponse.newBuilder() .setId(request.getId()) .setGet(response)); }</code><technical_language>initializing reuseByteArrayWrapper in constructor</technical_language>

Target:
private CompletionStage<BeamFnApi.StateResponse.Builder> handleMapGetRequest(BeamFnApi.StateRequest request) throws Exception { byte[] getRequest = request.getGet().getContinuationToken().toByteArray(); byte getFlag = getRequest[0]; reuseByteArrayWrapper.setData(getRequest); reuseByteArrayWrapper.setOffset(1); reuseByteArrayWrapper.setLimit(getRequest.length); MapState<ByteArrayWrapper, byte[]> mapState = getMapState(request); BeamFnApi.StateGetResponse.Builder response; switch (getFlag) { case GET_FLAG: response = handleMapGetValueRequest(reuseByteArrayWrapper, mapState); break; case CHECK_EMPTY_FLAG: response = handleMapCheckEmptyRequest(mapState); break; default: throw new RuntimeException(String.format( "Unsupported get request type: '%d' for map state.", getFlag)); } return CompletableFuture.completedFuture( BeamFnApi.StateResponse.newBuilder() .setId(request.getId()) .setGet(response)); }
Source:
<code>public void testResolveFromWorkDirYamlAndYaml() throws Exception { helper.givenYamlClientFailoverConfigFileInWorkDir(42); <START> helper.givenYmlClientFailoverConfigFileInWorkDir(42); <END> ClientFailoverConfig config = new YamlClientFailoverConfigBuilder().build(); assertEquals(42, config.getTryCount()); }</code><technical_language>If this is meant test precedence of .yaml .yml, this a int</technical_language>

Target:
public void testResolveFromWorkDirYamlAndYaml() throws Exception { helper.givenYamlClientFailoverConfigFileInWorkDir(42); helper.givenYmlClientFailoverConfigFileInWorkDir(24); ClientFailoverConfig config = new YamlClientFailoverConfigBuilder().build(); assertEquals(42, config.getTryCount()); }
Source:
<code>public AggregationDataStoreTestHarness(EntityManagerFactory entityManagerFactory, DataSource defaultDataSource) { <START> this(entityManagerFactory, defaultDataSource, Collections.emptyMap(), <END> SQLDialectFactory.getDefaultDialect().getDialectType(), Collections.emptyMap()); }</code><technical_language>this call constructor 4 args instead</technical_language>

Target:
public AggregationDataStoreTestHarness(EntityManagerFactory entityManagerFactory, DataSource defaultDataSource) { this(entityManagerFactory, new ConnectionDetails(defaultDataSource, SQLDialectFactory.getDefaultDialect().getClass().getName())); }
Source:
<code>public void saveNewSanStorage() { StorageModel model = (StorageModel) getWindow(); SanStorageModelBase sanModel = (SanStorageModelBase) model.getCurrentStorageItem(); VDS host = model.getHost().getSelectedItem(); boolean force = sanModel.isForce(); HashSet<String> lunIds = new HashSet<>(); for (LunModel lun : sanModel.getAddedLuns()) { lunIds.add(lun.getLunId()); } AddSANStorageDomainParameters params = new AddSANStorageDomainParameters(storageDomain); params.setVdsId(host.getId()); <START> params.setLunIds(new HashSet<>(lunIds)); <END> params.setForce(force); Frontend.getInstance().runAction(VdcActionType.AddSANStorageDomain, params, result -> { StorageListModel storageListModel = (StorageListModel) result.getState(); StorageModel storageModel = (StorageModel) storageListModel.getWindow(); storageListModel.storageModel = storageModel.getCurrentStorageItem(); if (!result.getReturnValue().getSucceeded()) { storageListModel.onFinish(storageListModel.context, false, storageListModel.storageModel); return; } StoragePool dataCenter = storageModel.getDataCenter().getSelectedItem(); if (!dataCenter.getId().equals(StorageModel.UnassignedDataCenterId)) { VdcReturnValueBase returnValue = result.getReturnValue(); Guid storageId = returnValue.getActionReturnValue(); storageListModel.attachStorageToDataCenter(storageId, dataCenter.getId(), storageModel.getActivateDomain().getEntity()); } storageListModel.onFinish(storageListModel.context, true, storageListModel.storageModel); }, this); }</code><technical_language>Redundant - pass lunIds</technical_language>

Target:
public void saveNewSanStorage() { StorageModel model = (StorageModel) getWindow(); SanStorageModelBase sanModel = (SanStorageModelBase) model.getCurrentStorageItem(); VDS host = model.getHost().getSelectedItem(); boolean force = sanModel.isForce(); HashSet<String> lunIds = new HashSet<>(); for (LunModel lun : sanModel.getAddedLuns()) { lunIds.add(lun.getLunId()); } AddSANStorageDomainParameters params = new AddSANStorageDomainParameters(storageDomain); params.setVdsId(host.getId()); params.setLunIds(lunIds); params.setForce(force); Frontend.getInstance().runAction(VdcActionType.AddSANStorageDomain, params, result -> { StorageListModel storageListModel = (StorageListModel) result.getState(); StorageModel storageModel = (StorageModel) storageListModel.getWindow(); storageListModel.storageModel = storageModel.getCurrentStorageItem(); if (!result.getReturnValue().getSucceeded()) { storageListModel.onFinish(storageListModel.context, false, storageListModel.storageModel); return; } StoragePool dataCenter = storageModel.getDataCenter().getSelectedItem(); if (!dataCenter.getId().equals(StorageModel.UnassignedDataCenterId)) { VdcReturnValueBase returnValue = result.getReturnValue(); Guid storageId = returnValue.getActionReturnValue(); storageListModel.attachStorageToDataCenter(storageId, dataCenter.getId(), storageModel.getActivateDomain().getEntity()); } storageListModel.onFinish(storageListModel.context, true, storageListModel.storageModel); }, this); }
Source:
<code>public boolean isRetryableException(Exception exception) { <START> return !isNonRetryableServiceException(exception); <END> }</code><technical_language>I explain earlier, I "inline" is move implementation body of isNonRetryableServiceException isRetryableException method, negations applied expressions, return true -> false; etc. This is a double negative</technical_language>

Target:
public boolean isRetryableException(Exception exception) { if (exception instanceof AmazonServiceException) { AmazonServiceException ase = (AmazonServiceException) exception; return !NONRETRYABLE_STATUS_CODES.contains(ase.getStatusCode()) && !NONRETRYABLE_ERROR_CODES.contains(ase.getErrorCode()); } return true; }
Source:
<code>public void stressTest() { TestableTimelockServer nonLeader = Iterables.getFirst(cluster.nonLeaders(client.namespace()).values(), null); int startingNumThreads = ManagementFactory.getThreadMXBean().getThreadCount(); try { for (int i = 0; i < 10_000; i++) { client.getFreshTimestamp(); <START> assertThat(ManagementFactory.getThreadMXBean().getThreadCount()) <END> .as("should not additionally spin up too many threads") .isLessThanOrEqualTo(startingNumThreads + 200); if (i == 1_000) { nonLeader.serverHolder().wireMock().register( WireMock.any(WireMock.anyUrl()) .atPriority(Integer.MAX_VALUE - 1) .willReturn(WireMock.serviceUnavailable().withFixedDelay( Ints.checkedCast(Duration.ofSeconds(2).toMillis()))).build()); } } } finally { nonLeader.serverHolder().resetWireMock(); } }</code><technical_language>This test fail if buildup occurs in warmup period. in reason for failure if occurred warmup simulated shutting down</technical_language>

Target:
public void stressTest() { TestableTimelockServer nonLeader = Iterables.getFirst(cluster.nonLeaders(client.namespace()).values(), null); int startingNumThreads = ManagementFactory.getThreadMXBean().getThreadCount(); boolean isNonLeaderTakenOut = false; try { for (int i = 0; i < 10_000; i++) { client.getFreshTimestamp(); assertNumberOfThreadsReasonable( startingNumThreads, ManagementFactory.getThreadMXBean().getThreadCount(), isNonLeaderTakenOut); if (i == 1_000) { makeServerWaitTwoSecondsAndThenReturn503s(nonLeader); isNonLeaderTakenOut = true; } } } finally { nonLeader.serverHolder().resetWireMock(); } }
Source:
<code>public void evaluate(final Node node, final RuleContext data) { initXPathRuleQuery(); final List<Node> nodesWithViolation = xpathRuleQuery.evaluate(node, data); <START> for (final Node nodeWithViolation : nodesWithViolation) { <END> addViolation(data, nodeWithViolation, nodeWithViolation.getImage()); } }</code><technical_language>Unwanted final</technical_language>

Target:
public void evaluate(final Node node, final RuleContext data) { if (xPathRuleQueryNeedsInitialization()) { initXPathRuleQuery(); } List<Node> nodesWithViolation = xpathRuleQuery.evaluate(node, data); for (Node nodeWithViolation : nodesWithViolation) { addViolation(data, nodeWithViolation, nodeWithViolation.getImage()); } }
Source:
<code>public Object get(Object key) { try { <START> return (getRegion().get(key)); <END> } catch (IOException ex) { LOG.info("error getting object ", ex); return null; } }</code><technical_language>same.. getters for local variables</technical_language>

Target:
public Object get(Object key) { try { return (getRegion().get(key)); } catch (IOException ex) { throw new RuntimeException("Exception while getting the object", ex); } }
Source:
<code>public static String encodeBase64URLSafeString(byte[] binaryData) { if(binaryData == null){ return null; } <START> <END> return com.google.common.io.BaseEncoding.base64Url().omitPadding().encode(binaryData); }</code><technical_language>nit: delete newline</technical_language>

Target:
public static String encodeBase64URLSafeString(byte[] binaryData) { if (binaryData == null) { return null; } return BaseEncoding.base64Url().omitPadding().encode(binaryData); }
Source:
<code>private void printUsage(ParametersParser parser) { logger.info( String.format( "usage: %s%n%n%s%n%n%s", parser.getPrefixUsage().replace("@PROGRAM_NAME@", (String)getContext().get(PROGRAM_NAME)), parser.getPrefixHelp(), parser.getPrefixUnderlinetext() ) <START> ); <END> }</code><technical_language>stdout, well, I put stdin/stdout/stderr in context core, important for now. again, this acquire parser, if add new fields all. need do is print parser.getUsage().replace().replace().replace()..</technical_language>

Target:
private void printUsage(ParametersParser parser) { System.out.format( "usage: %s", parser.getUsage().replace("@PROGRAM_NAME@", (String) context.get(PROGRAM_NAME)) ); }
Source:
<code>public float getBlockLocalityIndexForSsd(String host) { <START> return (float) getBlocksLocalityWeightInternal(host, e -> e.weightForSsd) <END> / (float) uniqueBlocksTotalWeight; }</code><technical_language>here: getBlocksLocalityWeightInternal(host, HostAndWeight::getWeightForSsd)</technical_language>

Target:
public float getBlockLocalityIndexForSsd(String host) { if (uniqueBlocksTotalWeight == 0) { return 0.0f; } else { return (float) getBlocksLocalityWeightInternal(host, HostAndWeight::getWeightForSsd) / (float) uniqueBlocksTotalWeight; } }
Source:
<code>public void rebuild() { <START> buildGraph(); <END> }</code><technical_language>do need of build & rebuild method? buildGraph() return Graph? Or... a getGraph() build good. rebuildGraph() direct return more sense end-user it. So, for normal snapshot state getGraph() is good. In case of a fresh state, please, call rebuildGraph(). WDYT</technical_language>

Target:
public Graph rebuild() { return buildGraph(); }
Source:
<code>public static String validateQuery(String query, ValidationType validationType) { final QueryValidator validator = QueryValidatorFactory.createValidator(validationType); <START> if ((query == null) || "".equals(query) || validator.isValid(query)) { <END> return query; } throw TalendRuntimeException.createUnexpectedException( "Please check your sql as we only allow the query which don't do write or lock action."); }</code><technical_language>String.isEmpty() instead of "".equals(query)</technical_language>

Target:
public static String validateQuery(String query, ValidationType validationType) { final QueryValidator validator = QueryValidatorFactory.createValidator(validationType); if ((query == null) || query.isEmpty() || validator.isValid(query)) { return query; } throw TalendRuntimeException.createUnexpectedException( "Please check your sql as we only allow the query which don't do write or lock action."); }
Source:
<code>private void clearHeaders() { try { <START> responseMetadataChangeLock.lock(); <END> responseMetadata.headers().clear(); logger.trace("Headers cleared for response in channel {}", ctx.channel()); } finally { responseMetadataChangeLock.unlock(); } }</code><technical_language>want this try</technical_language>

Target:
private void clearHeaders() { responseMetadataChangeLock.lock(); try { responseMetadata.headers().clear(); logger.trace("Headers cleared for response in channel {}", ctx.channel()); } finally { responseMetadataChangeLock.unlock(); } }
Source:
<code>public void dropRole(String role) { synchronized (rolesLock) { <START> Set<String> roles = new HashSet<>(listRoles()); <END> roles.remove(role); writeFile("roles", getRolesFile(), rolesCodec, ImmutableList.copyOf(roles), true); } }</code><technical_language>change roles for grantor</technical_language>

Target:
public void dropRole(String role) { synchronized (rolesLock) { Set<String> roles = new HashSet<>(listRoles()); roles.remove(role); writeFile("roles", getRolesFile(), rolesCodec, ImmutableList.copyOf(roles), true); Set<RoleGrant> grants = listRoleGrantsSanitized(); writeRoleGrantsFile(grants); } }
Source:
<code>public AdsBaseObject verifyAdImage(String slotName, String src, String imageUrl) { WebElement element = getWebElement(slotName); <START> boolean isMobile = src.toUpperCase().equals("MOBILE"); <END> Assertion.assertTrue(new AdsComparison().compareImageWithScreenshot(imageUrl, element, driver, isMobile)); PageObjectLogging.log("verifyAdImage", "Ad looks good", true, driver); return this; }</code><technical_language>swap left right for equals avoid NullPointerException also, equalsIgnoreCase instead "MOBILE".equalsIgnoreCase(src);</technical_language>

Target:
public AdsBaseObject verifyAdImage(String slotName, String src, String imageUrl) { WebElement element = getWebElement(slotName); boolean isMobile = "MOBILE".equalsIgnoreCase(src); Assertion.assertTrue(new AdsComparison().compareImageWithScreenshot(imageUrl, element, driver, isMobile)); PageObjectLogging.log("verifyAdImage", "Ad looks good", true, driver); return this; }
Source:
<code>public static IdentifierTree getArgumentIdentifier(MethodInvocationTree mit, int index) { Arguments arguments = mit.arguments(); if (index < 0 || index > arguments.size()) { <START> return null; <END> } ExpressionTree expr = ExpressionUtils.skipParentheses(arguments.get(index)); switch (expr.kind()) { case MEMBER_SELECT: return ((MemberSelectExpressionTree) expr).identifier(); case IDENTIFIER: return ((IdentifierTree) expr); default: return null; } }</code><technical_language>this happen in normal case? I this throwing IllegalStateException instead of returning null , this is error call invalid index</technical_language>

Target:
public static IdentifierTree getArgumentIdentifier(MethodInvocationTree mit, int index) { Arguments arguments = mit.arguments(); if (index < 0 || index > arguments.size()) { throw new IllegalArgumentException("index must be within arguments range."); } ExpressionTree expr = ExpressionUtils.skipParentheses(arguments.get(index)); switch (expr.kind()) { case MEMBER_SELECT: return ((MemberSelectExpressionTree) expr).identifier(); case IDENTIFIER: return ((IdentifierTree) expr); default: return null; } }
Source:
<code>public void initialize(ByteSize constraintAnnotation) { try { charset = Charset.forName(constraintAnnotation.charset()); } catch (IllegalArgumentException e) { throw reportFailedToInitialize(e); } min = constraintAnnotation.min(); <START> max = constraintAnnotation.max(); <END> if (max < min) { throw reportFailedToInitialize(new IllegalArgumentException("max[" + max + "] must be higher or equal to min[" + min + "].")); } }</code><technical_language>[x] I prefer add check for min >= 0 max >= 0 implementation of @Size provided Hibernate validator. (@ByteMin @ByteMax issue)</technical_language>

Target:
public void initialize(ByteSize constraintAnnotation) { try { charset = Charset.forName(constraintAnnotation.charset()); } catch (IllegalArgumentException e) { throw reportFailedToInitialize(e); } min = constraintAnnotation.min(); max = constraintAnnotation.max(); if (min < 0) { throw reportFailedToInitialize(new IllegalArgumentException("min[" + min + "] must not be negative value.")); } if (max < 0) { throw reportFailedToInitialize(new IllegalArgumentException("max[" + max + "] must not be negative value.")); } if (max < min) { throw reportFailedToInitialize(new IllegalArgumentException("max[" + max + "] must be higher or equal to min[" + min + "].")); } }
Source:
<code>public TimeBasedDirectoryScanner() { lastModifiedTimes = Maps.newHashMap(); recursive = true; scanIntervalMillis = DEF_SCAN_INTERVAL_MILLIS; files = Sets.newLinkedHashSet(); scanService = Executors.newSingleThreadExecutor(); discoveredFiles = new LinkedBlockingDeque<FileInfo>(); atomicThrowable = new AtomicReference<Throwable>(); ignoredFiles = Sets.newHashSet(); <START> lock = new Lock(); <END> }</code><technical_language>create this setup.. transient</technical_language>

Target:
public TimeBasedDirectoryScanner() { lastModifiedTimes = Maps.newHashMap(); recursive = true; scanIntervalMillis = DEF_SCAN_INTERVAL_MILLIS; files = Sets.newLinkedHashSet(); scanService = Executors.newSingleThreadExecutor(); discoveredFiles = new LinkedBlockingDeque<FileInfo>(); atomicThrowable = new AtomicReference<Throwable>(); ignoredFiles = Sets.newHashSet(); }
Source:
<code>public void sendRequest(Exchange exchange, final Request request) { if (request.getToken() != null) { KeyToken idByToken = Exchange.KeyToken.fromOutboundMessage(request); <START> if (!(exchange.getFailedTransmissionCount() > 0 || request.getOptions().hasBlock1() <END> || request.getOptions().hasBlock2() || request.getOptions().hasObserve()) && exchangeStore.get(idByToken) != null) { LOGGER.log(Level.WARNING, "Manual token overrides existing open request: {0}", idByToken); } } exchange.setObserver(exchangeObserver); exchangeStore.registerOutboundRequestWithTokenOnly(exchange); LOGGER.log(Level.FINE, "Tracking open request using {0}", new Object[] { request.getTokenString() }); if (request.getOptions().hasObserve() && request.getOptions().getObserve() == 0) { startObserve(request); } }</code><technical_language>if (request.getToken() != null) block removed this check is done in InMemoryMessageExchangeStore</technical_language>

Target:
public void sendRequest(Exchange exchange, final Request request) { exchange.setObserver(exchangeObserver); exchangeStore.registerOutboundRequestWithTokenOnly(exchange); LOGGER.log(Level.FINE, "Tracking open request using {0}", new Object[] { request.getTokenString() }); if (request.getOptions().hasObserve() && request.getOptions().getObserve() == 0) { registerObserve(request); } }
Source:
<code>public String toString() { <START> return "Dashboard{" + <END> "uid='" + uid + '\'' + ", title='" + title + '\'' + ", uri='" + uri + '\'' + ", url='" + url + '\'' + ", panels=" + panels + ", tags=" + tags + ", meta=" + meta + '}'; }</code><technical_language>Is a reason for MoreObjects.ToStringHelper instead</technical_language>

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("uid", uid) .add("title", title) .add("uri", uri) .add("url", url) .add("panels", panels) .add("tags", tags) .add("meta", meta) .toString(); }
Source:
<code>public void testFederateGetEmptyResults() throws Exception { List<String> sourceIds = ImmutableList.of("1"); QueryRequest fedQueryRequest = new QueryRequestImpl(mockQuery, false, sourceIds, properties); List<Source> sourceList = ImmutableList.of(); when(mockResponse.getHits()).thenReturn((long) sourceList.size()); QueryResponse federateResponse = federateStrategy.federate(sourceList, fedQueryRequest); <START> assertThat(federateResponse.getResults().size(), is(0)); <END> }</code><technical_language>correct, bad</technical_language>

Target:
public void testFederateGetEmptyResults() throws Exception { QueryRequest fedQueryRequest = new QueryRequestImpl(mockQuery, false, null, properties); List<Source> sourceList = ImmutableList.of(); QueryResponse federateResponse = federateStrategy.federate(sourceList, fedQueryRequest); assertThat(federateResponse.getResults().size(), is(0)); }
Source:
<code>private static int tableSize(final DfsBlockCacheConfig cfg) { final int wsz = cfg.getBlockSize(); final long limit = cfg.getBlockLimit(); if (wsz <= 0) throw new IllegalArgumentException(JGitText.get().invalidWindowSize); if (limit < wsz) throw new IllegalArgumentException(JGitText.get().windowSizeMustBeLesserThanLimit); <START> return (int) Math.min(5 * (limit / wsz) / 2, 2000000000); <END> }</code><technical_language>Define a final static int BILLION = 1000*1000*1000; 2*BILLION count zeroes. Turkish Lira, counting zeroes figure out a million ten million? 1000000 10000000. Btw, zeroes zeros</technical_language>

Target:
private static int tableSize(final DfsBlockCacheConfig cfg) { final int wsz = cfg.getBlockSize(); final long limit = cfg.getBlockLimit(); if (wsz <= 0) throw new IllegalArgumentException(JGitText.get().invalidWindowSize); if (limit < wsz) throw new IllegalArgumentException(JGitText.get().windowSizeMustBeLesserThanLimit); return (int) Math.min(5 * (limit / wsz) / 2, Integer.MAX_VALUE); }
Source:
<code><START> public static ITmfTimestampTransform createLinearFast(BigDecimal factor, BigDecimal offset) { <END> return new TmfTimestampTransformLinearFast(new TmfTimestampTransformLinear(factor, offset)); }</code><technical_language>this part of createlinear? if factor == 1.0 a createwithoffset</technical_language>

Target:
public static ITmfTimestampTransform createLinearFast(BigDecimal factor, BigDecimal offset) { return new TmfTimestampTransformLinearFast(factor, offset); }
Source:
<code>protected void finalize() throws Throwable { Task faultedTask = this.task; if (faultedTask != null) { Task.UnobservedExceptionHandler ueh = Task.getUnobservedExceptionHandler(); if (ueh != null) { ueh.unobservedException(faultedTask, new UnobservedTaskException(faultedTask.getError())); } } <START> } <END></code><technical_language>small edit: try { ... } finally { super.finalize() }</technical_language>

Target:
protected void finalize() throws Throwable { try { Task faultedTask = this.task; if (faultedTask != null) { Task.UnobservedExceptionHandler ueh = Task.getUnobservedExceptionHandler(); if (ueh != null) { ueh.unobservedException(faultedTask, new UnobservedTaskException(faultedTask.getError())); } } } finally { super.finalize(); } }
Source:
<code>public void changeCourseIdInForm(int instrNum, String newCourseId) { <START> String selector = "$('#edit-" + instrNum + "').find('[name=\"" + Const.ParamsNames.COURSE_ID + "\"]')"; <END> String action = ".val('" + newCourseId + "')"; ((JavascriptExecutor) browser.driver).executeScript(selector + action); }</code><technical_language>Is a child selector here? "$('#edit-" + instrNum + " > input[name=\'" + Const.ParamsNames.COURSE_ID + "\']')" // messy =(</technical_language>

Target:
public void changeCourseIdInForm(int instrNum, String newCourseId) { String selector = "$('#edit-" + instrNum + " input[name=\"" + Const.ParamsNames.COURSE_ID + "\"]')"; String action = ".val('" + newCourseId + "')"; ((JavascriptExecutor) browser.driver).executeScript(selector + action); }
Source:
<code>public void makeButton(FormEntryPrompt prompt){ setOrientation(LinearLayout.VERTICAL); TableLayout.LayoutParams params = new TableLayout.LayoutParams(); params.setMargins(7, 5, 7, 5); launchIntentButton = new Button(getContext()); setButtonLabel(); launchIntentButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontsize); launchIntentButton.setPadding(20, 20, 20, 20); launchIntentButton.setEnabled(!prompt.isReadOnly()); <START> launchIntentButton.setLayoutParams(params); <END> String s = prompt.getAnswerText(); if (s != null) { launchIntentButton.setText(StringUtils.getStringSpannableRobust(getContext(), R.string.intent_callout_button_update)); } launchIntentButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { performCallout(); } }); addView(launchIntentButton); }</code><technical_language>If merge master (which need do this auto-merge-able) WidgetUtils.setupButton, performs this button setup code</technical_language>

Target:
public void makeButton(FormEntryPrompt prompt){ setOrientation(LinearLayout.VERTICAL); TableLayout.LayoutParams params = new TableLayout.LayoutParams(); params.setMargins(7, 5, 7, 5); launchIntentButton = new Button(getContext()); String s = prompt.getAnswerText(); Spannable label; if (s != null) { label = StringUtils.getStringSpannableRobust(getContext(), R.string.intent_callout_button_update); } else{ label = StringUtils.getStringSpannableRobust(getContext(), R.string.intent_callout_button); } WidgetUtils.setupButton(launchIntentButton, label, mAnswerFontsize, !prompt.isReadOnly()); launchIntentButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { performCallout(); } }); addView(launchIntentButton); }
Source:
<code><START> public void testBackgroundLatencyUnSleep() throws Exception <END> { server.stop(); CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1)); try { client.start(); ((CuratorFrameworkImpl)client).sleepAndQueueOperationSeconds = Integer.MAX_VALUE; final CountDownLatch latch = new CountDownLatch(1); BackgroundCallback callback = new BackgroundCallback() { @Override public void processResult(CuratorFramework client, CuratorEvent event) throws Exception { latch.countDown(); } }; client.create().inBackground(callback).forPath("/test"); server.restart(); Assert.assertTrue(timing.awaitLatch(latch)); } finally { CloseableUtils.closeQuietly(client); } }</code><technical_language>test multiple operations verify fires rest continue sleep</technical_language>

Target:
public void testBackgroundLatencyUnSleep() throws Exception { server.stop(); CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1)); try { client.start(); ((CuratorFrameworkImpl)client).sleepAndQueueOperationSeconds = Integer.MAX_VALUE; final CountDownLatch latch = new CountDownLatch(3); BackgroundCallback callback = new BackgroundCallback() { @Override public void processResult(CuratorFramework client, CuratorEvent event) throws Exception { if ( (event.getType() == CuratorEventType.CREATE) && (event.getResultCode() == KeeperException.Code.OK.intValue()) ) { latch.countDown(); } } }; client.create().inBackground(callback).forPath("/test"); client.create().inBackground(callback).forPath("/test/one"); client.create().inBackground(callback).forPath("/test/two"); server.restart(); Assert.assertTrue(timing.awaitLatch(latch)); } finally { CloseableUtils.closeQuietly(client); } }
Source:
<code>public LogViewerController(Map conf) { port = Optional.fromNullable((Number) conf.get(Config.LOGVIEWER_PORT)).or(8000).intValue(); setUrlDetector(new SocketUrlDetection(port)); logdir = System.getenv("MESOS_SANDBOX") + "/logs"; if (conf.containsKey(STORM_LOG_DIR_CONF)) { logdir = (String) conf.get(STORM_LOG_DIR_CONF); <START> } <END> }</code><technical_language>Move lines 43:46 MesosCommon.getLogDirectory</technical_language>

Target:
public LogViewerController(Map conf) { port = Optional.fromNullable((Number) conf.get(Config.LOGVIEWER_PORT)).or(8000).intValue(); setUrlDetector(new SocketUrlDetection(port)); logDir = MesosCommon.getStormLogDir(conf, System.getenv("MESOS_SANDBOX") + "/logs"); }
Source:
<code>private static void encodeV1(HAProxyMessage msg, ByteBuf out) { final String protocol = msg.proxiedProtocol().name(); StringBuilder sb = new StringBuilder(108) .append("PROXY ").append(protocol).append(' ') .append(msg.sourceAddress()).append(' ') .append(msg.destinationAddress()).append(' ') .append(msg.sourcePort()).append(' ').append(msg.destinationPort()).append("\r\n"); <START> out.writeBytes(sb.toString().getBytes(CharsetUtil.US_ASCII)); <END> }</code><technical_language>dont write stuff ByteBuf ? out.writeCharSequence(...)</technical_language>

Target:
private static void encodeV1(HAProxyMessage msg, ByteBuf out) { out.writeBytes(TEXT_PREFIX); out.writeByte((byte) ' '); out.writeCharSequence(msg.proxiedProtocol().name(), CharsetUtil.US_ASCII); out.writeByte((byte) ' '); out.writeCharSequence(msg.sourceAddress(), CharsetUtil.US_ASCII); out.writeByte((byte) ' '); out.writeCharSequence(msg.destinationAddress(), CharsetUtil.US_ASCII); out.writeByte((byte) ' '); out.writeCharSequence(String.valueOf(msg.sourcePort()), CharsetUtil.US_ASCII); out.writeByte((byte) ' '); out.writeCharSequence(String.valueOf(msg.destinationPort()), CharsetUtil.US_ASCII); out.writeByte((byte) '\r'); out.writeByte((byte) '\n'); }
Source:
<code>protected void setup(Context context) throws IOException, InterruptedException { String moduleClassName = context.getConfiguration().get(EXPORT_ACTION_BUILDER_FACTORY_CLASSNAME); if (StringUtils.isNotBlank(moduleClassName)) { try { Class<?> clazz = Class.forName(moduleClassName); Constructor<?> constructor = clazz.getConstructor(); ActionBuilderFactory<SpecificRecordBase, Oaf> actionBuilderFactory = (ActionBuilderFactory<SpecificRecordBase, Oaf>) constructor.newInstance(); actionBuilder = actionBuilderFactory.instantiate(context.getConfiguration()); <START> objectMapper = new ObjectMapper(); <END> } catch (Exception e) { throw new RuntimeException("unexpected exception ocurred when instantiating " + "builder module: " + moduleClassName, e); } } else { throw new InvalidParameterException("unknown action builder module instance, " + "no " + EXPORT_ACTION_BUILDER_FACTORY_CLASSNAME + " parameter provided!"); } }</code><technical_language>ObjectMapper constructor throw exceptions creation moved filed definition</technical_language>

Target:
protected void setup(Context context) throws IOException, InterruptedException { String moduleClassName = context.getConfiguration().get(EXPORT_ACTION_BUILDER_FACTORY_CLASSNAME); if (StringUtils.isNotBlank(moduleClassName)) { try { Class<?> clazz = Class.forName(moduleClassName); Constructor<?> constructor = clazz.getConstructor(); ActionBuilderFactory<SpecificRecordBase, Oaf> actionBuilderFactory = (ActionBuilderFactory<SpecificRecordBase, Oaf>) constructor.newInstance(); actionBuilder = actionBuilderFactory.instantiate(context.getConfiguration()); } catch (Exception e) { throw new RuntimeException("unexpected exception ocurred when instantiating " + "builder module: " + moduleClassName, e); } } else { throw new InvalidParameterException("unknown action builder module instance, " + "no " + EXPORT_ACTION_BUILDER_FACTORY_CLASSNAME + " parameter provided!"); } }
Source:
<code>public boolean accepts(ModelNode response) { <START> if (response.hasDefined(RESULT)) { <END> final ModelNode result = response.get(RESULT); if (result.hasDefined(STEP_1)) { final List<Property> steps = result.asPropertyList(); for (Property step : steps) { final ModelNode stepContent = step.getValue(); if (stepContent.hasDefined(RESPONSE_HEADERS) && stepContent.get(RESPONSE_HEADERS).hasDefined(WARNINGS)) { return true; } } } } return false; }</code><technical_language>Is model node structure for standalone domain</technical_language>

Target:
public boolean accepts(ModelNode response) { if (response.hasDefined(RESPONSE_HEADERS)) { final ModelNode result = response.get(RESPONSE_HEADERS); if (result.hasDefined(WARNINGS)) { return true; } } return false; }
Source:
<code>private static FluentIterable<String> checkNodeHasIps(NodeMetadata node, AllowedInterfaces allowedInterfaces) { Iterable<String> ips = new HashSet<String>(); if(allowedInterfaces.scanPublic){ ips = concat(ips, node.getPublicAddresses()); } if(allowedInterfaces.scanPrivate){ ips = concat(ips, node.getPrivateAddresses()); } checkState(size(ips) > 0, "node does not have IP addresses configured: " + node); <START> return FluentIterable.from(ips); <END> }</code><technical_language>this setup, I a builder: ImmutableSet.Builder<String> ips = ImmutableSet.builder(); if (allowedInterfaces.scanPublic) { ips.addAll(node.getPublicAddresses()); } if (allowedInterfaces.scanPrivate) { ips.addAll(node.getPrivateAddresses()); } ImmutableSet<String> ipsToScan = ips.build(); checkState(!ipsToScan.isEmpty(), "node IP addresses configured: " + node); return FluentIterable.from(ipsToScan);</technical_language>

Target:
static FluentIterable<String> checkNodeHasIps(NodeMetadata node, AllowedInterfaces allowedInterfaces) { ImmutableSet.Builder<String> ipsBuilder = ImmutableSet.builder(); if (allowedInterfaces.scanPublic) { ipsBuilder.addAll(node.getPublicAddresses()); } if (allowedInterfaces.scanPrivate) { ipsBuilder.addAll(node.getPrivateAddresses()); } ImmutableSet<String> ips = ipsBuilder.build(); checkState(!ips.isEmpty(), "node does not have IP addresses configured: %s", node); return FluentIterable.from(ips); }