auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void navigatePrefix(final int offset) { <START> if (getSearchText() == lastSearch_ && lastResults_ != null) <END> { navigateSearchPrefix(offset); } else { server_.searchHistoryArchiveByPrefix( getSearchText(), 20, true, new HistoryCallback(getSearchText(), PopupMode.PopupNone) { @Override public void onResponseReceived(RpcObjectList<HistoryEntry> entries) { super.onResponseReceived(entries); navigateSearchPrefix(offset); } }); } }</code><technical_language>lastSearch_ null here</technical_language>

Target:
public void navigatePrefix(final int offset) { if (StringUtil.equals(getSearchText(), lastSearch_) && lastResults_ != null) { navigateSearchPrefix(offset); } else { server_.searchHistoryArchiveByPrefix( getSearchText(), 20, true, new HistoryCallback(getSearchText(), PopupMode.PopupNone) { @Override public void onResponseReceived(RpcObjectList<HistoryEntry> entries) { super.onResponseReceived(entries); navigateSearchPrefix(offset); } }); } }
Source:
<code>private void populateUsernameSuggestions(List<String> suggestions) { String usernameOrSelected = getUsernameOrSelected(); List<String> suggestionList = new ArrayList<>(); suggestionList.add(usernameOrSelected); for (String suggestion : suggestions) { if (!TextUtils.equals(suggestion, usernameOrSelected)) { suggestionList.add(suggestion); } } <START> mUsernamesAdapter = new UsernameChangerRecyclerViewAdapter(getActivity(), suggestionList); <END> mUsernamesAdapter.setOnUsernameSelectedListener(UsernameChangerFullScreenDialogFragment.this); mUsernamesAdapter.setSelectedItem(0); mUsernameSelectedIndex = 0; mUsernameSuggestions.setAdapter(mUsernamesAdapter); }</code><technical_language>opportunity reuse setUsernameSuggestions() setting mUsernameSelectedIndex = 0</technical_language>

Target:
private void populateUsernameSuggestions(List<String> suggestions) { String usernameOrSelected = getUsernameOrSelected(); List<String> suggestionList = new ArrayList<>(); suggestionList.add(usernameOrSelected); for (String suggestion : suggestions) { if (!TextUtils.equals(suggestion, usernameOrSelected)) { suggestionList.add(suggestion); } } mUsernameSelectedIndex = 0; setUsernameSuggestions(suggestionList); }
Source:
<code>public boolean isPassthrough() { if (isThresholdConfigured()) { InstanceCollectionPartitioner partitioner = getPartitioner(this, SimpleLog.NO_LOG); return !partitioner.usesReferences(); } <START> else if (isPartitionByFeatureTypeConfigured()) { <END> return false; } else { return true; } }</code><technical_language>isThresholdConfigured() isPartitionByFeatureTypeConfigured() true time? I move isPartitionByFeatureTypeConfigured() condition check</technical_language>

Target:
public boolean isPassthrough() { if (isPartitionByFeatureTypeConfigured()) { return false; } else if (isThresholdConfigured()) { InstanceCollectionPartitioner partitioner = getPartitioner(this, SimpleLog.NO_LOG); return !partitioner.usesReferences(); } else { return true; } }
Source:
<code><START> private ZkBaseDataAccessor(Builder builder) throws IOException, InvalidRoutingDataException { <END> switch (builder.realmMode) { case MULTI_REALM: _zkClient = new FederatedZkClient(builder.realmAwareZkConnectionConfig, builder.realmAwareZkClientConfig); break; case SINGLE_REALM: _zkClient = SharedZkClientFactory.getInstance() .buildZkClient(builder.realmAwareZkConnectionConfig.createZkConnectionConfig(), builder.realmAwareZkClientConfig.createHelixZkClientConfig()); break; default: throw new HelixException("Invalid RealmMode given: " + builder.realmMode); } _usesExternalZkClient = false; }</code><technical_language>move this constructor other public constructors</technical_language>

Target:
private ZkBaseDataAccessor(Builder builder) { switch (builder.realmMode) { case MULTI_REALM: try { if (builder.zkClientType == ZkClientType.DEDICATED) { _zkClient = DedicatedZkClientFactory.getInstance() .buildZkClient(builder.realmAwareZkConnectionConfig, builder.realmAwareZkClientConfig); } else if (builder.zkClientType == ZkClientType.SHARED) { _zkClient = SharedZkClientFactory.getInstance() .buildZkClient(builder.realmAwareZkConnectionConfig, builder.realmAwareZkClientConfig); } else { _zkClient = new FederatedZkClient(builder.realmAwareZkConnectionConfig, builder.realmAwareZkClientConfig); } } catch (IOException | InvalidRoutingDataException | IllegalStateException e) { throw new HelixException("Not able to connect on multi-realm mode.", e); } break; case SINGLE_REALM: if (builder.zkClientType == ZkClientType.DEDICATED) { _zkClient = DedicatedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(builder.zkAddress), builder.realmAwareZkClientConfig.createHelixZkClientConfig()); } else { _zkClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(builder.zkAddress), builder.realmAwareZkClientConfig.createHelixZkClientConfig()); _zkClient .waitUntilConnected(HelixZkClient.DEFAULT_CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS); } break; default: throw new HelixException("Invalid RealmMode given: " + builder.realmMode); } _usesExternalZkClient = false; }
Source:
<code>public MutableClock(Instant instant, ZoneId zone, TemporalAmount changeAmount) { assert instant != null : "instant may not be null"; assert zone != null : "zone may not be null"; <START> assert changeAmount != null : "changeAmount may not be null"; <END> this.instant = instant; this.zone = zone; this.changeAmount = changeAmount; }</code><technical_language>Java, work default. Objects.requireNonNull(instant, "instant null")</technical_language>

Target:
public MutableClock(Instant instant, ZoneId zone, TemporalAmount changeAmount) { this.instant = Objects.requireNonNull(instant,"instant may not be null"); this.zone = Objects.requireNonNull(zone, "zone may not be null"); this.changeAmount = Objects.requireNonNull(changeAmount, "changeAmount may not be null"); }
Source:
<code>public Response importRealm(final RealmRepresentation rep) { RealmManager realmManager = new RealmManager(session); AdminPermissions.realms(session, auth).requireCreateRealm(); logger.debugv("importRealm: {0}", rep.getRealm()); try { RealmModel realm = realmManager.getRealm(rep.getId()); if (realm == null) { realm = realmManager.getRealmByName(rep.getRealm()); } <START> if (realm == null) { <END> realm = realmManager.importRealm(rep); grantPermissionsToRealmCreator(realm); } URI location = AdminRoot.realmsUrl(session.getContext().getUri()).path(realm.getName()).build(); logger.debugv("imported realm success, sending back: {0}", location.toString()); return Response.created(location).build(); } catch (ModelDuplicateException e) { logger.error("Conflict detected", e); return ErrorResponse.exists("Conflict detected. See logs for details"); } catch (PasswordPolicyNotMetException e) { logger.error("Password policy not met for user " + e.getUsername(), e); if (session.getTransactionManager().isActive()) session.getTransactionManager().setRollbackOnly(); return ErrorResponse.error("Password policy not met. See logs for details", Response.Status.BAD_REQUEST); } }</code><technical_language>if realm is null (i.e. a realm id name exists in DB), imported. I this deserves a warning trace instead letting thinks realm imported</technical_language>

Target:
public Response importRealm(final RealmRepresentation rep) { RealmManager realmManager = new RealmManager(session); AdminPermissions.realms(session, auth).requireCreateRealm(); logger.debugv("importRealm: {0}", rep.getRealm()); try { RealmModel realm = realmManager.getRealm(rep.getId()); if (realm == null) { realm = realmManager.getRealmByName(rep.getRealm()); } if (realm == null) { realm = realmManager.importRealm(rep); grantPermissionsToRealmCreator(realm); } else { logger.debugv("Attempt to import realm that already exists: {0}", realm.getName()); } URI location = AdminRoot.realmsUrl(session.getContext().getUri()).path(realm.getName()).build(); logger.debugv("imported realm success, sending back: {0}", location.toString()); return Response.created(location).build(); } catch (ModelDuplicateException e) { logger.error("Conflict detected", e); return ErrorResponse.exists("Conflict detected. See logs for details"); } catch (PasswordPolicyNotMetException e) { logger.error("Password policy not met for user " + e.getUsername(), e); if (session.getTransactionManager().isActive()) session.getTransactionManager().setRollbackOnly(); return ErrorResponse.error("Password policy not met. See logs for details", Response.Status.BAD_REQUEST); } }
Source:
<code>public void addListener(AsyncCallback<Void> cb) { <START> if (finalAdded) { if (failed) { cb.onFailure(failedThrowable); } else if (remaining.isEmpty()) { cb.onSuccess(null); } else { listeners.add(cb); } } else { listeners.add(cb); } <END> }</code><technical_language>I this order, failed invoked immediately if final callback added. if (failed) { cb.onFailure(failedThrowable); } else if (finalAdded && remaining.isEmpty()) { cb.onSuccess(null); } else { listeners.add(cb); }</technical_language>

Target:
public void addListener(AsyncCallback<Void> cb) { if (!failed && finalAdded && remaining.isEmpty()) { cb.onSuccess(null); } else { handleAdd(cb).onSuccess(null); } }
Source:
<code>public void requestHandleOnCloseTest() throws IOException { <START> doRequestHandleTest(HttpMethod.POST, "close", true); <END> doRequestHandleTest(HttpMethod.GET, "close", true); doRequestHandleTest(HttpMethod.DELETE, "close", true); }</code><technical_language>declared constants in EchoMethodHandler</technical_language>

Target:
public void requestHandleOnCloseTest() throws IOException { doRequestHandleTest(HttpMethod.POST, EchoMethodHandler.CLOSE_URI, true); doRequestHandleTest(HttpMethod.GET, EchoMethodHandler.CLOSE_URI, true); doRequestHandleTest(HttpMethod.DELETE, EchoMethodHandler.CLOSE_URI, true); }
Source:
<code>public void onSaveClick() { editView.setError(null); if (call != null) { call.cancel(); } call = new DescriptionEditClient().request(pageTitle, editView.getDescription(), new DescriptionEditClient.Callback() { @Override public void success(@NonNull Call<DescriptionEdit> call) { <START> editView.setSaveState(false); <END> if (getActivity() != null) { DeviceUtil.hideSoftKeyboard(getActivity()); getActivity().finish(); } } @Override public void abusefilter(@NonNull Call<DescriptionEdit> call, boolean disallowed) { if (disallowed) { } else { } } @Override public void failure(@NonNull Call<DescriptionEdit> call, @NonNull Throwable caught) { editView.setSaveState(false); editView.setError(caught.getMessage()); } }); }</code><technical_language>I want this. I this save button reappear</technical_language>

Target:
public void onSaveClick() { editView.setError(null); editView.setSaveState(true); if (call != null) { call.cancel(); } call = new DescriptionEditClient().request(pageTitle, editView.getDescription(), new DescriptionEditClient.Callback() { @Override public void success(@NonNull Call<DescriptionEdit> call) { if (getActivity() != null) { DeviceUtil.hideSoftKeyboard(getActivity()); getActivity().finish(); } } @Override public void abusefilter(@NonNull Call<DescriptionEdit> call, boolean disallowed) { if (disallowed) { } else { } } @Override public void failure(@NonNull Call<DescriptionEdit> call, @NonNull Throwable caught) { editView.setSaveState(false); editView.setError(caught.getMessage()); } }); }
Source:
<code>public void testConnectATMode() throws Exception { PowerMockito.doReturn(XBeeMode.AT).when(xbeeDevice, "determineConnectionMode"); <START> <END> try { xbeeDevice.connect(); } catch (XBeeException e) { fail("This exception shouldn't be thrown now."); } catch (InvalidOperatingModeException e) { } assertEquals(xbeeDevice.getOperatingMode(), XBeeMode.AT); }</code><technical_language>check dataReader is running in XBee Device</technical_language>

Target:
public void testConnectATMode() throws Exception { PowerMockito.doReturn(OperatingMode.AT).when(xbeeDevice, "determineConnectionMode"); try { xbeeDevice.open(); } catch (XBeeException e) { fail("This exception shouldn't be thrown now."); } catch (InvalidOperatingModeException e) { } assertFalse(xbeeDevice.isOpen()); assertFalse(dataReader.isRunning()); assertEquals(xbeeDevice.getOperatingMode(), OperatingMode.AT); }
Source:
<code>public Quantity(String amount) { <START> AbstractMap.SimpleEntry<String, String> amountFormatPair = splitAmountAndFormat(amount); <END> this.amount = amountFormatPair.getKey(); this.format = amountFormatPair.getValue(); }</code><technical_language>If this is deserialize create a static factory/parser method of AbstractMap.SimpleEntry is here. * static Quantity parse(String formattedValue) { //... do parsing stuff return new Quantity(amountStr, formatStr); } If "intelligent" constructor is necessary, ditch AbstractMap.SimpleEntry parsed instance prefill new instance (kind of ugly too): final Quantity parsedQuantity = parse(amount); this(amount, format);</technical_language>

Target:
public Quantity(String amount) { Quantity parsedQuantity = parse(amount); this.amount = parsedQuantity.getAmount(); this.format = parsedQuantity.getFormat(); }
Source:
<code>public int hashCode() { final int prime = 31; int result = 1; result = prime * result + _curve.hashCode(); result = prime * result + _fixedCurve.hashCode(); <START> return result; <END> }</code><technical_language>_name included in this hash</technical_language>

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + _curve.hashCode(); result = prime * result + _fixedCurve.hashCode(); result = prime * result + _name.hashCode(); return result; }
Source:
<code>public void setInitializationData(IConfigurationElement config, String propertyName, Object data) { <START> Hashtable<String, String> parameters = (Hashtable<String, String>) data; <END> String profilingType = parameters .get(ProviderProfileConstants.INIT_DATA_TYPE_KEY); String configId = parameters .get(ProviderProfileConstants.INIT_DATA_CONFIG_ID_KEY); if (profilingType == null) { profilingType = ""; } if (configId == null) { configId = ""; } setLaunchConfigID(configId); setProfilingType(profilingType); }</code><technical_language>This cast Map<String,String></technical_language>

Target:
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) { Map<String, String> parameters = (Map<String, String>) data; String profilingType = parameters .get(ProviderProfileConstants.INIT_DATA_TYPE_KEY); String configId = parameters .get(ProviderProfileConstants.INIT_DATA_CONFIG_ID_KEY); if (profilingType == null) { profilingType = ""; } if (configId == null) { configId = ""; } setLaunchConfigID(configId); setProfilingType(profilingType); }
Source:
<code><START> private TemplateStoreInitializer <END> getTemplateStoreInitializer() { if (fJavaPluginInitializer == null) { fJavaPluginInitializer = new TemplateStoreInitializer(); fJavaPluginInitializer.activate(); } return fJavaPluginInitializer; }</code><technical_language>this synchronized</technical_language>

Target:
private synchronized TemplateStoreInitializer getTemplateStoreInitializer() { if (fJavaPluginInitializer == null) { fJavaPluginInitializer = new TemplateStoreInitializer(); fJavaPluginInitializer.activate(); } return fJavaPluginInitializer; }
Source:
<code>public void shouldReadAllLines() throws Exception { ExecutionContext executionContext = MetaDataInstanceFactory.createStepExecution().getExecutionContext(); final String inputFilePath = "/small20.vcf.gz"; String inputFile = VcfReaderTest.class.getResource(inputFilePath).getFile(); String fileId = "5"; String studyId = "7"; String studyName = "study name"; VariantSource source = new VariantSource(inputFile, fileId, studyId, studyName, VariantStudy.StudyType.COLLECTION, VariantSource.Aggregation.NONE); VcfReader vcfReader = new VcfReader(source, inputFile); vcfReader.setSaveState(false); vcfReader.open(executionContext); List<Variant> variants; int count = 0; while ((variants = vcfReader.read()) != null) { count++; } long actualCount = JobTestUtils.getLines(new GZIPInputStream(new FileInputStream(inputFile))); <START> assertEquals(actualCount, count); <END> }</code><technical_language>argument expected value</technical_language>

Target:
public void shouldReadAllLines() throws Exception { ExecutionContext executionContext = MetaDataInstanceFactory.createStepExecution().getExecutionContext(); final String inputFilePath = "/small20.vcf.gz"; String input = VcfReaderTest.class.getResource(inputFilePath).getFile(); String fileId = "5"; String studyId = "7"; String studyName = "study name"; VcfHeaderReader headerReader = new VcfHeaderReader(new File(input), fileId, studyId, studyName, VariantStudy.StudyType.COLLECTION, VariantSource.Aggregation.NONE); VariantSource source = headerReader.read(); VcfReader vcfReader = new VcfReader(source, input); vcfReader.setSaveState(false); vcfReader.open(executionContext); consumeReader(input, vcfReader); }
Source:
<code>void createWidget (int index) { super.createWidget (index); items = new TreeItem [4]; columns = new TreeColumn [4]; columnCount = 0; <START> if (OS.GTK_VERSION < OS.VERSION(3, 21, 0)) { <END> setFontDescription(defaultFont().handle); } }</code><technical_language>Generally check for GTK dev versions. GTK3.21 is a development version, this call GTK3.22</technical_language>

Target:
void createWidget (int index) { super.createWidget (index); items = new TreeItem [4]; columns = new TreeColumn [4]; columnCount = 0; if (OS.GTK_VERSION < OS.VERSION(3, 22, 0)) { setFontDescription(defaultFont().handle); } }
Source:
<code>private void executeBuildNoBusyCheck(final String type, final String subType) { workbenchContext_.setBuildInProgress(true); source_.withSaveFilesBeforeCommand(new Command() { @Override public void execute() { server_.startBuild(type, subType, new SimpleRequestCallback<Boolean>() { @Override public void onResponseReceived(Boolean response) { } @Override public void onError(ServerError error) { super.onError(error); workbenchContext_.setBuildInProgress(false); } }); } }, <START> new Command() { <END> public void execute() { } }, "Build"); }</code><technical_language>Another lambda-ing opportunity: source_.withSaveFilesBeforeCommand(() -> { server_.startBuild(type, subType, new SimpleRequestCallback<Boolean>() { @Override public void onResponseReceived(Boolean response) { } @Override public void onError(ServerError error) { super.onError(error); workbenchContext_.setBuildInProgress(false); } }); }, () -> {}, "Build");</technical_language>

Target:
private void executeBuildNoBusyCheck(final String type, final String subType) { workbenchContext_.setBuildInProgress(true); source_.withSaveFilesBeforeCommand(() -> { server_.startBuild(type, subType, new SimpleRequestCallback<Boolean>() { @Override public void onResponseReceived(Boolean response) { } @Override public void onError(ServerError error) { super.onError(error); workbenchContext_.setBuildInProgress(false); } }); }, () -> {}, "Build"); }
Source:
<code>private Result<TimeseriesResultValue> getNullTimeseriesResultValue(TimeseriesQuery query) { List<AggregatorFactory> aggregatorSpecs = query.getAggregatorSpecs(); Aggregator[] aggregators = new Aggregator[aggregatorSpecs.size()]; String[] aggregatorNames = new String[aggregatorSpecs.size()]; for (int i = 0; i < aggregatorSpecs.size(); i++) { aggregators[i] = aggregatorSpecs.get(i) .factorize(RowBasedColumnSelectorFactory.create(() -> new MapBasedRow( null, null ), null)); aggregatorNames[i] = aggregatorSpecs.get(i).getName(); } <START> TimeseriesResultBuilder bob = new TimeseriesResultBuilder(DateTimes.EPOCH); <END> for (int i = 0; i < aggregatorSpecs.size(); i++) { bob.addMetric(aggregatorNames[i], aggregators[i]); aggregators[i].close(); } return bob.build(); }</code><technical_language>I non-null, people expect for granularity: all. break stuff for null</technical_language>

Target:
private Result<TimeseriesResultValue> getNullTimeseriesResultValue(TimeseriesQuery query) { List<AggregatorFactory> aggregatorSpecs = query.getAggregatorSpecs(); Aggregator[] aggregators = new Aggregator[aggregatorSpecs.size()]; String[] aggregatorNames = new String[aggregatorSpecs.size()]; for (int i = 0; i < aggregatorSpecs.size(); i++) { aggregators[i] = aggregatorSpecs.get(i) .factorize(RowBasedColumnSelectorFactory.create(() -> new MapBasedRow( null, null ), null)); aggregatorNames[i] = aggregatorSpecs.get(i).getName(); } final DateTime start = query.getIntervals().isEmpty() ? DateTimes.EPOCH : query.getIntervals().get(0).getStart(); TimeseriesResultBuilder bob = new TimeseriesResultBuilder(start); for (int i = 0; i < aggregatorSpecs.size(); i++) { bob.addMetric(aggregatorNames[i], aggregators[i]); aggregators[i].close(); } return bob.build(); }
Source:
<code>protected abstract void processIncoming() throws IOException, ClientConnectionException; private void processHeartbeat() { int incoming = this.policy.getIncomingHeartbeat() / 2; if (!this.isInInit() && getHeartbeatTime() > incoming && this.half) { <START> log.info("There was no massege from " + getHostname() + " for " + incoming + " milliseconds"); <END> this.half = false; } if (!this.isInInit() && this.policy.isIncomingHeartbeat() && this.isIncomingHeartbeatExeeded()) { log.info("Heartbeat exceeded for " + getHostname() + " last message was " + getHeartbeatTime() + " milliseconds ago."); this.disconnect("Heartbeat exceeded"); } }</code><technical_language>warning instead: log.warn("No heartbeat message arrived host '{}' for ms.", getHostname(), incoming);</technical_language>

Target:
protected abstract void processIncoming() throws IOException, ClientConnectionException; private void processHeartbeat() { int incoming = this.policy.getIncomingHeartbeat() / 2; if (!this.isInInit() && getHeartbeatTime() > incoming && this.half) { log.info("No heartbeat message arrived from host '{}' for ms.", getHostname(), incoming); this.half = false; } if (!this.isInInit() && this.policy.isIncomingHeartbeat() && this.isIncomingHeartbeatExeeded()) { log.error("Heartbeat exceeded for host '{}', last response arrived ms ago.", getHostname(), getHeartbeatTime()); this.disconnect("Heartbeat exceeded"); } }
Source:
<code>public void executionStarted(final TestDescriptor testDescriptor) { String displayName = testDescriptor.getDisplayName(); if (testDescriptor.isTest()) { incrementTests(); } <START> else if (displayName.equals("A") || displayName.equals("B")) { <END> incrementClasses(); } }</code><technical_language>Is this if necessary</technical_language>

Target:
public void executionStarted(final TestDescriptor testDescriptor) { if (testDescriptor.isTest()) { incrementTests(); } else if (!testDescriptor.isRoot()) { incrementClasses(); } }
Source:
<code>public Boolean openDatabase() { DBMSConnectionProperties connectionProperties = new DBMSConnectionProperties(); connectionProperties.setType(selectedDBMSType.getValue()); connectionProperties.setHost(host.getValue()); connectionProperties.setPort(Integer.parseInt(port.getValue())); connectionProperties.setDatabase(database.getValue()); connectionProperties.setUser(user.getValue()); connectionProperties.setPassword(password.getValue()); connectionProperties.setUseSSL(useSSL.getValue()); connectionProperties.setKeyStore(keystore.getValue()); connectionProperties.setServerTimezone(serverTimezone.getValue()); setupKeyStore(); <START> Boolean connected = openSharedDatabase(connectionProperties); <END> return connected; }</code><technical_language>.. ..</technical_language>

Target:
public boolean openDatabase() { DBMSConnectionProperties connectionProperties = new DBMSConnectionProperties(); connectionProperties.setType(selectedDBMSType.getValue()); connectionProperties.setHost(host.getValue()); connectionProperties.setPort(Integer.parseInt(port.getValue())); connectionProperties.setDatabase(database.getValue()); connectionProperties.setUser(user.getValue()); connectionProperties.setPassword(password.getValue()); connectionProperties.setUseSSL(useSSL.getValue()); connectionProperties.setKeyStore(keystore.getValue()); connectionProperties.setServerTimezone(serverTimezone.getValue()); setupKeyStore(); boolean connected = openSharedDatabase(connectionProperties); return connected; }
Source:
<code>public TemplateDataset(NetcdfDatasetIF dataset, Set<String> requestedVariables, Map<String, ValueTemplate> attributeModifications, CalendarDateRange timeRange, Range verticalSubset, LatLonRect bbox) { this.globalAttributes = getGlobalAttributes(dataset, attributeModifications, timeRange, verticalSubset, bbox); List<NetcdfVariable> templateVariables = new ArrayList<>(); Map<String, Dimension> templateDimensions = new LinkedHashMap<>(); String timeDimension = dataset.getTimeAxis().getDimensionName(); for (NetcdfVariable variable: dataset.getVariables()) { <START> if (requestedVariables != null && !requestedVariables.contains(variable.getShortName())) { <END> continue; } TemplateVariable templateVariable = new TemplateVariable(variable, timeDimension); templateVariables.add(templateVariable); for (Dimension templateDimension: templateVariable.getDimensions()) { templateDimensions.put(templateDimension.getShortName(), templateDimension); } } List<Dimension> orderedTemplateDimensions = new ArrayList<>(); for (Dimension dimension: dataset.getDimensions()) { Dimension templateDimension = templateDimensions.get(dimension.getShortName()); if (templateDimension != null) { orderedTemplateDimensions.add(templateDimension); } } this.dimensions = new ArrayList<>(orderedTemplateDimensions); this.variables = new ArrayList<>(templateVariables); }</code><technical_language>Do Assert.equals(orderedTemplateDimensions.size(), dataset.getDimensions().size()); line 66 sense</technical_language>

Target:
public TemplateDataset(NetcdfDatasetIF dataset, Set<String> requestedVariables, Map<String, ValueTemplate> attributeModifications, CalendarDateRange timeRange, Range verticalSubset, LatLonRect bbox) { this.globalAttributes = getGlobalAttributes(dataset, attributeModifications, timeRange); List<NetcdfVariable> templateVariables = new ArrayList<>(); Map<String, Dimension> templateDimensions = new LinkedHashMap<>(); String timeDimension = dataset.getTimeAxis().getDimensionName(); for (NetcdfVariable variable: dataset.getVariables()) { if (requestedVariables != null && !requestedVariables.contains(variable.getShortName())) { continue; } TemplateVariable templateVariable = new TemplateVariable(variable, timeDimension); templateVariables.add(templateVariable); for (Dimension templateDimension: templateVariable.getDimensions()) { templateDimensions.put(templateDimension.getShortName(), templateDimension); } } List<Dimension> orderedTemplateDimensions = new ArrayList<>(); for (Dimension dimension: dataset.getDimensions()) { Dimension templateDimension = templateDimensions.get(dimension.getShortName()); if (templateDimension != null) { orderedTemplateDimensions.add(templateDimension); } } this.dimensions = new ArrayList<>(orderedTemplateDimensions); this.variables = new ArrayList<>(templateVariables); }
Source:
<code>public boolean existsVMReplica(ClaudiaData claudiaData, String tier, VM vm, String region) { try { String token = claudiaData.getUser().getToken(); String vdc = claudiaData.getVdc(); boolean exists = openStackUtil.existsServerForDelete(vm.getVmid(), region, token, vdc); if (!exists) { return false; } } catch (Exception e) { String errorMessage = "Error checking info from server " + vm.getVmid(); <START> log.error(errorMessage); <END> return false; } return true; }</code><technical_language>This log level "error", beacuse this method deleting instances and, in this case, expect this exception. create new review log levels</technical_language>

Target:
public boolean existsVMReplica(ClaudiaData claudiaData, String tier, VM vm, String region) { String token = claudiaData.getUser().getToken(); String vdc = claudiaData.getVdc(); boolean exists = openStackUtil.existsServerForDelete(vm.getVmid(), region, token, vdc); if (!exists) { return false; } return true; }
Source:
<code>protected void executeCommand() { if (getDiskImage() != null) { try { Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); VDSReturnValue vdsReturnValue = performImageVdsmOperation(); getReturnValue().getInternalVdsmTaskIdList().add( createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getStorageDomainId())); } catch (VdcBLLException e) { if (e.getErrorCode() == VdcBllErrors.ImageDoesNotExistInDomainError) { log.warnFormat("The image group with id {0} wasn't actually deleted from the storage domain {1} " + "because it didn't exist in it", getDiskImage().getId(), getStorageDomainId()); } <START> else if (isImageRemovedFromStorage()) { <END> log.infoFormat("The image group with id {0} was deleted from storage"); } else { throw e; } } if (getParameters().getParentCommand() != VdcActionType.RemoveVmFromImportExport && getParameters().getParentCommand() != VdcActionType.RemoveVmTemplateFromImportExport) { performImageDbOperations(); } } else { log.warn("DiskImage is null, nothing to remove"); } setSucceeded(true); }</code><technical_language>performImageDbOperations succeed if performImageVdsmOperation failed isImageRemovedFromStorage is true? if GetImagesList fails reach end result. discussed, I part able live situation (automatically overwriting whatever) reduce situations</technical_language>

Target:
protected void executeCommand() { if (getDiskImage() != null) { try { Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); VDSReturnValue vdsReturnValue = performImageVdsmOperation(); getReturnValue().getInternalVdsmTaskIdList().add( createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getStorageDomainId())); } catch (VdcBLLException e) { if (e.getErrorCode() == VdcBllErrors.ImageDoesNotExistInDomainError) { log.warnFormat("The image group with id {0} wasn't actually deleted from the storage domain {1} " + "because it didn't exist in it", getDiskImage().getId(), getStorageDomainId()); } else if (e.getErrorCode() == VdcBllErrors.ImageDeleteError && isImageRemovedFromStorage()) { log.infoFormat("The image group with id {0} was deleted from storage"); } else { throw e; } } if (getParameters().getParentCommand() != VdcActionType.RemoveVmFromImportExport && getParameters().getParentCommand() != VdcActionType.RemoveVmTemplateFromImportExport) { performImageDbOperations(); } } else { log.warn("DiskImage is null, nothing to remove"); } setSucceeded(true); }
Source:
<code>default CompletionStage<Void> prepareWithModifications(Transaction transaction, BatchModification batchModification) { <START> throw new UnsupportedOperationException("Store characteristic included " + Characteristic.TRANSACTIONAL + ", but it does not implement rollback"); <END> }</code><technical_language>Wrong method name in error message</technical_language>

Target:
default CompletionStage<Void> prepareWithModifications(Transaction transaction, BatchModification batchModification) { throw new UnsupportedOperationException("Store characteristic included " + Characteristic.TRANSACTIONAL + ", but it does not implement prepareWithModifications"); }
Source:
<code>public void getOrderGroupsByEncounter_shouldGetOrderGroupsFromAnEncounter() { Encounter existingEncounter = Context.getEncounterService().getEncounter(4); <START> List<OrderGroup> ordergroups1 = Context.getOrderService().getOrderGroupsByEncounter(existingEncounter); <END> assertEquals(1, ordergroups1.size()); }</code><technical_language>is reason for appending 1 variable name</technical_language>

Target:
public void getOrderGroupsByEncounter_shouldGetOrderGroupsFromAnEncounter() { Encounter existingEncounter = Context.getEncounterService().getEncounter(4); List<OrderGroup> ordergroups = Context.getOrderService().getOrderGroupsByEncounter(existingEncounter); assertEquals(1, ordergroups.size()); }
Source:
<code>public void performAction(SolrUpdateRequest updateRequest) throws IndexingException { Assert.notEmpty(updateRequest.getParams()); Map<String, String> params = updateRequest.getParams(); String staleTimestamp = params.get(STALE_TIMESTAMP); <START> if (StringUtils.isEmpty(staleTimestamp)) { <END> throw new IllegalArgumentException("Cannot cleanup stale children, no staleTimestamp provided"); } try { solrUpdateDriver.commit(); StringBuilder query = new StringBuilder(); if (getContentRootPid().equals(updateRequest.getPid())) { query.append("*:*"); } else { BriefObjectMetadata ancestorPathBean = getRootAncestorPath(updateRequest); query.append(solrSettings.getFieldName(SearchFieldKeys.ANCESTOR_PATH.name())).append(':') .append(SolrSettings.sanitize(ancestorPathBean.getPath().getSearchValue())); } query.append(" AND ").append(solrSettings.getFieldName(SearchFieldKeys.TIMESTAMP.name())) .append(":{* TO ").append(staleTimestamp).append("}"); solrUpdateDriver.deleteByQuery(query.toString()); } catch (Exception e) { throw new IndexingException("Error encountered in deleteStaleChildren for " + updateRequest.getTargetID(), e); } }</code><technical_language>spring framework for consistency, e.g., Assert.notNull(staleTimestamp)</technical_language>

Target:
public void performAction(SolrUpdateRequest updateRequest) throws IndexingException { Assert.notEmpty(updateRequest.getParams()); Map<String, String> params = updateRequest.getParams(); String staleTimestamp = params.get(STALE_TIMESTAMP); Assert.hasText(staleTimestamp, "Cannot cleanup stale children, no staleTimestamp provided"); try { solrUpdateDriver.commit(); StringBuilder query = new StringBuilder(); if (getContentRootPid().equals(updateRequest.getPid())) { query.append("*:*"); } else { BriefObjectMetadata ancestorPathBean = getRootAncestorPath(updateRequest); query.append(solrSettings.getFieldName(SearchFieldKeys.ANCESTOR_PATH.name())).append(':') .append(SolrSettings.sanitize(ancestorPathBean.getPath().getSearchValue())); } query.append(" AND ").append(solrSettings.getFieldName(SearchFieldKeys.TIMESTAMP.name())) .append(":{* TO ").append(staleTimestamp).append("}"); solrUpdateDriver.deleteByQuery(query.toString()); } catch (Exception e) { throw new IndexingException("Error encountered in deleteStaleChildren for " + updateRequest.getTargetID(), e); } }
Source:
<code>protected void initialize() { addWindowListener(new WindowAdapter() { @Override public void windowActivated(WindowEvent e) { <START> getMessageSender().cleanup(); <END> } @Override public void windowClosing(WindowEvent e) { getMessageSender().cleanup(); saveConfig(); } }); setContentPane(getWindowPanel()); }</code><technical_language>here, in HttpPanelSender(or ManualHttpRequestEditorDialog?) listen option change (OptionsChangedListener?) update button happens</technical_language>

Target:
protected void initialize() { addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { getMessageSender().cleanup(); saveConfig(); } }); setContentPane(getWindowPanel()); }
Source:
<code><START> public void load(File directory) throws ConfigurationException { <END> if (!directory.exists()) { throw new ConfigurationException(new FileNotFoundException( "The directory \"" + directory.getAbsolutePath() + "\" containing the configuration files doesn't " + "exist.")); } File[] files = directory.listFiles(); if (files != null) { sort(files); for (File file : files) { if (file.getName().endsWith(".properties")) { loadFile(file); } } } }</code><technical_language>I unsure need accept File parameter, load locations... engine local config /etc location /usr location</technical_language>

Target:
private void load(File directory) throws ConfigurationException { if (!directory.exists()) { throw new ConfigurationException(new FileNotFoundException( "The directory \"" + directory.getAbsolutePath() + "\" containing the configuration files doesn't " + "exist.")); } File[] files = directory.listFiles(); if (files != null) { sort(files); for (File file : files) { if (file.getName().endsWith(".properties")) { loadFile(file); } } } }
Source:
<code>private void saveState(Bundle outState) { outState.putBoolean("pausedZeroEnabledState", isZeroEnabled); <START> outState.putString("pausedZeroConfig", GsonMarshaller.marshal(currentZeroConfig)); <END> outState.putBoolean("isSearching", isSearching()); outState.putString(LANGUAGE_CODE_BUNDLE_KEY, app.getAppOrSystemLanguageCode()); }</code><technical_language>this type adapter needs support write</technical_language>

Target:
private void saveState(Bundle outState) { outState.putBoolean("isSearching", isSearching()); outState.putString(LANGUAGE_CODE_BUNDLE_KEY, app.getAppOrSystemLanguageCode()); }
Source:
<code>public boolean equals(Object obj) { if (!(obj instanceof GlusterHookEntity)) { return false; } GlusterHookEntity hook = (GlusterHookEntity) obj; if (!(getId().equals(hook.getId()) && clusterId.equals(hook.getClusterId()) && glusterCommand.equals(hook.getGlusterCommand()) && stage == hook.getStage() && name.equals(hook.getName()) && contentType == hook.getContentType() && conflictStatus == hook.getConflictStatus() && checksum.equals(hook.getChecksum()) <START> && status == hook.getStatus())) { <END> return false; } return true; }</code><technical_language>For string variables name, checksum, etc., please consider ObjectUtils.objectsEqual(), handles cases of objects null</technical_language>

Target:
public boolean equals(Object obj) { if (!(obj instanceof GlusterHookEntity)) { return false; } GlusterHookEntity hook = (GlusterHookEntity) obj; if (!(ObjectUtils.objectsEqual(getId(),hook.getId()) && ObjectUtils.objectsEqual(clusterId,hook.getClusterId()) && ObjectUtils.objectsEqual(glusterCommand,hook.getGlusterCommand()) && stage == hook.getStage() && ObjectUtils.objectsEqual(name,hook.getName()) && contentType == hook.getContentType() && ObjectUtils.objectsEqual(conflictStatus,hook.getConflictStatus()) && ObjectUtils.objectsEqual(checksum,hook.getChecksum()) && status == hook.getStatus())) { return false; } return true; }
Source:
<code><START> protected static void configNestedHVSupport(VirtualMachineMO vmMo, VirtualMachineTO vmSpec, VirtualMachineConfigSpec vmConfigSpec) throws Exception { <END> VmwareContext context = vmMo.getContext(); if ("true".equals(vmSpec.getDetails().get(VmDetailConstants.NESTED_VIRTUALIZATION_FLAG))) { if (s_logger.isDebugEnabled()) s_logger.debug("Nested Virtualization enabled in configuration, checking hypervisor capability"); ManagedObjectReference hostMor = vmMo.getRunningHost().getMor(); ManagedObjectReference computeMor = context.getVimClient().getMoRefProp(hostMor, "parent"); ManagedObjectReference environmentBrowser = context.getVimClient().getMoRefProp(computeMor, "environmentBrowser"); HostCapability hostCapability = context.getService().queryTargetCapabilities(environmentBrowser, hostMor); Boolean nestedHvSupported = hostCapability.isNestedHVSupported(); if (nestedHvSupported == null) { s_logger.warn("Hypervisor doesn't support nested virtualization, unable to set config for VM " + vmSpec.getName()); } else if (nestedHvSupported.booleanValue()) { s_logger.debug("Hypervisor supports nested virtualization, enabling for VM " + vmSpec.getName()); vmConfigSpec.setNestedHVEnabled(true); } else { s_logger.warn("Hypervisor doesn't support nested virtualization, unable to set config for VM " + vmSpec.getName()); vmConfigSpec.setNestedHVEnabled(false); } } }</code><technical_language>This method need static</technical_language>

Target:
protected void configNestedHVSupport(VirtualMachineMO vmMo, VirtualMachineTO vmSpec, VirtualMachineConfigSpec vmConfigSpec) throws Exception { VmwareContext context = vmMo.getContext(); if ("true".equals(vmSpec.getDetails().get(VmDetailConstants.NESTED_VIRTUALIZATION_FLAG))) { if (s_logger.isDebugEnabled()) s_logger.debug("Nested Virtualization enabled in configuration, checking hypervisor capability"); ManagedObjectReference hostMor = vmMo.getRunningHost().getMor(); ManagedObjectReference computeMor = context.getVimClient().getMoRefProp(hostMor, "parent"); ManagedObjectReference environmentBrowser = context.getVimClient().getMoRefProp(computeMor, "environmentBrowser"); HostCapability hostCapability = context.getService().queryTargetCapabilities(environmentBrowser, hostMor); Boolean nestedHvSupported = hostCapability.isNestedHVSupported(); if (nestedHvSupported == null) { s_logger.warn("Hypervisor doesn't support nested virtualization, unable to set config for VM " + vmSpec.getName()); } else if (nestedHvSupported.booleanValue()) { s_logger.debug("Hypervisor supports nested virtualization, enabling for VM " + vmSpec.getName()); vmConfigSpec.setNestedHVEnabled(true); } else { s_logger.warn("Hypervisor doesn't support nested virtualization, unable to set config for VM " + vmSpec.getName()); vmConfigSpec.setNestedHVEnabled(false); } } }
Source:
<code>protected void parseHeader(BufferedReader reader, String groupSep) throws IOException { splitNextLine(reader, groupSep) .map(parts -> { int count = parts.length; if (count < 3) throw new IllegalArgumentException("Expected at least 2 columns, got: " + count); groupNames.clear(); for (int i = 1; i < count - 1; i++) { <START> groupNames.add(parts[i]); <END> } return groupNames; }). orElseThrow(() -> new IllegalArgumentException("No header line")); }</code><technical_language>Replace for loop addAll method example: public void makeCopies(String[] source) { this.array = Arrays.copyOf(source, source.length); Collections.addAll(this.list, source); }</technical_language>

Target:
protected void parseHeader(BufferedReader reader, String groupSep) throws IOException { splitNextLine(reader, groupSep) .map(parts -> Collections.addAll(groupNames, stripHeadAndTail(parts))) .orElseThrow(() -> new IllegalArgumentException("No header line")); }
Source:
<code>public void testDefaultTimeOfMeetingIs30Minutes() { ExcelReader excelReader = new ExcelReader(EXCEL_INPUT_DATA); List<Map<String, String>> meetingData = excelReader.getMapValues("MeetingData"); String organizer = meetingData.get(0).get("Organizer"); String subject = meetingData.get(0).get("Subject"); String attendee = meetingData.get(0).get("Attendee"); String body = meetingData.get(0).get("Body"); HomeTabletPage homePage = new HomeTabletPage(); SchedulePage schedulePage = homePage.clickScheduleBtn(); int durationMeeting = schedulePage.setOrganizerTxtBox(organizer) .setSubjectTxtBox(subject) .setAttendeeTxtBoxPressingEnter(attendee) .setBodyTxtBox(body) .getDurationOfMeetingByDefault(); <START> Assert.assertEquals(30, durationMeeting); <END> }</code><technical_language>Assert structure is Assert.assertEqual("actual","expected") please check this in of test cases</technical_language>

Target:
public void testDefaultTimeOfMeetingIs30Minutes() { HomeTabletPage homeTabletPage = new HomeTabletPage(); SchedulePage schedulePage = homeTabletPage.clickScheduleBtn(); Assert.assertEquals(schedulePage.getDurationOfMeetingByDefault(), 30); }
Source:
<code>private FileAssetDto convertFileResourceToDto(AttachResource resource){ <START> FileAssetDto.FileAssetDtoBuilder builder = FileAssetDto.builder() <END> .id(resource.getId()) .name(resource.getMasterFileName()) .description(resource.getDescription()) .createdAt(resource.getCreationDate()) .updatedAt(resource.getLastModified()) .group(resource.getMainGroup()) .path(resource.getAttachPath()) .size(resource.getDefaultInstance().getFileLength()); for (Category category : resource.getCategories()) { builder.category(category.getCode()); } return builder.build(); }</code><technical_language>nice</technical_language>

Target:
private FileAssetDto convertFileResourceToDto(AttachResource resource){ return FileAssetDto.builder() .id(resource.getId()) .name(resource.getMasterFileName()) .description(resource.getDescription()) .createdAt(resource.getCreationDate()) .updatedAt(resource.getLastModified()) .group(resource.getMainGroup()) .path(resource.getAttachPath()) .size(resource.getDefaultInstance().getFileLength()) .categories(resource.getCategories().stream() .map(Category::getCode).collect(Collectors.toList())) .build(); }
Source:
<code>private User getUser() { <START> UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); <END> User user = runAsSystem(() -> userService.getUser(userDetails.getUsername())); if (user != null) { return user; } else { throw new UsernameNotFoundException("Can't find user: [" + userDetails.getUsername() + "]"); } }</code><technical_language>SecurityUtils.getCurrentUsername()</technical_language>

Target:
private User getUser() { User user = userService.getUser(SecurityUtils.getCurrentUsername()); if (user != null) { return user; } else { throw new UsernameNotFoundException("Can't find user: [" + SecurityUtils.getCurrentUsername() + "]"); } }
Source:
<code>private ServerBootstrap serverBootstrap() { return new ServerBootstrap() .group(this.bossGroup, this.childGroup) .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(logLevel)) .option(ChannelOption.SO_BACKLOG, 128) <START> .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) <END> .childHandler(this.channelInitializer(true)) .childOption(ChannelOption.SO_KEEPALIVE, true) .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) .validate(); }</code><technical_language>is right add a task for migrating PooledByteAllocator, benchmark it. I benchmarking task if want</technical_language>

Target:
private ServerBootstrap serverBootstrap() { return new ServerBootstrap() .group(this.bossGroup, this.childGroup) .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(logLevel)) .option(ChannelOption.SO_BACKLOG, 128) .childHandler(this.channelInitializer(true)) .childOption(ChannelOption.SO_KEEPALIVE, true) .validate(); }
Source:
<code>private InstructorAttributes extractUpdatedInstructor(String courseId, InstructorCreateRequest instructorRequest) { String instructorRole = instructorRequest.getRoleName(); String displayedName = instructorRequest.getDisplayName(); if (displayedName == null || displayedName.isEmpty()) { displayedName = InstructorAttributes.DEFAULT_DISPLAY_NAME; } instructorRole = SanitizationHelper.sanitizeName(instructorRole); <START> displayedName = SanitizationHelper.sanitizeName(displayedName); <END> InstructorAttributes instructorToEdit = updateBasicInstructorAttributes(courseId, instructorRequest.getId(), instructorRequest.getName(), instructorRequest.getEmail(), instructorRole, instructorRequest.getIsDisplayedToStudent(), displayedName); if (instructorRole.equals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_CUSTOM)) { updateInstructorCourseLevelPrivileges(instructorToEdit); } updateInstructorWithSectionLevelPrivileges(courseId, instructorToEdit); instructorToEdit.privileges.validatePrivileges(); return instructorToEdit; }</code><technical_language>This part issue before, sanitizer is called updateBasicInstructorAttributes</technical_language>

Target:
private InstructorAttributes extractUpdatedInstructor(String courseId, InstructorCreateRequest instructorRequest) { InstructorAttributes instructorToEdit = retrieveEditedInstructor(courseId, instructorRequest.getId(), instructorRequest.getName(), instructorRequest.getEmail(), instructorRequest.getRoleName(), instructorRequest.getIsDisplayedToStudent(), instructorRequest.getDisplayName()); if (instructorToEdit.getRole().equals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_CUSTOM)) { updateInstructorCourseLevelPrivileges(instructorToEdit); } updateInstructorWithSectionLevelPrivileges(courseId, instructorToEdit); instructorToEdit.privileges.validatePrivileges(); return instructorToEdit; }