auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Object decode(Response response, Type type) throws IOException, FeignException { Collection<String> contentTypes = HeaderAccessUtils.caseInsensitiveGet(response.headers(), HttpHeaders.CONTENT_TYPE); if (contentTypes == null) { contentTypes = ImmutableSet.of(); } <START> if (contentTypes.size() == 1 && Iterables.getOnlyElement(contentTypes, "").contains(MediaType.TEXT_PLAIN)) { <END> return stringDecoder.decode(response, type); } return delegate.decode(response, type); }</code><technical_language>this startsWith</technical_language>

Target:
public Object decode(Response response, Type type) throws IOException, FeignException { Collection<String> contentTypes = HeaderAccessUtils.caseInsensitiveGet(response.headers(), HttpHeaders.CONTENT_TYPE); if (contentTypes == null) { contentTypes = ImmutableSet.of(); } if (contentTypes.size() == 1 && Iterables.getOnlyElement(contentTypes, "").startsWith(MediaType.TEXT_PLAIN)) { return stringDecoder.decode(response, type); } return delegate.decode(response, type); }
Source:
<code>public static KeySource file(String fileName, KeySource defaultKeySource) { return () -> { final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try (final InputStream resource = classLoader.getResourceAsStream(fileName)) { if (resource == null) { <START> final byte[] key = defaultKeySource.getKey(); <END> try (FileOutputStream fos = new FileOutputStream(fileName)) { fos.write(key); fos.flush(); } return key; } else { return IOUtils.toByteArray(resource); } } }; }</code><technical_language>null check for defaultKeysource</technical_language>

Target:
public static KeySource file(String fileName, KeySource defaultKeySource) { if (defaultKeySource == null) { throw new IllegalArgumentException("Default key source cannot be null."); } return () -> { final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try (final InputStream resource = classLoader.getResourceAsStream(fileName)) { if (resource == null) { final byte[] key = defaultKeySource.getKey(); try (FileOutputStream fos = new FileOutputStream(fileName)) { fos.write(key); fos.flush(); } return key; } else { return IOUtils.toByteArray(resource); } } }; }
Source:
<code>public void testParagraph() { builder.beginDocument(); builder.beginBlock(BlockType.PARAGRAPH, new Attributes()); <START> builder.characters("A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines."); <END> builder.endBlock(); builder.endDocument(); String markup = out.toString(); TestUtil.println(markup); assertEquals( "A paragraph is simply one or more consecutive lines of text, separated by one or more blank lines.\n\n", markup); }</code><technical_language>this text a copyright infringement</technical_language>

Target:
public void testParagraph() { builder.beginDocument(); builder.beginBlock(BlockType.PARAGRAPH, new Attributes()); builder.characters("A paragraph ends when a blank line begins!"); builder.endBlock(); builder.endDocument(); assertMarkup("A paragraph ends when a blank line begins!\n\n"); }
Source:
<code><START> public void testCodeActionsQuickAssist() throws CoreException { <END> MockLanguageServer.reset(); IProject p = TestUtils.createProject(getClass().getSimpleName() + System.currentTimeMillis()); IFile f = TestUtils.createUniqueTestFile(p, "error"); TextEdit tEdit = new TextEdit(new Range(new Position(0, 0), new Position(0, 5)), "fixed"); WorkspaceEdit wEdit = new WorkspaceEdit(Collections.singletonMap(f.getLocationURI().toString(), Collections.singletonList(tEdit))); MockLanguageServer.INSTANCE.setCodeActions(Collections .singletonList(Either.forLeft(new Command( "fixme", "edit", Collections.singletonList(wEdit)) ) )); AbstractTextEditor editor = (AbstractTextEditor)TestUtils.openEditor(f); final Set<Shell> beforeShells = Arrays.stream(editor.getSite().getShell().getDisplay().getShells()).filter(Shell::isVisible).collect(Collectors.toSet()); editor.selectAndReveal(3, 0); TextOperationAction action = (TextOperationAction) editor.getAction(ITextEditorActionConstants.QUICK_ASSIST); action.update(); action.run(); this.completionShell= findNewShell(beforeShells, editor.getSite().getShell().getDisplay()); final Table completionProposalList = findCompletionSelectionControl(completionShell); checkCompletionContent(completionProposalList); editor.close(false); p.delete(true, new NullProgressMonitor()); }</code><technical_language>This is a good test, big coverage</technical_language>

Target:
public void testCodeActionsQuickAssist() throws CoreException { MockLanguageServer.reset(); IProject p = TestUtils.createProject(getClass().getSimpleName() + System.currentTimeMillis()); IFile f = TestUtils.createUniqueTestFile(p, "error"); TextEdit tEdit = new TextEdit(new Range(new Position(0, 0), new Position(0, 5)), "fixed"); WorkspaceEdit wEdit = new WorkspaceEdit(Collections.singletonMap(f.getLocationURI().toString(), Collections.singletonList(tEdit))); MockLanguageServer.INSTANCE.setCodeActions(Collections .singletonList(Either.forLeft(new Command( "fixme", "edit", Collections.singletonList(wEdit)) ) )); AbstractTextEditor editor = (AbstractTextEditor)TestUtils.openEditor(f); final Set<Shell> beforeShells = Arrays.stream(editor.getSite().getShell().getDisplay().getShells()).filter(Shell::isVisible).collect(Collectors.toSet()); editor.selectAndReveal(3, 0); TextOperationAction action = (TextOperationAction) editor.getAction(ITextEditorActionConstants.QUICK_ASSIST); action.update(); action.run(); this.completionShell= TestUtils.findNewShell(beforeShells, editor.getSite().getShell().getDisplay()); final Table completionProposalList = TestUtils.findCompletionSelectionControl(completionShell); checkCompletionContent(completionProposalList); editor.close(false); p.delete(true, new NullProgressMonitor()); }
Source:
<code><START> public void accept(final Socket socket) throws IOException { <END> if (this.latencyExceeded()) { Thread.currentThread().interrupt(); } else { this.origin.accept(socket); } }</code><technical_language>@eg04lt3r logic correct - understanding of issue is some active monitoring of call accept. this means a new thread created BkTimeable looping waking in a while check a list of threads called accept stopping if time is up</technical_language>

Target:
public void accept(final Socket socket) throws IOException { final Thread thread = Thread.currentThread(); this.executor.schedule( new Runnable() { @Override public void run() { thread.interrupt(); } }, this.latency, TimeUnit.MILLISECONDS ); this.origin.accept(socket); }
Source:
<code>public String get(String pluginKey) { if (!cache.containsKey(pluginKey)) { String value = downloadFromGithub(pluginKey); <START> cache.put(pluginKey, value); <END> } return cache.get(pluginKey); }</code><technical_language>this change</technical_language>

Target:
public String get(String pluginKey) { if (!cache.containsKey(pluginKey)) { cache.put(pluginKey, downloadFromGithub(pluginKey)); } return cache.get(pluginKey); }
Source:
<code><START> private Timer createTimer() { <END> return new Timer((int) REFRESH_RATE.toMillis(), (ae) -> EventQueue.invokeLater(() -> { if (! backend.isConnected()) { activeStateValueLabel.setText(OFFLINE); if (backend.getSettings().isDisplayStateColor()) { activeStatePanel.setBackground(Color.BLACK); } } GcodeState state = backend.getGcodeState(); if (state == null) { gStatesLabel.setText("--"); } else { StringBuilder sb = new StringBuilder(); sb.append(state.currentMotionMode).append(" "); sb.append(state.units).append(" "); sb.append(state.feedMode).append(" "); sb.append(state.distanceMode).append(" "); sb.append(state.offset).append(" "); sb.append(state.plane.code).append(" "); trimLastSpace(sb); gStatesLabel.setText(sb.toString()); } })); }</code><technical_language>ControllerListener is deprecated get events, ControllerStatusListener is new version get it. switch this method for performance reasons</technical_language>

Target:
private Timer createTimer() { return new Timer((int) REFRESH_RATE.toMillis(), (ae) -> EventQueue.invokeLater(() -> { if (! backend.isConnected()) { activeStateValueLabel.setText(OFFLINE); if (backend.getSettings().isDisplayStateColor()) { activeStatePanel.setBackground(Color.BLACK); } } GcodeState state = backend.getGcodeState(); if (state == null) { gStatesLabel.setText("--"); } else { gStatesLabel.setText( String.join(" ", state.currentMotionMode.toString(), state.units.toString(), state.feedMode.toString(), state.distanceMode.toString(), state.offset.toString(), state.plane.code.toString())); } })); }
Source:
<code>protected String getLocaleStringFromReferer(final HttpServletRequest request) { final URI refererURL; String result = null; try { String referer = request.getHeader(REFERER); <START> if (null != referer) { <END> refererURL = new URI(referer); String query = refererURL.getQuery(); if (null != query) { String[] parameters = query.split("&"); for (int i = 0; i < parameters.length; i++) { String[] keyValues = parameters[i].split("="); if (LOCALE.equalsIgnoreCase(keyValues[0])) { result = keyValues[1]; break; } } } } } catch (URISyntaxException e) { log.error("Unable to determine referer URI", e); } return result; }</code><technical_language>Please "something <operator> null" convention</technical_language>

Target:
protected String getLocaleStringFromReferer(final HttpServletRequest request) { final URI refererURL; String result = null; try { String referer = request.getHeader(REFERER); if (null != referer) { refererURL = new URI(referer); String query = refererURL.getQuery(); if (query != query) { String[] parameters = query.split("&"); for (int i = 0; i < parameters.length; i++) { String[] keyValues = parameters[i].split("="); if (LOCALE.equalsIgnoreCase(keyValues[0])) { result = keyValues[1]; break; } } } } } catch (URISyntaxException e) { log.error("Unable to determine referer URI", e); } return result; }
Source:
<code>public void testSnapshots() throws Exception { TestTransaction tx = new TestTransaction(env); tx.set("bob", BALANCE, "10"); tx.set("joe", BALANCE, "20"); tx.set("jill", BALANCE, "60"); tx.set("jane", BALANCE, "0"); tx.done(); TestTransaction tx1 = new TestTransaction(env); TestTransaction tx2 = new TestTransaction(env); <START> tx2.set("bob", BALANCE, "5"); <END> tx2.set("joe", BALANCE, "15"); tx2.set("jill", BALANCE, "70"); Assert.assertEquals("10", tx1.gets("bob", BALANCE)); tx2.done(); TestTransaction txd = new TestTransaction(env); txd.delete("jane", BALANCE); txd.done(); Assert.assertEquals("20", tx1.gets("joe", BALANCE)); Assert.assertEquals("60", tx1.gets("jill", BALANCE)); Assert.assertEquals("0", tx1.gets("jane", BALANCE)); tx1.set("bob", BALANCE, "5"); tx1.set("joe", BALANCE, "25"); assertCommitFails(tx1); TestTransaction tx3 = new TestTransaction(env); TestTransaction tx4 = new TestTransaction(env); tx4.set("jane", BALANCE, "3"); tx4.done(); Assert.assertEquals("5", tx3.gets("bob", BALANCE)); Assert.assertEquals("15", tx3.gets("joe", BALANCE)); Assert.assertEquals("70", tx3.gets("jill", BALANCE)); Assert.assertNull(tx3.gets("jane", BALANCE)); tx3.done(); TestTransaction tx5 = new TestTransaction(env); Assert.assertEquals("5", tx5.gets("bob", BALANCE)); Assert.assertEquals("15", tx5.gets("joe", BALANCE)); Assert.assertEquals("70", tx5.gets("jill", BALANCE)); Assert.assertEquals("3", tx5.gets("jane", BALANCE)); tx5.done(); }</code><technical_language>incr util</technical_language>

Target:
public void testSnapshots() throws Exception { TestTransaction tx = new TestTransaction(env); tx.set("bob", BALANCE, "10"); tx.set("joe", BALANCE, "20"); tx.set("jill", BALANCE, "60"); tx.set("jane", BALANCE, "0"); tx.done(); TestTransaction tx1 = new TestTransaction(env); TestTransaction tx2 = new TestTransaction(env); TestUtil.increment(tx2, "bob", BALANCE, -5); TestUtil.increment(tx2, "joe", BALANCE, -5); TestUtil.increment(tx2, "jill", BALANCE, 10); Assert.assertEquals("10", tx1.gets("bob", BALANCE)); tx2.done(); TestTransaction txd = new TestTransaction(env); txd.delete("jane", BALANCE); txd.done(); Assert.assertEquals("20", tx1.gets("joe", BALANCE)); Assert.assertEquals("60", tx1.gets("jill", BALANCE)); Assert.assertEquals("0", tx1.gets("jane", BALANCE)); tx1.set("bob", BALANCE, "5"); tx1.set("joe", BALANCE, "25"); assertCommitFails(tx1); TestTransaction tx3 = new TestTransaction(env); TestTransaction tx4 = new TestTransaction(env); tx4.set("jane", BALANCE, "3"); tx4.done(); Assert.assertEquals("5", tx3.gets("bob", BALANCE)); Assert.assertEquals("15", tx3.gets("joe", BALANCE)); Assert.assertEquals("70", tx3.gets("jill", BALANCE)); Assert.assertNull(tx3.gets("jane", BALANCE)); tx3.done(); TestTransaction tx5 = new TestTransaction(env); Assert.assertEquals("5", tx5.gets("bob", BALANCE)); Assert.assertEquals("15", tx5.gets("joe", BALANCE)); Assert.assertEquals("70", tx5.gets("jill", BALANCE)); Assert.assertEquals("3", tx5.gets("jane", BALANCE)); tx5.done(); }
Source:
<code>protected List<Guid> getFailedVolumeIds(Guid spmVdsId) { return getParameters().getImageList().stream() <START> .filter((volumeId) -> volumeExists(spmVdsId, volumeId)) <END> .collect(toList()); }</code><technical_language>brackets left hand of -> operator redundant (and frankly, a bit confusing). Please remove them</technical_language>

Target:
protected List<Guid> getFailedVolumeIds(Guid spmVdsId) { return getParameters().getImageList().stream() .filter(volumeId -> volumeExists(spmVdsId, volumeId)) .collect(toList()); }
Source:
<code>private void flushFailedActions() { if (!failedActions.isEmpty()) { <START> Iterator<Action> iterator = failedActions.values().iterator(); <END> while (iterator.hasNext()) { Action action = iterator.next(); iterator.remove(); performSubmit(action); } failedActions.clear(); } }</code><technical_language>for (Action action : failedActions.values())</technical_language>

Target:
private void flushFailedActions() { if (!failedActions.isEmpty()) { Iterator<Action> iterator = failedActions.values().iterator(); while (iterator.hasNext()) { Action action = iterator.next(); iterator.remove(); performSubmit(action); } } }
Source:
<code><START> public DynamicRepositoryLocationLoader(ApplicationContext applicationContext, String beanName) { <END> this.delegated = applicationContext.getBean(beanName, RepositoryLocationLoader.class); }</code><technical_language>Is a className instead of beanName here</technical_language>

Target:
public DynamicRepositoryLocationLoader(ApplicationContext applicationContext, String beanName) { this(applicationContext.getBean(beanName, RepositoryLocationLoader.class)); }
Source:
<code>void onContext(ValueChangeEvent<String> e) { String v = e.getValue(); int c; if (v != null && v.length() > 0) { c = Math.min(Math.max(0, Integer.parseInt(v)), 32767); contextEntireFile.setValue(false); } else if (v == null || v.isEmpty()) { c = WHOLE_FILE_CONTEXT; <START> contextEntireFile.setValue(true); <END> } else { return; } prefs.context(c); updateContextTimer.schedule(200); }</code><technical_language>defer setting this too, breaks when: focus in text box delete click check box</technical_language>

Target:
void onContext(ValueChangeEvent<String> e) { String v = e.getValue(); int c; if (v != null && v.length() > 0) { c = Math.min(Math.max(0, Integer.parseInt(v)), 32767); contextEntireFile.setValue(false); } else if (v == null || v.isEmpty()) { c = WHOLE_FILE_CONTEXT; } else { return; } prefs.context(c); updateContextTimer.schedule(200); }
Source:
<code>public Elide initializeElide(EntityDictionary dictionary, DataStore dataStore, ElideConfigProperties settings) { ElideSettingsBuilder builder = new ElideSettingsBuilder(dataStore) .withEntityDictionary(dictionary) .withDefaultMaxPageSize(settings.getMaxPageSize()) .withDefaultPageSize(settings.getPageSize()) <START> .withJSONApiLinks(new DefaultJSONApiLinks()) <END> .withUseFilterExpressions(true) .withJoinFilterDialect(new RSQLFilterDialect(dictionary)) .withSubqueryFilterDialect(new RSQLFilterDialect(dictionary)) .withAuditLogger(new Slf4jLogger()) .withEncodeErrorResponses(true) .withISO8601Dates("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC")); return new Elide(builder.build()); }</code><technical_language>This disabled default in Elide 4. However, turn for testing tests work</technical_language>

Target:
public Elide initializeElide(EntityDictionary dictionary, DataStore dataStore, ElideConfigProperties settings) { ElideSettingsBuilder builder = new ElideSettingsBuilder(dataStore) .withEntityDictionary(dictionary) .withDefaultMaxPageSize(settings.getMaxPageSize()) .withDefaultPageSize(settings.getPageSize()) .withUseFilterExpressions(true) .withJoinFilterDialect(new RSQLFilterDialect(dictionary)) .withSubqueryFilterDialect(new RSQLFilterDialect(dictionary)) .withAuditLogger(new Slf4jLogger()) .withEncodeErrorResponses(true) .withISO8601Dates("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC")); return new Elide(builder.build()); }
Source:
<code>public static CommonStatus mapCommonStatus(String status) { LOGGER.debug("Mapping common status {}", status); switch (status) { case "Accepted": return CommonStatus.REQUESTED; case "Ready": case "Succeeded": return CommonStatus.CREATED; case "Canceled": case "Deleted": case "Failed": return CommonStatus.FAILED; default: <START> return CommonStatus.FAILED; <END> } }</code><technical_language>extra log</technical_language>

Target:
public static CommonStatus mapCommonStatus(String status) { CommonStatus mappedStatus; switch (status) { case "Accepted": mappedStatus = CommonStatus.REQUESTED; break; case "Ready": case "Succeeded": mappedStatus = CommonStatus.CREATED; break; case "Canceled": case "Deleted": case "Failed": default: mappedStatus = CommonStatus.FAILED; break; } LOGGER.debug("Mapped status to common status {}", status, mappedStatus.toString()); return mappedStatus; }
Source:
<code>public CacheManagerInfo getCacheManager() { <START> String url = "http://"+this.baseURL+"/rest/"+CACHE_MANAGER_RESOURCE; <END> HttpRequest get = HttpRequest.newBuilder() .uri(URI.create(url)) .GET() .build(); CacheManagerInfo cacheManagerInfo = null; try { response = httpClient.send(get, HttpResponse.BodyHandlers.ofString()); String json = response.body(); cacheManagerInfo = mapper.readValue(json, CacheManagerInfo.class); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } return cacheManagerInfo; }</code><technical_language>Nit, spacing fixed String.format</technical_language>

Target:
public CacheManagerInfo getCacheManager() { String url = String.format("http://%s:%s/rest/%s", serverIp, this.defaultPort, CACHE_MANAGER_RESOURCE); HttpRequest get = HttpRequest.newBuilder() .uri(URI.create(url)) .GET() .build(); CacheManagerInfo cacheManagerInfo = null; try { response = httpClient.send(get, HttpResponse.BodyHandlers.ofString()); String json = response.body(); cacheManagerInfo = mapper.readValue(json, CacheManagerInfo.class); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } return cacheManagerInfo; }
Source:
<code>public void apply(OnlineCommandContext ctx) throws CliException, CommandFailedException, IOException, TimeoutException, InterruptedException { Operations ops = new Operations(ctx.client); Address ldapConnection = Address.coreService("management").and("ldap-connection", connectionName); if (replaceExisting) { try { ops.removeIfExists(ldapConnection); new Administration(ctx.client).reloadIfRequired(); } catch (OperationException e) { throw new IOException("Failed to LDAP outbound connection " + connectionName, e); } } List<String> resolvedHandlesReferralsFor = (handlesReferralsFor != null && !handlesReferralsFor.isEmpty()) ? handlesReferralsFor : null; ops.add(ldapConnection, Values.empty() .andOptional("name", connectionName) .andOptional("handles-referrals-for", initialContextFactory) .andOptional("initial-context-factory", initialContextFactory) .andOptional("referrals", referrals) .andOptional("search-credential", searchCredential) .andOptional("search-dn", searchDn) .andOptional("security-realm", securityRealm) .andOptional("url", url) .andListOptional(String.class, "handles-referrals-for", resolvedHandlesReferralsFor)); if (properties != null && !properties.isEmpty()) { for (Map.Entry<String, String> entry : properties.entrySet()) { ops.add(ldapConnection.and("property", entry.getKey()), Values.empty() .and("value", entry.getValue()) ); } <START> } <END> }</code><technical_language>This possibly a Batch (and ops.batch). required, some commands error behavior is a bit nicer</technical_language>

Target:
public void apply(OnlineCommandContext ctx) throws Exception { Operations ops = new Operations(ctx.client); Address ldapConnection = Address.coreService("management").and("ldap-connection", connectionName); if (replaceExisting) { try { ops.removeIfExists(ldapConnection); new Administration(ctx.client).reloadIfRequired(); } catch (OperationException e) { throw new IOException("Failed to LDAP outbound connection " + connectionName, e); } } List<String> resolvedHandlesReferralsFor = (handlesReferralsFor != null && !handlesReferralsFor.isEmpty()) ? handlesReferralsFor : null; Batch batch = new Batch(); batch.add(ldapConnection, Values.empty() .andOptional("name", connectionName) .andOptional("handles-referrals-for", initialContextFactory) .andOptional("initial-context-factory", initialContextFactory) .andOptional("referrals", referrals) .andOptional("search-credential", searchCredential) .andOptional("search-dn", searchDn) .andOptional("security-realm", securityRealm) .andOptional("url", url) .andListOptional(String.class, "handles-referrals-for", resolvedHandlesReferralsFor)); if (properties != null && !properties.isEmpty()) { for (Map.Entry<String, String> entry : properties.entrySet()) { batch.add(ldapConnection.and("property", entry.getKey()), Values.empty() .and("value", entry.getValue()) ); } } ops.batch(batch); }
Source:
<code>public void openEditModal() { ItemObjectModel itemObjectModel = new ItemObjectModel(); itemObjectModel.setParameters(model.getParameters()); itemObjectModel.setResolver(model.getResolver()); BiConsumer<String,String> removeConsumer = (n,v) -> { super.remove(); }; BiConsumer<String,String> editConsumer = removeConsumer.andThen( (n,v) ->{ <START> itemObjectModel.setName(n); <END> itemObjectModel.setValue(v); this.getListPresenter().add(itemObjectModel); fireChangeEvent(); }); doubleValueModal.show(editConsumer); doubleValueModal.getView().setName(model.getName()); doubleValueModal.getView().setValue(model.getValue()); }</code><technical_language>avoid access direct view, presenter instead</technical_language>

Target:
public void openEditModal() { doubleValueModal.show((n, v) -> { view.setName(n); model.setName(n); view.setValue(v); model.setValue(v); fireChangeEvent(); }, model.getName(), model.getValue()); }
Source:
<code>public void run() { Display.getDefault().syncExec(new Runnable() { @Override public void run() { <START> if (!getEditorControl().isDisposed() && KeyPressCommitRunnable.this.toCommit != null && KeyPressCommitRunnable.this.toCommit.equals(getEditorValue())) { <END> commit(MoveDirectionEnum.NONE, false); } } }); }</code><technical_language>If is editor control is disposed here, is null. I add getEditorControl() != null && ... please && condition a new line for readability. fault, for readability</technical_language>

Target:
public void run() { Display.getDefault().syncExec(new Runnable() { @Override public void run() { if (getEditorControl() != null && !getEditorControl().isDisposed() && KeyPressCommitRunnable.this.toCommit != null && KeyPressCommitRunnable.this.toCommit.equals(getEditorValue())) { commit(MoveDirectionEnum.NONE, false); } } }); }
Source:
<code>public void testCreateComputationScheduler() { ThreadFactory factory = new ThreadFactory() { @Override public Thread newThread(Runnable r) { <START> return new Thread("Test"); <END> } }; Scheduler scheduler = RxJavaPlugins.createComputationScheduler(factory); verifyThread(scheduler.createWorker(), new Predicate<Thread>() { @Override public boolean test(Thread thread) throws Exception { return "Test".equals(thread.getName()); } }); }</code><technical_language>I this allow executing tasks ignore r</technical_language>

Target:
public void testCreateComputationScheduler() { final String name = "ComputationSchedulerTest"; ThreadFactory factory = new ThreadFactory() { @Override public Thread newThread(Runnable r) { return new Thread(r, name); } }; final Scheduler customScheduler = RxJavaPlugins.createComputationScheduler(factory); RxJavaPlugins.setComputationSchedulerHandler(new Function<Scheduler, Scheduler>() { @Override public Scheduler apply(Scheduler scheduler) throws Exception { return customScheduler; } }); try { verifyThread(Schedulers.computation(), name); } finally { customScheduler.shutdown(); RxJavaPlugins.reset(); } }
Source:
<code>public Options() { sendHwm = 1000; recvHwm = 1000; affinity = 0; identitySize = 0; rate = 100; recoveryIvl = 10000; multicastHops = 1; sndbuf = 0; rcvbuf = 0; tos = 0; type = -1; linger = -1; reconnectIvl = 100; reconnectIvlMax = 0; backlog = 100; maxMsgSize = -1; recvTimeout = -1; sendTimeout = -1; ipv6 = false; if ("false".equals(System.getProperty("java.net.preferIPv4Stack", null)) || "true".equals(System.getProperty("java.net.preferIPv6Addresses", null))) { ipv6 = true; <START> } <END> immediate = true; filter = false; recvIdentity = false; rawSocket = false; tcpKeepAlive = -1; tcpKeepAliveCnt = -1; tcpKeepAliveIdle = -1; tcpKeepAliveIntvl = -1; mechanism = Mechanisms.NULL; asServer = false; gssPlaintext = false; socketId = 0; conflate = false; handshakeIvl = 30000; heartbeatTtl = 0; heartbeatInterval = 0; heartbeatTimeout = -1; heartbeatContext = new byte[0]; identity = new byte[0]; identitySize = (byte) identity.length; curvePublicKey = new byte[CURVE_KEYSIZE]; curveSecretKey = new byte[CURVE_KEYSIZE]; curveServerKey = new byte[CURVE_KEYSIZE]; allocator = new MsgAllocatorThreshold(Config.MSG_ALLOCATION_HEAP_THRESHOLD.getValue()); selectorChooser = null; }</code><technical_language>Refactor idea: replace lines 191-194 with: java ipv6 = "false".equals(System.getProperty("java.net.preferIPv4Stack", null)) || "true".equals(System.getProperty("java.net.preferIPv6Addresses", null))</technical_language>

Target:
public Options() { sendHwm = 1000; recvHwm = 1000; affinity = 0; identitySize = 0; rate = 100; recoveryIvl = 10000; multicastHops = 1; sndbuf = 0; rcvbuf = 0; tos = 0; type = -1; linger = -1; reconnectIvl = 100; reconnectIvlMax = 0; backlog = 100; maxMsgSize = -1; recvTimeout = -1; sendTimeout = -1; ipv6 = "false".equals(System.getProperty("java.net.preferIPv4Stack", null)) || "true".equals(System.getProperty("java.net.preferIPv6Addresses", null)); immediate = true; filter = false; recvIdentity = false; rawSocket = false; tcpKeepAlive = -1; tcpKeepAliveCnt = -1; tcpKeepAliveIdle = -1; tcpKeepAliveIntvl = -1; mechanism = Mechanisms.NULL; asServer = false; gssPlaintext = false; socketId = 0; conflate = false; handshakeIvl = 30000; heartbeatTtl = 0; heartbeatInterval = 0; heartbeatTimeout = -1; heartbeatContext = new byte[0]; identity = new byte[0]; identitySize = (byte) identity.length; curvePublicKey = new byte[CURVE_KEYSIZE]; curveSecretKey = new byte[CURVE_KEYSIZE]; curveServerKey = new byte[CURVE_KEYSIZE]; allocator = new MsgAllocatorThreshold(Config.MSG_ALLOCATION_HEAP_THRESHOLD.getValue()); selectorChooser = null; }
Source:
<code>private boolean checkForPendingAppHealthActions() { boolean kickedOff = false; if (RecoveryMeasuresHelper.recoveryMeasuresPending()) { finishWithExecutionIntent(); kickedOff = true; <START> } else if (UpdateActivity.isUpdateBlockedOnSync()) { <END> triggerSync(true); kickedOff = true; } else if (CommCareApplication.instance().isSyncPending(false)) { triggerSync(true); kickedOff = true; } else if (UpdatePromptHelper.promptForUpdateIfNeeded(this)) { kickedOff = true; } CommCareApplication.instance().getSession().setAppHealthChecksCompleted(); return kickedOff; }</code><technical_language>this method (checkForPendingAppHealthActions) triggers time get home screen, time app starts for time, right? I means failures sync forcing user sync , say, form, if currently sync. I this needs some identify user attempted sync in current login, force a sync if happened, trigger right behavior (sync update), session (or update attempt. If user restarts update blocked sync reset flag force a sync)</technical_language>

Target:
private boolean checkForPendingAppHealthActions() { boolean kickedOff = false; if (RecoveryMeasuresHelper.recoveryMeasuresPending()) { finishWithExecutionIntent(); kickedOff = true; } else if (UpdateActivity.isUpdateBlockedOnSync() && UpdateActivity.sBlockedUpdateWorkflowInProgress) { triggerSync(true); kickedOff = true; } else if (CommCareApplication.instance().isSyncPending(false)) { triggerSync(true); kickedOff = true; } else if (UpdatePromptHelper.promptForUpdateIfNeeded(this)) { kickedOff = true; } String userId = CommCareApplication.instance().getSession().getLoggedInUser().getUniqueId(); if (HiddenPreferences.shouldForceLogs(userId)) { CommCareUtil.triggerLogSubmission(CommCareApplication.instance(), true); } CommCareApplication.instance().getSession().setAppHealthChecksCompleted(); return kickedOff; }
Source:
<code>OperatorSpecGraph(StreamGraphSpec graphSpec) { this.inputOperators = graphSpec.getInputOperators(); this.outputStreams = graphSpec.getOutputStreams(); this.tables = graphSpec.getTables(); this.allOpSpecs = Collections.unmodifiableSet(this.findAllOperatorSpecs()); <START> hasWindowOrJoins = checkWindowOrJoins(); <END> serializedGraphSpec = graphSpecSerde.toBytes(this); }</code><technical_language>Minor: this. for well</technical_language>

Target:
OperatorSpecGraph(StreamGraphSpec graphSpec) { this.inputOperators = graphSpec.getInputOperators(); this.outputStreams = graphSpec.getOutputStreams(); this.tables = graphSpec.getTables(); this.allOpSpecs = Collections.unmodifiableSet(this.findAllOperatorSpecs()); this.hasWindowOrJoins = checkWindowOrJoins(); this.serializedOpSpecGraph = opSpecGraphSerde.toBytes(this); }
Source:
<code>public static void output(@AggregationState EntropyState state, BlockBuilder out) { if (state.getNull()) { out.appendNull(); return; } if (state.getSumC() == 0) { DOUBLE.writeDouble(out, 0); return; } double entropy = Math.max( (-state.getSumCLogC() / state.getSumC() + Math.log(state.getSumC())) / Math.log(2), 0); <START> entropy = Math.max(entropy, 0); <END> DOUBLE.writeDouble(out, entropy); }</code><technical_language>This line redundant</technical_language>

Target:
public static void output(@AggregationState EntropyState state, BlockBuilder out) { Double entropy = 0.0; if (state.getSumC() > 0.0) { entropy = Math.max( (Math.log(state.getSumC()) - state.getSumCLogC() / state.getSumC()) / Math.log(2.0), 0.0); } DOUBLE.writeDouble(out, entropy); }
Source:
<code>public void validateComponentType() { assertThat(this.defaultR2dbcMessageSource.getComponentType()).isEqualTo("r2dbc:inbound-channel" + <START> "-adapter"); <END> }</code><technical_language>wrap line .isEqualTo() instead of splitting string</technical_language>

Target:
public void validateComponentType() { assertThat(this.defaultR2dbcMessageSource.getComponentType()) .isEqualTo("r2dbc:inbound-channel-adapter"); }
Source:
<code>public void onComplete() { <START> ObservableSource<? extends R> p = other; <END> if (p == null) { downstream.onComplete(); } else { other = null; p.subscribe(this); } }</code><technical_language>o</technical_language>

Target:
public void onComplete() { ObservableSource<? extends R> o = other; if (o == null) { downstream.onComplete(); } else { other = null; o.subscribe(this); } }
Source:
<code>public Builder clusterName(String clusterName) { assertThat(clusterName, <START> Objects::nonNull, <END> () -> new AxonConfigurationException("The clusterName may not be null")); this.clusterName = clusterName; return this; }</code><technical_language>non-null, empty</technical_language>

Target:
public Builder clusterName(String clusterName) { assertClusterName(clusterName, "The clusterName may not be null or empty"); this.clusterName = clusterName; return this; }
Source:
<code>private Answer executeRequest(UpdateDhcpOptionVspCommand cmd) { try { isNuageVspManagerLoaded(); _nuageVspGuruClient.applyDhcpOptions(cmd.getDhcpOptions(), cmd.getNetwork()); return new Answer(cmd, true, "Update DhcpOptions on VM's in network: " + cmd.getNetwork().getName() + " on Nuage VSD " + _hostName); } catch (ExecutionException | ConfigurationException e) { <START> s_logger.error("Failure during " + cmd + " on Nuage VSD " + _hostName, e); <END> return new Answer(cmd, e); } }</code><technical_language>Please add cmd.getDhcpOptions log message assist operational debugging</technical_language>

Target:
private Answer executeRequest(UpdateDhcpOptionVspCommand cmd) { try { isNuageVspManagerLoaded(); _nuageVspGuruClient.applyDhcpOptions(cmd.getDhcpOptions(), cmd.getNetwork()); return new Answer(cmd, true, "Update DhcpOptions on VM's in network: " + cmd.getNetwork().getName() + " on Nuage VSD " + _hostName); } catch (ExecutionException | ConfigurationException e) { s_logger.error("Failure during " + cmd.toDetailString() + " on Nuage VSD " + _hostName, e); return new Answer(cmd, e); } }
Source:
<code>public List<Map<String, Object>> getRefund(long refundId) { List<Map<String, Object>> ret = jdbi.withHandle(h -> <START> h.createQuery("SELECT external_id, reference, amount, status, created_date, charge_id, refunded_by " + <END> "FROM refunds " + "WHERE id = :refund_id") .bind("refund_id", refundId) .list()); return ret; }</code><technical_language>forget update this</technical_language>

Target:
public List<Map<String, Object>> getRefund(long refundId) { List<Map<String, Object>> ret = jdbi.withHandle(h -> h.createQuery("SELECT external_id, reference, amount, status, created_date, charge_id, user_external_id " + "FROM refunds " + "WHERE id = :refund_id") .bind("refund_id", refundId) .list()); return ret; }
Source:
<code>static ReadStrand getStrand(final SAMRecord rec) { if (rec.getReadUnmappedFlag() || rec.getMateUnmappedFlag()) { return ReadStrand.UNKNOWN; } <START> if (!rec.getReferenceIndex().equals(rec.getMateReferenceIndex()) && !rec.getReadUnmappedFlag() && !rec.getMateUnmappedFlag()) { <END> if (rec.getFirstOfPairFlag() == (rec.getReferenceIndex() < rec.getMateReferenceIndex())) { return ReadStrand.TOP; } else { return ReadStrand.BOTTOM; } } final int read5PrimeStart = (rec.getReadNegativeStrandFlag()) ? rec.getUnclippedEnd() : rec.getUnclippedStart(); final int mate5PrimeStart = (rec.getMateNegativeStrandFlag()) ? SAMUtils.getMateUnclippedEnd(rec) : SAMUtils.getMateUnclippedStart(rec); if(rec.getFirstOfPairFlag() == (read5PrimeStart <= mate5PrimeStart)) { return ReadStrand.TOP; } else { return ReadStrand.BOTTOM; } }</code><technical_language>need for unmapped check check returned above</technical_language>

Target:
static ReadStrand getStrand(final SAMRecord rec) { if (rec.getReadUnmappedFlag() || rec.getMateUnmappedFlag()) { return ReadStrand.UNKNOWN; } if (!rec.getReferenceIndex().equals(rec.getMateReferenceIndex())) { if (rec.getFirstOfPairFlag() == (rec.getReferenceIndex() < rec.getMateReferenceIndex())) { return ReadStrand.TOP; } else { return ReadStrand.BOTTOM; } } final int read5PrimeStart = (rec.getReadNegativeStrandFlag()) ? rec.getUnclippedEnd() : rec.getUnclippedStart(); final int mate5PrimeStart = (rec.getMateNegativeStrandFlag()) ? SAMUtils.getMateUnclippedEnd(rec) : SAMUtils.getMateUnclippedStart(rec); if (rec.getFirstOfPairFlag() == (read5PrimeStart <= mate5PrimeStart)) { return ReadStrand.TOP; } else { return ReadStrand.BOTTOM; } }
Source:
<code>private void checkOrSetContentType(final Contentlet contentletIn, final User user) { if (contentletIn.isNew() && null == contentletIn.getContentType() && <START> contentletIn.getMap().containsKey(Contentlet.BASE_TYPE_KEY)) { <END> final BaseContentType baseContentType = BaseContentType.getBaseContentType( (String) contentletIn.getMap().get(Contentlet.BASE_TYPE_KEY)); if (null != baseContentType) { final Optional<BaseTypeToContentTypeStrategy> typeStrategy = this.baseTypeToContentTypeStrategyResolver.get(baseContentType); if (typeStrategy.isPresent()) { final Host host = Try.of(()->APILocator.getHostAPI().find( contentletIn.getHost(), user, false)).getOrNull(); if (null != host) { final Optional<ContentType> contentTypeOpt = typeStrategy.get().apply(baseContentType, CollectionsUtils.map("user", user, "host", host, "contentletMap", contentletIn.getMap())); if (contentTypeOpt.isPresent()) { contentletIn.setContentType(contentTypeOpt.get()); } } } } } }</code><technical_language>need a contentlet.getBaseType() method contentType if set map if not</technical_language>

Target:
private void checkOrSetContentType(final Contentlet contentletIn, final User user) { final Optional<BaseContentType> baseTypeOpt = contentletIn.getBaseType(); if (contentletIn.isNew() && null == contentletIn.getContentType() && baseTypeOpt.isPresent()) { final BaseContentType baseContentType = baseTypeOpt.get(); final Optional<BaseTypeToContentTypeStrategy> typeStrategy = this.baseTypeToContentTypeStrategyResolver.get(baseContentType); if (typeStrategy.isPresent()) { final Host host = Try.of(()->APILocator.getHostAPI().find( contentletIn.getHost(), user, false)).getOrNull(); if (null != host) { final Optional<ContentType> contentTypeOpt = typeStrategy.get().apply(baseContentType, CollectionsUtils.map("user", user, "host", host, "contentletMap", contentletIn.getMap())); if (contentTypeOpt.isPresent()) { contentletIn.setContentType(contentTypeOpt.get()); } } } } }
Source:
<code>public void surviveWithOneTaskAsStandby() throws ExecutionException, InterruptedException, IOException { IntegrationTestUtils.produceKeyValuesSynchronouslyWithTimestamp( inputTopic, Collections.singletonList( new KeyValue<>(0, 0)), TestUtils.producerConfig( CLUSTER.bootstrapServers(), IntegerSerializer.class, IntegerSerializer.class, new Properties()), 10L); final String appId = "eos-test-app"; final String stateDirPath = TestUtils.tempDirectory(appId).getPath(); final CountDownLatch instanceLatch = new CountDownLatch(1); try ( final KafkaStreams streamInstanceOne = buildStreamWithDirtyStateDir(appId, stateDirPath + "/" + appId + "-1/", instanceLatch); final KafkaStreams streamInstanceTwo = buildStreamWithDirtyStateDir(appId, stateDirPath + "/" + appId + "-2/", instanceLatch); ) { streamInstanceOne.start(); streamInstanceTwo.start(); assertTrue(instanceLatch.await(15, TimeUnit.SECONDS)); waitForCondition(() -> streamInstanceOne.state().equals(KafkaStreams.State.RUNNING), "Stream instance one should be up and running by now"); waitForCondition(() -> streamInstanceTwo.state().equals(KafkaStreams.State.RUNNING), <START> "Stream instance one should be up and running by now"); <END> streamInstanceOne.close(Duration.ZERO); streamInstanceTwo.close(Duration.ZERO); } }</code><technical_language>Stream instance "one" -> "two"</technical_language>

Target:
public void surviveWithOneTaskAsStandby() throws ExecutionException, InterruptedException, IOException { IntegrationTestUtils.produceKeyValuesSynchronouslyWithTimestamp( inputTopic, Collections.singletonList( new KeyValue<>(0, 0)), TestUtils.producerConfig( CLUSTER.bootstrapServers(), IntegerSerializer.class, IntegerSerializer.class, new Properties()), 10L); final String appId = "eos-test-app"; final String stateDirPath = TestUtils.tempDirectory(appId).getPath(); final CountDownLatch instanceLatch = new CountDownLatch(1); try ( final KafkaStreams streamInstanceOne = buildStreamWithDirtyStateDir(appId, stateDirPath + "/" + appId + "-1/", instanceLatch); final KafkaStreams streamInstanceTwo = buildStreamWithDirtyStateDir(appId, stateDirPath + "/" + appId + "-2/", instanceLatch); ) { streamInstanceOne.start(); streamInstanceTwo.start(); assertTrue(instanceLatch.await(15, TimeUnit.SECONDS)); waitForCondition(() -> streamInstanceOne.state().equals(KafkaStreams.State.RUNNING), "Stream instance one should be up and running by now"); waitForCondition(() -> streamInstanceTwo.state().equals(KafkaStreams.State.RUNNING), "Stream instance two should be up and running by now"); streamInstanceOne.close(Duration.ZERO); streamInstanceTwo.close(Duration.ZERO); } }
Source:
<code>public String viewEntityDetailsById(@PathVariable(value = "entityTypeId") String entityTypeId, @PathVariable(value = "entityId") String entityId, Model model) throws Exception { EntityType entityType = dataService.getEntityType(entityTypeId); if (entityType == null) { throw new MolgenisDataAccessException( "EntityType with id [" + entityTypeId + "] does not exist. Did you use the correct URL?"); } <START> else <END> { Object id = getTypedValue(entityId, entityType.getIdAttribute()); model.addAttribute("entity", dataService.getRepository(entityTypeId).findOneById(id)); model.addAttribute("entityType", entityType); model.addAttribute("entityTypeId", entityTypeId); model.addAttribute("viewName", getStandaloneReportViewName(entityTypeId)); return "view-standalone-report"; } }</code><technical_language>else needed , exception stops method code</technical_language>

Target:
public String viewEntityDetailsById(@PathVariable(value = "entityTypeId") String entityTypeId, @PathVariable(value = "entityId") String entityId, Model model) throws Exception { EntityType entityType = dataService.getEntityType(entityTypeId); if (entityType == null) { throw new MolgenisDataAccessException( "EntityType with id [" + entityTypeId + "] does not exist. Did you use the correct URL?"); } Object id = getTypedValue(entityId, entityType.getIdAttribute()); model.addAttribute("entity", dataService.getRepository(entityTypeId).findOneById(id)); model.addAttribute("entityType", entityType); model.addAttribute("entityTypeId", entityTypeId); model.addAttribute("viewName", getStandaloneReportViewName(entityTypeId)); return "view-standalone-report"; }
Source:
<code>private void setHColumnFamilyProperties(HColumnDescriptor[] columnDescriptors) { Map<ImmutableBytesWritable, ImmutableBytesWritable> propsMap = columnDescriptors[0].getValues(); for(Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> entry : propsMap.entrySet()){ ImmutableBytesWritable key = entry.getKey(); ImmutableBytesWritable defaultValue = entry.getValue(); Map<String, String> CFMap = new HashMap<String, String>(); Set<ImmutableBytesWritable> set = new HashSet<ImmutableBytesWritable>(); <START> for(HColumnDescriptor columnDescriptor: columnDescriptors){ <END> String columnFamilyName = Bytes.toString(columnDescriptor.getName()); ImmutableBytesWritable value = columnDescriptor.getValues().get(key); if (SYNCED_DATA_TABLE_AND_INDEX_COL_FAM_PROPERTIES.contains(Bytes.toString(key.get()))){ definedProps.put(Bytes.toString(key.get()), Bytes.toString(value.get())); continue; } CFMap.put(columnFamilyName, Bytes.toString(value.get())); set.add(value); } if (set.size() > 1){ for(Map.Entry<String, String> mapEntry: CFMap.entrySet()){ definedProps.put(String.format("%s.%s", mapEntry.getKey(), Bytes.toString(key.get())), mapEntry.getValue()); } } else { definedProps.put(Bytes.toString(key.get()), Bytes.toString(defaultValue.get())); } } }</code><technical_language>space {</technical_language>

Target:
private void setHColumnFamilyProperties(HColumnDescriptor[] columnDescriptors) { Map<ImmutableBytesWritable, ImmutableBytesWritable> propsMap = columnDescriptors[0].getValues(); for(Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> entry : propsMap.entrySet()) { ImmutableBytesWritable key = entry.getKey(); ImmutableBytesWritable globalValue = entry.getValue(); Map<String, String> cfToPropertyValueMap = new HashMap<String, String>(); Set<ImmutableBytesWritable> cfPropertyValueSet = new HashSet<ImmutableBytesWritable>(); for(HColumnDescriptor columnDescriptor: columnDescriptors) { String columnFamilyName = Bytes.toString(columnDescriptor.getName()); ImmutableBytesWritable value = columnDescriptor.getValues().get(key); if (SYNCED_DATA_TABLE_AND_INDEX_COL_FAM_PROPERTIES.contains(Bytes.toString(key.get()))) { definedProps.put(Bytes.toString(key.get()), Bytes.toString(value.get())); break; } cfToPropertyValueMap.put(columnFamilyName, Bytes.toString(value.get())); cfPropertyValueSet.add(value); } if (cfPropertyValueSet.size() > 1) { for(Map.Entry<String, String> mapEntry: cfToPropertyValueMap.entrySet()) { definedProps.put(String.format("%s.%s", mapEntry.getKey(), Bytes.toString(key.get())), mapEntry.getValue()); } } else { definedProps.put(Bytes.toString(key.get()), Bytes.toString(globalValue.get())); } } }
Source:
<code>public void unrelatedNodesWithSamePropertyShouldNotInterfereWithUniquenessCheck() throws Exception { createConstraint( "Person", "id" ); long ourNode; { Statement statement = statementInNewTransaction( AnonymousContext.writeToken() ); ourNode = createLabeledNode( statement, "Person", "id", 1 ); createLabeledNode( statement, "Item", "id", 2 ); commit(); } Statement statement = statementInNewTransaction( AnonymousContext.writeToken() ); ReadOperations readOps = statement.readOperations(); int person = readOps.labelGetForName( "Person" ); int propId = readOps.propertyKeyGetForName( "id" ); final int labelId = person; final int[] propertyKeyIds = new int[]{propId}; NewIndexDescriptor idx = readOps <START> .uniqueIndexGetForLabelAndPropertyKey( SchemaDescriptorFactory.forLabel( labelId, propertyKeyIds ) ); <END> createLabeledNode( statement, "Item", "id", 2 ); assertThat( readOps.nodeGetFromUniqueIndexSeek( idx, exact( propId, 1 ) ), equalTo( ourNode ) ); }</code><technical_language>ping</technical_language>

Target:
public void unrelatedNodesWithSamePropertyShouldNotInterfereWithUniquenessCheck() throws Exception { createConstraint( "Person", "id" ); long ourNode; { Statement statement = statementInNewTransaction( AnonymousContext.writeToken() ); ourNode = createLabeledNode( statement, "Person", "id", 1 ); createLabeledNode( statement, "Item", "id", 2 ); commit(); } Statement statement = statementInNewTransaction( AnonymousContext.writeToken() ); ReadOperations readOps = statement.readOperations(); int person = readOps.labelGetForName( "Person" ); int propId = readOps.propertyKeyGetForName( "id" ); NewIndexDescriptor idx = readOps .uniqueIndexGetForLabelAndPropertyKey( SchemaDescriptorFactory.forLabel( person, propId ) ); createLabeledNode( statement, "Item", "id", 2 ); assertThat( readOps.nodeGetFromUniqueIndexSeek( idx, exact( propId, 1 ) ), equalTo( ourNode ) ); }
Source:
<code>AssignableNode(ClusterConfig clusterConfig, InstanceConfig instanceConfig, String instanceName) { _instanceName = instanceName; Map<String, Integer> instanceCapacity = fetchInstanceCapacity(clusterConfig, instanceConfig); _faultZone = computeFaultZone(clusterConfig, instanceConfig); _instanceTags = ImmutableSet.copyOf(instanceConfig.getTags()); _disabledPartitionsMap = ImmutableMap.copyOf(instanceConfig.getDisabledPartitionsMap()); _maxAllowedCapacity = ImmutableMap.copyOf(instanceCapacity); <START> _remainingCapacity = new HashMap<>(_maxAllowedCapacity); <END> _maxPartition = clusterConfig.getMaxPartitionsPerInstance(); }</code><technical_language>nit: avoid private fields dependencies in constructor is preferred. new HashMap<>(instanceCapacity); assign instanceCapacity _remainingCapacity</technical_language>

Target:
AssignableNode(ClusterConfig clusterConfig, InstanceConfig instanceConfig, String instanceName) { _instanceName = instanceName; Map<String, Integer> instanceCapacity = fetchInstanceCapacity(clusterConfig, instanceConfig); _faultZone = computeFaultZone(clusterConfig, instanceConfig); _instanceTags = ImmutableSet.copyOf(instanceConfig.getTags()); _disabledPartitionsMap = ImmutableMap.copyOf(instanceConfig.getDisabledPartitionsMap()); _maxAllowedCapacity = ImmutableMap.copyOf(instanceCapacity); _remainingCapacity = new HashMap<>(instanceCapacity); _maxPartition = clusterConfig.getMaxPartitionsPerInstance(); _currentAssignedReplicaMap = new HashMap<>(); _highestCapacityUtilization = 0f; }