auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onPostChanged(OnPostChanged event) { switch (event.causeOfChange) { case FETCH_POSTS: case FETCH_PAGES: mIsFetchingPosts = false; if (!isAdded()) { return; } setRefreshing(false); hideLoadMoreProgress(); if (!event.isError()) { mCanLoadMorePosts = event.canLoadMore; <START> int count; <END> if (mIsPage) { count = mPostStore.getPagesCountForSite(mSite); } else { count = mPostStore.getPostsCountForSite(mSite); } if (count > 0) { hideEmptyView(); } else { if (NetworkUtils.isNetworkAvailable(getActivity())) { updateEmptyView(EmptyViewMessageType.NO_CONTENT); } else { updateEmptyView(EmptyViewMessageType.NETWORK_ERROR); } } loadPosts(LoadMode.IF_CHANGED); } else { PostError error = event.error; switch (error.type) { case UNAUTHORIZED: updateEmptyView(EmptyViewMessageType.PERMISSION_ERROR); break; default: updateEmptyView(EmptyViewMessageType.GENERIC_ERROR); break; } } break; case DELETE_POST: if (event.isError()) { String message = String.format(getText(R.string.error_delete_post).toString(), mIsPage ? "page" : "post"); ToastUtils.showToast(getActivity(), message, ToastUtils.Duration.SHORT); loadPosts(LoadMode.IF_CHANGED); } break; } }</code><technical_language>Do mind explaining changes in publishPost, I completely fix. I count 0 is published though, completely sure. I showing empty view while publishing either. I feel updating view this async action this is a dynamic page lots happen while a network call is done, prefer handle of callbacks if possible. reasoning changes, I missing something</technical_language>

Target:
public void onPostChanged(OnPostChanged event) { switch (event.causeOfChange) { case FETCH_POSTS: case FETCH_PAGES: mIsFetchingPosts = false; if (!isAdded()) { return; } setRefreshing(false); hideLoadMoreProgress(); if (!event.isError()) { mCanLoadMorePosts = event.canLoadMore; loadPosts(LoadMode.IF_CHANGED); } else { PostError error = event.error; switch (error.type) { case UNAUTHORIZED: updateEmptyView(EmptyViewMessageType.PERMISSION_ERROR); break; default: updateEmptyView(EmptyViewMessageType.GENERIC_ERROR); break; } } break; case DELETE_POST: if (event.isError()) { String message = String.format(getText(R.string.error_delete_post).toString(), mIsPage ? "page" : "post"); ToastUtils.showToast(getActivity(), message, ToastUtils.Duration.SHORT); loadPosts(LoadMode.IF_CHANGED); } break; } }
Source:
<code>public OtpCredentialLoader(String credentialName, String algorithmAttributeName, String hashAttributeName, String seedAttributeName, String sequenceAttributeName) { <START> Assert.assertNotNull(credentialName); <END> Assert.assertNotNull(algorithmAttributeName); Assert.assertNotNull(hashAttributeName); Assert.assertNotNull(seedAttributeName); Assert.assertNotNull(sequenceAttributeName); this.myCredentialName = credentialName; this.algorithmAttributeName = algorithmAttributeName; this.hashAttributeName = hashAttributeName; this.seedAttributeName = seedAttributeName; this.sequenceAttributeName = sequenceAttributeName; }</code><technical_language>I write this code assertNotNull validate a parameter a public constructor method. checkNotNullParam instead</technical_language>

Target:
public OtpCredentialLoader(String credentialName, String algorithmAttributeName, String hashAttributeName, String seedAttributeName, String sequenceAttributeName) { Assert.checkNotNullParam("credentialName", credentialName); Assert.checkNotNullParam("algorithmAttributeName", algorithmAttributeName); Assert.checkNotNullParam("hashAttributeName", hashAttributeName); Assert.checkNotNullParam("seedAttributeName", seedAttributeName); Assert.checkNotNullParam("sequenceAttributeName", sequenceAttributeName); this.myCredentialName = credentialName; this.algorithmAttributeName = algorithmAttributeName; this.hashAttributeName = hashAttributeName; this.seedAttributeName = seedAttributeName; this.sequenceAttributeName = sequenceAttributeName; }
Source:
<code>private static String getCanonicalName(String account, String shareName, String filePath) { return ImplUtils.isNullOrEmpty(filePath) <START> ? String.format("/file/%s/%s/%s",account, shareName, filePath.replace("\\", "/")) <END> : String.format("/file/%s/%s",account, shareName); }</code><technical_language>suggestion ? String.format("/file/%s/%s/%s", account, shareName, filePath.replace("\\", "/"))</technical_language>

Target:
private static String getCanonicalName(String account, String shareName, String filePath) { return !ImplUtils.isNullOrEmpty(filePath) ? String.format("/file/%s/%s/%s", account, shareName, filePath.replace("\\", "/")) : String.format("/file/%s/%s", account, shareName); }
Source:
<code>private String getGcLogFileLocation() { String fileLocation; <START> if(!isJava8OrBelow()) { <END> String gcLogSwitch = vmArgumentFinder.findVmArgument(GCLOGS_JRE9_SWITCH); if (gcLogSwitch == null) { LOGGER.fine("No GC Logging switch found, cannot collect gc logging files."); fileLocation = null; } else { Matcher fileLocationMatcher = Pattern.compile(GCLOGS_JRE9_LOCATION).matcher(gcLogSwitch); if(fileLocationMatcher.matches()) { fileLocation = fileLocationMatcher.group("location"); } else { LOGGER.fine("No GC Logging custom file location found."); fileLocation = null; } } } else { String gcLogSwitch = vmArgumentFinder.findVmArgument(GCLOGS_JRE_SWITCH); if (gcLogSwitch == null) { LOGGER.fine("No GC Logging switch found, cannot collect gc logging files."); fileLocation = null; } else { fileLocation = gcLogSwitch.substring(GCLOGS_JRE_SWITCH.length()); } } return fileLocation; }</code><technical_language>I tend prefer main branches for "positive" value, I confusing. WDYT</technical_language>

Target:
private String getGcLogFileLocation() { String fileLocation; if(isJava8OrBelow()) { String gcLogSwitch = vmArgumentFinder.findVmArgument(GCLOGS_JRE_SWITCH); if (gcLogSwitch == null) { LOGGER.fine("No GC Logging switch found, cannot collect gc logging files."); fileLocation = null; } else { fileLocation = gcLogSwitch.substring(GCLOGS_JRE_SWITCH.length()); } } else { String gcLogSwitch = vmArgumentFinder.findVmArgument(GCLOGS_JRE9_SWITCH); if (gcLogSwitch == null) { LOGGER.fine("No GC Logging switch found, cannot collect gc logging files."); fileLocation = null; } else { Matcher fileLocationMatcher = Pattern.compile(GCLOGS_JRE9_LOCATION).matcher(gcLogSwitch); if(fileLocationMatcher.matches()) { fileLocation = fileLocationMatcher.group("location"); } else { LOGGER.fine("No GC Logging custom file location found."); fileLocation = null; } } } return fileLocation; }
Source:
<code>public int purgeCatalog(long expirationTime, int maxSize) { int n = 0; try { <START> log.debug("purging.. '{}' tasks ended almost seconds ago.", maxSize, expirationTime); <END> n = tapeRecallDAO.purgeCompletedTasks(expirationTime, maxSize); } catch (DataAccessException e) { log.error("Unable to takeover a task {}", e); } return n; }</code><technical_language>purging completed recall tasks older seconds</technical_language>

Target:
public int purgeCatalog(long expirationTime, int maxSize) { log.debug("purging '{}' completed tasks older than '{}' seconds ...", maxSize, expirationTime); try { return tapeRecallDAO.purgeCompletedTasks(expirationTime, maxSize); } catch (DataAccessException e) { log.error("Unable to takeover a task {}", e); return 0; } }
Source:
<code>public static MoreLikeThisQueryBuilder.Item[] getItems(Object value) { RepositoryManager rm = Framework.getService(RepositoryManager.class); String repo = rm.getDefaultRepository().getName(); ElasticSearchAdmin esa = Framework.getService(ElasticSearchAdmin.class); String esIndex = esa.getIndexNameForRepository(repo); String[] values; if (value instanceof Object[]) { values = (String[]) value; } else { values = new String[] { (String) value }; } MoreLikeThisQueryBuilder.Item[] ret = new MoreLikeThisQueryBuilder.Item[values.length]; for (int i = 0; i < values.length; i++) { <START> ret[i] = new MoreLikeThisQueryBuilder.Item(esIndex, DOC_TYPE, values[i]); <END> } return ret; }</code><technical_language>i put this method a static public. start this a method of org.nuxeo.elasticsearch.query.NxqlQueryConverter class i moved i wondering front compatibility this i put in NxqlConverter class /** * @deprecated 11.1. {@link MoreLikeThisESHintQueryBuilder#getItems(Object)} instead. */ @Deprecated protected static MoreLikeThisQueryBuilder.Item[] getItems(Object value) { return MoreLikeThisESHintQueryBuilder.getItems(value); }</technical_language>

Target:
public static MoreLikeThisQueryBuilder.Item[] getItems(Object value) { RepositoryManager rm = Framework.getService(RepositoryManager.class); String repo = rm.getDefaultRepository().getName(); ElasticSearchAdmin esa = Framework.getService(ElasticSearchAdmin.class); String esIndex = esa.getIndexNameForRepository(repo); String[] values; if (value instanceof String[]) { values = (String[]) value; } else { values = new String[] { (String) value }; } MoreLikeThisQueryBuilder.Item[] ret = new MoreLikeThisQueryBuilder.Item[values.length]; for (int i = 0; i < values.length; i++) { ret[i] = new MoreLikeThisQueryBuilder.Item(esIndex, DOC_TYPE, values[i]); } return ret; }
Source:
<code>public Session cassandraSession() { log.debug("Creating Spring Bean for cassandra session"); Session session; try { session = Cluster.builder().addContactPoints(configurationContext.getCassandraHostsQuorum().split(",")) <START> .withPort(9042) <END> .build().connect(); } catch (Exception e) { session = null; } return session; }</code><technical_language>Port in configuration</technical_language>

Target:
public Session cassandraSession() { log.debug("Creating Spring Bean for cassandra session"); Session session; try { session = Cluster.builder().addContactPoints(configurationContext.getCassandraHostsQuorum().split(",")) .withPort(configurationContext.getCassandraPort()) .build().connect(); } catch (Exception e) { session = null; } return session; }
Source:
<code><START> public void setup() throws ConnectionException { <END> context = new AstyanaxContext.Builder() .forCluster(CLUSTER_NAME) .forKeyspace(KEYSPACE_NAME) .withAstyanaxConfiguration(new AstyanaxConfigurationImpl() .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE) .setConnectionPoolType(ConnectionPoolType.ROUND_ROBIN) .setCqlVersion("3.0.0") .setTargetCassandraVersion("1.2") ) .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("Atlas") .setPort(PORT) .setMaxBlockedThreadsPerHost(CLIENT_THREADS) .setMaxConnsPerHost(CLIENT_THREADS) .setMaxConns(CLIENT_THREADS * 5) .setConnectTimeout(CONNECTION_TIMEOUT) .setSeeds(SEEDS) ) .withConnectionPoolMonitor(new CountingConnectionPoolMonitor()) .buildKeyspace(ThriftFamilyFactory.getInstance()); context.start(); cqlStatement = context.getClient().prepareCqlStatement(); store = new CassandraEquivalenceSummaryStore(context, 1000); }</code><technical_language>throws Exception for JUnit methods</technical_language>

Target:
public void setup() throws Exception { context = new AstyanaxContext.Builder() .forCluster(CLUSTER_NAME) .forKeyspace(KEYSPACE_NAME) .withAstyanaxConfiguration(new AstyanaxConfigurationImpl() .setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE) .setConnectionPoolType(ConnectionPoolType.ROUND_ROBIN) .setCqlVersion("3.0.0") .setTargetCassandraVersion("1.2") ) .withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("Atlas") .setPort(PORT) .setMaxBlockedThreadsPerHost(CLIENT_THREADS) .setMaxConnsPerHost(CLIENT_THREADS) .setMaxConns(CLIENT_THREADS * 5) .setConnectTimeout(CONNECTION_TIMEOUT) .setSeeds(SEEDS) ) .withConnectionPoolMonitor(new CountingConnectionPoolMonitor()) .buildKeyspace(ThriftFamilyFactory.getInstance()); context.start(); cqlStatement = context.getClient().prepareCqlStatement(); store = new CassandraEquivalenceSummaryStore(context, 1000); }
Source:
<code>public String getFirstName() { <START> return sanitizeText(rawData.optString(CONTACT_FIELDS[1])); <END> }</code><technical_language>a constant FIRST_NAME? (just LAST_NAME)</technical_language>

Target:
public String getFirstName() { return sanitizeText(rawData.optString(FIRST_NAME)); }
Source:
<code>public void shouldAllowProcessorToProcessApiRequestFromPlugin() throws Exception { String api = "api-uri"; GoPluginApiRequestProcessor processor = mock(GoPluginApiRequestProcessor.class); GoApiRequest goApiRequest = mock(GoApiRequest.class); when(goApiRequest.api()).thenReturn(api); DefaultGoApplicationAccessor goApplicationAccessor = new DefaultGoApplicationAccessor(); goApplicationAccessor.registerProcessorFor(api, processor); <START> processor.process(goApiRequest); <END> verify(processor).process(goApiRequest); }</code><technical_language>Hmm. This test wrong. a processor.process() method called "processor" mock. Then, a verification mock. So, fail. this test call goApplicationAccessor.submit() method something, verify sense</technical_language>

Target:
public void shouldAllowProcessorToProcessApiRequestFromPlugin() throws Exception { String api = "api-uri"; GoPluginApiRequestProcessor processor = mock(GoPluginApiRequestProcessor.class); GoApiRequest goApiRequest = mock(GoApiRequest.class); when(goApiRequest.api()).thenReturn(api); DefaultGoApplicationAccessor goApplicationAccessor = new DefaultGoApplicationAccessor(); goApplicationAccessor.registerProcessorFor(api, processor); goApplicationAccessor.submit(goApiRequest); verify(processor).process(goApiRequest); }
Source:
<code><START> public void updateEditorPages(int activatedPage) { <END> removeAllPages(); addPages(); if (backToActivePage > 0 && backToActivePage < this.getPageCount()) { setActivePage(backToActivePage); } else { setActivePage(0); } setPartName(getPartName()); }</code><technical_language>activatedPage is anymore</technical_language>

Target:
public void updateEditorPages(int activatedPage) { updateEditorPages(); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.simple_drawee_view); mSimpleDraweeView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { <START> AnimatedDrawableSupport animatable = (AnimatedDrawableSupport)mSimpleDraweeView.getController().getAnimatable(); <END> if (animatable.isRunning()) { animatable.pause(); } else { animatable.start(); } } }); final EditText editText = (EditText) findViewById(R.id.uri_edit_text); editText.setOnEditorActionListener( new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { final boolean isEnterKeyDown = (actionId == EditorInfo.IME_NULL) && (event.getAction() == KeyEvent.ACTION_DOWN); if (isEnterKeyDown || actionId == EditorInfo.IME_ACTION_DONE) { updateImageUri(Uri.parse(v.getText().toString())); } return false; } }); final Button clearButton = (Button) findViewById(R.id.clear_uri); clearButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editText.getText().clear(); } }); }</code><technical_language>This is necessarily AnimatedDrawableSupport, AnimatedDrawable. cast this AbstractAnimatedDrawable instead</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mSimpleDraweeView = (SimpleDraweeView) findViewById(R.id.simple_drawee_view); mSimpleDraweeView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AnimatedDrawable animatable = (AnimatedDrawable)mSimpleDraweeView.getController().getAnimatable(); if (animatable.isRunning()) { animatable.pause(); } else { animatable.start(); } } }); final EditText editText = (EditText) findViewById(R.id.uri_edit_text); editText.setOnEditorActionListener( new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { final boolean isEnterKeyDown = (actionId == EditorInfo.IME_NULL) && (event.getAction() == KeyEvent.ACTION_DOWN); if (isEnterKeyDown || actionId == EditorInfo.IME_ACTION_DONE) { updateImageUri(Uri.parse(v.getText().toString())); } return false; } }); final Button clearButton = (Button) findViewById(R.id.clear_uri); clearButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editText.getText().clear(); } }); }
Source:
<code>public void updateFormTitle(Form form, ISelection selection) { if (selection instanceof IStructuredSelection) { boolean semanticElementFound = false; IStructuredSelection structuredSelection = (IStructuredSelection) selection; Object element = structuredSelection.getFirstElement(); if (element != null) { SiriusInputDescriptor inputDescriptor = new SiriusInputDescriptor(element); EObject semanticElement = inputDescriptor.getSemanticElement(); if (semanticElement != null) { updateFormText(form, semanticElement); form.setImage(ExtendedImageRegistry.INSTANCE.getImage(new EditingDomainServices().getLabelProviderImage(semanticElement))); } } if <START> (!semanticElementFound) { <END> form.setText(""); form.setImage(null); } } }</code><technical_language>I miss semanticElementFound else false</technical_language>

Target:
public void updateFormTitle(Form form, ISelection selection) { if (selection instanceof IStructuredSelection) { boolean semanticElementFound = false; IStructuredSelection structuredSelection = (IStructuredSelection) selection; Object element = structuredSelection.getFirstElement(); if (element != null) { SiriusInputDescriptor inputDescriptor = new SiriusInputDescriptor(element); EObject semanticElement = inputDescriptor.getSemanticElement(); if (semanticElement != null) { semanticElementFound = true; updateFormText(form, semanticElement); form.setImage(ExtendedImageRegistry.INSTANCE.getImage(new EditingDomainServices().getLabelProviderImage(semanticElement))); } } if (!semanticElementFound) { form.setText(""); form.setImage(null); } } }
Source:
<code>public String selectBroker(String table) { if (table == null) { <START> List<String> list = allBrokerListRef.get(); <END> if (list != null && !list.isEmpty()) { return list.get(RANDOM.nextInt(list.size())); } else { return null; } } String tableName = table.replace(OFFLINE_SUFFIX, "").replace(REALTIME_SUFFIX, ""); List<String> list = tableToBrokerListMapRef.get().get(tableName); if (list != null && !list.isEmpty()) { return list.get(RANDOM.nextInt(list.size())); } return null; }</code><technical_language>allBrokerListRef computed of this method api vulnerable a broker is longer ONLINE in EV</technical_language>

Target:
public String selectBroker(String table) { if (table == null) { List<String> list = _allBrokerListRef.get(); if (list != null && !list.isEmpty()) { return list.get(RANDOM.nextInt(list.size())); } else { return null; } } String tableName = table.replace(ExternalViewReader.OFFLINE_SUFFIX, "").replace(ExternalViewReader.REALTIME_SUFFIX, ""); List<String> list = _tableToBrokerListMapRef.get().get(tableName); if (list != null && !list.isEmpty()) { return list.get(RANDOM.nextInt(list.size())); } return null; }
Source:
<code>public String toString() { switch (this) { case CBR: <START> return "Constant"; <END> case VBR: return "Variable"; default: return super.toString(); } }</code><technical_language>@Sami32 need a bigger computer screen. I 3 screens, I need in cryptic codes I point some truth it, I personally find CBR VBR similar I misread them. IMO, C V better. eyes, do some problems separating two</technical_language>

Target:
public String toString() { switch (this) { case CONSTANT: return "Constant"; case VARIABLE: return "Variable"; default: return super.toString(); } }
Source:
<code>public void localeThreeLetterRegionalVariantResolves() { assertThat("A locale with a 3-letter coe and regional variant resolves correctly", LanguageUtil.getLocale("yue_TW").getDisplayName().equals("yue (Taiwan)")); assertThat("A locale with a 3-letter coe and regional variant resolves correctly", LanguageUtil.getLocale("yue-TW").getDisplayName().equals("yue (Taiwan)")); <START> } <END></code><technical_language>Do need/intend handle ISO 639 here? zh-Hant-TW for example? <LINK_0> - if this is relevant</technical_language>

Target:
public void localeThreeLetterRegionalVariantResolves() { assertThat("A locale with a 2-letter code and regional variant resolves correctly", "yue (Taiwan)", is(LanguageUtil.getLocale("yue-TW").getDisplayName())); assertThat("A locale with a 2-letter code and regional variant resolves correctly", "yue (Taiwan)", is(LanguageUtil.getLocale("yue_TW").getDisplayName())); }
Source:
<code><START> public void flush(boolean force) <END> { for (int partition = 0; partition < pageBuilders.size(); partition++) { PageBuilder partitionPageBuilder = pageBuilders.get(partition); if (!partitionPageBuilder.isEmpty() && (force || partitionPageBuilder.isFull())) { Page pageSplit = partitionPageBuilder.build(); partitionPageBuilder.reset(); memoryTracker.accept(pageSplit.getRetainedSizeInBytes()); buffers.get(partition).accept(new PageReference(pageSplit, 1, () -> memoryTracker.accept(-pageSplit.getRetainedSizeInBytes()))); } } }</code><technical_language>this private, this class</technical_language>

Target:
private void flush(boolean force) { for (int partition = 0; partition < pageBuilders.size(); partition++) { PageBuilder partitionPageBuilder = pageBuilders.get(partition); if (!partitionPageBuilder.isEmpty() && (force || partitionPageBuilder.isFull())) { Page pageSplit = partitionPageBuilder.build(); partitionPageBuilder.reset(); memoryTracker.accept(pageSplit.getRetainedSizeInBytes()); buffers.get(partition).accept(new PageReference(pageSplit, 1, () -> memoryTracker.accept(-pageSplit.getRetainedSizeInBytes()))); } } }
Source:
<code>private boolean canBumpEpoch() { return !isTransactional() || <START> apiVersions.get(transactionCoordinator.idString()).apiVersion(ApiKeys.INIT_PRODUCER_ID).maxVersion >= 3; <END> }</code><technical_language>missing a couple null checks here</technical_language>

Target:
boolean canBumpEpoch() { if (!isTransactional()) { return true; } return coordinatorSupportsBumpingEpoch; }
Source:
<code>private void update(SessionOSData newSessionData) { if (fViewer == null || fViewer.getControl() == null) return; if (fViewer.getControl().isDisposed()) return; if (newSessionData == null) { fSessionData = null; <START> if (fWrongType) <END> hideTable(Messages.OSView_4); else if (fMultiple) hideTable(Messages.OSView_14); else hideTable(Messages.OSView_15); fResourceClassEditor.setEnabled(false); fRefreshAction.setEnabled(false); return; } if (newSessionData != fSessionData) { fSessionData = newSessionData; updateSessionDataContents(); } }</code><technical_language>checking fMultiple first, fWrongType. I find selecting multiple entries in sessions "Invalid debug object" message is more confusing "multiple sessions" message. do think</technical_language>

Target:
private void update(SessionOSData newSessionData) { if (fViewer == null || fViewer.getControl() == null) return; if (fViewer.getControl().isDisposed()) return; if (newSessionData == null) { fSessionData = null; if (fMultiple) hideTable(Messages.OSView_14); else if (fWrongType) hideTable(Messages.OSView_4); else hideTable(Messages.OSView_15); fResourceClassEditor.setEnabled(false); fRefreshAction.setEnabled(false); return; } if (newSessionData != fSessionData) { fSessionData = newSessionData; updateSessionDataContents(); } }
Source:
<code>protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { String destination = "/" + remaining.replaceAll(":", "/"); StompConfiguration config = getConfiguration().copy(); setProperties(config, parameters); StompEndpoint endpoint = new StompEndpoint(uri, this, config, destination); setProperties(endpoint, parameters); if (config.getSslContextParameters() == null) { config.setSslContextParameters(retrieveGlobalSslContextParameters()); } <START> endpoint.setHeaderFilterStrategy(getHeaderFilterStrategy()); <END> return endpoint; }</code><technical_language>do this call setProperties endpoint, override custom endpoint configured heater filter strategy component</technical_language>

Target:
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { String destination = "/" + remaining.replaceAll(":", "/"); StompConfiguration config = getConfiguration().copy(); setProperties(config, parameters); StompEndpoint endpoint = new StompEndpoint(uri, this, config, destination); endpoint.setHeaderFilterStrategy(getHeaderFilterStrategy()); setProperties(endpoint, parameters); if (config.getSslContextParameters() == null) { config.setSslContextParameters(retrieveGlobalSslContextParameters()); } return endpoint; }
Source:
<code>public void checkDeprecatedAssignment(Assignment assignment) { JvmIdentifiableElement feature = assignment.getFeature(); if (feature instanceof JvmOperation) { JvmOperation operation = (JvmOperation) feature; <START> if (DeprecationUtil.isDeprecated(operation)) { <END> warning( "The '" + operation.getQualifiedName() + "' is deprecated.", assignment, Mwe2Package.Literals.ASSIGNMENT__FEATURE_NAME, DEPRECATED_ELEMENT); } } }</code><technical_language>this in semantic highlighting too</technical_language>

Target:
public void checkDeprecatedAssignment(Assignment assignment) { JvmIdentifiableElement feature = assignment.getFeature(); if (feature instanceof JvmOperation) { JvmOperation operation = (JvmOperation) feature; if (DeprecationUtil.isDeprecated(operation)) { warning( "The '" + operation.getQualifiedName() + "' is deprecated.", assignment, Mwe2Package.Literals.ASSIGNMENT__FEATURE, DEPRECATED_ELEMENT); } } }
Source:
<code>public List<String> getNestedPathHierarchyForObject(String absoluteObjectPath) { Optional<List<String>> nestedDocumentPath = indexModels.stream() .map( indexModel -> indexModel.getObjectNode( absoluteObjectPath ) ) .filter( Objects::nonNull ) .map( fieldNode -> Optional.ofNullable( fieldNode.getNestedPathHierarchy() ) ) .reduce( (nestedDocumentPath1, nestedDocumentPath2) -> { if ( Objects.equals( nestedDocumentPath1, nestedDocumentPath2 ) ) { return nestedDocumentPath1; } <START> throw log.conflictingNestedDocumentPathHierarchyForProjection( <END> absoluteObjectPath, nestedDocumentPath1.orElse( null ), nestedDocumentPath2.orElse( null ), getIndexesEventContext() ); } ) .orElse( Optional.empty() ); return nestedDocumentPath.orElse( null ); }</code><technical_language>rename this method adapt message</technical_language>

Target:
public List<String> getNestedPathHierarchyForObject(String absoluteObjectPath) { Optional<List<String>> nestedDocumentPath = indexModels.stream() .map( indexModel -> indexModel.getObjectNode( absoluteObjectPath ) ) .filter( Objects::nonNull ) .map( node -> Optional.ofNullable( node.getNestedPathHierarchy() ) ) .reduce( (nestedDocumentPath1, nestedDocumentPath2) -> { if ( Objects.equals( nestedDocumentPath1, nestedDocumentPath2 ) ) { return nestedDocumentPath1; } throw log.conflictingNestedDocumentPathHierarchy( absoluteObjectPath, nestedDocumentPath1.orElse( null ), nestedDocumentPath2.orElse( null ), getIndexesEventContext() ); } ) .orElse( Optional.empty() ); return nestedDocumentPath.orElse( null ); }
Source:
<code>public static AuthUI getInstance(@NonNull FirebaseApp app) { AuthUI authUi; synchronized (INSTANCES) { authUi = INSTANCES.get(app); if (authUi == null) { <START> INSTANCES.put(app, authUi = new AuthUI(app)); <END> } } return authUi; }</code><technical_language>nit: I find multi-line version easier understand. I Java devs of assignment expression</technical_language>

Target:
public static AuthUI getInstance(@NonNull FirebaseApp app) { AuthUI authUi; synchronized (INSTANCES) { authUi = INSTANCES.get(app); if (authUi == null) { authUi = new AuthUI(app); INSTANCES.put(app, authUi); } } return authUi; }
Source:
<code>public LimitedOutputStream createFile() throws IOException { if (bytesUsed.get() >= maxBytesUsed) { throw new TemporaryStorageFullException(maxBytesUsed); } synchronized (files) { if (closed) { throw new ISE("Closed"); } FileUtils.forceMkdir(storageDirectory); <START> final File theFile = new File(storageDirectory, StringUtils.safeFormat("%08d.tmp", files.size())); <END> final EnumSet<StandardOpenOption> openOptions = EnumSet.of( StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE ); final FileChannel channel = FileChannel.open(theFile.toPath(), openOptions); files.add(theFile); return new LimitedOutputStream(theFile, Channels.newOutputStream(channel)); } }</code><technical_language>crash if bad format string</technical_language>

Target:
public LimitedOutputStream createFile() throws IOException { if (bytesUsed.get() >= maxBytesUsed) { throw new TemporaryStorageFullException(maxBytesUsed); } synchronized (files) { if (closed) { throw new ISE("Closed"); } FileUtils.forceMkdir(storageDirectory); final File theFile = new File(storageDirectory, StringUtils.format("%08d.tmp", files.size())); final EnumSet<StandardOpenOption> openOptions = EnumSet.of( StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE ); final FileChannel channel = FileChannel.open(theFile.toPath(), openOptions); files.add(theFile); return new LimitedOutputStream(theFile, Channels.newOutputStream(channel)); } }
Source:
<code>private static Person getByEmail(ZulipApp app, String email) { try { return getByEmail(app.getDatabaseHelper().getDao( Person.class), email); } catch (SQLException e) { <START> e.printStackTrace(); <END> } return null; }</code><technical_language>ZLog</technical_language>

Target:
private static Person getByEmail(ZulipApp app, String email) { try { return getByEmail(app.getDatabaseHelper().getDao( Person.class), email); } catch (SQLException e) { ZLog.logException(e); } return null; }
Source:
<code>public InputStream getLineAsStream() throws IOException { <START> return IOUtils.toInputStream(getLine(), "UTF-8"); <END> }</code><technical_language>suggest in place of line? deprecated IOUtils#toInputString? (which is passing encoding giving a string)</technical_language>

Target:
public InputStream getLineAsStream() throws IOException { return new ByteArrayInputStream(getLine().getBytes()); }
Source:
<code>public List<CDPStructuredFlowEvent> getFlow() { <START> return flow != null ? flow : Collections.emptyList(); <END> }</code><technical_language>initialize field a Collections.emptyList() getter logic. I handle this way. applies others</technical_language>

Target:
public List<CDPStructuredFlowEvent> getFlow() { return flow; }
Source:
<code>public static GermplasmListNewColumnsInfo generateAddedColumnsInfo() { final GermplasmListNewColumnsInfo newColumnsInfo = new GermplasmListNewColumnsInfo(1); <START> final LinkedHashMap<String, List<ListDataColumnValues>> columnValuesMap = new LinkedHashMap<>(); <END> for (final String column : ADDED_COLUMNS) { final List<ListDataColumnValues> valuesList = new ArrayList<>(); for (int x = 1; x <= NO_OF_LIST_ENTRIES; x++) { valuesList.add(new ListDataColumnValues(column, x, column + ":" + x)); newColumnsInfo.addColumn(column); } columnValuesMap.put(column, valuesList); } newColumnsInfo.setColumnValuesMap(columnValuesMap); return newColumnsInfo; }</code><technical_language>Declare columnValuesMap Map</technical_language>

Target:
public static GermplasmListNewColumnsInfo generateAddedColumnsInfo() { final GermplasmListNewColumnsInfo newColumnsInfo = new GermplasmListNewColumnsInfo(1); final Map<String, List<ListDataColumnValues>> columnValuesMap = new LinkedHashMap<>(); for (final String column : ADDED_COLUMNS) { final List<ListDataColumnValues> valuesList = new ArrayList<>(); for (int x = 1; x <= NO_OF_LIST_ENTRIES; x++) { valuesList.add(new ListDataColumnValues(column, x, column + ":" + x)); newColumnsInfo.addColumn(column); } columnValuesMap.put(column, valuesList); } newColumnsInfo.setColumnValuesMap(columnValuesMap); return newColumnsInfo; }
Source:
<code>public void executeQueueTest() { try { startResource(); QueueCapability queueCapability = (QueueCapability) networkResource.getCapability(getOSPFInformation(CAPABILIY_TYPE)); queueCapability.execute(); stopResource(); <START> } catch (ResourceException e) { <END> e.printStackTrace(); Assert.fail(e.getMessage()); } catch (ProtocolException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }</code><technical_language>need catch, print fail exception. Simply declare part of method signature JUnit fail test for if exceptions thrown</technical_language>

Target:
public void executeQueueTest() throws ResourceException, ProtocolException { startResource(); QueueCapability queueCapability = (QueueCapability) networkResource.getCapability(getOSPFInformation(CAPABILIY_TYPE)); queueCapability.execute(); stopResource(); }
Source:
<code>protected void doExecute() { <START> final IBatchMerger2 merger = new BatchMerger(mergerRegistry); <END> if (leftToRight) { merger.copyAllLeftToRight(differences, new BasicMonitor()); } else { merger.copyAllRightToLeft(differences, new BasicMonitor()); } }</code><technical_language>I point of this change, fact BatchMerger is IBatchMerger2 here... Is a missing parameter below</technical_language>

Target:
protected void doExecute() { final IBatchMerger merger = new BatchMerger(mergerRegistry); if (leftToRight) { merger.copyAllLeftToRight(differences, new BasicMonitor()); } else { merger.copyAllRightToLeft(differences, new BasicMonitor()); } }
Source:
<code>public void testLegacyQueryContext() { MemoryPool generalPool = new MemoryPool(GENERAL_POOL, new DataSize(10, BYTE)); MemoryPool systemPool = new MemoryPool(SYSTEM_POOL, new DataSize(10, BYTE)); try (LocalQueryRunner localQueryRunner = new LocalQueryRunner(TEST_SESSION)) { LegacyQueryContext queryContext = new LegacyQueryContext( new QueryId("query"), new DataSize(10, BYTE), generalPool, systemPool, new TestingGcMonitor(), localQueryRunner.getExecutor(), localQueryRunner.getScheduler(), new DataSize(0, BYTE), new SpillSpaceTracker(new DataSize(0, BYTE))); TaskStateMachine taskStateMachine = new TaskStateMachine(TaskId.valueOf("task-id"), taskNotificationExecutor); TaskContext taskContext = queryContext.addTaskContext(taskStateMachine, TEST_SESSION, false, false); LocalMemoryContext systemContext = taskContext.localSystemMemoryContext(); <START> ListenableFuture<?> blocked = systemContext.setBytes(10); <END> assertTrue(blocked.isDone()); assertEquals(systemPool.getReservedBytes(), 10); assertEquals(generalPool.getReservedBytes(), 0); systemContext.close(); assertEquals(systemPool.getReservedBytes(), 0); assertEquals(generalPool.getReservedBytes(), 0); } }</code><technical_language>larger. more obvious way</technical_language>

Target:
public void testLegacyQueryContext() { MemoryPool generalPool = new MemoryPool(GENERAL_POOL, new DataSize(10_000, BYTE)); MemoryPool systemPool = new MemoryPool(SYSTEM_POOL, new DataSize(10_000, BYTE)); try (LocalQueryRunner localQueryRunner = new LocalQueryRunner(TEST_SESSION)) { LegacyQueryContext queryContext = new LegacyQueryContext( new QueryId("query"), new DataSize(10, BYTE), generalPool, systemPool, new TestingGcMonitor(), localQueryRunner.getExecutor(), localQueryRunner.getScheduler(), new DataSize(0, BYTE), new SpillSpaceTracker(new DataSize(0, BYTE))); TaskStateMachine taskStateMachine = new TaskStateMachine(TaskId.valueOf("task-id"), taskNotificationExecutor); TaskContext taskContext = queryContext.addTaskContext(taskStateMachine, TEST_SESSION, false, false); LocalMemoryContext systemContext = taskContext.localSystemMemoryContext(); ListenableFuture<?> blocked = systemContext.setBytes(10_000); assertTrue(blocked.isDone()); assertEquals(systemPool.getReservedBytes(), 10_000); assertEquals(generalPool.getReservedBytes(), 0); systemContext.close(); assertEquals(systemPool.getReservedBytes(), 0); assertEquals(generalPool.getReservedBytes(), 0); } }
Source:
<code>public void setAuthData(ExternalOAuth externalOAuth) { for (FormGroup formGroup : form) { for (FormField formField : formGroup.getFields()) { <START> if (formField.getId().equals("access_token")) { <END> ((StringFormField)formField).setValue(externalOAuth.token()); } if (formField.getId().equals("expires_in")) { ((StringFormField)formField).setValue("" + externalOAuth.expiresIn()); } } } }</code><technical_language>flip equals(). Otherwise, if id is null, crash app</technical_language>

Target:
public BookingForm setAuthData(ExternalOAuth externalOAuth) { for (FormGroup formGroup : form) { for (FormField formField : formGroup.getFields()) { if (formField.getId() != null && formField.getId().equals(FormField.ACCESS_TOKEN)) { ((StringFormField) formField).setValue(externalOAuth.token()); } if (formField.getId().equals(FormField.EXPIRES_IN)) { ((StringFormField) formField).setValue("" + externalOAuth.expiresIn()); } if (formField.getId().equals(FormField.REFRESH_TOKEN) && externalOAuth.refreshToken() != null) { ((StringFormField) formField).setValue("" + externalOAuth.refreshToken()); } } } return this; }
Source:
<code>protected void endMoveVmCommand() { <START> incrementDbGeneration(); <END> endActionOnAllImageGroups(); if (getVm() != null) { VmHandler.UnLockVm(getVm()); VmHandler.updateDisksFromDb(getVm()); } else { setCommandShouldBeLogged(false); log.warn("MoveVmCommand::EndMoveVmCommand: Vm is null - not performing full EndAction"); } setSucceeded(true); }</code><technical_language>code getVm() return null</technical_language>

Target:
protected void endMoveVmCommand() { boolean vmExists = (getVm() != null); if (vmExists) { incrementDbGeneration(); } endActionOnAllImageGroups(); if (vmExists) { VmHandler.UnLockVm(getVm()); VmHandler.updateDisksFromDb(getVm()); } else { setCommandShouldBeLogged(false); log.warn("MoveVmCommand::EndMoveVmCommand: Vm is null - not performing full EndAction"); } setSucceeded(true); }
Source:
<code>private ComponentImpl createReferencePluginComponent( String pluginRef, FileContentProvider contentProvider) throws InfrastructureException { ExtendedPluginFQN fqn = pluginFQNParser.evaluateFqn(pluginRef, contentProvider); <START> ComponentImpl component = new ComponentImpl(PLUGIN_COMPONENT_TYPE, pluginRef); <END> if (!isNullOrEmpty(fqn.getId())) { component.setId(fqn.getId()); } if (!isNullOrEmpty(fqn.getReference())) { component.setReference(fqn.getReference()); } return component; }</code><technical_language>strange this constructor create a ComponentImpl yaml components: - type: chePlugin id: <url plugin meta.yaml> java ComponentImpl component = new ComponentImpl(); component.setType(PLUGIN_COMPONENT_TYPE); additionally, if null check line 190 fails (fqn.getId() is null), component left ID is a url, is invalid</technical_language>

Target:
private ComponentImpl createReferencePluginComponent( String pluginRef, FileContentProvider contentProvider) throws InfrastructureException { ExtendedPluginFQN fqn = pluginFQNParser.evaluateFqn(pluginRef, contentProvider); ComponentImpl component = new ComponentImpl(); component.setType(PLUGIN_COMPONENT_TYPE); if (!isNullOrEmpty(fqn.getId())) { component.setId(fqn.getId()); } if (!isNullOrEmpty(fqn.getReference())) { component.setReference(fqn.getReference()); } return component; }
Source:
<code><START> public void writeData(SliceOutput sliceOutput) <END> { if (!stripeOffsets.isEmpty()) { Slice compressionSlice = utf8Slice(compressionCodec.name()); sliceOutput.writeInt(compressionSlice.length()); size += SIZE_OF_INT; sliceOutput.writeBytes(compressionSlice); size += compressionSlice.length(); sliceOutput.writeInt(stripeOffsets.size()); size += SIZE_OF_INT; for (long offset : stripeOffsets) { sliceOutput.writeLong(offset); size += SIZE_OF_LONG; } } size += FOOTER_LENGTH_IN_BYTES; sliceOutput.writeInt(toIntExact(size())); }</code><technical_language>#size called writeData . size pre-computed</technical_language>

Target:
public void writeData(SliceOutput sliceOutput) { if (!stripeOffsets.isEmpty()) { sliceOutput.writeInt(compressionSlice.length()); sliceOutput.writeBytes(compressionSlice); sliceOutput.writeInt(stripeOffsets.size()); for (long offset : stripeOffsets) { sliceOutput.writeLong(offset); } } sliceOutput.writeInt(toIntExact(size())); }
Source:
<code>private final void sendIntent() { Intent intent = new Intent(Intent.ACTION_BATTERY_CHANGED); <START> intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); <END> try { mBatteryStats.setOnBattery(mPlugType == BATTERY_PLUGGED_NONE, mBatteryLevel); } catch (RemoteException e) { } int icon = getIcon(mBatteryLevel); intent.putExtra("status", mBatteryStatus); intent.putExtra("health", mBatteryHealth); intent.putExtra("present", mBatteryPresent); intent.putExtra("level", mBatteryLevel); intent.putExtra("scale", BATTERY_SCALE); intent.putExtra("icon-small", icon); intent.putExtra("plugged", mPlugType); intent.putExtra("voltage", mBatteryVoltage); intent.putExtra("temperature", mBatteryTemperature); intent.putExtra("technology", mBatteryTechnology); if (false) { Log.d(TAG, "updateBattery level:" + mBatteryLevel + " scale:" + BATTERY_SCALE + " status:" + mBatteryStatus + " health:" + mBatteryHealth + " present:" + mBatteryPresent + " voltage: " + mBatteryVoltage + " temperature: " + mBatteryTemperature + " technology: " + mBatteryTechnology + " AC powered:" + mAcOnline + " USB powered:" + mUsbOnline + " icon:" + icon ); } ActivityManagerNative.broadcastStickyIntent(intent, null); }</code><technical_language>This FLAG_RECEIVER_REGISTERED_ONLY -- want system launch consumers of battery stats update them; that'd a big waste. REGISTERED_ONLY updates running monitors only</technical_language>

Target:
private final void sendIntent() { Intent intent = new Intent(Intent.ACTION_BATTERY_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); try { mBatteryStats.setOnBattery(mPlugType == BATTERY_PLUGGED_NONE, mBatteryLevel); } catch (RemoteException e) { } int icon = getIcon(mBatteryLevel); intent.putExtra("status", mBatteryStatus); intent.putExtra("health", mBatteryHealth); intent.putExtra("present", mBatteryPresent); intent.putExtra("level", mBatteryLevel); intent.putExtra("scale", BATTERY_SCALE); intent.putExtra("icon-small", icon); intent.putExtra("plugged", mPlugType); intent.putExtra("voltage", mBatteryVoltage); intent.putExtra("temperature", mBatteryTemperature); intent.putExtra("technology", mBatteryTechnology); if (false) { Log.d(TAG, "updateBattery level:" + mBatteryLevel + " scale:" + BATTERY_SCALE + " status:" + mBatteryStatus + " health:" + mBatteryHealth + " present:" + mBatteryPresent + " voltage: " + mBatteryVoltage + " temperature: " + mBatteryTemperature + " technology: " + mBatteryTechnology + " AC powered:" + mAcOnline + " USB powered:" + mUsbOnline + " icon:" + icon ); } ActivityManagerNative.broadcastStickyIntent(intent, null); }
Source:
<code>private void addPatternToCombo(Combo comb) { for (AbstractUndoRecordingCommand command : patterns) { <START> comb.add(command.getLabel()); <END> } }</code><technical_language>build combo commands. configure next page selected pattern build a pattern specific command configuration wizard page user clic finish</technical_language>

Target:
private void addPatternToCombo(Combo comb) { for (IPatternProvider pattern : patterns) { comb.add(pattern.getLabel()); } }
Source:
<code>protected void eventHandle(@Nullable ITmfEvent event) { if (event == null) { return; } final String eventName = event.getName(); <START> if (eventName.equals(fLayout.eventSchedSwitch())) { <END> Integer cpu = TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event); if (cpu == null) { return; } ITmfEventField content = event.getContent(); long ts = event.getTimestamp().getValue(); Long prevTid = (Long) content.getField(fLayout.fieldPrevTid()).getValue(); final ITmfStateSystemBuilder ss = checkNotNull(getStateSystemBuilder()); Integer currentCPUNode = ss.getQuarkRelativeAndAdd(getNodeCPUs(ss), cpu.toString()); Integer cumulativeTimeQuark = ss.getQuarkRelativeAndAdd(currentCPUNode, prevTid.toString()); Long startTime = fLastStartTimes.get(cpu); if (startTime == null) { startTime = fTraceStart; } StateSystemBuilderUtils.incrementAttributeLong(ss, ts, cumulativeTimeQuark, ts - startTime); fLastStartTimes.put(cpu, ts); } }</code><technical_language>Some changes unrelated patch, improve readability, I would: get/check ss get cpu prevTId next check cpu prevTid null skipp this event if are</technical_language>

Target:
protected void eventHandle(@Nullable ITmfEvent event) { if (event == null) { return; } final String eventName = event.getName(); if (eventName.equals(fLayout.eventSchedSwitch())) { final ITmfStateSystemBuilder ss = checkNotNull(getStateSystemBuilder()); Integer cpu = TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event); if (cpu == null) { return; } ITmfEventField content = event.getContent(); Long prevTid = content.getFieldValue(Long.class, fLayout.fieldPrevTid()); if (prevTid == null) { return; } int currentCPUNode = ss.getQuarkRelativeAndAdd(getNodeCPUs(ss), cpu.toString()); int cumulativeTimeQuark = ss.getQuarkRelativeAndAdd(currentCPUNode, prevTid.toString()); Long startTime = fLastStartTimes.getOrDefault(cpu, fTraceStart); long ts = event.getTimestamp().getValue(); StateSystemBuilderUtils.incrementAttributeLong(ss, ts, cumulativeTimeQuark, ts - startTime); fLastStartTimes.put(cpu, ts); } }
Source:
<code>public void testListAvailabilityZones() throws Exception { AvailabilityZoneAPI availabilityZoneApi = api.getAvailabilityZoneApi("RegionOne"); FluentIterable<? extends AvailabilityZone> zones = availabilityZoneApi.list(); for (AvailabilityZone zone : zones) { Assert.assertNotNull(zone.getName()); <START> Assert.assertTrue(zone.getZoneState().isAvailable()); <END> } }</code><technical_language>Static import remove Assert., add a message for assertTrue</technical_language>

Target:
public void testListAvailabilityZones() throws Exception { AvailabilityZoneAPI availabilityZoneApi = api.getAvailabilityZoneApi("RegionOne"); FluentIterable<? extends AvailabilityZone> zones = availabilityZoneApi.list(); for (AvailabilityZone zone : zones) { assertNotNull(zone.getName()); assertTrue(zone.getState().available(), "zone: " + zone.getName() + " is not available."); } }
Source:
<code>public void setTaskStatusDown(Task task) { <START> setTaskStatusDown(Arrays.asList()); <END> }</code><technical_language>parameter task is used. passed setTaskStatusDown here? suggestion setTaskStatusDown(Arrays.asList(task));</technical_language>

Target:
public void setTaskStatusDown(Task task) { setTaskStatusDown(Arrays.asList(task)); }