auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testMapMetrics() { HazelcastInstance hz = createHazelcastInstance(); Node node = getNode(hz); PhoneHome phoneHome = new PhoneHome(node, "http://localhost:8080/ping"); Map<String, String> map1 = hz.getMap("hazelcast"); Map<String, String> map2 = hz.getMap("phonehome"); <START> map2.put("1", "hazelcast"); <END> node.getConfig().getMapConfig("hazelcast").setReadBackupData(true); node.getConfig().getMapConfig("phonehome").getMapStoreConfig().setEnabled(true); node.getConfig().getMapConfig("hazelcast").addQueryCacheConfig(new QueryCacheConfig("queryconfig")); node.getConfig().getMapConfig("hazelcast").getHotRestartConfig().setEnabled(true); stubFor(get(urlPathEqualTo("/ping")) .willReturn(aResponse() .withStatus(200))); phoneHome.phoneHome(false); verify(1, getRequestedFor(urlPathEqualTo("/ping")).withQueryParam("mpct", equalTo("2")) .withQueryParam("mpbrct", equalTo("1")) .withQueryParam("mpmsct", equalTo("1")) .withQueryParam("mpaoqcct", equalTo("1")) .withQueryParam("mpaoict", equalTo("1")) .withQueryParam("mphect", equalTo("1"))); }</code><technical_language>This index. is a map entry</technical_language>

Target:
public void testMapMetrics() { HazelcastInstance hz = createHazelcastInstance(); Node node = getNode(hz); PhoneHome phoneHome = new PhoneHome(node, "http://localhost:8080/ping"); Map<String, String> map1 = hz.getMap("hazelcast"); Map<String, String> map2 = hz.getMap("phonehome"); node.getConfig().getMapConfig("hazelcast").setReadBackupData(true); node.getConfig().getMapConfig("phonehome").getMapStoreConfig().setEnabled(true); node.getConfig().getMapConfig("hazelcast").addQueryCacheConfig(new QueryCacheConfig("queryconfig")); node.getConfig().getMapConfig("hazelcast").getHotRestartConfig().setEnabled(true); node.getConfig().getMapConfig("hazelcast").getIndexConfigs().add(new IndexConfig()); stubFor(get(urlPathEqualTo("/ping")) .willReturn(aResponse() .withStatus(200))); phoneHome.phoneHome(false); verify(1, getRequestedFor(urlPathEqualTo("/ping")).withQueryParam("mpct", equalTo("2")) .withQueryParam("mpbrct", equalTo("1")) .withQueryParam("mpmsct", equalTo("1")) .withQueryParam("mpaoqcct", equalTo("1")) .withQueryParam("mpaoict", equalTo("1")) .withQueryParam("mphect", equalTo("1"))); }
Source:
<code>public static void rsyncFileToRemote(final String localPath, final String address, final String remotePath, final boolean useDel) { StringBuilder builder = new StringBuilder(); builder.append("rsync"); builder.append(" -rtLDvz"); if (useDel) { builder.append(" --del"); } builder.append(" " + localPath); builder.append(" " + address + ":" + remotePath); <START> startAProcess(builder.toString().split(" ")); <END> }</code><technical_language>this dangerous, reason manually construct array above</technical_language>

Target:
public static void rsyncFileToRemote(final String localPath, final String address, final String remotePath, final boolean useDel) { ArrayList<String> command = new ArrayList<String>(); command.add("rsync"); command.add("-rtLDvz"); if (useDel) { command.add("--del"); } command.add(localPath); command.add(address + ":" + remotePath); startAProcess(command.toArray(new String[] {})); }
Source:
<code>public List findElementsByName(String using) throws WebDriverException{ return super.findElementsByName(using); <START> } <END></code><technical_language>reverted</technical_language>

Target:
public List findElementsByName(String using) { return super.findElementsByName(using); }
Source:
<code>public static Long convertObjectToLong(Object valObj) { if (valObj instanceof Long) { return (Long) valObj; } else if (valObj instanceof Number) { return ((Number) valObj).longValue(); } else if (valObj instanceof String) { try { <START> String s = ((String) valObj).replace(",", ""); <END> return LONG_PAT.matcher(s).matches() ? Long.valueOf(s) : Double.valueOf(s).longValue(); } catch (Exception e) { throw new ParseException(e, "Unable to parse value[%s] as long", valObj); } } else { throw new ParseException("Unknown type[%s]", valObj.getClass()); } }</code><technical_language>Well, I suppose purpose is remove 1000s delimiter numbers, e. g. 1,000,000 is 1000000. in locales, e. g. in Russian locale comma is a separator integer part fractional part in non-integer numbers. IMO this is "too smart" do this. discussed separately, in this PR</technical_language>

Target:
public static Long convertObjectToLong(Object valObj) { if (valObj == null) { return 0L; } if (valObj instanceof Long) { return (Long) valObj; } else if (valObj instanceof Number) { return ((Number) valObj).longValue(); } else if (valObj instanceof String) { try { return GuavaUtils.tryParseLong((String) valObj); } catch (Exception e) { throw new ParseException(e, "Unable to parse value[%s] as long", valObj); } } else { throw new ParseException("Unknown type[%s]", valObj.getClass()); } }
Source:
<code>protected static List<Integer> grep(File fileName, String regexp, List<String> resultLines) { List<Integer> resultLineNumbers = new ArrayList<>(); Reader reader = null; try { reader = new FileReader(fileName); resultLineNumbers = grep(reader, regexp, resultLines); }catch (IOException e) { e.printStackTrace(); } finally { <START> closeQuietly(reader); <END> } return resultLineNumbers; }</code><technical_language>Java7, try-with-resources feature</technical_language>

Target:
protected static List<Integer> grep(File fileName, String regexp, List<String> resultLines) { List<Integer> resultLineNumbers = new ArrayList<>(); try(Reader reader = new FileReader(fileName)) { resultLineNumbers = grep(reader, regexp, resultLines); } catch (IOException e) { e.printStackTrace(); } return resultLineNumbers; }
Source:
<code>private DrugOrder checkDrugOrdersForDiscontinuing(DrugOrder drugOrder1, DrugOrder drugOrder2){ if (OpenmrsUtil.nullSafeEquals(drugOrder1.getDrug(), drugOrder2.getDrug())) { return drugOrder2; <START> }else{ <END> return null; } }</code><technical_language>need else clause, is redundant, return null</technical_language>

Target:
private DrugOrder checkDrugOrdersForDiscontinuing(DrugOrder drugOrder1, DrugOrder drugOrder2){ if (OpenmrsUtil.nullSafeEquals(drugOrder1.getDrug(), drugOrder2.getDrug())) { return drugOrder2; } return null; }
Source:
<code>public Map<SystemResource, Number> getSystemResourceUsage() { systemResourceUsage.clear(); for (SystemResource sr : systemResources) { Method getterMethod = getGetterMethod(sr); getterMethod.setAccessible(true); try { systemResourceUsage.put(sr, (Number)getterMethod.invoke(operatingSystemMXBean)); } catch (Exception e) { <START> Throwables.propagate(e); <END> } } return systemResourceUsage; }</code><technical_language>java throw Throwables.propagate(e); IDE compiler execution flow stops</technical_language>

Target:
public Map<SystemResource, Number> getSystemResourceUsage() { systemResourceUsage.clear(); for (SystemResource sr : systemResources) { Method getterMethod = getGetterMethod(sr); getterMethod.setAccessible(true); try { systemResourceUsage.put(sr, (Number)getterMethod.invoke(operatingSystemMXBean)); } catch (Exception e) { throw Throwables.propagate(e); } } return systemResourceUsage; }
Source:
<code>private void getSubscriptionUrl() { registrationService.getRegistrationUrl(new MethodCallback<RegistrationUrl>() { @Override <START> public void onFailure(Method method, Throwable exception) { <END> } @Override public void onSuccess(Method method, RegistrationUrl registrationUrl) { LocaleInfo currentLocale = LocaleInfo.getCurrentLocale(); if (currentLocale.getLocaleName().equals("fr")) { getView().setRegistrationUrl(registrationUrl.getFr()); } else { getView().setRegistrationUrl(registrationUrl.getEn()); } } }); }</code><technical_language>Add minimal feedback failure</technical_language>

Target:
private void getSubscriptionUrl() { registrationService.getRegistrationUrl(new MethodCallback<RegistrationUrl>() { @Override public void onFailure(Method method, Throwable exception) { getView().logError("Failure to load registration url"); } @Override public void onSuccess(Method method, RegistrationUrl registrationUrl) { LocaleInfo currentLocale = LocaleInfo.getCurrentLocale(); if (currentLocale.getLocaleName().equals("fr")) { getView().setRegistrationUrl(registrationUrl.getFr()); } else { getView().setRegistrationUrl(registrationUrl.getEn()); } } }); }
Source:
<code>public String getString(String name, String defaultValue) { String value = cfg.getString(PLUGIN, pluginName, name); if (value != null) { return value; } else { return defaultValue; <START> } <END> }</code><technical_language>done shorter: return Objects.firstNonNull(cfg.getString(PLUGIN, pluginName, name), defaultValue);</technical_language>

Target:
public String getString(String name, String defaultValue) { return Objects.firstNonNull(cfg.getString(PLUGIN, pluginName, name), defaultValue); }
Source:
<code>public Map<String, String> getMetadataMap() { Map<String, String> metadataMap = new LinkedHashMap<String, String>(); Configuration config = (Configuration) INSTANCE .getBackingConfigurationSource(); <START> String subsetPrefix = propMetadataNamespace.substring(0, propMetadataNamespace.length() - 1); <END> for (Iterator<String> iter = config.subset(subsetPrefix) .getKeys(); iter.hasNext();) { String key = iter.next(); String value = config.getString(propMetadataNamespace + key); metadataMap.put(key, value); } return metadataMap; }</code><technical_language>I add a check for empty string & check if namespace ends a "." avoid exception if changes namespace</technical_language>

Target:
public Map<String, String> getMetadataMap() { Map<String, String> metadataMap = new LinkedHashMap<String, String>(); Configuration config = (Configuration) INSTANCE .getBackingConfigurationSource(); String subsetPrefix = propMetadataNamespace.charAt(propMetadataNamespace.length() - 1) == '.' ? propMetadataNamespace.substring(0, propMetadataNamespace.length() - 1) : propMetadataNamespace; for (Iterator<String> iter = config.subset(subsetPrefix) .getKeys(); iter.hasNext();) { String key = iter.next(); String value = config.getString(subsetPrefix + "." + key); metadataMap.put(key, value); } return metadataMap; }
Source:
<code>public void shouldAlertGivenFunctionInJavaScriptResponse() throws HttpMalformedHeaderException, URIException { String body = "Some text <script>$eval()</script>\nLine 2\n"; HttpMessage msg = createHttpMessageWithRespBody(body, "text/javascript;charset=ISO-8859-1"); Source source = createSource(msg); rule.scanHttpResponseReceive(msg, -1, source); <START> assertThat(alertsRaised, hasSize(1)); <END> }</code><technical_language>assert evidence expected</technical_language>

Target:
public void shouldAlertGivenFunctionInJavaScriptResponse() throws HttpMalformedHeaderException, URIException { String body = "Some text <script>$eval()</script>\nLine 2\n"; HttpMessage msg = createHttpMessageWithRespBody(body, "text/javascript;charset=ISO-8859-1"); Source source = createSource(msg); rule.scanHttpResponseReceive(msg, -1, source); assertThat(alertsRaised, hasSize(1)); assertEquals("eval", alertsRaised.get(0).getEvidence()); }
Source:
<code>protected ContentValues mergeValues(@NonNull ContentValues v1, @NonNull ContentValues v2) { <START> Gson gson = new Gson(); <END> GitHubRepository b1 = gson.fromJson(v1.getAsString(GitHubRepositoryColumns.JSON), GitHubRepository.class); GitHubRepository b2 = gson.fromJson(v2.getAsString(GitHubRepositoryColumns.JSON), GitHubRepository.class); return getContentValuesForItem(b1.overwrite(b2)); }</code><technical_language>inject Gson? easier test</technical_language>

Target:
protected ContentValues mergeValues(@NonNull ContentValues v1, @NonNull ContentValues v2) { GitHubRepository b1 = getGson().fromJson(v1.getAsString(GitHubRepositoryColumns.JSON), GitHubRepository.class); GitHubRepository b2 = getGson().fromJson(v2.getAsString(GitHubRepositoryColumns.JSON), GitHubRepository.class); return getContentValuesForItem(b1.overwrite(b2)); }
Source:
<code>protected boolean validateMemoryAlignment(VmStatic vmStaticData) { if (getCluster().getArchitecture().getFamily() == ArchitectureType.ppc && vmStaticData.getMemSizeMb() % 256 != 0) { addValidationMessageVariable("clusterArch", getCluster().getArchitecture()); <START> return failValidation(EngineMessage.MEMORY_SIZE_NOT_MULTIPLE_OF_256_ON_PPC); <END> } return true; }</code><technical_language>please failValidation(EngineMessage message, String ... variableReplacements) instead</technical_language>

Target:
protected boolean validateMemoryAlignment(VmStatic vmStaticData) { if (getCluster().getArchitecture().getFamily() == ArchitectureType.ppc && vmStaticData.getMemSizeMb() % 256 != 0) { return failValidation(EngineMessage.MEMORY_SIZE_NOT_MULTIPLE_OF_256_ON_PPC, String.format("$%s %s", "clusterArch", getCluster().getArchitecture())); } return true; }
Source:
<code>public void deleteAuthorizationFailureTest() throws Exception { <START> if (store.getStoreConfig().storeValidateAuthorization == true) { <END> MockId mockId = put(1, PUT_RECORD_SIZE, Utils.Infinite_Time).get(0); assertNotSame("accountId should not be -1 for added Blob.", -1, mockId.getAccountId()); assertNotSame("containerId should not be -1 for added Blob.", -1, mockId.getContainerId()); short[] accountIds = {-1, Utils.getRandomShort(TestUtils.RANDOM), -1, mockId.getAccountId(), Utils.getRandomShort( TestUtils.RANDOM)}; short[] containerIds = {-1, -1, Utils.getRandomShort(TestUtils.RANDOM), Utils.getRandomShort( TestUtils.RANDOM), mockId.getContainerId()}; for (int i = 0; i < accountIds.length; i++) { verifyDeleteFailure(new MockId(mockId.getID(), accountIds[i], containerIds[i]), StoreErrorCodes.Authorization_Failure); } } }</code><technical_language>assumeTrue(store.getStoreConfig().storeValidateAuthorization) - test run if is true (will get skipped, fail)</technical_language>

Target:
public void deleteAuthorizationFailureTest() throws Exception { MockId mockId = put(1, PUT_RECORD_SIZE, Utils.Infinite_Time).get(0); assertNotSame("accountId should not be -1 for added Blob.", -1, mockId.getAccountId()); assertNotSame("containerId should not be -1 for added Blob.", -1, mockId.getContainerId()); short[] accountIds = {-1, Utils.getRandomShort(TestUtils.RANDOM), -1, mockId.getAccountId(), Utils.getRandomShort(TestUtils.RANDOM)}; short[] containerIds = {-1, -1, Utils.getRandomShort(TestUtils.RANDOM), Utils.getRandomShort( TestUtils.RANDOM), mockId.getContainerId()}; for (int i = 0; i < accountIds.length; i++) { verifyDeleteFailure(new MockId(mockId.getID(), accountIds[i], containerIds[i]), StoreErrorCodes.Authorization_Failure); } }
Source:
<code>private void enterThenDisablePasscodeIfNeeded() { <START> if (isViewDisplayed(getViewById(R.id.button1)) == false) { <END> return; } typeFullPasscode(); loadSettingsFromNotesList(); loadPasscodeUnsetterFromSettings(); typeFullPasscode(); dismissSettings(); }</code><technical_language>suggestion if (!isViewDisplayed(getViewById(R.id.button1))) { simplify isViewDisplayed(getViewById(R.id.button1)) == false !isViewDisplayed(getViewById(R.id.button1))</technical_language>

Target:
private void enterThenDisablePasscodeIfNeeded() { if (!isViewDisplayed(getViewById(R.id.button1))) { return; } typeFullPasscode(); loadSettingsFromNotesList(); loadPasscodeUnsetterFromSettings(); typeFullPasscode(); dismissSettings(); }
Source:
<code>private File createTempFile(String contents) { try { File tmpFile = File.createTempFile("config", ".tmp"); FileWriter writer = new FileWriter(tmpFile); writer.write(contents); <START> writer.close(); <END> return tmpFile; } catch (IOException e) { } return null; }</code><technical_language>try ... catch resources cleaner</technical_language>

Target:
private File createTempFile(String contents) throws IOException { File tmpFile = File.createTempFile("config", ".tmp"); try (FileWriter writer = new FileWriter(tmpFile)) { writer.write(contents); return tmpFile; } }
Source:
<code>public ProcessingStatus onOK() { for (int i = 0; i < results.length; i++) { if (results[i] == null) { messageIsInvalid = true; break; } } if (messageIsInvalid) { return ProcessingStatus.INLALID; } List<Integer> toRetry = new ArrayList<>(); ProcessingStatus processingStatus = ProcessingStatus.SUCCESS; for (int i = 0; i < results.length; i++) { Status status = results[i]; if (status.getCode() == io.grpc.Status.Code.OK.value()) { continue; } if (retryOptions.isRetryable(getGrpcCode(status))) { toRetry.add(i); } else { processingStatus = ProcessingStatus.NOT_RETRYABLE; } } <START> <END> if (!toRetry.isEmpty()) { currentRequest = createRetryRequest(toRetry); if (processingStatus == ProcessingStatus.SUCCESS) { processingStatus = ProcessingStatus.RETYABLE; } } return processingStatus; }</code><technical_language>cleaner add early return for ProcessingStatus.NOT_RETRYABLE loop</technical_language>

Target:
public ProcessingStatus onOK() { if (!messageIsInvalid) { for (int i = 0; i < results.length; i++) { if (results[i] == null) { messageIsInvalid = true; break; } } } if (messageIsInvalid) { return ProcessingStatus.INVALID; } List<Integer> toRetry = new ArrayList<>(); ProcessingStatus processingStatus = ProcessingStatus.SUCCESS; for (int i = 0; i < results.length; i++) { Status status = results[i]; if (status.getCode() == io.grpc.Status.Code.OK.value()) { continue; } else if (retryOptions.isRetryable(getGrpcCode(status))) { toRetry.add(i); if (processingStatus == ProcessingStatus.SUCCESS) { processingStatus = ProcessingStatus.RETRYABLE; } } else { processingStatus = ProcessingStatus.NOT_RETRYABLE; break; } } if (!toRetry.isEmpty()) { currentRequest = createRetryRequest(toRetry); } return processingStatus; }
Source:
<code>public MethodDefinition declareMethod( EnumSet<Access> access, String name, ParameterizedType returnType, Iterable<Parameter> parameters) { if (Iterables.size(parameters) > MAX_ALLOWED_VARARG_ARGUMENTS) { <START> throw new PrestoException(TOO_MANY_VARARG_ARGUMENTS, <END> String.format("Number of arguments (%d) for vararg functions exceeds limit (%d)", Iterables.size(parameters), MAX_ALLOWED_VARARG_ARGUMENTS)); } MethodDefinition methodDefinition = new MethodDefinition(this, access, name, returnType, parameters); for (MethodDefinition method : methods) { if (name.equals(method.getName()) && method.getParameterTypes().equals(methodDefinition.getParameterTypes())) { throw new IllegalArgumentException("Method with same name and signature already exists: " + name); } } methods.add(methodDefinition); return methodDefinition; }</code><technical_language>bytecode independent spi; making this IllegalArgumentException. Also, put argument in a separate line</technical_language>

Target:
public MethodDefinition declareMethod( EnumSet<Access> access, String name, ParameterizedType returnType, Iterable<Parameter> parameters) { MethodDefinition methodDefinition = new MethodDefinition(this, access, name, returnType, parameters); for (MethodDefinition method : methods) { if (name.equals(method.getName()) && method.getParameterTypes().equals(methodDefinition.getParameterTypes())) { throw new IllegalArgumentException("Method with same name and signature already exists: " + name); } } methods.add(methodDefinition); return methodDefinition; }
Source:
<code>public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View root = super.onCreateView(inflater, container, savedInstanceState); <START> bus = EventBus.getDefault(); <END> if (savedInstanceState != null) { savedSearchFilter = savedInstanceState.getString(BUNDLE_KEY_SEARCH_QUERY); } searchFilter = savedSearchFilter; return root; }</code><technical_language>I this is needed</technical_language>

Target:
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View root = super.onCreateView(inflater, container, savedInstanceState); if (savedInstanceState != null) { savedSearchFilter = savedInstanceState.getString(BUNDLE_KEY_SEARCH_QUERY); } searchFilter = savedSearchFilter; return root; }
Source:
<code>public void testRobotIsCreatedWithCorrectInitialPosition() { final GridPosition initialGridPosition = new GridPosition(0, 0); final Robot robot = new Robot(initialGridPosition, Orientation.NORTH); final GridPosition actualGridPosition = robot.getGridPosition(); <START> assertTrue(actualGridPosition.equals(initialGridPosition)); <END> }</code><technical_language>thoughts assertEquals()? This increases fidelity of signal test system: programmer wrong failure message</technical_language>

Target:
public void testRobotIsCreatedWithCorrectInitialPosition() { final GridPosition initialGridPosition = new GridPosition(0, 0); final Robot robot = new Robot(initialGridPosition, Orientation.NORTH); assertTrue(robot.getGridPosition().equals(initialGridPosition)); }
Source:
<code>protected boolean canDoAction() { final ClusterValidator validator = new ClusterValidator(getDbFacade(), getVdsGroup()); boolean validationResult = validate(validator.nameNotUsed()) && validate(validator.cpuTypeSupportsVirtService()) && validate(validator.versionSupported()) && validate(validator.dataCenterVersionMismatch()) && validate(validator.dataCenterExists()) && validate(validator.localStoragePoolAttachedToSingleCluster()) && validate(validator.qosBaloonSupported()) && validate(validator.glusterServiceSupported()) && validate(validator.clusterServiceDefined()) && validate(validator.mixedClusterServicesSupported()) && validate(validator.attestationServerConfigured()) <START> && validate(validator.migrationSupported(getArchitecture())) <END> && validate(validator.virtIoRngSupported()); if (!validateClusterPolicy()) { return false; } return validationResult; }</code><technical_language>patch this line exact point preserve previous semantic: && validateClusterPolicy()</technical_language>

Target:
protected boolean canDoAction() { final ClusterValidator validator = new ClusterValidator(getDbFacade(), getVdsGroup()); return validate(validator.nameNotUsed()) && validate(validator.cpuTypeSupportsVirtService()) && validate(validator.versionSupported()) && validate(validator.dataCenterVersionMismatch()) && validate(validator.dataCenterExists()) && validate(validator.localStoragePoolAttachedToSingleCluster()) && validate(validator.qosBaloonSupported()) && validate(validator.glusterServiceSupported()) && validate(validator.clusterServiceDefined()) && validate(validator.mixedClusterServicesSupported()) && validate(validator.attestationServerConfigured()) && validate(validator.migrationSupported(getArchitecture())) && validateClusterPolicy() && validate(validator.virtIoRngSupported()); }
Source:
<code>for (Map.Entry<Integer, Schema<ChangeData>> e : ChangeSchemas.ALL.entrySet()) { if (e.getKey() <= 3) { versions.put(e.getValue(), lucene43); } else if (e.getKey() <= 5) { versions.put(e.getValue(), lucene44); } else if (e.getKey() <= 8) { versions.put(e.getValue(), lucene46); } else if (e.getKey() <= 10) { versions.put(e.getValue(), lucene47); } else if (e.getKey() <= 11) { versions.put(e.getValue(), lucene48); } else if (e.getKey() <= 13) { versions.put(e.getValue(), lucene410); } else { <START> versions.put(e.getValue(), Version.LUCENE_4_10_2); <END> } }</code><technical_language>replace Lucene version in existing index schema version. Schema version V14 stays Lucene Version 4.10.1. change Lucene version schema upgrade + reindex is needed. Check this change for schema upgrade example [1]. [1] <LINK_0></technical_language>

Target:
for (Map.Entry<Integer, Schema<ChangeData>> e : ChangeSchemas.ALL.entrySet()) { if (e.getKey() <= 3) { versions.put(e.getValue(), lucene43); } else if (e.getKey() <= 5) { versions.put(e.getValue(), lucene44); } else if (e.getKey() <= 8) { versions.put(e.getValue(), lucene46); } else if (e.getKey() <= 10) { versions.put(e.getValue(), lucene47); } else if (e.getKey() <= 11) { versions.put(e.getValue(), lucene48); } else if (e.getKey() <= 13) { versions.put(e.getValue(), lucene410); } else if (e.getKey() <= 14) { versions.put(e.getValue(), lucene4101); } else { versions.put(e.getValue(), Version.LUCENE_4_10_2); } }
Source:
<code>private void onClose() { if (DEBUG) Log.d(TAG, "onClose() called"); if (lockManager != null) { lockManager.releaseWifiAndCpu(); } if (playerImpl != null) { removeViewFromParent(); playerImpl.setRecovery(); playerImpl.savePlaybackState(); playerImpl.stopActivityBinding(); playerImpl.removePopupFromView(); playerImpl.destroy(); } if (notificationManager != null) notificationManager.cancel(NOTIFICATION_ID); <START> playerImpl = null; lockManager = null; <END> stopForeground(true); stopSelf(); }</code><technical_language>move if (!= null) branches</technical_language>

Target:
private void onClose() { if (DEBUG) { Log.d(TAG, "onClose() called"); } if (playerImpl != null) { removeViewFromParent(); playerImpl.setRecovery(); playerImpl.savePlaybackState(); playerImpl.stopActivityBinding(); playerImpl.removePopupFromView(); playerImpl.destroy(); } if (notificationManager != null) { notificationManager.cancel(NOTIFICATION_ID); } stopForeground(true); stopSelf(); }
Source:
<code>protected static final SPromise registerOnError(final SPromise rcvr, final SBlock block, final RootCallTarget blockCallTarget, final RegisterOnError registerNode) { assert block.getMethod().getNumberOfArguments() == 2; Actor current = EventualMessage.getActorCurrentMessageIsExecutionOn(); <START> SPromise promise = SPromise.createPromise(current, false, false, false); <END> SResolver resolver = SPromise.createResolver(promise, "onE:block"); PromiseCallbackMessage msg = new PromiseCallbackMessage(EventualMessage.getCurrentExecutingMessageId(), rcvr.getOwner(), block, resolver, blockCallTarget, false, false, promise); registerNode.register(rcvr, msg, current); return promise; }</code><technical_language>Hm, flags depend is some breakpoint here</technical_language>

Target:
protected final SPromise registerOnError(final SPromise rcvr, final SBlock block, final RootCallTarget blockCallTarget, final RegisterOnError registerNode) { assert block.getMethod().getNumberOfArguments() == 2; Actor current = EventualMessage.getActorCurrentMessageIsExecutionOn(); SPromise promise = SPromise.createPromise(current, promiseResolutionBreakpoint.executeCheckIsSetAndEnabled(), false, false); SResolver resolver = SPromise.createResolver(promise); PromiseCallbackMessage msg = new PromiseCallbackMessage(EventualMessage.getCurrentExecutingMessageId(), rcvr.getOwner(), block, resolver, blockCallTarget, false, promiseResolverBreakpoint.executeCheckIsSetAndEnabled(), promise); registerNode.register(rcvr, msg, current); return promise; }
Source:
<code>public final TmfModelResponse<List<M>> fetchTree(TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { <START> if (fCached != null) { return fCached; } <END> fAnalysisModule.waitForInitialization(); ITmfStateSystem ss = fAnalysisModule.getStateSystem(); if (ss == null) { return new TmfModelResponse<>(null, ITmfResponse.Status.FAILED, CommonStatusMessage.STATE_SYSTEM_FAILED); } boolean complete = ss.waitUntilBuilt(0); try (FlowScopeLog scope = new FlowScopeLogBuilder(LOGGER, Level.FINE, getClass().getSimpleName() + "#fetchTree").build()) { List<M> tree = getTree(ss, filter, monitor); if (complete) { TmfModelResponse<List<M>> response = new TmfModelResponse<>(tree, ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED); if (isCacheable()) { fCached = response; } return response; } return new TmfModelResponse<>(tree, ITmfResponse.Status.RUNNING, CommonStatusMessage.RUNNING); } catch (StateSystemDisposedException e) { return new TmfModelResponse<>(null, ITmfResponse.Status.FAILED, CommonStatusMessage.STATE_SYSTEM_FAILED); } }</code><technical_language>return cached tree? check if filter matches cached query from</technical_language>

Target:
public final TmfModelResponse<List<M>> fetchTree(TimeQueryFilter filter, @Nullable IProgressMonitor monitor) { if (fCached != null) { return fCached; } fAnalysisModule.waitForInitialization(); ITmfStateSystem ss = fAnalysisModule.getStateSystem(); if (ss == null) { return new TmfModelResponse<>(null, ITmfResponse.Status.FAILED, CommonStatusMessage.STATE_SYSTEM_FAILED); } boolean complete = ss.waitUntilBuilt(0); try (FlowScopeLog scope = new FlowScopeLogBuilder(LOGGER, Level.FINE, "AbstractTreeDataProvider#fetchTree") .setCategory(getClass().getSimpleName()).build()) { List<M> tree = getTree(ss, filter, monitor); if (complete) { TmfModelResponse<List<M>> response = new TmfModelResponse<>(tree, ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED); if (isCacheable()) { fCached = response; } return response; } return new TmfModelResponse<>(tree, ITmfResponse.Status.RUNNING, CommonStatusMessage.RUNNING); } catch (StateSystemDisposedException e) { return new TmfModelResponse<>(null, ITmfResponse.Status.FAILED, CommonStatusMessage.STATE_SYSTEM_FAILED); } }
Source:
<code><START> private void testMovingMoving(Operation operation) throws Exception { <END> test(2, operation.f, new MagicKey("moving1", cache(0), cache(1)), new MagicKey("moving2", cache(0), cache(1))); }</code><technical_language>Test methods public</technical_language>

Target:
public void testMovingMoving(Operation operation) throws Exception { test(2, operation.f, new MagicKey("moving1", cache(0), cache(1)), new MagicKey("moving2", cache(0), cache(1))); }
Source:
<code>private static void warmUpCHSubNetwork(GraphHopper graphHopper, int iterations) { GraphHopperStorage ghStorage = graphHopper.getGraphHopperStorage(); for (int i = 0; i < iterations; i++) { <START> int startNode = ThreadLocalRandom.current().nextInt(0, graphHopper.getMaxVisitedNodes() + 1); <END> int endNode = ThreadLocalRandom.current().nextInt(0, graphHopper.getMaxVisitedNodes() + 1); double fromLatitude = ghStorage.getNodeAccess().getLatitude(startNode); double fromLongitude = ghStorage.getNodeAccess().getLongitude(startNode); double toLatitude = ghStorage.getNodeAccess().getLatitude(endNode); double toLongitude = ghStorage.getNodeAccess().getLongitude(endNode); GHRequest request = new GHRequest(fromLatitude, fromLongitude, toLatitude, toLongitude); graphHopper.route(request); } }</code><technical_language>mind Random instead of ThreadLocalRandom instantiate this loop? is a special reason TLR used, threads involved here, thread-sharing</technical_language>

Target:
private static void warmUpCHSubNetwork(GraphHopper graphHopper, int iterations) { int retryCount = 0; int maxRetries = 10; while (true) { try { GraphHopperStorage ghStorage = graphHopper.getGraphHopperStorage(); Random rand = new Random(); for (int i = 0; i < iterations; i++) { int startNode = rand.nextInt(graphHopper.getMaxVisitedNodes() + 1); int endNode = rand.nextInt(graphHopper.getMaxVisitedNodes() + 1); double fromLatitude = ghStorage.getNodeAccess().getLatitude(startNode); double fromLongitude = ghStorage.getNodeAccess().getLongitude(startNode); double toLatitude = ghStorage.getNodeAccess().getLatitude(endNode); double toLongitude = ghStorage.getNodeAccess().getLongitude(endNode); GHRequest request = new GHRequest(fromLatitude, fromLongitude, toLatitude, toLongitude); graphHopper.route(request); } break; } catch (Exception ex) { if (++retryCount == maxRetries) throw ex; } } }
Source:
<code><START> public String isThereATraceBetween(EObject firstElement, EObject secondElement, EObject traceModel) { <END> GenericTraceModel root = (GenericTraceModel) traceModel; List<RelatedTo> relevantLinks = new ArrayList<RelatedTo>(); List<RelatedTo> allTraces = root.getTraces(); String traceString = ""; for (RelatedTo trace : allTraces) { if (firstElement != secondElement) { if (trace.getItem().contains(firstElement) && trace.getItem().contains(secondElement)) { relevantLinks.add(trace); } } } if (relevantLinks.size() > 0) { traceString = "X"; } String spacer = ""; String internalTraceString = this.isThereAnInternalTraceBetween(firstElement, secondElement, traceModel); if(internalTraceString!=null) { spacer = (!traceString.equals("") && !internalTraceString.equals("")) ? ", " : ""; return traceString + spacer + internalTraceString;}else return traceString; }</code><technical_language>I understand this method does. return a string? string express</technical_language>

Target:
public boolean isThereATraceBetween(EObject firstElement, EObject secondElement, EObject traceModel) { GenericTraceModel root = (GenericTraceModel) traceModel; List<RelatedTo> relevantLinks = new ArrayList<RelatedTo>(); List<RelatedTo> allTraces = root.getTraces(); for (RelatedTo trace : allTraces) { if (firstElement != secondElement) { if (trace.getItem().contains(firstElement) && trace.getItem().contains(secondElement)) { relevantLinks.add(trace); } } } if (relevantLinks.size() > 0) { return true; } return this.isThereAnInternalTraceBetween(firstElement, secondElement, traceModel); }
Source:
<code>private Collection<DDiagramElement> getNodes(final EObject semanticElement, final DSemanticDiagram dSemanticDiagram, final Collection<DiagramElementMapping> mappings) { Set<DDiagramElement> result = new HashSet<DDiagramElement>(); if (semanticElement != null) { for (DDiagramElement dDiagramElement <START> : new DDiagramInternalQuery(dSemanticDiagram).getDiagramElements()) { <END> if (mappings.contains(dDiagramElement.getMapping()) && semanticElement.equals(dDiagramElement.getTarget())) { result.add(dDiagramElement); } } } return result; }</code><technical_language>call dSemanticDiagram.getDiagramElements() org.eclipse.sirius.diagram.business.api.query.DDiagramQuery.getAllDiagramElements()</technical_language>

Target:
private Collection<DDiagramElement> getNodes(final EObject semanticElement, final DSemanticDiagram dSemanticDiagram, final Collection<DiagramElementMapping> mappings) { Set<DDiagramElement> result = new HashSet<DDiagramElement>(); if (semanticElement != null) { for (DDiagramElement dDiagramElement : new DDiagramQuery(dSemanticDiagram).getAllDiagramElements()) { if (mappings.contains(dDiagramElement.getMapping()) && semanticElement.equals(dDiagramElement.getTarget())) { result.add(dDiagramElement); } } } return result; }
Source:
<code><START> public void setOrdinal(int ordinal) { <END> this.ordinal = ordinal; }</code><technical_language>is needed and/or public? If needed - I a Builder class for GeneratorStage (maybe a Builder GeneratorPipeline class ti automatically registered?). for some other setters</technical_language>

Target:
void setOrdinal(int ordinal) { this.ordinal = ordinal; }
Source:
<code>public void testRegExp(final String regexp, final String[] expected) throws IOException { final String[] allNames = {"5newline5.txt", "Level2.fofn", "example.bam", "ipsum.txt.bgz", "ipsum.txt.bgzipped_with_gzextension.gz", "slurptest.txt", "Level1.fofn", "empty.txt", "ipsum.txt", "ipsum.txt.bgz.wrongextension", "ipsum.txt.gz", "words_longs.txt"}; final Path regExpDir = Files.createTempDirectory("regExpDir"); regExpDir.toFile().deleteOnExit(); final List<String> listExpected = Arrays.asList(expected); final List<File> expectedFiles = new ArrayList<File>(); for (String name : allNames) { final Path file = regExpDir.resolve(name); file.toFile().createNewFile(); if (listExpected.contains(name)) { expectedFiles.add(file.toFile()); } <START> file.toFile().deleteOnExit(); <END> } final File[] result = IOUtil.getFilesMatchingRegexp(regExpDir.toFile(), regexp); Assert.assertEqualsNoOrder(result, expectedFiles.toArray()); }</code><technical_language>move this right resolve call</technical_language>

Target:
public void testRegExp(final String regexp, final String[] expected) throws IOException { final String[] allNames = {"5newline5.txt", "Level2.fofn", "example.bam", "ipsum.txt.bgz", "ipsum.txt.bgzipped_with_gzextension.gz", "slurptest.txt", "Level1.fofn", "empty.txt", "ipsum.txt", "ipsum.txt.bgz.wrongextension", "ipsum.txt.gz"}; final Path regExpDir = Files.createTempDirectory("regExpDir"); regExpDir.toFile().deleteOnExit(); final List<String> listExpected = Arrays.asList(expected); final List<File> expectedFiles = new ArrayList<File>(); for (String name : allNames) { final Path file = regExpDir.resolve(name); file.toFile().deleteOnExit(); file.toFile().createNewFile(); if (listExpected.contains(name)) { expectedFiles.add(file.toFile()); } } final File[] result = IOUtil.getFilesMatchingRegexp(regExpDir.toFile(), regexp); Assert.assertEqualsNoOrder(result, expectedFiles.toArray()); }
Source:
<code>private List<StorageQuotaValidationParameter> getStorageQuotaListParameters() { List<StorageQuotaValidationParameter> list = new ArrayList<StorageQuotaValidationParameter>(); <START> for (Disk disk : getParameters().getVm().getDiskMap().values()) { <END> if(disk instanceof DiskImage){ DiskImage diskImage = (DiskImage)disk; list.add(new StorageQuotaValidationParameter(diskImage.getQuotaId(), imageToDestinationDomainMap.get(diskImage.getId()), diskImage.getSizeInGigabytes())); } } return list; }</code><technical_language>is this fixing anything? constructor sets vm getParameters().getVm() getVm set in constructor parameters is done (which redundant, anyway). i understand need params here</technical_language>

Target:
private List<StorageQuotaValidationParameter> getStorageQuotaListParameters() { List<StorageQuotaValidationParameter> list = new ArrayList<StorageQuotaValidationParameter>(); for (Disk disk : getVm().getDiskMap().values()) { if(disk instanceof DiskImage){ DiskImage diskImage = (DiskImage)disk; list.add(new StorageQuotaValidationParameter(diskImage.getQuotaId(), imageToDestinationDomainMap.get(diskImage.getId()), diskImage.getSizeInGigabytes())); } } return list; }
Source:
<code>public void testClone() { final CookieClient oldClient = new CookieClient(); oldClient.setName(TYPE); <START> final SimpleTestUsernameProfileCreator profileCreator = new SimpleTestUsernameProfileCreator(); <END> oldClient.setProfileCreator(profileCreator); final TokenAuthenticator authN = new SimpleTestTokenAuthenticator(); oldClient.setAuthenticator(authN); final CookieClient client = (CookieClient) oldClient.clone(); assertEquals(oldClient.getName(), client.getName()); assertEquals(oldClient.getProfileCreator(), client.getProfileCreator()); assertEquals(oldClient.getAuthenticator(), client.getAuthenticator()); }</code><technical_language>This profile creator exist anymore authenticator saves profile in credentials for default AuthenticatorProfileCreator</technical_language>

Target:
public void testClone() { final CookieClient oldClient = new CookieClient(); oldClient.setName(TYPE); final AuthenticatorProfileCreator profileCreator = new AuthenticatorProfileCreator(); oldClient.setProfileCreator(profileCreator); final TokenAuthenticator authN = new SimpleTestTokenAuthenticator(); oldClient.setAuthenticator(authN); final CookieClient client = (CookieClient) oldClient.clone(); assertEquals(oldClient.getName(), client.getName()); assertEquals(oldClient.getProfileCreator(), client.getProfileCreator()); assertEquals(oldClient.getAuthenticator(), client.getAuthenticator()); }
Source:
<code>public static ReaderRelatedPostList fromJsonPosts(@NonNull JSONArray jsonPosts) { ReaderRelatedPostList posts = new ReaderRelatedPostList(); for (int i = 0; i < jsonPosts.length(); i++) { <START> posts.add(ReaderRelatedPost.fromJson(jsonPosts.optJSONObject(i))); <END> } return posts; }</code><technical_language>AFAICT, optJSONObject() return null if array item is a JSONObject JSONArray hold a mix of kind of json types. null check added do job so,</technical_language>

Target:
public static ReaderRelatedPostList fromJsonPosts(@NonNull JSONArray jsonPosts) { ReaderRelatedPostList posts = new ReaderRelatedPostList(); for (int i = 0; i < jsonPosts.length(); i++) { JSONObject jsonRelatedPost = jsonPosts.optJSONObject(i); if (jsonRelatedPost != null) { ReaderRelatedPost relatedPost = ReaderRelatedPost.fromJson(jsonRelatedPost); if (relatedPost != null) { posts.add(relatedPost); } } } return posts; }
Source:
<code><START> public ResponseEntity<?> delete(@RequestBody List<Long> printerIds) throws IOException { <END> for (long id : printerIds) { Printer printer = printerService.get(id); if (printer != null) { printerService.remove(printer); } } return new ResponseEntity<>(HttpStatus.OK); }</code><technical_language>@ResponseStatus(HttpStatus.NO_RESPONSE) change return type void remove return statement</technical_language>

Target:
public void delete(@RequestBody List<Long> printerIds) throws IOException { for (long id : printerIds) { Printer printer = printerService.get(id); if (printer != null) { printerService.remove(printer); } } }
Source:
<code>public MethodOutcome updatePatient(@ResourceParam Patient patient, @IdParam IdDt theId) { MethodOutcome retVal = new MethodOutcome(); OperationOutcome outcome = new OperationOutcome(); try { patient = patientResource.updatePatient(patient, theId.getIdPart()); } catch (Exception e) { outcome.addIssue() .setDetails( "No Patient is associated with the given UUID to update. Please" + " make sure you have set at lease one prefered identifier, non-deleted name, Gender and Birthdate to create a new " + "Patient with the given UUID. The actual error message was" + e.getMessage()); <START> retVal.setOperationOutcome(outcome); <END> return retVal; } outcome.addIssue().setDetails("Patient is successfully updated"); retVal.setOperationOutcome(outcome); return retVal; }</code><technical_language>Hmm.... convinced error message - surely patient update fails for reasons other patient a UUID? this misleading... I suggest replacing "Failed update patient. actual error message " + e.getMessage();</technical_language>

Target:
public MethodOutcome updatePatient(@ResourceParam Patient patient, @IdParam IdDt theId) { MethodOutcome retVal = new MethodOutcome(); OperationOutcome outcome = new OperationOutcome(); patient = patientResource.updatePatient(patient, theId.getIdPart()); outcome.addIssue().setDetails("Patient is successfully updated"); retVal.setOperationOutcome(outcome); return retVal; }
Source:
<code>public ServiceMetricEvent.Builder makeMetricBuilder(GroupByQuery query) { int numMinutes = 0; for (Interval interval : query.getIntervals()) { numMinutes += Minutes.minutesIn(interval).getMinutes(); } return new ServiceMetricEvent.Builder() .setUser2(query.getDataSource()) .setUser3(String.format("%,d dims", query.getDimensions().size())) .setUser4("groupBy") .setUser5(Joiner.on(",").join(query.getIntervals())) .setUser6(String.valueOf(query.hasFilters())) .setUser7(String.format("%,d aggs", query.getAggregatorSpecs().size())) .setUser9(Minutes.minutes(numMinutes).toString()) <START> .setUser10(QueryHelper.getQueryId(query)); <END> }</code><technical_language>i if getQueryId a method baseQuery object. is need for query helper</technical_language>

Target:
public ServiceMetricEvent.Builder makeMetricBuilder(GroupByQuery query) { int numMinutes = 0; for (Interval interval : query.getIntervals()) { numMinutes += Minutes.minutesIn(interval).getMinutes(); } return new ServiceMetricEvent.Builder() .setUser2(query.getDataSource()) .setUser3(String.format("%,d dims", query.getDimensions().size())) .setUser4("groupBy") .setUser5(Joiner.on(",").join(query.getIntervals())) .setUser6(String.valueOf(query.hasFilters())) .setUser7(String.format("%,d aggs", query.getAggregatorSpecs().size())) .setUser9(Minutes.minutes(numMinutes).toString()) .setUser10(query.getId()); }
Source:
<code>protected void onInit() { if (this.getSessionAcknowledgeMode()!= null) { <START> Integer acknowledgeMode = JmsAdapterParserUtils.parseAcknowledgeMode(this.getSessionAcknowledgeMode()); <END> if (acknowledgeMode != null) { if (JmsAdapterParserUtils.SESSION_TRANSACTED == acknowledgeMode) { jmsTemplate.setSessionTransacted(true); } } else { jmsTemplate.setSessionAcknowledgeMode(acknowledgeMode); } } }</code><technical_language>bad design: core component XML parsing. if end-user provides number name for acknowledgeMode some util method somewhere, parser package</technical_language>

Target:
protected void onInit() { if (this.getSessionAcknowledgeMode() != null) { Integer acknowledgeMode = JmsAdapterUtils.parseAcknowledgeMode(this.getSessionAcknowledgeMode()); if (acknowledgeMode != null) { if (JmsAdapterUtils.SESSION_TRANSACTED == acknowledgeMode) { this.jmsTemplate.setSessionTransacted(true); } else { this.jmsTemplate.setSessionAcknowledgeMode(acknowledgeMode); } } } }
Source:
<code>public List<String> executeLastN(SearchParameterMap theSearchParameterMap, FhirContext theFhirContext, Integer theMaxResultsToFetch) { <START> String OBSERVATION_IDENTIFIER_FIELD_NAME = "identifier"; <END> String[] topHitsInclude = {OBSERVATION_IDENTIFIER_FIELD_NAME}; return buildAndExecuteSearch(theSearchParameterMap, theFhirContext, topHitsInclude, ObservationJson::getIdentifier, theMaxResultsToFetch); }</code><technical_language>move class level</technical_language>

Target:
public List<String> executeLastN(SearchParameterMap theSearchParameterMap, FhirContext theFhirContext, Integer theMaxResultsToFetch) { String[] topHitsInclude = {OBSERVATION_IDENTIFIER_FIELD_NAME}; return buildAndExecuteSearch(theSearchParameterMap, theFhirContext, topHitsInclude, ObservationJson::getIdentifier, theMaxResultsToFetch); }
Source:
<code>public EventAddedEvent(org.sleuthkit.datamodel.TimelineManager.EventAddedEvent event) { super(Case.Events.EVENT_ADDED.name(), null, event.getAddedEvent().getEventID()); <START> addedEvent = event.getAddedEvent(); <END> addedEventID = addedEvent.getEventID(); }</code><technical_language>passing event id super class constructor making a field a confusing. Personally, I prefer approach in DataSourceAddedEvent id of object is obtained in getNewValue long id = (Long) super.getNewValue() "extra" field is required. Thoughts</technical_language>

Target:
public EventAddedEvent(org.sleuthkit.datamodel.TimelineManager.EventAddedEvent event) { super(Case.Events.EVENT_ADDED.name(), null, event.getAddedEvent().getEventID()); addedEvent = event.getAddedEvent(); }
Source:
<code>private void maybeWriteToChannel() { if (firstChunk.isComplete() && readCalled) { while (operationException.get() == null && chunkIndexToBuf.containsKey(indexOfNextChunkToWriteOut)) { ByteBuf byteBuf = chunkIndexToBuf.remove(indexOfNextChunkToWriteOut); if (byteBuf != null) { asyncWritableChannel.write(byteBuf.nioBuffer(), chunkAsyncWriteCallback); <START> chunkIndexToBufWaitingForRelease.put(indexOfNextChunkToWriteOut, byteBuf); <END> indexOfNextChunkToWriteOut++; } } if (operationException.get() != null || numChunksWrittenOut.get() == numChunksTotal) { completeRead(); } } }</code><technical_language>this call asyncWritableChannel.write in case write calls chunkAsyncWriteCallback buff is added map</technical_language>

Target:
private void maybeWriteToChannel() { if (firstChunk.isComplete() && readCalled) { while (operationException.get() == null && chunkIndexToBuf.containsKey(indexOfNextChunkToWriteOut)) { ByteBuf byteBuf = chunkIndexToBuf.remove(indexOfNextChunkToWriteOut); if (byteBuf != null) { chunkIndexToBufWaitingForRelease.put(indexOfNextChunkToWriteOut, byteBuf); asyncWritableChannel.write(byteBuf.nioBuffer(), chunkAsyncWriteCallback); indexOfNextChunkToWriteOut++; } } if (operationException.get() != null || numChunksWrittenOut.get() == numChunksTotal) { completeRead(); } } }
Source:
<code>public void close() { synchronized (lock) { final State oldState = state; state = State.DONE; try { if (yielder != null) { Yielder<Object[]> theYielder = this.yielder; this.yielder = null; <START> Runnable closer = () -> { <END> try { theYielder.close(); } catch (Throwable t) { throw Throwables.propagate(t); } }; Future future = yielderOpenCloseExecutor.submit(closer); future.get(); } } catch (Throwable t) { if (oldState != State.DONE) { try { onClose.run(); } catch (Throwable t1) { t.addSuppressed(t1); } } throw Throwables.propagate(t); } if (oldState != State.DONE) { try { onClose.run(); } catch (Throwable t) { throw Throwables.propagate(t); } } } }</code><technical_language>inlined loss of legibility, I think</technical_language>

Target:
public void close() { synchronized (lock) { final State oldState = state; state = State.DONE; try { if (yielder != null) { Yielder<Object[]> theYielder = this.yielder; this.yielder = null; yielderOpenCloseExecutor.submit( () -> { theYielder.close(); return null; } ).get(); yielderOpenCloseExecutor.shutdownNow(); } } catch (Throwable t) { if (oldState != State.DONE) { try { onClose.run(); } catch (Throwable t1) { t.addSuppressed(t1); } } throw Throwables.propagate(t); } if (oldState != State.DONE) { try { onClose.run(); } catch (Throwable t) { throw Throwables.propagate(t); } } } }