auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void updateDetails(final String description, final String language, final int watchers, final int forks, final boolean isPrivate, final boolean isFork, final String mirrorUrl) { if (TextUtils.isEmpty(mirrorUrl)) { if (isPrivate) { setText(0, ICON_PRIVATE); } else if (isFork) { setText(0, ICON_FORK); } else { setText(0, ICON_PUBLIC); } } else { if (isPrivate) { setText(0, ICON_MIRROR_PRIVATE); } else { setText(0, ICON_MIRROR_PUBLIC); } } if (!TextUtils.isEmpty(description)) { setText(1, description).setVisibility(View.VISIBLE); } else { setGone(1, true); } if (!TextUtils.isEmpty(language)) { GitHubColorUtils gitHubColorUtils = GitHubColorUtils.getInstance(); StyledText t = new StyledText(); <START> t.foreground(language, Color.parseColor(gitHubColorUtils.githubColorCode(language))); <END> setText(2, t).setVisibility(View.VISIBLE); } else { setGone(2, true); } setNumber(3, watchers); setNumber(4, forks); }</code><technical_language>check gitHubColorUtils.githubColorCode(language) == null here? some language's color is null in githubcolor.json</technical_language>

Target:
protected void updateDetails(final String description, final String language, final int watchers, final int forks, final boolean isPrivate, final boolean isFork, final String mirrorUrl) { if (TextUtils.isEmpty(mirrorUrl)) { if (isPrivate) { setText(0, ICON_PRIVATE); } else if (isFork) { setText(0, ICON_FORK); } else { setText(0, ICON_PUBLIC); } } else { if (isPrivate) { setText(0, ICON_MIRROR_PRIVATE); } else { setText(0, ICON_MIRROR_PUBLIC); } } if (!TextUtils.isEmpty(description)) { setText(1, description).setVisibility(View.VISIBLE); } else { setGone(1, true); } if (!TextUtils.isEmpty(language)) { String languageColorCode = " "; GitHubColorUtils gitHubColorUtils = GitHubColorUtils.getInstance(); StyledText t = new StyledText(); languageColorCode = gitHubColorUtils.githubColorCode(language); if(languageColorCode==null) languageColorCode = "#000"; t.foreground(language, Color.parseColor(languageColorCode)); setText(2, t).setVisibility(View.VISIBLE); } else { setGone(2, true); } setNumber(3, watchers); setNumber(4, forks); }
Source:
<code>public void stopLeScan() { if (isBluetoothLowEnergySupported() && callback != null) { try { scanner.stopScan(callback); <START> } catch (Exception sentBySysteminternally) { <END> Logger.log.logError("System bug throwing a NullPointerException internally.", sentBySysteminternally); } finally { leScanRunning = false; } } }</code><technical_language>missing callback = null</technical_language>

Target:
public void stopLeScan() { if (isBluetoothLowEnergySupported() && callback != null) { try { scanner.stopScan(callback21); } catch (Exception sentBySysteminternally) { Logger.log.logError("System bug throwing a NullPointerException internally.", sentBySysteminternally); } finally { leScanRunning = false; callback = null; } } }
Source:
<code><START> FilterDateRangeRule(RelBuilderFactory relBuilderFactory) { <END> super(operand(Filter.class, null, FILTER_PREDICATE, any()), relBuilderFactory, "FilterDateRangeRule"); }</code><technical_language>I need change visibility if want in Hive plug builder factory</technical_language>

Target:
public FilterDateRangeRule(RelBuilderFactory relBuilderFactory) { super(operand(Filter.class, null, FILTER_PREDICATE, any()), relBuilderFactory, "FilterDateRangeRule"); }
Source:
<code>private <M extends Metric> M metric(String name) { IgniteEx grid = grid(0); boolean isNear = ((IgniteKernal)grid).internalCache(DEFAULT_CACHE_NAME).isNear(); MetricRegistry mreg = grid.context().metric().registry(cacheMetricsRegistryName(DEFAULT_CACHE_NAME, isNear)); <START> M histogram = mreg.findMetric(name); <END> assertNotNull(histogram); return histogram; }</code><technical_language>rename this m metric</technical_language>

Target:
private <M extends Metric> M metric(String name) { IgniteEx grid = grid(0); boolean isNear = ((IgniteKernal)grid).internalCache(DEFAULT_CACHE_NAME).isNear(); MetricRegistry mreg = grid.context().metric().registry(cacheMetricsRegistryName(DEFAULT_CACHE_NAME, isNear)); M m = mreg.findMetric(name); assertNotNull(m); return m; }
Source:
<code>public void run() { if (pullRetryTimeoutMs == 0L) { return; } try { Thread.sleep(pullRetryTimeoutMs); } catch (final InterruptedException e) { LOG.log(Level.FINE, "Interrupt while sleeping for retry interval"); } while (stateMachine.getCurrentState().equals(STATE_RUNNING)) { final long startTime = ticker.read(); for (final WorkerThread workerThread : threads) { final Map<K, PullRequest> pendingPullRequests = workerThread.pendingPullRequests; boolean needInterrupt = false; for (final PullRequest pullRequest : pendingPullRequests.values()) { if (needInterrupt) { pullRequest.retryIfTimeout(); } else { needInterrupt = pullRequest.retryIfTimeout(); <START> } <END> } if (needInterrupt) { workerThread.interruptToTriggerRetry(); } } final long elapsedTimeInMs = (long)((ticker.read() - startTime) / 1e6); if (elapsedTimeInMs < pullRetryTimeoutMs) { try { Thread.sleep(pullRetryTimeoutMs - elapsedTimeInMs); } catch (final InterruptedException e) { LOG.log(Level.FINE, "Interrupt while sleeping for retry interval"); } } } finishClose(); }</code><technical_language>change this _if~else_ part following? needInterrupt |= pullRequest.retryIfTimeout(); I more simple readable</technical_language>

Target:
public void run() { if (pullRetryTimeoutMs == TIMEOUT_NO_RETRY) { return; } long elapsedTimeInMs = 0; while (stateMachine.getCurrentState().equals(STATE_RUNNING)) { if (elapsedTimeInMs < pullRetryTimeoutMs) { try { Thread.sleep(pullRetryTimeoutMs - elapsedTimeInMs); } catch (final InterruptedException e) { LOG.log(Level.FINE, "Interrupt while sleeping for retry interval"); } } final long startTime = ticker.read(); for (final WorkerThread workerThread : workerThreads) { final Map<K, PullRequest> pendingPullRequests = workerThread.pendingPullRequests; boolean needInterrupt = false; for (final PullRequest pullRequest : pendingPullRequests.values()) { needInterrupt |= pullRequest.requestRetryIfTimeout(); } if (needInterrupt) { workerThread.interruptToTriggerRetry(); } } elapsedTimeInMs = TimeUnit.MILLISECONDS.convert(ticker.read() - startTime, TimeUnit.NANOSECONDS); } finishClose(); }
Source:
<code>public static int parseInt(String s, Dimension dimension) throws NumberFormatException { switch (dimension) { case NOT: case SIZE: return parseInt(s); case DURATION: try { long durationInMillis = TimeUtil.toMillis(s); if ((int) durationInMillis == durationInMillis) { return (int) durationInMillis; } throw new ArithmeticException("integer overflow"); } catch (NumberFormatException e) { <START> return parseInt(s); <END> } } throw new AssertionError("Unknown dimension " + dimension); }</code><technical_language>NumberFormatException caught method is - for example lead ignoring new value</technical_language>

Target:
public static int parseInt(String s, Dimension dimension) throws NumberFormatException { switch (dimension) { case NOT: case SIZE: return parseInt(s); case DURATION: long durationInMillis = TimeUtil.toMillis(s); if ((int) durationInMillis == durationInMillis) { return (int) durationInMillis; } throw new ArithmeticException("integer overflow"); } throw new AssertionError("Unknown dimension " + dimension); }
Source:
<code>public List<SelectItem> resetSelectItems(DatasetFieldType typeIn) { List<SelectItem> retList = new ArrayList<>(); if ((typeIn.isHasParent() && typeIn.getParentDatasetFieldType().isInclude()) || (!typeIn.isHasParent() && typeIn.isInclude())) { SelectItem requiredItem = new SelectItem(); requiredItem.setLabel("Required"); requiredItem.setValue(true); retList.add(requiredItem); SelectItem optional = new SelectItem(); optional.setLabel("Optional"); optional.setValue(false); retList.add(optional); } else { SelectItem hidden = new SelectItem(); <START> hidden.setLabel("Hidden"); <END> hidden.setValue(false); hidden.setDisabled(true); retList.add(hidden); } return retList; }</code><technical_language>plan for "Required" "Hidden" above? hard coded English. Do plan move version in Bundle.properties "dataverse.item.hidden".</technical_language>

Target:
public List<SelectItem> resetSelectItems(DatasetFieldType typeIn) { List<SelectItem> retList = new ArrayList<>(); if ((typeIn.isHasParent() && typeIn.getParentDatasetFieldType().isInclude()) || (!typeIn.isHasParent() && typeIn.isInclude())) { SelectItem requiredItem = new SelectItem(); requiredItem.setLabel(BundleUtil.getStringFromBundle("dataverse.item.required")); requiredItem.setValue(true); retList.add(requiredItem); SelectItem optional = new SelectItem(); optional.setLabel(BundleUtil.getStringFromBundle("dataverse.item.optional")); optional.setValue(false); retList.add(optional); } else { SelectItem hidden = new SelectItem(); hidden.setLabel(BundleUtil.getStringFromBundle("dataverse.item.hidden")); hidden.setValue(false); hidden.setDisabled(true); retList.add(hidden); } return retList; }
Source:
<code><START> private void updateSavePageMenuItem(MenuItem menuItemSavePage) { <END> if (refreshedIfSaved) { menuItemSavePage.setEnabled(false); menuItemSavePage.setTitle(getString(R.string.menu_page_saved)); } else if (isPageSaved) { menuItemSavePage.setEnabled(true); menuItemSavePage.setTitle(getString(R.string.menu_refresh_saved_page)); } else { menuItemSavePage.setEnabled(true); menuItemSavePage.setTitle(getString(R.string.menu_save_page)); } }</code><technical_language>Privates bottom read top bottom readers of this class clients</technical_language>

Target:
private void updateSavePageMenuItem(MenuItem menuItemSavePage) { if (!savedPageCheckComplete) { menuItemSavePage.setEnabled(false); } else if (refreshedIfSaved) { menuItemSavePage.setEnabled(false); menuItemSavePage.setTitle(getString(R.string.menu_page_saved)); } else if (pageSaved) { menuItemSavePage.setEnabled(true); menuItemSavePage.setTitle(getString(R.string.menu_refresh_saved_page)); } else { menuItemSavePage.setEnabled(true); menuItemSavePage.setTitle(getString(R.string.menu_save_page)); } }
Source:
<code><START> public void replaceQueryValues(Map<String, ?> unencoded, Map<String, Boolean> alreadyEncoded) { <END> Iterator<Entry<String, Collection<String>>> iterator = queries.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, Collection<String>> entry = iterator.next(); if (entry.getValue() == null) { continue; } Collection<String> values = new ArrayList<String>(); for (String value : entry.getValue()) { if (value.indexOf('{') == 0 && value.indexOf('}') == value.length() - 1) { Object variableValue = unencoded.get(value.substring(1, value.length() - 1)); if (variableValue == null) { continue; } if (variableValue instanceof Iterable) { for (Object val : Iterable.class.cast(variableValue)) { String encodedValue = encodeValueIfNotEncoded(entry.getKey(), val, alreadyEncoded); values.add(encodedValue); } } else { String encodedValue = encodeValueIfNotEncoded(entry.getKey(), variableValue, alreadyEncoded); values.add(encodedValue); } } else { values.add(value); } } if (values.isEmpty()) { iterator.remove(); } else { entry.setValue(values); } } }</code><technical_language>this need public (ex this directly?)</technical_language>

Target:
void replaceQueryValues(Map<String, ?> unencoded, Map<String, Boolean> alreadyEncoded) { Iterator<Entry<String, Collection<String>>> iterator = queries.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, Collection<String>> entry = iterator.next(); if (entry.getValue() == null) { continue; } Collection<String> values = new ArrayList<String>(); for (String value : entry.getValue()) { if (value.indexOf('{') == 0 && value.indexOf('}') == value.length() - 1) { Object variableValue = unencoded.get(value.substring(1, value.length() - 1)); if (variableValue == null) { continue; } if (variableValue instanceof Iterable) { for (Object val : Iterable.class.cast(variableValue)) { String encodedValue = encodeValueIfNotEncoded(entry.getKey(), val, alreadyEncoded); values.add(encodedValue); } } else { String encodedValue = encodeValueIfNotEncoded(entry.getKey(), variableValue, alreadyEncoded); values.add(encodedValue); } } else { values.add(value); } } if (values.isEmpty()) { iterator.remove(); } else { entry.setValue(values); } } }
Source:
<code>protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_anonymous_upgrade); ButterKnife.bind(this); updateUI(); IdpResponse response = IdpResponse.fromResultIntent(getIntent()); if (response != null) { <START> onActivityResult(RC_SIGN_IN, ErrorCodes.ANONYMOUS_UPGRADE_MERGE_CONFLICT, getIntent()); <END> } }</code><technical_language>Is this change related email link? generally good practice call onActivityResult (or of activity lifecycle callbacks) directly. call underlying logic want happen</technical_language>

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_anonymous_upgrade); ButterKnife.bind(this); updateUI(); IdpResponse response = IdpResponse.fromResultIntent(getIntent()); if (response != null) { handleSignInResult(RC_SIGN_IN, ErrorCodes.ANONYMOUS_UPGRADE_MERGE_CONFLICT, getIntent()); } }
Source:
<code>protected void updateAccountOrContinue() { if (changedDisplayName()) { startProgress(); PushAccountSettingsPayload payload = new PushAccountSettingsPayload(); payload.params = new HashMap<>(); payload.params.put("display_name", mDisplayName); if (changedPassword()) { payload.params.put("password", mPassword); } mDispatcher.dispatch(AccountActionBuilder.newPushSettingsAction(payload)); <START> } else if (changedPassword()) { <END> startProgress(); PushAccountSettingsPayload payload = new PushAccountSettingsPayload(); payload.params = new HashMap<>(); payload.params.put("password", mPassword); mDispatcher.dispatch(AccountActionBuilder.newPushSettingsAction(payload)); } else if (changedUsername()) { startProgress(); PushUsernamePayload payload = new PushUsernamePayload(mUsername, AccountUsernameActionType.KEEP_OLD_SITE_AND_ADDRESS); mDispatcher.dispatch(AccountActionBuilder.newPushUsernameAction(payload)); } else if (mSignupEpilogueListener != null) { AnalyticsTracker.track(AnalyticsTracker.Stat.SIGNUP_SOCIAL_EPILOGUE_UNCHANGED); mSignupEpilogueListener.onContinue(); } }</code><technical_language>I notice check for password username modification is else if blocks I wonder, changed _in parallel_ display name</technical_language>

Target:
protected void updateAccountOrContinue() { if (changedDisplayName()) { startProgress(); PushAccountSettingsPayload payload = new PushAccountSettingsPayload(); payload.params = new HashMap<>(); payload.params.put("display_name", mDisplayName); if (changedPassword()) { payload.params.put("password", mInputPassword.getEditText().getText().toString()); } mDispatcher.dispatch(AccountActionBuilder.newPushSettingsAction(payload)); } else if (changedPassword()) { startProgress(); PushAccountSettingsPayload payload = new PushAccountSettingsPayload(); payload.params = new HashMap<>(); payload.params.put("password", mInputPassword.getEditText().getText().toString()); mDispatcher.dispatch(AccountActionBuilder.newPushSettingsAction(payload)); } else if (changedUsername()) { startProgress(); PushUsernamePayload payload = new PushUsernamePayload(mUsername, AccountUsernameActionType.KEEP_OLD_SITE_AND_ADDRESS); mDispatcher.dispatch(AccountActionBuilder.newPushUsernameAction(payload)); } else if (mSignupEpilogueListener != null) { AnalyticsTracker.track(AnalyticsTracker.Stat.SIGNUP_SOCIAL_EPILOGUE_UNCHANGED); mSignupEpilogueListener.onContinue(); } }
Source:
<code>public boolean addLocationInformation(final String readName, final PhysicalLocation loc){ if (!locationMap.containsKey(readName)) { final boolean b = readLocationInformation(readName, loc); if (b) { locationMap.put(readName, loc); } return b; } else { <START> PhysicalLocation location = locationMap.get(readName); <END> loc.setTile(location.getTile()); loc.setX(location.getX()); loc.setY(location.getY()); return true; } }</code><technical_language>final</technical_language>

Target:
public boolean addLocationInformation(final String readName, final PhysicalLocation loc){ if (!readName.equals(readNameStored)) { if (readLocationInformation(readName, loc)) { readNameStored = readName; physicalLocationStored.setX(loc.getX()); physicalLocationStored.setY(loc.getY()); physicalLocationStored.setTile(loc.getTile()); return true; } return false; } else { loc.setTile(physicalLocationStored.getTile()); loc.setX(physicalLocationStored.getX()); loc.setY(physicalLocationStored.getY()); return true; } }
Source:
<code>public List<VdsNetworkInterface> getNics(Guid hostId) { if (!hostIdToNics.containsKey(hostId)) { VDS host = new VDS(); host.setId(hostId); NetworkConfigurator configurator = new NetworkConfigurator(host, commandContext); <START> hostIdToNics.put(hostId, configurator.filterBondsWithoutSlaves(interfaceDao.getAllInterfacesForVds(hostId))); <END> } return hostIdToNics.get(hostId); }</code><technical_language>seems, filterBondsWithoutSlaves is interrested in 'host' in commandContext. method static - easy ugly CDI. move this method class. Please notice, this class requires commandContext usage is this fake one. this change simplify this method, heal NetworkConfigurator, simplify this class constructor, descendants</technical_language>

Target:
public List<VdsNetworkInterface> getNics(Guid hostId) { if (!hostIdToNics.containsKey(hostId)) { VDS host = new VDS(); host.setId(hostId); NetworkConfigurator configurator = new NetworkConfigurator(host, null); hostIdToNics.put(hostId, configurator.filterBondsWithoutSlaves(interfaceDao.getAllInterfacesForVds(hostId))); } return hostIdToNics.get(hostId); }
Source:
<code>public Collection<IRemoteTest> split(int shardCountHint) { if (shardCountHint <= 1 || mIsSharded) { return null; } Collection<IRemoteTest> tests = new ArrayList<>(); for (int i = 0; i < shardCountHint; i++) { tests.add(getTestShard(shardCountHint, i)); } <START> mIsSharded = true; <END> return tests; }</code><technical_language>do need this var? this method idempotent? In general, is avoid making object stateful</technical_language>

Target:
public Collection<IRemoteTest> split(int shardCountHint) { if (shardCountHint <= 1) { return null; } Collection<IRemoteTest> tests = new ArrayList<>(); for (int i = 0; i < shardCountHint; i++) { tests.add(getTestShard(shardCountHint, i)); } return tests; }
Source:
<code>public void editProcessTest() throws Exception { <START> assumeTrue(!SystemUtils.IS_OS_WINDOWS && !SystemUtils.IS_OS_MAC); <END> Pages.getProcessesPage().editProcess(); assertEquals("Header for edit process is incorrect", "createNewProcess", Pages.getProcessFromTemplatePage().getHeaderText()); }</code><technical_language>is failing windows machines, doesnt run ;-)</technical_language>

Target:
public void editProcessTest() throws Exception { assumeTrue(!SystemUtils.IS_OS_WINDOWS && !SystemUtils.IS_OS_MAC); Pages.getProcessesPage().editProcess(); assertEquals("Header for edit process is incorrect", "Vorgang bearbeiten (First process)", Pages.getProcessEditPage().getHeaderText()); }
Source:
<code>public FullBean processFullBean(FullBean fullBean){ <START> if(manifestAddUrl==null || manifestAddUrl.equals(Boolean.FALSE)){ WebMetaInfo.injectWebMetaInfoBatch(fullBean, mongoServer, false, api2BaseUrl); } else { WebMetaInfo.injectWebMetaInfoBatch(fullBean, mongoServer, true, api2BaseUrl); } <END> if ((fullBean.getAggregations() != null && !fullBean.getAggregations().isEmpty())) { ((FullBeanImpl) fullBean).setAsParent(); for (Aggregation agg : fullBean.getAggregations()) { if (agg.getWebResources() != null && !agg.getWebResources().isEmpty()) { for (WebResourceImpl wRes : (List<WebResourceImpl>) agg.getWebResources()) { wRes.initAttributionSnippet(); } } } } return fullBean; }</code><technical_language>check if manifestAddUrl == null, in line 235 do simply pass of manifestAddUrl (so this a nullpointer exception?) I consistent; check in line 235, remove null-check move WebMetaInfo.injectWebMetaInfoBatch method. preference for check in 1 location</technical_language>

Target:
public FullBean processFullBean(FullBean fullBean){ WebMetaInfo.injectWebMetaInfoBatch(fullBean, mongoServer, manifestAddUrl, api2BaseUrl); if ((fullBean.getAggregations() != null && !fullBean.getAggregations().isEmpty())) { ((FullBeanImpl) fullBean).setAsParent(); for (Aggregation agg : fullBean.getAggregations()) { if (agg.getWebResources() != null && !agg.getWebResources().isEmpty()) { for (WebResourceImpl wRes : (List<WebResourceImpl>) agg.getWebResources()) { wRes.initAttributionSnippet(); } } } } return fullBean; }
Source:
<code>private String getStrongboxHome() { final String strongboxHome = ensureAbsolute(environment.getRequiredProperty("strongbox.home")); <START> return strongboxHome.endsWith("/") ? strongboxHome : strongboxHome + "/"; <END> }</code><technical_language>this method ensure etc/conf/conf.yaml is absolute ? If etc/conf/conf.yaml is provided etc/conf/conf.yaml is returned is absolute</technical_language>

Target:
private String getStrongboxHome() { final String strongboxHome = ensureParentOrCurrentDirAbsolute(environment.getRequiredProperty("strongbox.home")); return strongboxHome.endsWith("/") ? strongboxHome : strongboxHome + "/"; }
Source:
<code><START> private static boolean isFileBeginning(int line, int column, boolean hasBOM) { <END> if (line == 1) { return column > (hasBOM ? 1 : 0); } return true; }</code><technical_language>@pynicolas this method name? I understand,</technical_language>

Target:
private static boolean isFileBeginning(int line, int column, boolean hasBOM) { if (line == 1) { return column <= (hasBOM ? 1 : 0); } return false; }
Source:
<code>private void fireCategorySelection(String categoryName){ for(CategorySelectionObserver o : observers){ try{ o.update(this, categoryName); <START> }catch(Exception ex){} <END> } }</code><technical_language>remove this catch Exception</technical_language>

Target:
private void fireCategorySelection(String categoryName) { for (CategorySelectionObserver o : observers) { o.update(this, categoryName); } }
Source:
<code>@Override protected Boolean run(final VisorCancelServiceTaskArg arg) { IgniteServices services = ignite.services(); String svcName = arg.getName(); Optional<ServiceDescriptor> svc = services.serviceDescriptors().stream() .filter(d -> d.name().equalsIgnoreCase(svcName)) .findFirst(); if (!svc.isPresent()) return false; try { services.cancel(svcName); } catch (IgniteException e) { IgniteLogger log = ignite.log().getLogger(VisorCancelServiceTask.class); <START> log.warning("Error on service cance.", e); <END> return false; } return true; }</code><technical_language>Typo</technical_language>

Target:
@Override protected Boolean run(final VisorCancelServiceTaskArg arg) { IgniteServices services = ignite.services(); String svcName = arg.getName(); Optional<ServiceDescriptor> svc = services.serviceDescriptors().stream() .filter(d -> d.name().equalsIgnoreCase(svcName)) .findFirst(); if (!svc.isPresent()) return false; services.cancel(svcName); return true; }
Source:
<code>private static FormIndex indexFromString(String stringIndex, FormDef form){ if(stringIndex == null || stringIndex.equals("None")){ return null; } else if(stringIndex.equals("<")){ return FormIndex.createBeginningOfFormIndex(); } else if(stringIndex.equals(">")){ return FormIndex.createEndOfFormIndex(); } List<Pair<Integer, Integer>> list = stepToList(stringIndex); FormIndex ret = reduceFormIndex(list, null); ret.assignRefs(form); return ret; <START> } <END></code><technical_language>Great code org / helper method ordering this method :+1:</technical_language>

Target:
public static FormIndex indexFromString(String stringIndex, FormDef form) { if (stringIndex == null || stringIndex.equals("None")) { return null; } else if (stringIndex.equals("<")) { return FormIndex.createBeginningOfFormIndex(); } else if (stringIndex.equals(">")) { return FormIndex.createEndOfFormIndex(); } List<Pair<Integer, Integer>> list = stepToList(stringIndex); FormIndex ret = reduceFormIndex(list, null); ret.assignRefs(form); return ret; }
Source:
<code>protected boolean shouldVerify() throws IOException { byte[] lastVerifyTimeValue = scan.getAttribute(UngroupedAggregateRegionObserver.INDEX_RETRY_VERIFY); Long lastVerifyTime = lastVerifyTimeValue == null ? 0 : Bytes.toLong(lastVerifyTimeValue); <START> if(indexRowKeyforReadRepair != null || lastVerifyTime == 0 || shouldVerifyCheckDone) { <END> return true; } IndexToolVerificationResult verificationResultTemp = verificationResultRepository .getVerificationResult(lastVerifyTime, scan, region, indexMaintainer.getIndexTableName()) ; if(verificationResultTemp != null) { verificationResult = verificationResultTemp; } shouldVerifyCheckDone = true; return verificationResultTemp == null; }</code><technical_language>this function is called, shouldVerifyCheckDone is set true point on, true. if want incremental, do verify do check lastVerifyTime? If lastVerifyTime is 0, shouldVerify check set true. 1 global variable decide if verify multiple this easier</technical_language>

Target:
public boolean shouldVerify() throws IOException { byte[] lastVerifyTimeValue = scan.getAttribute(UngroupedAggregateRegionObserver.INDEX_RETRY_VERIFY); Long lastVerifyTime = lastVerifyTimeValue == null ? 0 : Bytes.toLong(lastVerifyTimeValue); if(indexRowKeyforReadRepair != null || lastVerifyTime == 0 || shouldVerifyCheckDone) { return true; } IndexToolVerificationResult verificationResultTemp = verificationResultRepository .getVerificationResult(lastVerifyTime, scan, region, indexMaintainer.getIndexTableName()) ; if(verificationResultTemp != null) { verificationResult = verificationResultTemp; } shouldVerifyCheckDone = true; return verificationResultTemp == null; }
Source:
<code>static GroupByHash createGroupByHash( Session session, List<? extends Type> hashTypes, int[] hashChannels, Optional<Integer> inputHashChannel, int expectedSize, JoinCompiler joinCompiler) { <START> return createGroupByHash(session, hashTypes, hashChannels, inputHashChannel, expectedSize, joinCompiler, x -> true); <END> }</code><technical_language>(and other places)</technical_language>

Target:
static GroupByHash createGroupByHash( Session session, List<? extends Type> hashTypes, int[] hashChannels, Optional<Integer> inputHashChannel, int expectedSize, JoinCompiler joinCompiler) { return createGroupByHash(hashTypes, hashChannels, inputHashChannel, expectedSize, isDictionaryAggregationEnabled(session), joinCompiler, NOOP); }
Source:
<code>public CurrencyAmount presentValueFromProductPresentValue( FixedCouponBondTrade trade, LegalEntityDiscountingProvider provider, CurrencyAmount productPresentValue) { <START> CurrencyAmount pvProduct = productPresentValue.multipliedBy(trade.getQuantity()); <END> CurrencyAmount pvPayment = presentValuePayment(trade, provider); return pvProduct.plus(pvPayment); }</code><technical_language>product present account coupons in future today. present of trade include coupons settlement date/ ex-coupon date. adjustment for coupons is required in present value</technical_language>

Target:
private CurrencyAmount presentValueFromProductPresentValue( FixedCouponBondTrade trade, LegalEntityDiscountingProvider provider, CurrencyAmount productPresentValue) { CurrencyAmount pvProduct = productPresentValue.multipliedBy(trade.getQuantity()); CurrencyAmount pvPayment = presentValuePayment(trade, provider); return pvProduct.plus(pvPayment); }
Source:
<code>public List<LogicalNodeDto> getLogicalNodes() { <START> return Collections.unmodifiableList(logicalNodes!=null?logicalNodes:new ArrayList<>()); <END> }</code><technical_language>Add this qualifier: this.logicalNodes</technical_language>

Target:
public List<LogicalNodeDto> getLogicalNodes() { return Collections.unmodifiableList(this.logicalNodes!=null?this.logicalNodes:new ArrayList<>()); }
Source:
<code>private static String readResponse(URLConnection conn) throws IOException { conn.setReadTimeout(10000); <START> InputStreamReader isr = new InputStreamReader(conn.getInputStream(), Const.SystemParams.ENCODING); <END> StringBuilder sb = new StringBuilder(); try (BufferedReader rd = new BufferedReader(isr)) { String line; while ((line = rd.readLine()) != null) { sb.append(line); } } return sb.toString(); }</code><technical_language>This part of try-with-resources block</technical_language>

Target:
private static String readResponse(URLConnection conn) throws IOException { conn.setReadTimeout(10000); StringBuilder sb = new StringBuilder(); try (InputStreamReader isr = new InputStreamReader(conn.getInputStream(), Const.SystemParams.ENCODING); BufferedReader rd = new BufferedReader(isr)) { String line; while ((line = rd.readLine()) != null) { sb.append(line); } } return sb.toString(); }
Source:
<code>private void fetchDateBannerInfo() { if (canFetchBannerInfo && unit.getType() == BlockType.PROBLEM) { courseDateViewModel = new ViewModelProvider(this, new ViewModelFactory()).get(CourseDateViewModel.class); <START> initObserver(); <END> courseDateViewModel.fetchCourseDatesBannerInfo(unit.getCourseId(), true); } }</code><technical_language>initObserver move-in onViewCreated call once. remove recursive behavior of webview loading</technical_language>

Target:
private void fetchDateBannerInfo() { if (unit.getType() == BlockType.PROBLEM) { courseDateViewModel.fetchCourseDatesBannerInfo(unit.getCourseId(), true); } }
Source:
<code>public boolean covers(TrackingToken other) { <START> return false; <END> }</code><technical_language>throwing UnsupportedOperationException well? caller aware this token in tracking purposes</technical_language>

Target:
public boolean covers(TrackingToken other) { throw new UnsupportedOperationException("ConfigTokens don't support comparing to other tokens"); }
Source:
<code>private Set<ValidatorWrapper> validatorFactory( String attribute, List<Outer.Validator> validators) { return validators .stream() .filter(Objects::nonNull) .filter(v -> StringUtils.isNotBlank(v.validator)) <START> .map((Outer.Validator key) -> getValidator(attribute, key)) <END> .collect(toSet()); }</code><technical_language>calling getValidator(attribute, key) method definition for get validator is getValidator(String key, Outer.Validator validator) { is confusing attributes swapped. (i'm assuming confusing fix some variable names something)</technical_language>

Target:
private Set<ValidatorWrapper> validatorFactory( String attribute, List<Outer.Validator> validators) { return validators .stream() .filter(Objects::nonNull) .filter(v -> StringUtils.isNotBlank(v.validator)) .map((Outer.Validator validator) -> getValidator(attribute, validator)) .collect(toSet()); }
Source:
<code>void incrementPlanCacheHitCount() { <START> log.tracef( "QueryStatistics - plan cache hit : %s", query ); <END> planCacheHitCount.increment(); }</code><technical_language>in process of removing other logger calls add more</technical_language>

Target:
void incrementPlanCacheHitCount() { planCacheHitCount.increment(); }
Source:
<code>public void testJsonValueFieldIsEncoded() throws Exception { MockHttpServletResponse response = getAsServletResponse(RestBaseController.ROOT_PATH + "/about/system-status.json"); assertEquals(200, response.getStatus()); assertEquals("application/json", response.getContentType()); JSONArray array = ((JSONObject) ((JSONObject) JSONSerializer.toJSON(response.getContentAsString())) .get("metrics")) .getJSONArray("metric"); assertTrue(array.size() == MetricInfo.values().length); <START> for (int i = 0; i < array.size(); i++) { <END> assertNotNull(array.getJSONObject(i).get("value")); } }</code><technical_language>If memory serves well, if a metric is in a environment (for example machine provide a network sensor) metric collected. Hence, checking metrics a sense, checking size :scream:</technical_language>

Target:
public void testJsonValueFieldIsEncoded() throws Exception { MockHttpServletResponse response = getAsServletResponse(RestBaseController.ROOT_PATH + "/about/system-status.json"); assertEquals(200, response.getStatus()); assertEquals("application/json", response.getContentType()); JSONArray metrics = (JSONArray) ((JSONObject) json(response)) .getJSONObject("metrics") .getJSONArray("metric"); for (int i = 0; i < metrics.size(); i++) { assertNotNull(((JSONObject) metrics.get(i)).containsKey("value")); } }
Source:
<code>Move(final Unit unit, final Route route, final Unit transportToLoad) { this( mutableSingletonList(unit), route, <START> new HashMap<Unit, Unit>(Map.of(unit, transportToLoad))); <END> }</code><technical_language>suggestion new HashMap<>(Map.of(unit, transportToLoad))); Pretty works</technical_language>

Target:
Move(final Unit unit, final Route route, final Unit transportToLoad) { this(new ArrayList<>(List.of(unit)), route, new HashMap<>(Map.of(unit, transportToLoad))); }
Source:
<code>protected void executeCommand() { VDS spmVds = LinqUtils.first(LinqUtils.filter(getAllRunningVdssInPool(), new Predicate<VDS>() { @Override public boolean eval(VDS vds) { return vds.getSpmStatus() == VdsSpmStatus.SPM; } })); final List<LUNs> luns = getHostLuns(spmVds); final Map<String, LUNs> lunsMap = new HashMap<String, LUNs>(); for (LUNs lun : luns) { lunsMap.put(lun.getLUN_id(), lun); } final List<LUNs> processedLunsList = new ArrayList<LUNs>(); for (String lunId : getParameters().getLunIds()) { LUNs lun = lunsMap.get(lunId); if (lun == null) { handleFailure(spmVds, getDbFacade().getLunDao().get(lunId)); return; } lun.setvolume_group_id(getStorageDomain().getStorage()); processedLunsList.add(lun); } Pair<Boolean, Map<String, List<Guid>>> result = ConnectVdsToLun(processedLunsList); if (result.getFirst()) { getReturnValue().setActionReturnValue(processedLunsList); setCommandShouldBeLogged(false); setSucceeded(true); } else { Map<String, List<Guid>> processed = result.getSecond(); for (Map.Entry<String, List<Guid>> entry : processed.entrySet()) { for (Guid vdsId : entry.getValue()) { LUNs lun = lunsMap.get(entry.getKey()); <START> StorageHelperDirector.getInstance().getItem(StorageType.ISCSI) <END> .disconnectStorageFromLunByVdsId(getStorageDomain(), vdsId, lun); } } } }</code><technical_language>this change redundant. 1. StorageHelperDirector removed in general point in touching this. 2. if in future support other types of connections LUNs (FCoE software initiator other) making this ISCSI limiting. change getStorageDomain().getType</technical_language>

Target:
protected void executeCommand() { VDS spmVds = LinqUtils.first(LinqUtils.filter(getAllRunningVdssInPool(), new Predicate<VDS>() { @Override public boolean eval(VDS vds) { return vds.getSpmStatus() == VdsSpmStatus.SPM; } })); final List<LUNs> luns = getHostLuns(spmVds); final Map<String, LUNs> lunsMap = new HashMap<String, LUNs>(); for (LUNs lun : luns) { lunsMap.put(lun.getLUN_id(), lun); } final List<LUNs> processedLunsList = new ArrayList<LUNs>(); for (String lunId : getParameters().getLunIds()) { LUNs lun = lunsMap.get(lunId); if (lun == null) { handleFailure(spmVds, getDbFacade().getLunDao().get(lunId)); return; } lun.setvolume_group_id(getStorageDomain().getStorage()); processedLunsList.add(lun); } Pair<Boolean, Map<String, List<Guid>>> result = ConnectVdsToLun(processedLunsList); if (result.getFirst()) { getReturnValue().setActionReturnValue(processedLunsList); setCommandShouldBeLogged(false); setSucceeded(true); } else { Map<String, List<Guid>> processed = result.getSecond(); for (Map.Entry<String, List<Guid>> entry : processed.entrySet()) { for (Guid vdsId : entry.getValue()) { LUNs lun = lunsMap.get(entry.getKey()); StorageHelperDirector.getInstance().getItem(getStoragePool().getStorageType()) .disconnectStorageFromLunByVdsId(getStorageDomain(), vdsId, lun); } } } }
Source:
<code>public DataFileCategory getCategoryByName(String categoryName) { <START> if (categoryName != null && !categoryName.isEmpty()) { <END> if (dataFileCategories != null) { for (DataFileCategory dataFileCategorie : dataFileCategories) { if (categoryName.equals(dataFileCategorie.getName())) { return dataFileCategorie; } } } DataFileCategory newCategory = new DataFileCategory(); newCategory.setName(categoryName); newCategory.setDataset(this); this.addFileCategory(newCategory); return newCategory; } return null; }</code><technical_language>I heart String.isEmpty() "".equals(String). Nice</technical_language>

Target:
public DataFileCategory getCategoryByName(String categoryName) { if (categoryName != null && !categoryName.isEmpty()) { if (dataFileCategories != null) { for (DataFileCategory dataFileCategory : dataFileCategories) { if (categoryName.equals(dataFileCategory.getName())) { return dataFileCategory; } } } DataFileCategory newCategory = new DataFileCategory(); newCategory.setName(categoryName); newCategory.setDataset(this); this.addFileCategory(newCategory); return newCategory; } return null; }
Source:
<code>public boolean registerWorldTransfer(int newWorld) { try (Connection con = DatabaseConnection.getConnection()) { long currentTimeMillis = System.currentTimeMillis(); try (PreparedStatement ps = con.prepareStatement("SELECT completionTime FROM worldtransfers WHERE characterid=?")) { ps.setInt(1, getId()); ResultSet rs = ps.executeQuery(); while(rs.next()) { Timestamp completedTimestamp = rs.getTimestamp("completionTime"); if(completedTimestamp == null) return false; else if(completedTimestamp.getTime() + ServerConstants.WORLD_TRANSFER_COOLDOWN > currentTimeMillis) return false; } } catch(SQLException e) { e.printStackTrace(); return false; } <START> try (PreparedStatement ps = con.prepareStatement("INSERT INTO worldtransfers (characterid, `from`, `to`) VALUES (?, ?, ?)")){ <END> ps.setInt(1, getId()); ps.setInt(2, getWorld()); ps.setInt(3, newWorld); ps.executeUpdate(); return true; } catch (SQLException e) { e.printStackTrace(); } } catch(SQLException e) { e.printStackTrace(); } return false; }</code><technical_language>This enum imo</technical_language>

Target:
public boolean registerWorldTransfer(int newWorld) { try (Connection con = DatabaseConnection.getConnection()) { long currentTimeMillis = System.currentTimeMillis(); try (PreparedStatement ps = con.prepareStatement("SELECT completionTime FROM worldtransfers WHERE characterid=?")) { ps.setInt(1, getId()); ResultSet rs = ps.executeQuery(); while(rs.next()) { Timestamp completedTimestamp = rs.getTimestamp("completionTime"); if(completedTimestamp == null) return false; else if(completedTimestamp.getTime() + ServerConstants.WORLD_TRANSFER_COOLDOWN > currentTimeMillis) return false; } } catch(SQLException e) { e.printStackTrace(); FilePrinter.printError(FilePrinter.WORLD_TRANSFER, e, "Failed to register world transfer for character " + getName() + "."); return false; } try (PreparedStatement ps = con.prepareStatement("INSERT INTO worldtransfers (characterid, `from`, `to`) VALUES (?, ?, ?)")){ ps.setInt(1, getId()); ps.setInt(2, getWorld()); ps.setInt(3, newWorld); ps.executeUpdate(); return true; } catch (SQLException e) { e.printStackTrace(); FilePrinter.printError(FilePrinter.WORLD_TRANSFER, e, "Failed to register world transfer for character " + getName() + "."); } } catch(SQLException e) { e.printStackTrace(); FilePrinter.printError(FilePrinter.WORLD_TRANSFER, e, "Failed to get DB connection."); } return false; }
Source:
<code>public void edit(final NewExternalSubnetModel subnet) { driver.edit(subnet); <START> if (subnet.getNetwork().getEntity() != null){ <END> networkEditor.asValueBox().setValue(subnet.getNetwork().getEntity().getName()); } }</code><technical_language>If mistaken, for subnet.getNetwork() null, drop check</technical_language>

Target:
public void edit(final NewExternalSubnetModel subnet) { driver.edit(subnet); networkEditor.asValueBox().setValue(subnet.getNetwork().getEntity().getName()); }
Source:
<code>public void prepare() throws Exception { <START> super.init(TestUserMode.SUPER_TENANT_USER); <END> }</code><technical_language>is super.init throwing parents class Exception? Whats throwing Exception init method</technical_language>

Target:
public void prepare() throws XPathExpressionException { super.init(TestUserMode.SUPER_TENANT_USER); }
Source:
<code>public void onBindViewHolder(@NonNull PatientAllergyRecyclerViewAdapter.ViewHolder holder, int position) { Allergy allergy = list.get(position); holder.allergen.setText(allergy.getAllergen().getCodedAllergen().getDisplay()); if (allergy.getComment().isEmpty()) { holder.comment.setText(ApplicationConstants.EMPTY_DASH_REPRESENTATION); } else { holder.comment.setText(allergy.getComment()); } if (allergy.getReactions().size() == 0) { holder.reaction.setText(ApplicationConstants.EMPTY_DASH_REPRESENTATION); } else { StringBuilder reactions = new StringBuilder(); for (int i = 0; i < allergy.getReactions().size() - 1; i++) { reactions.append(allergy.getReactions().get(i).getReaction().getDisplay()).append(", "); <START> } <END> reactions.append(allergy.getReactions().get(allergy.getReactions().size() - 1).getReaction().getDisplay()); holder.reaction.setText(reactions); } if (allergy.getSeverity() == null) { holder.severity.setText(ApplicationConstants.EMPTY_DASH_REPRESENTATION); } else { holder.severity.setText(allergy.getSeverity().getDisplay()); } }</code><technical_language>", " application constants @rishabh-997 ?</technical_language>

Target:
public void onBindViewHolder(@NonNull PatientAllergyRecyclerViewAdapter.ViewHolder holder, int position) { Allergy allergy = list.get(position); holder.allergen.setText(allergy.getAllergen().getCodedAllergen().getDisplay()); if (null == allergy.getComment() || allergy.getComment().isEmpty()) { holder.comment.setText(ApplicationConstants.EMPTY_DASH_REPRESENTATION); } else { holder.comment.setText(allergy.getComment()); } if (allergy.getReactions().size() == 0) { holder.reaction.setText(ApplicationConstants.EMPTY_DASH_REPRESENTATION); } else { StringBuilder reactions = new StringBuilder(); for (int i = 0; i < allergy.getReactions().size() - 1; i++) { reactions.append(allergy.getReactions().get(i).getReaction().getDisplay()).append(ApplicationConstants.COMMA_WITH_SPACE); } reactions.append(allergy.getReactions().get(allergy.getReactions().size() - 1).getReaction().getDisplay()); holder.reaction.setText(reactions); } if (allergy.getSeverity() == null) { holder.severity.setText(ApplicationConstants.EMPTY_DASH_REPRESENTATION); } else { holder.severity.setText(allergy.getSeverity().getDisplay()); } }
Source:
<code>public List<DatabaseEvent> getAllFailureMessages(String serviceType, Date startDate, Date endDate) { Session session = null; List<DatabaseEvent> events = null; try { final SessionFactory sessionFactory = getSessionFactory(); if (sessionFactory != null) { session = sessionFactory.openSession(); Criteria criteria = session.createCriteria(DatabaseEvent.class); criteria.add(Restrictions.eq(EVENT_TYPE_NAME, "MESSAGE_PROCESSING_FAILED")); if (startDate != null) { criteria.add(Restrictions.ge(DATE_NAME, startDate)); } if (endDate != null) { criteria.add(Restrictions.le(DATE_NAME, endDate)); } if (StringUtils.isNotBlank(serviceType)) { criteria.add(Restrictions.eq(SERVICE_TYPE, serviceType)); } <START> <END> } } catch (HibernateException e) { LOG.error("Exception getting failure messages caused by :{}", e.getLocalizedMessage(), e); } finally { GenericDBUtils.closeSession(session); } return events; }</code><technical_language>Need execute Query here</technical_language>

Target:
public List<DatabaseEvent> getAllFailureMessages(String serviceType, Date startDate, Date endDate) { Session session = null; List<DatabaseEvent> events = null; try { final SessionFactory sessionFactory = getSessionFactory(); if (sessionFactory != null) { session = sessionFactory.openSession(); Criteria criteria = session.createCriteria(DatabaseEvent.class); criteria.add(Restrictions.eq(EVENT_TYPE_NAME, "MESSAGE_PROCESSING_FAILED")); if (startDate != null) { criteria.add(Restrictions.ge(DATE_NAME, startDate)); } if (endDate != null) { criteria.add(Restrictions.le(DATE_NAME, endDate)); } if (StringUtils.isNotBlank(serviceType)) { criteria.add(Restrictions.eq(SERVICE_TYPE, serviceType)); } events = criteria.list(); } } catch (HibernateException e) { LOG.error("Exception getting failure messages caused by :{}", e.getLocalizedMessage(), e); } finally { GenericDBUtils.closeSession(session); } return events; }
Source:
<code>public void commit() throws IOException { close(); try { Files.move(tmpPath, destPath, StandardCopyOption.ATOMIC_MOVE); } catch (IOException e) { if (e instanceof AtomicMoveNotSupportedException) { LOGGER.log(Level.WARNING, "Atomic move not supported. falling back to non-atomic move.", e); } else { LOGGER.log(Level.WARNING, "Unable to move atomically, falling back to non-atomic move.", e); } if (destPath.toFile().exists()) { LOGGER.log(Level.INFO, "The target file {0} was already existing", destPath); } try { Files.move(tmpPath, destPath, StandardCopyOption.REPLACE_EXISTING); } catch (IOException e1) { <START> e.addSuppressed(e1); <END> LOGGER.log(Level.WARNING, "Unable to move {0} to {1}. Attempting to delete {0} and abandoning.", new Path[]{tmpPath, destPath}); try { Files.deleteIfExists(tmpPath); } catch (IOException e2) { e1.addSuppressed(e2); LOGGER.log(Level.WARNING, "Unable to delete {0}, good bye then!", tmpPath); throw e; } throw e; } } }</code><technical_language>this done in case AtomicMove is unsupported (e instanceof AtomicMoveNotSupportedException)- actual failure suppressed shown (not file systems support atomicMove attempts fail for some instances)</technical_language>

Target:
public void commit() throws IOException { close(); try { Files.move(tmpPath, destPath, StandardCopyOption.ATOMIC_MOVE); } catch (IOException moveFailed) { if (moveFailed instanceof AtomicMoveNotSupportedException) { LOGGER.log(Level.WARNING, "Atomic move not supported. falling back to non-atomic move.", moveFailed); } else { LOGGER.log(Level.WARNING, "Unable to move atomically, falling back to non-atomic move.", moveFailed); } if (destPath.toFile().exists()) { LOGGER.log(Level.INFO, "The target file {0} was already existing", destPath); } try { Files.move(tmpPath, destPath, StandardCopyOption.REPLACE_EXISTING); } catch (IOException replaceFailed) { replaceFailed.addSuppressed(moveFailed); LOGGER.log(Level.WARNING, "Unable to move {0} to {1}. Attempting to delete {0} and abandoning.", new Path[]{tmpPath, destPath}); try { Files.deleteIfExists(tmpPath); } catch (IOException deleteFailed) { replaceFailed.addSuppressed(deleteFailed); LOGGER.log(Level.WARNING, "Unable to delete {0}, good bye then!", tmpPath); throw replaceFailed; } throw replaceFailed; } } }
Source:
<code>public NextAction handleFailure(StateExecution execution) { if (handleFailureImpl(execution)) { return moveToState(schedule, "Failure handled successfully"); } <START> return moveToState(failed, "Requires manual fixing"); <END> }</code><technical_language>I if "ok" final state well</technical_language>

Target:
public NextAction handleFailure(StateExecution execution) { if (handleFailureImpl(execution)) { return moveToState(schedule, "Failure handled, rescheduling"); } return moveToState(failed, "Failure handling failed, stopping"); }