auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public void badRangeHeaderTest() <END> throws Exception { JSONObject headers = new JSONObject(); headers.put(RestUtils.Headers.RANGE, "adsfksakdfsdfkdaklf"); try { doOperation(createRestRequest(RestMethod.GET, "/", headers, null), new MockRestResponseChannel()); fail("GET operation should have failed because of an invalid range header"); } catch (RestServiceException e) { assertEquals("Unexpected error code", RestServiceErrorCode.RangeNotSatisfiable, e.getErrorCode()); } }</code><technical_language>doc</technical_language>

Target:
public void badRangeHeaderTest() throws Exception { JSONObject headers = new JSONObject(); headers.put(RestUtils.Headers.RANGE, "adsfksakdfsdfkdaklf"); try { doOperation(createRestRequest(RestMethod.GET, "/", headers, null), new MockRestResponseChannel()); fail("GET operation should have failed because of an invalid range header"); } catch (RestServiceException e) { assertEquals("Unexpected error code", RestServiceErrorCode.InvalidArgs, e.getErrorCode()); } }
Source:
<code>public void pathWriterFailureMentionsCause() throws Exception { try { final Path outputPath = Paths.get("nope://no.txt"); createSmallBam(outputPath); <START> Assert.assertFalse(true, "Should have thrown a RuntimeIOException"); <END> } catch (RuntimeIOException expected) { Assert.assertTrue(expected.getCause().toString().contains("NoSuchFileException")); } }</code><technical_language>more elegant Assert.fail()</technical_language>

Target:
public void pathWriterFailureMentionsCause() throws Exception { try { final Path outputPath = Paths.get("nope://no.txt"); createSmallBam(outputPath); Assert.fail("Should have thrown a RuntimeIOException"); } catch (RuntimeIOException expected) { Assert.assertTrue(expected.getCause().toString().contains("NoSuchFileException")); } }
Source:
<code>public void before() { A = Allele.create("A"); ARef = Allele.create("A", true); T = Allele.create("T"); ATIns = Allele.create("AT"); ATCIns = Allele.create("ATC"); NoCall = Allele.create(Allele.NO_CALL_STRING); SpandDel = Allele.create(htsjdk.variant.vcf.VCFConstants.SPANNING_DELETION_ALLELE); <START> } <END></code><technical_language>Allele.SPAN_DEL public</technical_language>

Target:
public void before() { A = Allele.create("A"); ARef = Allele.create("A", true); T = Allele.create("T"); ATIns = Allele.create("AT"); ATCIns = Allele.create("ATC"); NoCall = Allele.create(Allele.NO_CALL_STRING); SpandDel = Allele.create(Allele.SPAN_DEL_STRING); }
Source:
<code>public Response getDispoItemsById(@PathParam("fileName") String fileName) { if (!fileName.endsWith(".LIS")) { fileName = <START> fileName.replaceAll("\\.(ada|c).*", <END> ".LIS"); } DispoSet set = dispoApi.getDispoSetById(program, setId); String fullPath = set.getImportPath() + File.separator + "vcast" + File.separator + fileName; final File result = new File(fullPath); StreamingOutput streamingOutput = new StreamingOutput() { @Override public void write(OutputStream outputStream) throws WebApplicationException { FileInputStream inputStream = null; Writer writer = null; try { inputStream = new FileInputStream(result); writer = new OutputStreamWriter(outputStream, "UTF-8"); int c; while ((c = inputStream.read()) != -1) { writer.write(c); } outputStream.flush(); } catch (IOException ex) { throw new OseeCoreException(ex); } finally { Lib.close(inputStream); Lib.close(writer); } } }; String contentDisposition = String.format("attachment; filename=\"%s\"; creation-date=\"%s\"", fileName, new Date()); return Response.ok(streamingOutput).header("Content-Disposition", contentDisposition).type("application/text").build(); }</code><technical_language>if this is issue not, i this match a .ada<more chars> ".LIS". i trailing .* in regex removed</technical_language>

Target:
public Response getDispoItemsById(@PathParam("fileName") String fileName) { if (!fileName.endsWith(".LIS")) { fileName = fileName.replaceAll("\\.(ada|c)", ".LIS"); } DispoSet set = dispoApi.getDispoSetById(program, setId); String fullPath = set.getImportPath() + File.separator + "vcast" + File.separator + fileName; final File result = new File(fullPath); StreamingOutput streamingOutput = new StreamingOutput() { @Override public void write(OutputStream outputStream) throws WebApplicationException { FileInputStream inputStream = null; Writer writer = null; try { inputStream = new FileInputStream(result); writer = new OutputStreamWriter(outputStream, "UTF-8"); int c; while ((c = inputStream.read()) != -1) { writer.write(c); } outputStream.flush(); } catch (IOException ex) { throw new OseeCoreException(ex); } finally { Lib.close(inputStream); Lib.close(writer); } } }; String contentDisposition = String.format("attachment; filename=\"%s\"; creation-date=\"%s\"", fileName, new Date()); return Response.ok(streamingOutput).header("Content-Disposition", contentDisposition).type("application/text").build(); }
Source:
<code>public ConnectionProviderUI(IConfigurationElement element) { super(element); editable = Boolean.parseBoolean(element.getAttribute(EDITABLE)); IConfigurationElement[] children = element.getChildren(); ArrayList<IConfigurationElement> wizardPageList = new ArrayList<IConfigurationElement>(); labelProviderElement = null; for( int i = 0; i < children.length; i++ ) { <START> if( children[i].getName().equals("wizardFragment")) { END> if( rootFragment != null ) { } rootFragment = children[i]; } else if( children[i].getName().equals("connectionLabelProvider")) { labelProviderElement = children[i]; } } }</code><technical_language>Optional: invert equals avoid potential NPE</technical_language>

Target:
public ConnectionProviderUI(IConfigurationElement element) { super(element); editable = Boolean.parseBoolean(element.getAttribute(EDITABLE)); IConfigurationElement[] children = element.getChildren(); ArrayList<IConfigurationElement> wizardPageList = new ArrayList<IConfigurationElement>(); labelProviderElement = null; boolean multipleFragments = false; for( int i = 0; i < children.length; i++ ) { if( "wizardFragment".equals(children[i].getName())) { if( rootFragment != null && !multipleFragments) { String msg = "providerUI " + element.getAttribute("id") + " in contributor " + element.getContributor().getName() + " declares more than 1 wizard fragment"; JMXUIActivator.log(IStatus.WARNING, msg, null); multipleFragments = true; } rootFragment = children[i]; } else if( "connectionLabelProvider".equals(children[i].getName())) { labelProviderElement = children[i]; } } }
Source:
<code>public URL getElasticsearchUrl() { final List<URL> urls = elasticsearchUrls.getValue(); if (urls.isEmpty()) { return null; } final int index = accessesToElasticsearchUrl.getAndIncrement() % urls.size(); URL elasticsearchURL = urls.get(index); final String defaultUsernameValue = elasticsearchDefaultUsername.getValue(); final String defaultPasswordValue = elasticsearchDefaultPassword.getValue(); if (elasticsearchURL.getUserInfo() == null && ! defaultUsernameValue.isEmpty() && ! defaultPasswordValue.isEmpty()) { try { String username = URLEncoder.encode(defaultUsernameValue, "UTF-8"); String password = URLEncoder.encode(defaultPasswordValue, "UTF-8"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder .append(elasticsearchURL.getProtocol()) .append("://") .append(username) .append(":") .append(password) .append("@") .append(elasticsearchURL.getHost()) .append(":") <START> .append(elasticsearchURL.getPort()); <END> return new URL(stringBuilder.toString()); } catch (Exception e) { logger.error(e.getMessage(), e); } } return elasticsearchURL; }</code><technical_language>good me. I problem (and I do this often). If Elasticsearch a reverse-proxy configures pass requests server1.example-internal.com/search some-elasticsearch-host.example-internal.com, need append elasticsearchURL.getPath() well, stagemonitor sends request server1.example-internal.com/search instead of server1.example-internal.com</technical_language>

Target:
public URL getElasticsearchUrl() { final List<URL> urls = elasticsearchUrls.getValue(); if (urls.isEmpty()) { return null; } final int index = accessesToElasticsearchUrl.getAndIncrement() % urls.size(); URL elasticsearchURL = urls.get(index); final String defaultUsernameValue = elasticsearchDefaultUsername.getValue(); final String defaultPasswordValue = elasticsearchDefaultPassword.getValue(); if (elasticsearchURL.getUserInfo() == null && ! defaultUsernameValue.isEmpty() && ! defaultPasswordValue.isEmpty()) { try { String username = URLEncoder.encode(defaultUsernameValue, "UTF-8"); String password = URLEncoder.encode(defaultPasswordValue, "UTF-8"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder .append(elasticsearchURL.getProtocol()) .append("://") .append(username) .append(":") .append(password) .append("@") .append(elasticsearchURL.getHost()) .append(":") .append(elasticsearchURL.getPort()) .append(elasticsearchURL.getPath()); return new URL(stringBuilder.toString()); } catch (Exception e) { logger.error(e.getMessage(), e); } } return elasticsearchURL; }
Source:
<code>private void updateDiscardAfterDelete() { if (getDataCenter().getSelectedItem() != null && getAvailableStorageTypeItems().getSelectedItem() != null) { boolean discardAfterDeleteSupported = (Boolean) AsyncDataProvider.getInstance().getConfigValuePreConverted( ConfigurationValues.DiscardAfterDeleteSupported, getDataCenter().getSelectedItem().getCompatibilityVersion().toString()); boolean isBlockDomain = getAvailableStorageTypeItems().getSelectedItem().isBlockDomain(); getDiscardAfterDelete().setIsAvailable(discardAfterDeleteSupported && isBlockDomain); if (getDiscardAfterDelete().getIsAvailable()) { if (isNewStorage()) { <START> getDiscardAfterDelete().setEntity(false); <END> } else { getDiscardAfterDelete().setEntity(getStorage().isDiscardAfterDelete()); } } } }</code><technical_language>creating a new domain, please select a block domain discard available, set discard true move NFS domain selection try save a new NFS domain, I suspect a problem discard set true</technical_language>

Target:
private void updateDiscardAfterDelete() { if (getDataCenter().getSelectedItem() != null && getAvailableStorageTypeItems().getSelectedItem() != null) { boolean isBlockDomain = getAvailableStorageTypeItems().getSelectedItem().isBlockDomain(); if (!isBlockDomain) { getDiscardAfterDelete().setIsAvailable(false); getDiscardAfterDelete().setEntity(false); return; } boolean discardAfterDeleteSupported = (Boolean) AsyncDataProvider.getInstance().getConfigValuePreConverted( ConfigurationValues.DiscardAfterDeleteSupported, getDataCenter().getSelectedItem().getCompatibilityVersion().toString()); getDiscardAfterDelete().setIsAvailable(discardAfterDeleteSupported); if (getDiscardAfterDelete().getIsAvailable()) { if (isNewStorage()) { getDiscardAfterDelete().setEntity(false); } else { getDiscardAfterDelete().setEntity(getStorage().isDiscardAfterDelete()); } } } }
Source:
<code>public void refresh(final GlusterVolumeEntity volumeEntity) { refresh = new Timer() { @Override public void run() { refreshDetails(volumeEntity); } }; <START> refresh.schedule(10000); <END> }</code><technical_language>problem exists cancelling timer previous If above, request returned creating a new timer scheduling. this timer re-used? create time in constructor schedule triggered want</technical_language>

Target:
public void refresh(final GlusterVolumeEntity volumeEntity) { refresh.schedule(10000); }
Source:
<code>private void testSize(final int size) { CircularBuffer<Integer> instance = new CircularBuffer<Integer>(size); int i = 1; while (i < size) { i <<= 1; } <START> assert i == instance.capacity(); <END> instance.add(99); final int v = instance.remove(); assert 99 == v; instance = null; }</code><technical_language>assert, junit</technical_language>

Target:
private void testSize(final int size) { final CircularBuffer<Integer> instance = new CircularBuffer<Integer>(size); int i = 1; while (i < size) { i <<= 1; } assertEquals(i, instance.capacity()); instance.add(99); final int v = instance.poll(); assertEquals(99, v); assertNull(instance.peek()); }
Source:
<code>public void testCanStartAndStop() { log.info("test=canStartAndStop; entity="+entity+"; app="+entity.getApplication()); Entities.start(entity.getApplication(), ImmutableList.of(loc)); Asserts.succeedsEventually(MutableMap.of("timeout", 120*1000), new Runnable() { public void run() { assertTrue(entity.getAttribute(Startable.SERVICE_UP)); }}); entity.stop(); <START> assertFalse(entity.getAttribute(Startable.SERVICE_UP)); <END> }</code><technical_language>async assert switch a feed-based mechanism for detecting process stopped</technical_language>

Target:
public void testCanStartAndStop() { LOG.info("test=canStartAndStop; entity="+entity+"; app="+entity.getApplication()); Entities.start(entity.getApplication(), ImmutableList.of(loc)); Asserts.succeedsEventually(MutableMap.of("timeout", 120*1000), new Runnable() { public void run() { assertTrue(entity.getAttribute(Startable.SERVICE_UP)); }}); entity.stop(); assertFalse(entity.getAttribute(Startable.SERVICE_UP)); }
Source:
<code>public void testOne() throws Exception { final File fileToProcess = new File(getPath("SuppressionXpathRegressionInvalidJavaDocPositionOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(InvalidJavadocPositionCheck.class); final String[] expectedViolation = { "4:1: " + getCheckMessage(InvalidJavadocPositionCheck.class, <START> InvalidJavadocPositionCheck.MSG_KEY, "RuntimeException"), <END> }; final List<String> expectedXpathQueries = Collections.singletonList( "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionInvalidJavadocPositionOne']]" + "/MODIFIERS/BLOCK_COMMENT_BEGIN" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); }</code><technical_language>"RuntimeException" I guess this is leftover of copy-pasting other issue. Please correct below</technical_language>

Target:
public void testOne() throws Exception { final File fileToProcess = new File(getPath("SuppressionXpathRegressionInvalidJavadocPositionOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(InvalidJavadocPositionCheck.class); final String[] expectedViolation = { "4:1: " + getCheckMessage(InvalidJavadocPositionCheck.class, InvalidJavadocPositionCheck.MSG_KEY), }; final List<String> expectedXpathQueries = Collections.singletonList( "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionInvalidJavadocPositionOne']]" + "/MODIFIERS/BLOCK_COMMENT_BEGIN" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); }
Source:
<code>private int sshExec(Map<String,?> props, String command) { File tempCmdFile = writeTempFile(command); tempCmdFile.setExecutable(true); File tempKeyFile = null; try { List<String> cmd = Lists.newArrayList(); cmd.add(getOptionalVal(props, PROP_SSH_EXECUTABLE, sshExecutable)); String propsFlags = getOptionalVal(props, PROP_SSH_FLAGS, sshFlags); if (propsFlags!=null && propsFlags.trim().length()>0) cmd.addAll(Arrays.asList(propsFlags.trim().split(" "))); if (privateKeyFile != null) { cmd.add("-i"); cmd.add(privateKeyFile.getAbsolutePath()); } else if (privateKeyData != null) { tempKeyFile = writeTempFile(privateKeyData); cmd.add("-i"); cmd.add(tempKeyFile.getAbsolutePath()); } if (!strictHostKeyChecking) { cmd.add("-o"); cmd.add("StrictHostKeyChecking=no"); } if (port != 22) { cmd.add("-P"); cmd.add(""+port); } if (allocatePTY) { cmd.add("-tt"); } cmd.add((Strings.isEmpty(getUsername()) ? "" : getUsername()+"@")+getHostAddress()); <START> cmd.add(tempCmdFile.getAbsolutePath()); <END> if (LOG.isTraceEnabled()) LOG.trace("Executing ssh with command: (with {})", command, cmd); int result = execProcess(props, cmd); if (LOG.isTraceEnabled()) LOG.trace("Executed command: {}; exit code {}", cmd, result); return result; } finally { tempCmdFile.delete(); if (tempKeyFile != null) tempKeyFile.delete(); } }</code><technical_language>I this work localhost, tempCmdFile exists machine ssh'ing to. work ssh'ing a remote machine</technical_language>

Target:
private int sshExec(Map<String,?> props, String command) { File tempKeyFile = null; try { List<String> cmd = Lists.newArrayList(); cmd.add(getOptionalVal(props, PROP_SSH_EXECUTABLE, sshExecutable)); String propsFlags = getOptionalVal(props, PROP_SSH_FLAGS, sshFlags); if (propsFlags!=null && propsFlags.trim().length()>0) cmd.addAll(Arrays.asList(propsFlags.trim().split(" "))); if (privateKeyFile != null) { cmd.add("-i"); cmd.add(privateKeyFile.getAbsolutePath()); } else if (privateKeyData != null) { tempKeyFile = writeTempFile(privateKeyData); cmd.add("-i"); cmd.add(tempKeyFile.getAbsolutePath()); } if (!strictHostKeyChecking) { cmd.add("-o"); cmd.add("StrictHostKeyChecking=no"); } if (port != 22) { cmd.add("-P"); cmd.add(""+port); } if (allocatePTY) { cmd.add("-tt"); } cmd.add((Strings.isEmpty(getUsername()) ? "" : getUsername()+"@")+getHostAddress()); cmd.add("bash -c \""+command+"\""); if (LOG.isTraceEnabled()) LOG.trace("Executing ssh with command: (with {})", command, cmd); int result = execProcess(props, cmd); if (LOG.isTraceEnabled()) LOG.trace("Executed command: {}; exit code {}", cmd, result); return result; } finally { if (tempKeyFile != null) tempKeyFile.delete(); } }
Source:
<code>private void markOperationComplete(Long operationSequenceId) { Long heapSize = pendingOperationsWithSize.remove(operationSequenceId); if (heapSize != null) { currentWriteBufferSize -= heapSize; } else { <START> LOG.warn("An operation completion was recieved multiple times. Your operations completed." <END> + " Please notify Google that this occurred."); } }</code><technical_language>suggestion sounds good: "An operation reported complete multiple times. due a communication glitch a retry."</technical_language>

Target:
private void markOperationComplete(Long operationSequenceId) { Long heapSize = pendingOperationsWithSize.remove(operationSequenceId); if (heapSize != null) { currentWriteBufferSize -= heapSize; } else { LOG.warn("An operation was reported to be complete multiple times. It's likely due to a " + "communication glitch and a retry."); } }
Source:
<code>public static <V> Future<V> execute(FutureTask<V> command) { try { return (Future<V>) es.submit(command); } catch (RejectedExecutionException e) { <START> log.warn("The thread pool is out of limit. A submitted task was rejected"); <END> throw e; } }</code><technical_language>s/A submitted/The submitted/ s/task/event/ Also, is add some info here? event's type that</technical_language>

Target:
public static <V> Future<V> execute(FutureTask<V> command) { try { return (Future<V>) es.submit(command); } catch (RejectedExecutionException e) { log.warn("The thread pool is out of limit. The submitted event was rejected"); throw e; } }
Source:
<code>private void onSelectedHookSourceChanged() { EntityModel selectedItem = (EntityModel) getHookSources().getSelectedItem(); if (selectedItem == null) { return; } GlusterServerHook selectedServer = (GlusterServerHook) selectedItem.getEntity(); getServerHooksList().setSelectedItem(selectedServer); if (selectedServer.getStatus() == GlusterHookStatus.MISSING) { getContentModel().getContent().setEntity(null); getContentModel().getStatus().setEntity(null); getContentModel().getMd5Checksum().setEntity(null); return; } getContentModel().getStatus().setEntity(selectedServer.getStatus()); getContentModel().getMd5Checksum().setEntity(selectedServer.getChecksum()); if (selectedServer.getContentType() == GlusterHookContentType.TEXT) { startProgress(null); AsyncDataProvider.getGlusterHookContent(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { String content = (String) returnValue; getContentModel().getContent().setEntity(content); stopProgress(); } <START> }), getGlusterHookEntiry().getId(), selectedServer.getServerId()); <END> } }</code><technical_language>minor - consider refactoring getGlusterHookEntity()</technical_language>

Target:
private void onSelectedHookSourceChanged() { EntityModel selectedItem = (EntityModel) getHookSources().getSelectedItem(); if (selectedItem == null) { return; } GlusterServerHook selectedServer = (GlusterServerHook) selectedItem.getEntity(); getServerHooksList().setSelectedItem(selectedServer); if (selectedServer.getStatus() == GlusterHookStatus.MISSING) { getContentModel().getContent().setEntity(null); getContentModel().getStatus().setEntity(null); getContentModel().getMd5Checksum().setEntity(null); return; } getContentModel().getStatus().setEntity(selectedServer.getStatus()); getContentModel().getMd5Checksum().setEntity(selectedServer.getChecksum()); if (selectedServer.getContentType() == GlusterHookContentType.TEXT) { startProgress(null); AsyncDataProvider.getGlusterHookContent(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { String content = (String) returnValue; getContentModel().getContent().setEntity(content); stopProgress(); } }), getGlusterHookEntity().getId(), selectedServer.getServerId()); } }
Source:
<code>public void openProjectOnGitHubTest() { projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME); projectExplorer.waitContextMenu(); projectExplorer.clickOnItemInContextMenu( TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.OPEN_ON_GITHUB); seleniumWebDriverHelper.switchToNextWindow(seleniumWebDriver.getWindowHandle()); <START> Assert.assertTrue(seleniumWebDriver.getCurrentUrl().startsWith(testRepo.getHtmlUrl())); <END> }</code><technical_language>For increasing stability "wait" is "Assert": waitUrlStartsWith(testRepo.getHtmlUrl()); } private void waitUrlStartsWith(String expectedUrlPart){ seleniumWebDriverHelper.waitSuccessCondition(driver -> seleniumWebDriver.getCurrentUrl().startsWith(expectedUrlPart)); }</technical_language>

Target:
public void openProjectOnGitHubTest() { projectExplorer.waitAndSelectItem(PROJECT_NAME, 5); projectExplorer.openContextMenuByPathSelectedItem(PROJECT_NAME); projectExplorer.waitContextMenu(); projectExplorer.clickOnItemInContextMenu( TestProjectExplorerContextMenuConstants.ContextMenuFirstLevelItems.OPEN_ON_GITHUB); seleniumWebDriverHelper.switchToNextWindow(seleniumWebDriver.getWindowHandle()); seleniumWebDriverHelper.waitSuccessCondition(urlToBe(testRepo.getHtmlUrl() + "/tree/master/")); }
Source:
<code>public void testNestedRepeats() throws Exception{ List<String> subjects = createSuccessSubjects(); MockEventListener mockEventListener = new MockEventListener(MOCK_ID_1); registry.registerListener(mockEventListener,subjects); HttpPost request = new HttpPost(String.format("http://localhost:%d/odk/forms/%s/%s", TestContext.getJettyPort(), CONFIG_NAME, TITLE)); StringEntity entity = new StringEntity(getJson()); request.setEntity(entity); HttpResponse response = getHttpClient().execute(request); assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_OK); int count = 0; while(mockEventListener.getEvents().size() < EXPECTED_EVENTS_SUCCESS && count < WAIT_COUNT) { count++; getLogger().debug("Number of events: " + mockEventListener.getEvents().size()); if (count == WAIT_COUNT) { <START> getLogger().error("Timeout"); <END> fail(); } Thread.sleep(2000); } List<MotechEvent> events = mockEventListener.getEvents(); assertNotNull(events); assertEquals(events.size(), 7); }</code><technical_language>pass this message for fail()</technical_language>

Target:
public void testNestedRepeats() throws Exception { List<String> subjects = createSuccessSubjects(); MockEventListener mockEventListener = new MockEventListener(MOCK_ID_1); registry.registerListener(mockEventListener, subjects); HttpPost request = new HttpPost(String.format("http://localhost:%d/odk/forms/%s/%s", TestContext.getJettyPort(), CONFIG_NAME, TITLE)); StringEntity entity = new StringEntity(getJson()); request.setEntity(entity); HttpResponse response = getHttpClient().execute(request); assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_OK); int count = 0; while (mockEventListener.getEvents().size() < EXPECTED_EVENTS_SUCCESS && count < WAIT_COUNT) { count++; getLogger().debug("Number of events: " + mockEventListener.getEvents().size()); if (count == WAIT_COUNT) { fail(TIMEOUT); } Thread.sleep(2000); } List<MotechEvent> events = mockEventListener.getEvents(); assertNotNull(events); assertEquals(events.size(), 7); }
Source:
<code>public void testForbiddenEnsembleChange() throws Exception { try (WriteHandle wh = result(newCreateLedgerOp() .withEnsembleSize(1) .withWriteQuorumSize(1) .withAckQuorumSize(1) .withPassword(PASSWORD) .withWriteFlags(WriteFlag.DEFERRED_SYNC) .execute())) { for (int i = 0; i < NUM_ENTRIES - 1; i++) { wh.append(DATA.retainedDuplicate()); } assertEquals(1, availableBookies.size()); killBookie(wh.getLedgerMetadata().getEnsembleAt(wh.getLastAddPushed()).get(0)); assertEquals(0, availableBookies.size()); startNewBookie(); assertEquals(1, availableBookies.size()); try { wh.append(DATA.retainedDuplicate()); fail("since ensemble change is disable we cannot be able to write any more"); } catch (BKException.BKWriteException ex) { } LedgerHandle lh = (LedgerHandle) wh; <START> assertTrue(lh.delayedWriteFailedBookies.isEmpty()); <END> } }</code><technical_language>reason getDelayedWriteFailedBookies() removed? method is generally direct variable access for testing</technical_language>

Target:
public void testForbiddenEnsembleChange() throws Exception { try (WriteHandle wh = result(newCreateLedgerOp() .withEnsembleSize(1) .withWriteQuorumSize(1) .withAckQuorumSize(1) .withPassword(PASSWORD) .withWriteFlags(WriteFlag.DEFERRED_SYNC) .execute())) { for (int i = 0; i < NUM_ENTRIES - 1; i++) { wh.append(DATA.retainedDuplicate()); } assertEquals(1, availableBookies.size()); killBookie(wh.getLedgerMetadata().getEnsembleAt(wh.getLastAddPushed()).get(0)); assertEquals(0, availableBookies.size()); startNewBookie(); assertEquals(1, availableBookies.size()); try { wh.append(DATA.retainedDuplicate()); fail("since ensemble change is disable we cannot be able to write any more"); } catch (BKException.BKWriteException ex) { } LedgerHandle lh = (LedgerHandle) wh; assertFalse(lh.hasDelayedWriteFailedBookies()); } }
Source:
<code>public String getCompartmentName() { Stereotype stereotype = UMLUtil.getStereotype(resolveSemanticElement()); if (stereotype != null) { return (StereotypeDisplayUtils.BRACE_LEFT + stereotype.getName() + StereotypeDisplayUtils.BRACE_RIGHT); } <START> return "Bad compartement stereotype"; <END> }</code><technical_language>a constant</technical_language>

Target:
public String getCompartmentName() { Stereotype stereotype = UMLUtil.getStereotype(resolveSemanticElement()); if (stereotype != null) { return (StereotypeDisplayUtils.BRACE_LEFT + stereotype.getName() + StereotypeDisplayUtils.BRACE_RIGHT); } return NO_STEREOTYPE_COMPARTMENT; }
Source:
<code>protected void run() { for (;;) { try { int strategy = selectStrategy.calculateStrategy(selectNowSupplier, hasTasks()); switch (strategy) { case SelectStrategy.CONTINUE: continue; case SelectStrategy.BUSY_WAIT: strategy = epollBusyWait(); break; case SelectStrategy.SELECT: if (wakenUp == 1) { wakenUp = 0; } <START> if (hasTasks()) { <END> break; } strategy = epollWait(); default: } final int ioRatio = this.ioRatio; if (ioRatio == 100) { try { if (strategy > 0) { processReady(events, strategy); } } finally { runAllTasks(); } } else { final long ioStartTime = System.nanoTime(); try { if (strategy > 0) { processReady(events, strategy); } } finally { final long ioTime = System.nanoTime() - ioStartTime; runAllTasks(ioTime * (100 - ioRatio) / ioRatio); } } if (allowGrowing && strategy == events.length()) { events.increase(); } } catch (Throwable t) { handleLoopException(t); } try { if (isShuttingDown()) { closeAll(); if (confirmShutdown()) { break; } } } catch (Throwable t) { handleLoopException(t); } } }</code><technical_language>slightly simpler java if (!hasTasks()) { strategy = epollWait(); } // fallthrough</technical_language>

Target:
protected void run() { for (;;) { try { int strategy = selectStrategy.calculateStrategy(selectNowSupplier, hasTasks()); switch (strategy) { case SelectStrategy.CONTINUE: continue; case SelectStrategy.BUSY_WAIT: strategy = epollBusyWait(); break; case SelectStrategy.SELECT: if (wakenUp == 1) { wakenUp = 0; } if (!hasTasks()) { strategy = epollWait(); } default: } final int ioRatio = this.ioRatio; if (ioRatio == 100) { try { if (strategy > 0) { processReady(events, strategy); } } finally { runAllTasks(); } } else { final long ioStartTime = System.nanoTime(); try { if (strategy > 0) { processReady(events, strategy); } } finally { final long ioTime = System.nanoTime() - ioStartTime; runAllTasks(ioTime * (100 - ioRatio) / ioRatio); } } if (allowGrowing && strategy == events.length()) { events.increase(); } } catch (Throwable t) { handleLoopException(t); } try { if (isShuttingDown()) { closeAll(); if (confirmShutdown()) { break; } } } catch (Throwable t) { handleLoopException(t); } } }
Source:
<code>public void setWrapper(Wrapper wrapper) { if (tomcatContainer == null) { synchronized (lock) { if (tomcatContainer == null) { String serverInfo = ServerInfo.getServerInfo(); logger.info("Server info: " + serverInfo); for (String className : adapterClasses) { try { Object obj = Class.forName(className).newInstance(); logger.debug("Testing container adapter: " + className); if (obj instanceof TomcatContainer) { if (forceFirstAdapter || ((TomcatContainer) obj).canBoundTo(serverInfo)) { logger.info("Using " + className); tomcatContainer = (TomcatContainer) obj; tomcatContainer.setWrapper(wrapper); break; } logger.debug("Cannot bind " + className + " to " + serverInfo); } else { logger.error(className + " does not implement " + TomcatContainer.class.getName()); } } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Failed to load " + className, e); } else { logger.info("Failed to load " + className); } } } if (tomcatContainer == null) { logger.error("No suitable container adapter found!"); } } } } try { if (tomcatContainer != null && wrapper == null) { logger.info("Unregistering container adapter"); tomcatContainer.setWrapper(null); } <START> } catch (ThreadDeath e) { <END> throw e; } catch (Exception e) { logger.error("Could not unregister container adapter", e); } }</code><technical_language>catch (ThreadDeath) is necessary if catch (Throwable). ThreadDeath extends Error, caught catch (Exception). remove catch (ThreadDeath) entirely, cleaner. instances of this this PR. I note noisy</technical_language>

Target:
public void setWrapper(Wrapper wrapper) { if (tomcatContainer == null) { synchronized (lock) { if (tomcatContainer == null) { String serverInfo = ServerInfo.getServerInfo(); logger.info("Server info: " + serverInfo); for (String className : adapterClasses) { try { Object obj = Class.forName(className).newInstance(); logger.debug("Testing container adapter: " + className); if (obj instanceof TomcatContainer) { if (forceFirstAdapter || ((TomcatContainer) obj).canBoundTo(serverInfo)) { logger.info("Using " + className); tomcatContainer = (TomcatContainer) obj; tomcatContainer.setWrapper(wrapper); break; } logger.debug("Cannot bind " + className + " to " + serverInfo); } else { logger.error(className + " does not implement " + TomcatContainer.class.getName()); } } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Failed to load " + className, e); } else { logger.info("Failed to load " + className); } } } if (tomcatContainer == null) { logger.error("No suitable container adapter found!"); } } } } try { if (tomcatContainer != null && wrapper == null) { logger.info("Unregistering container adapter"); tomcatContainer.setWrapper(null); } } catch (Exception e) { logger.error("Could not unregister container adapter", e); } }
Source:
<code>public Observable<InstanceInfo> forSnapshot(final Interest<InstanceInfo> interest) { return transportClient.connect() .flatMap(new Func1<MessageConnection, Observable<InstanceInfo>>() { @Override public Observable<InstanceInfo> call(final MessageConnection connection) { return connection .submitWithAck(new SnapshotRegistration(interest)) .cast(Object.class) .concatWith(connection.incoming()) .takeWhile(END_OF_STREAM_FILTER) .filter(INVALID_MESSAGE_FILTER) <START> .doOnNext(new Action1<Object>() { <END> @Override public void call(Object message) { connection.acknowledge().subscribe(); } }) .map(new Func1<Object, InstanceInfo>() { @Override public InstanceInfo call(Object message) { return ((AddInstance) message).getInstanceInfo(); } }) .doOnError(new Action1<Throwable>() { @Override public void call(Throwable error) { logger.error("Snapshot subscription error", error); } }) .doOnTerminate(new Action0() { @Override public void call() { connection.shutdown(); } }); } }); }</code><technical_language>merged doOnNext() map()</technical_language>

Target:
public Observable<InstanceInfo> forSnapshot(final Interest<InstanceInfo> interest) { return transportClient.connect() .flatMap(new Func1<MessageConnection, Observable<InstanceInfo>>() { @Override public Observable<InstanceInfo> call(final MessageConnection connection) { return connection .submitWithAck(new SnapshotRegistration(interest)) .cast(Object.class) .concatWith(connection.incoming()) .takeWhile(END_OF_STREAM_FILTER) .filter(INVALID_MESSAGE_FILTER) .doOnNext(new Action1<Object>() { @Override public void call(Object message) { connection.acknowledge().doOnError(new Action1<Throwable>() { @Override public void call(Throwable e) { logger.error("Failed to send an acknowledgment to snapshot change notification message", e); } }).subscribe(); } }) .map(new Func1<Object, InstanceInfo>() { @Override public InstanceInfo call(Object message) { return ((AddInstance) message).getInstanceInfo(); } }) .doOnError(new Action1<Throwable>() { @Override public void call(Throwable error) { logger.error("Snapshot subscription error", error); } }) .doOnTerminate(new Action0() { @Override public void call() { connection.shutdown(); } }); } }); }
Source:
<code>public void setup(OperatorContext context) { shutdown = false; logger.debug("Operator Context = {}", context); if (!redeploy) { <START> operator.setup(context); <END> } }</code><technical_language>is a new behaviour, this exposed a new method in operator interface? This allows identify operators of this feature</technical_language>

Target:
public void setup(OperatorContext context) { shutdown = false; if (!reuseOperator) { logger.debug("Operator Context = {}", context); operator.setup(context); } }
Source:
<code><START> protected void computeRequiredDifferencesToReject() { <END> for (Diff difftoMerge : selectedDifferences) { MergeOperation mergeAction = this.mergeMode.getMergeAction(difftoMerge, this.leftEditable, this.rightEditable); if (mergeAction == MergeOperation.MERGE) { IMerger merger = mergerRegistry.getHighestRankingMerger(difftoMerge); if (merger instanceof IMerger2) { addAll(differencesToMerge, ((IMerger2)merger).getDirectResultingRejections(difftoMerge, !leftToRight)); } } } if (cascadingDifferencesFilterEnabled) { Set<Diff> setToReject = Sets.newHashSet(differencesToMerge); Iterable<Diff> cascadingDifferences = concat(transform(setToReject, ComparisonUtil .getSubDiffs(leftToRight))); addAll(differencesToMerge, cascadingDifferences); } }</code><technical_language>giving more thought, I thin responsibility is here. I CompareCopyCommand created passed context information needed merger perform job. I this reprensents a heavier rework more healthy in terms of maintainability robustness. study more in details impacts of a decision decide do</technical_language>

Target:
protected void computeRequiredDifferencesToReject() { for (Diff difftoMerge : selectedDifferences) { MergeOperation mergeAction = this.selectedMode.getMergeAction(difftoMerge, this.leftEditable, this.rightEditable); if (mergeAction == MergeOperation.MERGE) { IMerger merger = mergerRegistry.getHighestRankingMerger(difftoMerge); if (merger instanceof IMerger2) { addAll(differencesToMerge, ((IMerger2)merger).getDirectResultingRejections(difftoMerge, !leftToRight)); } } } if (cascadingDifferencesFilterEnabled) { Set<Diff> setToReject = Sets.newHashSet(differencesToMerge); Iterable<Diff> cascadingDifferences = concat(transform(setToReject, ComparisonUtil .getSubDiffs(leftToRight))); addAll(differencesToMerge, cascadingDifferences); } }
Source:
<code>public Object aroundInvoke(final InvocationContext invocationContext) throws Exception { <START> log.debug("serverInterceptor aroundInvoke "); <END> return invocationContext.proceed(); }</code><technical_language>need check interceptor executed</technical_language>

Target:
public Object aroundInvoke(final InvocationContext invocationContext) throws Exception { try { return invocationContext.proceed(); } finally { latch.countDown(); } }
Source:
<code>public void start(ComponentContext context) { super.start(context); if (Framework.isBooleanPropertyTrue(CLUSTERING_ENABLED_PROP)) { String nodeId = Framework.getProperty(NODE_ID_PROP); if (StringUtils.isBlank(nodeId)) { nodeId = String.valueOf(RANDOM.nextLong()); log.warn("Missing cluster node id configuration, please define it explicitly " + "(usually through repository.clustering.id). Using random cluster node id instead: " <START> + nodeId); <END> } else { nodeId = nodeId.trim(); } invalidator = new CachePubSubInvalidator(); invalidator.initialize(CACHE_INVAL_PUBSUB_TOPIC, nodeId); log.info("Registered cache invalidator for node: {}", nodeId); } else { log.info("Not registering a cache invalidator because clustering is not enabled"); } Collection<CacheDescriptor> descriptors = getDescriptors(XP_CACHES); descriptors.forEach(this::startCacheDescriptor); }</code><technical_language>%s for nodeId if want advantage of log4j2</technical_language>

Target:
public void start(ComponentContext context) { super.start(context); if (Framework.isBooleanPropertyTrue(CLUSTERING_ENABLED_PROP)) { String nodeId = Framework.getProperty(NODE_ID_PROP); if (StringUtils.isBlank(nodeId)) { nodeId = String.valueOf(RANDOM.nextLong()); log.warn("Missing cluster node id configuration, please define it explicitly " + "(usually through repository.clustering.id). Using random cluster node id instead: {}", nodeId); } else { nodeId = nodeId.trim(); } invalidator = new CachePubSubInvalidator(); invalidator.initialize(CACHE_INVAL_PUBSUB_TOPIC, nodeId); log.info("Registered cache invalidator for node: {}", nodeId); } else { log.info("Not registering a cache invalidator because clustering is not enabled"); } Collection<CacheDescriptor> descriptors = getDescriptors(XP_CACHES); descriptors.forEach(this::startCacheDescriptor); }
Source:
<code><START> private JoinNode.EquiJoinClause equiJoinClause(Symbol symbol1, Symbol symbol2) <END> { return new JoinNode.EquiJoinClause(symbol1, symbol2); }</code><technical_language>Import EquiJoinClause</technical_language>

Target:
private EquiJoinClause equiJoinClause(Symbol symbol1, Symbol symbol2) { return new EquiJoinClause(symbol1, symbol2); }
Source:
<code>private IBinding resolveBindingPromiscuous() { if (fBinding != null && !(fBinding instanceof IProblemBinding)) { return fBinding; } setBinding(null); IBinding result = resolveBindingNormal(); if (!(result instanceof IProblemBinding)) { <START> setBinding(null); <END> } return result; }</code><technical_language>This early clearing binding resolved times resolving other names. Instead of storing promiscuously resolved binding in name store in a new field of ProblemBinding. This need re-resolve turning promiscuous resolution turning again</technical_language>

Target:
private IBinding resolveBindingPromiscuous() { if (fBinding == null) { try { CPPSemantics.disablePromiscuousBindingResolution(); resolveBindingNormal(); } finally { CPPSemantics.enablePromiscuousBindingResolution(); } } if (!(fBinding instanceof ProblemBinding)) { return fBinding; } ProblemBinding problem = (ProblemBinding) fBinding; if (problem.getPromiscuousBinding() == null) { IBinding promiscuous = resolveBindingNormal(); problem.setPromiscuousBinding(promiscuous); fBinding = problem; } return problem.getPromiscuousBinding(); }
Source:
<code>public static String normalizeSpace(final String str) { if (isEmpty(str)) { return str; } <START> if (isBlank(str)){ <END> return EMPTY; } final int size = str.length(); final char[] newChars = new char[size]; int count = 0; int whitespacesCount = 0; for (int i = 0; i < size; i++) { char actualChar = str.charAt(i); boolean isWhitespace = Character.isWhitespace(actualChar) || actualChar == '\u00A0'; if (!isWhitespace) { newChars[count++] = actualChar; whitespacesCount = 0; } else { if (whitespacesCount == 0) { newChars[count++] = SPACE.charAt(0); } whitespacesCount++; } } return new String(newChars, 0, count).trim(); }</code><technical_language>Noting this means isEmpty is unnecessary</technical_language>

Target:
public static String normalizeSpace(final String str) { if (isEmpty(str)) { return str; } final int size = str.length(); final char[] newChars = new char[size]; int count = 0; int whitespacesCount = 0; boolean startWhitespaces = true; for (int i = 0; i < size; i++) { char actualChar = str.charAt(i); boolean isWhitespace = Character.isWhitespace(actualChar); if (!isWhitespace) { startWhitespaces = false; newChars[count++] = (actualChar == 160 ? 32 : actualChar); whitespacesCount = 0; } else { if (whitespacesCount == 0 && !startWhitespaces) { newChars[count++] = SPACE.charAt(0); } whitespacesCount++; } } if (startWhitespaces) { return EMPTY; } return new String(newChars, 0, count - (whitespacesCount > 0 ? 1 : 0)).trim(); }
Source:
<code>public AnalysisCache getAnalysisCache() { if (analysisCache == null || isIgnoreIncrementalAnalysis() && isAnalysisCacheFunctional()) { <START> setAnalysisCache(null); <END> } return analysisCache; }</code><technical_language>passing null a lousy hack avoid double logging of warning (as in constructor). this chance initialize analysisCache right definition skip this logic in getter altogether</technical_language>

Target:
public AnalysisCache getAnalysisCache() { if (analysisCache == null || isIgnoreIncrementalAnalysis() && !(analysisCache instanceof NoopAnalysisCache)) { setAnalysisCache(new NoopAnalysisCache()); } return analysisCache; }
Source:
<code>MnsService(MapClientService context) { if (VDBG) { Log.v(TAG, "MnsService()"); } sContext = context; sAcceptThread = new SocketAcceptor(); <START> sServerSockets = ObexServerSockets.create(sAcceptThread); if (sServerSockets == null) { Log.e(TAG, "ObexServerSockets is null"); return; } <END> SdpManager sdpManager = SdpManager.getDefaultManager(); if (sdpManager == null) { Log.e(TAG, "SdpManager is null"); return; } mSdpHandle = sdpManager.createMapMnsRecord("MAP Message Notification Service", sServerSockets.getRfcommChannel(), -1, MNS_VERSION, MasClient.MAP_SUPPORTED_FEATURES); }</code><technical_language>sServerSockets is null, fail create socket acceptor, meaning MAP client work text messages synced car. Is this want? I feel null check is masking another error ObexServerSockets.create()</technical_language>

Target:
MnsService(MapClientService context) { if (VDBG) { Log.v(TAG, "MnsService()"); } sContext = context; sAcceptThread = new SocketAcceptor(); sServerSockets = Objects.requireNonNull(ObexServerSockets.create(sAcceptThread), "Cannot create OBEX server socket for MAP profile"); SdpManager sdpManager = SdpManager.getDefaultManager(); if (sdpManager == null) { Log.e(TAG, "SdpManager is null"); return; } mSdpHandle = sdpManager.createMapMnsRecord("MAP Message Notification Service", sServerSockets.getRfcommChannel(), -1, MNS_VERSION, MasClient.MAP_SUPPORTED_FEATURES); }
Source:
<code>public Future<Boolean> addBagItem() { FutureTask<Boolean> future = new FutureTask<>(new Runnable() { @Override public void run() { long sleepBackoff = 200L; final int minimumIdle = config.getMinimumIdle(); final int maxPoolSize = config.getMaximumPoolSize(); while (poolState == POOL_NORMAL && totalConnections.get() < maxPoolSize && getIdleConnections() <= minimumIdle && !addConnection()) { quietlySleep(sleepBackoff); <START> sleepBackoff = Math.min((long) (connectionTimeout / 2), (long) (sleepBackoff * 1.5)); <END> } } }, true); addConnectionExecutor.execute(future); return future; }</code><technical_language>calling Math.min(long, long)</technical_language>

Target:
public Future<Boolean> addBagItem() { FutureTask<Boolean> future = new FutureTask<>(new Runnable() { @Override public void run() { long sleepBackoff = 200L; final int minimumIdle = config.getMinimumIdle(); final int maxPoolSize = config.getMaximumPoolSize(); while (poolState == POOL_NORMAL && totalConnections.get() < maxPoolSize && getIdleConnections() <= minimumIdle && !addConnection()) { quietlySleep(sleepBackoff); sleepBackoff = Math.min(connectionTimeout / 2, (long) (sleepBackoff * 1.5)); } } }, true); addConnectionExecutor.execute(future); return future; }
Source:
<code>private List<GenericArtifact> readArtifactList(ObjectMapper mapper, String hydratedTemplate) { try { return mapper.readValue(hydratedTemplate, artifactListReference); } catch (IOException ioe) { <START> log.error(ioe.getMessage()); <END> return null; } }</code><technical_language>this a good time fail</technical_language>

Target:
private List<GenericArtifact> readArtifactList(ObjectMapper mapper, String hydratedTemplate) { try { return mapper.readValue(hydratedTemplate, artifactListReference); } catch (IOException ioe) { throw new RuntimeException(ioe); } }
Source:
<code>public MojoParameter getContainer(String[] path) { <START> if(path == null || path.length == 0) <END> return this; MojoParameter param = this; int i = 0; while(param != null && i < path.length) { param = param.getNestedParameter(path[i]); i++ ; } if(param == null) return null; return param; }</code><technical_language>trivial, single statements</technical_language>

Target:
public MojoParameter getContainer(String[] path) { if(path == null || path.length == 0) { return this; } MojoParameter param = this; int i = 0; while(param != null && i < path.length) { param = param.getNestedParameter(path[i]); i++ ; } if(param == null) { return null; } return param; }
Source:
<code>public void testPutsSucceedWhileTopologyChanges() throws Exception { RemoteCache<Integer, String> remote = client(0).getCache(); remote.put(1, "v1"); assertEquals("v1", remote.get(1)); PutHammer putHammer = new PutHammer(); Future<Void> putHammerFuture = fork(putHammer); EmbeddedCacheManager cm = TestCacheManagerFactory.createClusteredCacheManager(getCacheConfiguration()); registerCacheManager(cm); <START> HotRodServer newServer = HotRodClientTestingUtil.startHotRodServer(cm); <END> waitForClusterToForm(); TestingUtil.waitForRehashToComplete(cm.getCache(), cache(0)); TestingUtil.sleepThread(2000); HotRodClientTestingUtil.killServers(newServer); TestingUtil.killCacheManagers(cm); TestingUtil.waitForRehashToComplete(cache(0)); remote.put(-1, "minus one"); RoundRobinBalancingStrategy strategy = getLoadBalancer(client(0)); SocketAddress[] servers = strategy.getServers(); putHammer.stop = true; putHammerFuture.get(); assertEquals(1, servers.length); }</code><technical_language>(try finally)</technical_language>

Target:
public void testPutsSucceedWhileTopologyChanges() throws Exception { RemoteCache<Integer, String> remote = client(0).getCache(); remote.put(1, "v1"); assertEquals("v1", remote.get(1)); PutHammer putHammer = new PutHammer(); Future<Void> putHammerFuture = fork(putHammer); HotRodServer newServer = addHotRodServer(getCacheConfiguration()); TestingUtil.sleepThread(2000); HotRodClientTestingUtil.killServers(newServer); TestingUtil.killCacheManagers(newServer.getCacheManager()); TestingUtil.waitForRehashToComplete(cache(0)); remote.put(-1, "minus one"); RoundRobinBalancingStrategy strategy = getLoadBalancer(client(0)); SocketAddress[] servers = strategy.getServers(); putHammer.stop = true; putHammerFuture.get(); assertEquals(1, servers.length); }