auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void setupParams() throws ServerConnectorException { fileURI = fileProperties.get(Constants.TRANSPORT_FILE_FILE_URI); if (fileURI == null) { throw new ServerConnectorException(Constants.TRANSPORT_FILE_FILE_URI + " is a " + "mandatory parameter for " + Constants.PROTOCOL_NAME + " transport."); } if (fileURI.trim().equals("")) { throw new ServerConnectorException(Constants.TRANSPORT_FILE_FILE_URI + " parameter " + "cannot be empty for " + Constants.PROTOCOL_NAME + " transport."); } String timeOut = fileProperties.get(Constants.FILE_ACKNOWLEDGEMENT_TIME_OUT); if (timeOut != null) { try { timeOutInterval = Long.parseLong(timeOut); } catch (NumberFormatException e) { log.error("Provided " + Constants.FILE_ACKNOWLEDGEMENT_TIME_OUT + " is invalid. " + "Using the default callback timeout, " + timeOutInterval + " milliseconds", e); } } String strDeleteIfNotAck = fileProperties.get(Constants.FILE_DELETE_IF_NOT_ACKNOWLEDGED); if (strDeleteIfNotAck != null) { try { deleteIfNotAck = Boolean.parseBoolean(strDeleteIfNotAck); <START> } catch (RuntimeException re) { <END> log.warn(Constants.FILE_DELETE_IF_NOT_ACKNOWLEDGED + " parameter should be either " + "\"true\" or \"false\". Found: " + strDeleteIfNotAck + ". Assigning default value \"false\".", re); } } }</code><technical_language>catching Runtime Exception here</technical_language>

Target:
private void setupParams() throws ServerConnectorException { fileURI = fileProperties.get(Constants.TRANSPORT_FILE_FILE_URI); if (fileURI == null) { throw new ServerConnectorException(Constants.TRANSPORT_FILE_FILE_URI + " is a " + "mandatory parameter for " + Constants.PROTOCOL_NAME + " transport."); } if (fileURI.trim().equals("")) { throw new ServerConnectorException(Constants.TRANSPORT_FILE_FILE_URI + " parameter " + "cannot be empty for " + Constants.PROTOCOL_NAME + " transport."); } String timeOut = fileProperties.get(Constants.FILE_ACKNOWLEDGEMENT_TIME_OUT); if (timeOut != null) { try { timeOutInterval = Long.parseLong(timeOut); } catch (NumberFormatException e) { log.error("Provided " + Constants.FILE_ACKNOWLEDGEMENT_TIME_OUT + " is invalid. " + "Using the default callback timeout, " + timeOutInterval + " milliseconds", e); } } String strDeleteIfNotAck = fileProperties.get(Constants.FILE_DELETE_IF_NOT_ACKNOWLEDGED); if (strDeleteIfNotAck != null) { deleteIfNotAck = Boolean.parseBoolean(strDeleteIfNotAck); } }
Source:
<code>public SparkRunner(String configurationFilePath, String jobFilePath, String resultFilePath) throws IOException { try { _hadoopConfigurationDirectory = HadoopUtils.getHadoopConfigurationDirectoryToUse(); <START> _hadoopDefaultFS = FileSystem.newInstance(HadoopUtils.getHadoopConfiguration(_hadoopConfigurationDirectory)); <END> } catch (IOException e) { throw new IllegalStateException("Could not create Hadoop filesystem", e); } _applicationDriver = new ApplicationDriver(_hadoopDefaultFS.getUri(), DATACLEANER_LIB_DIR); _configurationFile = findFile(configurationFilePath, true); _jobFile = findFile(jobFilePath, true); if(resultFilePath != null) { _resultFile = findFile(resultFilePath, false); } else { _resultFile = null; } }</code><technical_language>HadoopUtils class a single method for this FileSystem ... intricate code that, if need change it, difficult ensure get right everywhere</technical_language>

Target:
public SparkRunner(String configurationFilePath, String jobFilePath, String resultFilePath) throws IOException { try { _hadoopConfigurationDirectory = HadoopUtils.getHadoopConfigurationDirectoryToUse(); _hadoopDefaultFS = HadoopUtils.getFileSystem(); } catch (IOException e) { throw new IllegalStateException("Could not create Hadoop filesystem", e); } _applicationDriver = new ApplicationDriver(_hadoopDefaultFS.getUri(), DATACLEANER_LIB_DIR); _configurationFile = findFile(configurationFilePath, true); _jobFile = findFile(jobFilePath, true); if(resultFilePath != null) { _resultFile = findFile(resultFilePath, false); } else { _resultFile = null; } }
Source:
<code>public <T extends Event> EventQueue<T> lookup(String name, String scope, boolean autoCreate) { final boolean bAppScope = EventQueues.APPLICATION.equals(scope); final boolean bSessionScope = EventQueues.SESSION.equals(scope); if (bAppScope || bSessionScope) { <START> if (bSessionScope && Sessions.getCurrent() == null) <END> throw new IllegalStateException("Current session is not available"); return lookup0(name, bAppScope ? (Scope) WebApps.getCurrent() : Sessions.getCurrent(), autoCreate); } else if (EventQueues.DESKTOP.equals(scope)) { final Execution exec = Executions.getCurrent(); if (exec == null) throw new IllegalStateException("Not in an execution"); final Desktop desktop = exec.getDesktop(); Map<String, EventQueue<T>> eqs = cast((Map) desktop.getAttribute(ATTR_EVENT_QUEUES)); if (eqs == null) desktop.setAttribute(ATTR_EVENT_QUEUES, eqs = new HashMap<String, EventQueue<T>>(4)); EventQueue<T> eq = eqs.get(name); if (autoCreate && eq == null) eqs.put(name, eq = new DesktopEventQueue<T>()); if (log.isDebugEnabled()) { log.debug("Lookup event queue: name [{}], scope [{}], autoCreate [{}]", name, scope, autoCreate); } return eq; } else throw new UnsupportedOperationException("Unknown scope: " + scope); }</code><technical_language>javascript if (B && C) { ... } else if (A || B) { ... } else if ..</technical_language>

Target:
public <T extends Event> EventQueue<T> lookup(String name, String scope, boolean autoCreate) { final boolean bAppScope = EventQueues.APPLICATION.equals(scope); final boolean bSessionScope = EventQueues.SESSION.equals(scope); if (bSessionScope && Sessions.getCurrent() == null) { throw new IllegalStateException("Current session is not available"); } else if (bAppScope || bSessionScope) { return lookup0(name, bAppScope ? (Scope) WebApps.getCurrent() : Sessions.getCurrent(), autoCreate); } else if (EventQueues.DESKTOP.equals(scope)) { final Execution exec = Executions.getCurrent(); if (exec == null) throw new IllegalStateException("Not in an execution"); final Desktop desktop = exec.getDesktop(); Map<String, EventQueue<T>> eqs = cast((Map) desktop.getAttribute(ATTR_EVENT_QUEUES)); if (eqs == null) desktop.setAttribute(ATTR_EVENT_QUEUES, eqs = new HashMap<String, EventQueue<T>>(4)); EventQueue<T> eq = eqs.get(name); if (autoCreate && eq == null) eqs.put(name, eq = new DesktopEventQueue<T>()); if (log.isDebugEnabled()) { log.debug("Lookup event queue: name [{}], scope [{}], autoCreate [{}]", name, scope, autoCreate); } return eq; } else throw new UnsupportedOperationException("Unknown scope: " + scope); }
Source:
<code>public Collection<? extends Action> getProjectActions() { <START> return jacocoProjectAction != null ? Arrays.asList(jacocoProjectAction) : Collections.emptyList(); <END> }</code><technical_language>I Collections.singletonList() instead of Arrays.asList()</technical_language>

Target:
public Collection<? extends Action> getProjectActions() { return jacocoProjectAction != null ? Collections.singletonList(jacocoProjectAction) : Collections.emptyList(); }
Source:
<code>static public String sendHttpDeleteRequest(String url) { String response = null; try { <START> return HttpUtil.executeUrl("DELETE", url, 1000); <END> } catch (IOException e) { logger.error("Fatal transport error: {}",e); } return response; }</code><technical_language>response = instead of return</technical_language>

Target:
static public String sendHttpDeleteRequest(String url) { String response = null; try { response = HttpUtil.executeUrl("DELETE", url, 1000); } catch (IOException e) { logger.error("Fatal transport error: {}", e); } return response; }
Source:
<code>private String getActualNativeSRSCode(ResourceInfo resourceInfo) { try { if (resourceInfo instanceof FeatureTypeInfo) { FeatureTypeInfo ft = (FeatureTypeInfo) resourceInfo; return "EPSG:" + CRS.lookupEpsgCode( ft.getFeatureSource(null, null).getInfo().getCRS(), false); } else { CatalogBuilder cb = new CatalogBuilder(GeoServerApplication.get().getCatalog()); cb.setStore(resourceInfo.getStore()); <START> ReferencedEnvelope bounds = cb.getNativeBounds(resourceInfo); <END> return "EPSG:" + CRS.lookupEpsgCode(bounds.getCoordinateReferenceSystem(), false); } } catch (Exception e) { LOGGER.log( Level.SEVERE, "Error getting actual Native SRS code for resource " + resourceInfo.getNativeName(), e); } return ""; }</code><technical_language>weird of get native bounds, retrieve CRS, is a more straightforward way</technical_language>

Target:
private String getActualNativeSRSCode(ResourceInfo resourceInfo) { try { CatalogBuilder cb = new CatalogBuilder(GeoServerApplication.get().getCatalog()); cb.setStore(resourceInfo.getStore()); return "EPSG:" + CRS.lookupEpsgCode(cb.getNativeCRS(resourceInfo), false); } catch (Exception e) { LOGGER.log( Level.SEVERE, "Error getting actual Native SRS code for resource " + resourceInfo.getNativeName(), e); } return ""; }
Source:
<code>private void setLocation(@Nullable Place place) { <START> if (mPostLocation == null) { <END> mPostLocation = new PostLocation(); } if (place == null) { mLocationTextView.setText(R.string.post_settings_not_set); mPost.clearLocation(); mPostLocation = null; return; } mPostLocation.setLatitude(place.getLatLng().latitude); mPostLocation.setLongitude(place.getLatLng().longitude); mPost.setLocation(mPostLocation); mLocationTextView.setText(place.getAddress()); }</code><technical_language>This is removed anyway, if this if (place == null) nullifying mPostLocation in if anyway</technical_language>

Target:
private void setLocation(@Nullable Place place) { if (place == null) { mPost.clearLocation(); mPostLocation = null; return; } if (mPostLocation == null) { mPostLocation = new PostLocation(); } mPostLocation.setLatitude(place.getLatLng().latitude); mPostLocation.setLongitude(place.getLatLng().longitude); mPost.setLocation(mPostLocation); mLocationTextView.setText(place.getAddress()); }
Source:
<code>public void testStartingOfflineServeres() throws Exception { VoldemortServer server = getVoldemortServer(0); server.goOffline(); server.stop(); String baseDirPath = server.getVoldemortConfig().getVoldemortHome(); String parentDirPath = Paths.get(baseDirPath).getParent().toString(); List<StoreDefinition> storeDefs = server.getMetadataStore().getStoreDefList(); try { VoldemortConfig config = ServerTestUtils.createServerConfigWithDefs(useNio, 0, parentDirPath, cluster, storeDefs, new Properties()); VoldemortServer newServer = ServerTestUtils.startVoldemortServer(socketStoreFactory, config, cluster); fail("should have thrown an connection exception"); <START> }catch (VoldemortException e){ <END> assertEquals(UnreachableStoreException.class, e.getClass()); } }</code><technical_language>I handle Catch UnreachableStoreException check exception is ConnectException.class</technical_language>

Target:
public void testStartingOfflineServeres() throws Exception { VoldemortServer server = getVoldemortServer(0); server.goOffline(); server.stop(); verifyNewServer(server); }
Source:
<code>private void peekEventsFromIncompleteTransactions(List<AsyncEvent> batch, Set<TransactionId> incompleteTransactionIdsInBatch, long lastKey) { if (!isGroupTransactionEvents()) { return; } if (areAllTransactionsCompleteInBatch(incompleteTransactionIdsInBatch)) { return; } for (TransactionId transactionId : incompleteTransactionIdsInBatch) { boolean presentLastEventInTransaction = false; final int maxRetries = 2; int retries = 0; long lastKeyForTransaction = lastKey; while (!presentLastEventInTransaction && ++retries <= maxRetries) { EventsAndLastKey eventsAndKey = <START> peekEventsWithTransactionId(transactionId, lastKeyForTransaction); <END> for (Object object : eventsAndKey.events) { GatewaySenderEventImpl event = (GatewaySenderEventImpl) object; batch.add(event); presentLastEventInTransaction = event.isLastEventInTransaction(); if (logger.isDebugEnabled()) { logger.debug( "Peeking extra event: {}, isLastEventInTransaction: {}, batch size: {}", event.getKey(), event.isLastEventInTransaction(), batch.size()); } } lastKeyForTransaction = eventsAndKey.lastKey; } if (retries >= maxRetries) { logger.warn("Not able to retrieve all events for transaction after retries", transactionId, retries); } } }</code><technical_language>This similar other peekEventsFromIncompleteTransactions, is a reuse code? classes do a lot of duplication ..</technical_language>

Target:
private void peekEventsFromIncompleteTransactions(List<AsyncEvent> batch, Set<TransactionId> incompleteTransactionIdsInBatch, long lastKey) { if (!mustGroupTransactionEvents()) { return; } if (areAllTransactionsCompleteInBatch(incompleteTransactionIdsInBatch)) { return; } for (TransactionId transactionId : incompleteTransactionIdsInBatch) { boolean areAllEventsForTransactionInBatch = false; int retries = 0; long lastKeyForTransaction = lastKey; while (!areAllEventsForTransactionInBatch && retries++ < GET_TRANSACTION_EVENTS_FROM_QUEUE_RETRIES) { EventsAndLastKey eventsAndKey = peekEventsWithTransactionId(transactionId, lastKeyForTransaction); for (Object object : eventsAndKey.events) { GatewaySenderEventImpl event = (GatewaySenderEventImpl) object; batch.add(event); areAllEventsForTransactionInBatch = event.isLastEventInTransaction(); if (logger.isDebugEnabled()) { logger.debug( "Peeking extra event: {}, isLastEventInTransaction: {}, batch size: {}", event.getKey(), event.isLastEventInTransaction(), batch.size()); } } lastKeyForTransaction = eventsAndKey.lastKey; } if (!areAllEventsForTransactionInBatch) { logger.warn("Not able to retrieve all events for transaction after tries", transactionId, retries); } } }
Source:
<code>private void iterateThrough(Iterator<UIWidget> widgets) { modifyingList = true; while (widgets.hasNext()) { UIWidget next = widgets.next(); boolean setParent = false; if (next instanceof ScrollableArea) { parentToSet = (ScrollableArea) next; setParent = true; } else if (next instanceof UILayout || next instanceof WidgetWithOrder) { setParent = true; } if (next instanceof WidgetWithOrder) { TabbingManager.addToWidgetsList((WidgetWithOrder) next); TabbingManager.addToUsedNums(((WidgetWithOrder) next).order); <START> if (setParent) { <END> ((WidgetWithOrder) next).setParent(parentToSet); } } if (next.iterator().hasNext()) { iterateThrough(next.iterator()); } else if (next instanceof UIRadialRing) { Iterator<UIRadialSection> iter = ((UIRadialRing) next).getSections().iterator(); while (iter.hasNext()) { next = iter.next(); TabbingManager.addToWidgetsList((WidgetWithOrder) next); TabbingManager.addToUsedNums(((WidgetWithOrder) next).order); if (setParent) { ((WidgetWithOrder) next).setParent(parentToSet); } } } } modifyingList = false; }</code><technical_language>This is true</technical_language>

Target:
private void iterateThrough(Iterator<UIWidget> widgets) { modifyingList = true; while (widgets.hasNext()) { UIWidget next = widgets.next(); boolean setParent = false; if (next instanceof ScrollableArea) { parentToSet = (ScrollableArea) next; } if (next instanceof WidgetWithOrder) { TabbingManager.addToWidgetsList((WidgetWithOrder) next); TabbingManager.addToUsedNums(((WidgetWithOrder) next).order); ((WidgetWithOrder) next).setParent(parentToSet); } if (next.iterator().hasNext()) { iterateThrough(next.iterator()); } else if (next instanceof UIRadialRing) { Iterator<UIRadialSection> iter = ((UIRadialRing) next).getSections().iterator(); while (iter.hasNext()) { next = iter.next(); TabbingManager.addToWidgetsList((WidgetWithOrder) next); TabbingManager.addToUsedNums(((WidgetWithOrder) next).order); if (setParent) { ((WidgetWithOrder) next).setParent(parentToSet); } } } } modifyingList = false; }
Source:
<code>public void countUnicodePointsOnce() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(LineLengthCheck.class); checkConfig.addAttribute("max", "100"); <START> System.setProperty("file.encoding", StandardCharsets.UTF_8.name()); <END> final String[] expected = { "6: " + getCheckMessage(MSG_KEY, 100, 136), "7: " + getCheckMessage(MSG_KEY, 100, 136), }; verify(checkConfig, getPath("InputLineLengthUnicodeChars.java"), expected); }</code><technical_language>I this is acceptable clash other tests this one. unset property leaking other tests. if do unset, guaranteed code hit unset in test. This passed configuration object set checker property set max property for check</technical_language>

Target:
public void countUnicodePointsOnce() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(LineLengthCheck.class); checkConfig.addAttribute("max", "100"); final DefaultConfiguration checkerConfig = createRootConfig(checkConfig); checkerConfig.addAttribute("charset", StandardCharsets.UTF_8.name()); final String[] expected = { "6: " + getCheckMessage(MSG_KEY, 100, 136), "7: " + getCheckMessage(MSG_KEY, 100, 136), }; verify(checkerConfig, getPath("InputLineLengthUnicodeChars.java"), expected); }
Source:
<code>private void performGet(HttpClient client, HttpHost httpHost, String url, int expectedStatus) throws IOException { <START> HttpGet getProject = new HttpGet(url); <END> getProject.addHeader("Accept", ContentType.APPLICATION_JSON.getMimeType()); HttpResponse getProjectResponse = client.execute(httpHost, getProject); assertEquals(expectedStatus, getProjectResponse.getStatusLine().getStatusCode()); EntityUtils.consume(getProjectResponse.getEntity()); }</code><technical_language>call getProject.releaseConnection() in finally block</technical_language>

Target:
private void performGet(HttpClient client, HttpHost httpHost, String url, int expectedStatus) throws IOException { HttpGet getProject = new HttpGet(url); try { getProject.addHeader("Accept", ContentType.APPLICATION_JSON.getMimeType()); HttpResponse getProjectResponse = client.execute(httpHost, getProject); assertEquals(expectedStatus, getProjectResponse.getStatusLine().getStatusCode()); EntityUtils.consume(getProjectResponse.getEntity()); } finally { getProject.releaseConnection(); } }
Source:
<code>public SolNullOptionalException() { <START> super("Some object, which contained a null where by design it shouldn't have, caused a crash to the game. Please report this; there is some major design flaw within the game." <END> ); }</code><technical_language>caused a crash game -> caused game crash Please report this; is some major design flaw game -> Rephrase this more.. genially</technical_language>

Target:
public SolNullOptionalException() { super("Some object, which contained a null where by design it shouldn't have, caused the game to crash. Please report this, since this means there is some design flaw within the game." ); }
Source:
<code>public String toString(FlowMatch wcmatch) { <START> if (wcmatch.getEtherType() == ARP.ETHERTYPE) <END> return "ArpOp=" + wcmatch.networkProto; else return toString() + "=" + getNetworkProtocolAsString(wcmatch.networkProto); }</code><technical_language>unrelated</technical_language>

Target:
public String toString(FlowMatch wcmatch) { return toString() + "=" + wcmatch.inputPortNumber; }
Source:
<code>public void test(TestHarness th) { try { <START> foo1(); <END> } catch (Exception e) { th.check(foo1Reached); } try { foo2(); } catch (Exception e) { th.check(foo2Reached); } }</code><technical_language>Add a call th.fail calls _foo1_ _foo2_, explicitely fail if exception thrown</technical_language>

Target:
public void test(TestHarness th) { try { foo1(); th.fail(); } catch (Exception e) { th.check(foo1Reached); } try { foo2(); th.fail(); } catch (Exception e) { th.check(foo2Value, 20); } }
Source:
<code>public PyQualifiedExpressionTree qualifiedExpression(AstNode astNode) { PyExpressionTree qualifier = expression(astNode.getFirstChild()); List<AstNode> names = astNode.getChildren(PythonGrammar.NAME); <START> names.remove(names.size() - 1); <END> PyNameTree name = name(astNode.getLastChild()); for (AstNode nameNode : names) { qualifier = new PyQualifiedExpressionTreeImpl(astNode, name(nameNode), qualifier); } return new PyQualifiedExpressionTreeImpl(astNode, name, qualifier); }</code><technical_language>do modify AstNode? risky</technical_language>

Target:
public PyQualifiedExpressionTree qualifiedExpression(AstNode astNode) { PyExpressionTree qualifier = expression(astNode.getFirstChild()); List<AstNode> names = astNode.getChildren(PythonGrammar.NAME); AstNode lastNameNode = astNode.getLastChild(); for (AstNode nameNode : names) { if (nameNode != lastNameNode) { qualifier = new PyQualifiedExpressionTreeImpl(astNode, name(nameNode), qualifier, nameNode.getPreviousSibling().getToken()); } } return new PyQualifiedExpressionTreeImpl(astNode, name(lastNameNode), qualifier, lastNameNode.getPreviousSibling().getToken()); }
Source:
<code>public void addGatewayPublishedAPIDetails(String APIId, String APIName, String version, String tenantDomain) throws APIManagementException { try (Connection connection = GatewayArtifactsMgtDBUtil.getArtifactSynchronizerConnection(); <START> PreparedStatement statement = connection.prepareStatement(SQLConstants.ADD_GW_PUBLISHED_API_DETAILS)) { <END> statement.setString(1, APIId); statement.setString(2, APIName); statement.setString(3, version); statement.setString(4, tenantDomain); statement.executeUpdate(); } catch (SQLException e) { handleException("Failed to add API details for " + APIName, e); } }</code><technical_language>need autocommit false in connection s insert</technical_language>

Target:
public void addGatewayPublishedAPIDetails(String APIId, String APIName, String version, String tenantDomain) throws APIManagementException { try (Connection connection = GatewayArtifactsMgtDBUtil.getArtifactSynchronizerConnection()) { connection.setAutoCommit(false); try (PreparedStatement statement = connection .prepareStatement(SQLConstants.ADD_GW_PUBLISHED_API_DETAILS)) { statement.setString(1, APIId); statement.setString(2, APIName); statement.setString(3, version); statement.setString(4, tenantDomain); statement.executeUpdate(); } connection.commit(); } catch (SQLException e) { handleException("Failed to add API details for " + APIName, e); } }
Source:
<code>public WebsocketSession( GatewayMessageCodec messageCodec, HttpServerRequest httpRequest, WebsocketInbound inbound, WebsocketOutbound outbound) { this.messageCodec = messageCodec; this.id = Integer.toHexString(System.identityHashCode(this)); HttpHeaders httpHeaders = httpRequest.requestHeaders(); this.contentType = Optional.ofNullable(httpHeaders.get(CONTENT_TYPE)).orElse(DEFAULT_CONTENT_TYPE); this.inbound = (WebsocketInbound) inbound.withConnection(connection -> connection.onDispose(this::clearSubscriptions)); this.outbound = outbound; <START> DirectProcessor<ByteBuf> outboundProcessor = DirectProcessor.create(); <END> outboundSink = outboundProcessor.sink(); this.outbound .options(SendOptions::flushOnEach) .sendObject(outboundProcessor.map(TextWebSocketFrame::new)) .then() .subscribe( null, th -> LOGGER.error("Exception on sending for session={}, cause: {}", id, th)); }</code><technical_language>here. UnicastProcessor buffering backpressure</technical_language>

Target:
public WebsocketSession( GatewayMessageCodec messageCodec, HttpServerRequest httpRequest, WebsocketInbound inbound, WebsocketOutbound outbound) { this.messageCodec = messageCodec; this.id = Integer.toHexString(System.identityHashCode(this)); HttpHeaders httpHeaders = httpRequest.requestHeaders(); this.contentType = Optional.ofNullable(httpHeaders.get(CONTENT_TYPE)).orElse(DEFAULT_CONTENT_TYPE); this.inbound = (WebsocketInbound) inbound.withConnection(connection -> connection.onDispose(this::clearSubscriptions)); this.outbound = outbound; UnicastProcessor<ByteBuf> outboundProcessor = UnicastProcessor.create(); outboundSink = outboundProcessor.sink(); this.outbound .options(SendOptions::flushOnEach) .sendObject(outboundProcessor.onBackpressureBuffer().map(TextWebSocketFrame::new)) .then() .subscribe( null, th -> LOGGER.error("Exception on sending for session={}, cause: {}", id, th)); }
Source:
<code>void onRowSelected(int selectedPosition, int selectedSubPosition) { ObjectAdapter adapter = getAdapter(); if (( mRowsFragment != null && mRowsFragment.getView() != null && mRowsFragment.getView().hasFocus() && !mPendingFocusOnVideo) && (adapter == null || adapter.size() == 0 || (getVerticalGridView().getSelectedPosition() == 0 && getVerticalGridView().getSelectedSubPosition() == 0))) { showTitle(true); } else { showTitle(false); } if (adapter != null && adapter.size() > selectedPosition) { final VerticalGridView gridView = getVerticalGridView(); final int count = gridView.getChildCount(); if (count > 0) { mStateMachine.fireEvent(EVT_DETAILS_ROW_LOADED); } for (int i = 0; i < count; i++) { ItemBridgeAdapter.ViewHolder bridgeViewHolder = (ItemBridgeAdapter.ViewHolder) gridView.getChildViewHolder(gridView.getChildAt(i)); RowPresenter rowPresenter = (RowPresenter) bridgeViewHolder.getPresenter(); onSetRowStatus(rowPresenter, rowPresenter.getRowViewHolder(bridgeViewHolder.getViewHolder()), <START> bridgeViewHolder.getLocalAdapterPosition(), <END> selectedPosition, selectedSubPosition); } } }</code><technical_language>a fragment's client point of view, I care if adapter is a merge adapter not, if app MergeAdapter, I needs idnex of row in RV. Typical example, if DetailsFragment want do scroll row view, hide/show title. If return local adapter position, return 0 is row view in fragment</technical_language>

Target:
void onRowSelected(int selectedPosition, int selectedSubPosition) { ObjectAdapter adapter = getAdapter(); if (( mRowsFragment != null && mRowsFragment.getView() != null && mRowsFragment.getView().hasFocus() && !mPendingFocusOnVideo) && (adapter == null || adapter.size() == 0 || (getVerticalGridView().getSelectedPosition() == 0 && getVerticalGridView().getSelectedSubPosition() == 0))) { showTitle(true); } else { showTitle(false); } if (adapter != null && adapter.size() > selectedPosition) { final VerticalGridView gridView = getVerticalGridView(); final int count = gridView.getChildCount(); if (count > 0) { mStateMachine.fireEvent(EVT_DETAILS_ROW_LOADED); } for (int i = 0; i < count; i++) { ItemBridgeAdapter.ViewHolder bridgeViewHolder = (ItemBridgeAdapter.ViewHolder) gridView.getChildViewHolder(gridView.getChildAt(i)); RowPresenter rowPresenter = (RowPresenter) bridgeViewHolder.getPresenter(); onSetRowStatus(rowPresenter, rowPresenter.getRowViewHolder(bridgeViewHolder.getViewHolder()), bridgeViewHolder.getAdapterPositionInRecyclerView(), selectedPosition, selectedSubPosition); } } }
Source:
<code>public void logBadEmailRecord() { <START> LOG.error("logBadEmailRecord, payeeIdL '" + payeeId + "' payment group ID: '" + paymentGroupId + "' email address: '" + <END> emailAddress + "' disbursement number: '" + disbursementNumber + "'"); }</code><technical_language>Is payeeIdL a typo intentional</technical_language>

Target:
public void logBadEmailRecord() { LOG.error("logBadEmailRecord, payeeId: '" + payeeId + "' payment group ID: '" + paymentGroupId + "' email address: '" + emailAddress + "' disbursement number: '" + disbursementNumber + "'"); }
Source:
<code>private void closeOpenEditorsForProject(IProject project) { final List<IEditorReference> editorsToBeClosed = new ArrayList<>(); Map<IFile, IEditorReference> fileEditors = findAllEditorReferences(); try { List<IFile> projectfiles = findAllProjectFiles(project); for (IResource resource : projectfiles) { if (fileEditors.containsKey(resource)) { editorsToBeClosed.add(fileEditors.get(resource)); } } } catch (CoreException e) { <START> e.printStackTrace(); <END> } if (!editorsToBeClosed.isEmpty()) { PlatformUI.getWorkbench().getDisplay() .syncExec(new Runnable() { @Override public void run() { IEditorReference[] editorToBeClosed = new IEditorReference[editorsToBeClosed .size()]; editorToBeClosed = editorsToBeClosed .toArray(editorToBeClosed); activePage.closeEditors(editorToBeClosed, true); } }); } }</code><technical_language>Please log for errors</technical_language>

Target:
private void closeOpenEditorsForProject(IProject project) { final List<IEditorReference> editorsToBeClosed = new ArrayList<>(); Map<IFile, IEditorReference> fileEditors = findAllEditorReferences(); try { List<IFile> projectfiles = findAllProjectFiles(project); for (IResource resource : projectfiles) { if (fileEditors.containsKey(resource)) { editorsToBeClosed.add(fileEditors.get(resource)); } } } catch (CoreException e) { Activator.logError("Problems during auto-close of related editors", e); } if (!editorsToBeClosed.isEmpty()) { PlatformUI.getWorkbench().getDisplay() .syncExec(new Runnable() { @Override public void run() { IEditorReference[] editorToBeClosed = new IEditorReference[editorsToBeClosed .size()]; editorToBeClosed = editorsToBeClosed .toArray(editorToBeClosed); activePage.closeEditors(editorToBeClosed, true); } }); } }
Source:
<code>private void testGetRecoveryCourseForInstructor() { ______TS("success: instructor with deleted course"); InstructorAttributes instructor = dataBundle.instructors.get("instructor1OfCourse3"); CourseAttributes course = coursesLogic.getRecoveryCourseForInstructor(instructor); assertNotNull(course); <START> ______TS("boundary: instructor without any courses"); <END> instructor = dataBundle.instructors.get("instructor5"); course = coursesLogic.getRecoveryCourseForInstructor(instructor); assertNull(course); ______TS("Null parameter"); try { coursesLogic.getRecoveryCourseForInstructor(null); signalFailureToDetectException(); } catch (AssertionError e) { assertEquals(Const.StatusCodes.DBLEVEL_NULL_INPUT, e.getMessage()); } }</code><technical_language>more of "without **deleted** courses" courses right</technical_language>

Target:
private void testGetRecoveryCourseForInstructor() { ______TS("success: instructor with deleted course"); InstructorAttributes instructor = dataBundle.instructors.get("instructor1OfCourse3"); CourseAttributes course = coursesLogic.getRecoveryCourseForInstructor(instructor); assertNotNull(course); ______TS("boundary: instructor without any deleted courses"); instructor = dataBundle.instructors.get("instructor5"); course = coursesLogic.getRecoveryCourseForInstructor(instructor); assertNull(course); ______TS("Null parameter"); try { coursesLogic.getRecoveryCourseForInstructor(null); signalFailureToDetectException(); } catch (AssertionError e) { assertEquals(Const.StatusCodes.DBLEVEL_NULL_INPUT, e.getMessage()); } }
Source:
<code>public void testJobQueries(){ <START> List<TaskExecution> expectedTaskExecutionList = new ArrayList<TaskExecution>(2); <END> expectedTaskExecutionList.add(TestVerifierUtils.createSampleTaskExecutionNoArg()); expectedTaskExecutionList.add(TestVerifierUtils.createSampleTaskExecutionNoArg()); for (TaskExecution expectedTaskExecution : expectedTaskExecutionList) { expectedTaskExecution = this.dao.createTaskExecution(expectedTaskExecution.getTaskName(), expectedTaskExecution.getStartTime(), expectedTaskExecution.getArguments(), expectedTaskExecution.getExternalExecutionId()); this.dao.completeTaskExecution(expectedTaskExecution.getExecutionId(), expectedTaskExecution.getExitCode(), expectedTaskExecution.getEndTime(), expectedTaskExecution.getExitMessage()); } Set jobIds = new HashSet<Long>(2); jobIds.add(123L); jobIds.add(456L); this.dao.getBatchJobAssociations().put( expectedTaskExecutionList.get(0).getExecutionId(), jobIds); assertEquals(Long.valueOf(expectedTaskExecutionList.get(0).getExecutionId()), this.dao.getTaskExecutionIdByJobExecutionId(123L)); assertEquals(Long.valueOf(expectedTaskExecutionList.get(0).getExecutionId()), this.dao.getTaskExecutionIdByJobExecutionId(456L)); assertNull(this.dao.getTaskExecutionIdByJobExecutionId(789L)); }</code><technical_language>FYI, compile 1.7, diamond operators <></technical_language>

Target:
public void testJobQueries(){ List<TaskExecution> expectedTaskExecutionList = new ArrayList<>(2); expectedTaskExecutionList.add(TestVerifierUtils.createSampleTaskExecutionNoArg()); expectedTaskExecutionList.add(TestVerifierUtils.createSampleTaskExecutionNoArg()); for (TaskExecution expectedTaskExecution : expectedTaskExecutionList) { expectedTaskExecution = this.dao.createTaskExecution(expectedTaskExecution.getTaskName(), expectedTaskExecution.getStartTime(), expectedTaskExecution.getArguments(), expectedTaskExecution.getExternalExecutionId()); this.dao.completeTaskExecution(expectedTaskExecution.getExecutionId(), expectedTaskExecution.getExitCode(), expectedTaskExecution.getEndTime(), expectedTaskExecution.getExitMessage()); } Set jobIds = new HashSet<Long>(2); jobIds.add(123L); jobIds.add(456L); this.dao.getBatchJobAssociations().put( expectedTaskExecutionList.get(0).getExecutionId(), jobIds); assertEquals(Long.valueOf(expectedTaskExecutionList.get(0).getExecutionId()), this.dao.getTaskExecutionIdByJobExecutionId(123L)); assertEquals(Long.valueOf(expectedTaskExecutionList.get(0).getExecutionId()), this.dao.getTaskExecutionIdByJobExecutionId(456L)); assertNull(this.dao.getTaskExecutionIdByJobExecutionId(789L)); }
Source:
<code>private void writeAddress(VmDevice device) { if (!device.getAddress().isEmpty()) { writeAddress(StringMapUtils.string2Map(device.getAddress())); <START> } <END> }</code><technical_language>need for this part - StringMapUtils#string2Map is supposed return empty map for empty string writeAddress method write xml</technical_language>

Target:
private void writeAddress(VmDevice device) { writeAddress(StringMapUtils.string2Map(device.getAddress())); }
Source:
<code>private Champ insertIntoPrefix(final int index, final ByteArrayWrapper key, final MaybeMultihash val) { final HashPrefixPayload[] src = this.contents; final HashPrefixPayload[] result = new HashPrefixPayload[src.length]; <START> System.arraycopy(src, 0, result, 0, src.length); <END> KeyElement[] prefix = new KeyElement[src[index].mappings.length + 1]; System.arraycopy(src[index].mappings, 0, prefix, 0, src[index].mappings.length); prefix[prefix.length - 1] = new KeyElement(key, val); Arrays.sort(prefix, Comparator.comparing(m -> m.key)); result[index] = new HashPrefixPayload(prefix, null); return new Champ(dataMap, nodeMap, result); }</code><technical_language>clearer Arrays.copyOf</technical_language>

Target:
private Champ insertIntoPrefix(final int index, final ByteArrayWrapper key, final MaybeMultihash val) { final HashPrefixPayload[] src = this.contents; final HashPrefixPayload[] result = Arrays.copyOf(src, src.length); KeyElement[] prefix = new KeyElement[src[index].mappings.length + 1]; System.arraycopy(src[index].mappings, 0, prefix, 0, src[index].mappings.length); prefix[prefix.length - 1] = new KeyElement(key, val); Arrays.sort(prefix, Comparator.comparing(m -> m.key)); result[index] = new HashPrefixPayload(prefix); return new Champ(dataMap, nodeMap, result); }
Source:
<code>public void queueLogin(Player player) { if (player.getState() == EntityState.NEW && !logins.contains(player)) { <START> logins.offer(player); <END> } }</code><technical_language>Add offer for ConcurrentLinkedQueue</technical_language>

Target:
public void queueLogin(Player player) { if (player.getState() == EntityState.NEW && !logins.contains(player)) { logins.add(player); } }
Source:
<code>public final void deliverResponse(final Exchange exchange, final Response response) { if (response == null) { throw new NullPointerException("Response must not be null"); } else if (exchange == null) { throw new NullPointerException("Exchange must not be null"); } else if (exchange.getRequest() == null) { throw new IllegalArgumentException("Exchange does not contain request"); } else { boolean processed = preDeliverResponse(exchange, response); if (!processed && exchange.getRequest().getResponse() == null) { <START> exchange.getRequest().setResponse(response); <END> } } }</code><technical_language>I want</technical_language>

Target:
public final void deliverResponse(final Exchange exchange, final Response response) { if (response == null) { throw new NullPointerException("Response must not be null"); } else if (exchange == null) { throw new NullPointerException("Exchange must not be null"); } else if (exchange.getRequest() == null) { throw new IllegalArgumentException("Exchange does not contain request"); } else { boolean processed = preDeliverResponse(exchange, response); if (!processed) { exchange.getRequest().setResponse(response); } } }
Source:
<code>public static void verifyParallelism(ExecutionEnvironment env, int expectedParallelism) { <START> Optimizer compiler = new Optimizer(null, new DefaultCostEstimator(), new Configuration()); <END> OptimizedPlan optimizedPlan = compiler.compile(env.createProgramPlan()); List<PlanNode> queue = new ArrayList<>(); queue.addAll(optimizedPlan.getDataSinks()); while (queue.size() > 0) { PlanNode node = queue.remove(queue.size() - 1); assertTrue("Wrong parallelism for " + node.toString(), node.getParallelism() <= expectedParallelism); for (Channel channel : node.getInputs()) { queue.add(channel.getSource()); } } }</code><technical_language>Is this change needed</technical_language>

Target:
public static void verifyParallelism(ExecutionEnvironment env, int expectedParallelism) { env.setParallelism(2 * expectedParallelism); Optimizer compiler = new Optimizer(null, new DefaultCostEstimator(), new Configuration()); OptimizedPlan optimizedPlan = compiler.compile(env.createProgramPlan()); List<PlanNode> queue = new ArrayList<>(); queue.addAll(optimizedPlan.getDataSinks()); while (queue.size() > 0) { PlanNode node = queue.remove(queue.size() - 1); assertTrue("Wrong parallelism for " + node.toString(), node.getParallelism() <= expectedParallelism); for (Channel channel : node.getInputs()) { queue.add(channel.getSource()); } } }
Source:
<code><START> public static <S,D> DocumentStream<D> map(final DocumentStream<S> source,final Function<S,D> map) { <END> return new DocumentStreamMapper<S,D>(source,map); }</code><technical_language>nitpick: need keyword public</technical_language>

Target:
static <S,D> DocumentStream<D> map(final DocumentStream<S> source,final Function<S,D> map) { if(source instanceof RewindableDocumentStream) return new RewindableDocumentStream.RewindableDocumentStreamMapper<S,D>((RewindableDocumentStream<S>)source,map); else return new DocumentStreamMapper<S,D>(source,map); }
Source:
<code>protected GroupSetProvider(GroupBackend groupBackend, @GerritServerConfig Config config, ThreadLocalRequestContext threadContext, ServerRequestContext serverCtx, String section, String subsection, String name) { <START> RequestContext ctx = threadContext.setContext(serverCtx); <END> String[] groupNames = config.getStringList(section, subsection, name); ImmutableSet.Builder<AccountGroup.UUID> builder = ImmutableSet.builder(); for (String n : groupNames) { GroupReference g = GroupBackends.findBestSuggestion(groupBackend, n); if (g == null) { log.warn("Group \"{}\" not in database, skipping.", n); } else { builder.add(g.getUUID()); } } groupIds = builder.build(); threadContext.setContext(ctx); }</code><technical_language>need wrap body in a try/finally ensure erase context</technical_language>

Target:
protected GroupSetProvider(GroupBackend groupBackend, @GerritServerConfig Config config, ThreadLocalRequestContext threadContext, ServerRequestContext serverCtx, String section, String subsection, String name) { RequestContext ctx = threadContext.setContext(serverCtx); try { String[] groupNames = config.getStringList(section, subsection, name); ImmutableSet.Builder<AccountGroup.UUID> builder = ImmutableSet.builder(); for (String n : groupNames) { GroupReference g = GroupBackends.findBestSuggestion(groupBackend, n); if (g == null) { log.warn("Group \"{}\" not in database, skipping.", n); } else { builder.add(g.getUUID()); } } groupIds = builder.build(); } finally { threadContext.setContext(ctx); } }
Source:
<code>protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); context.getPropertiesComponent().setLocation("ref:prop"); ((ElytronComponent) context.getComponent("elytron")).setSecurityDomainBuilder(getSecurityDomainBuilder()); ((ElytronComponent) context.getComponent("elytron")).setMechanismName(getMechanismName()); <START> ((ElytronComponent) context.getComponent("elytron")).setElytronProvider(getElytronProvider()); <END> return context; }</code><technical_language>nit: context.getComponent("elytron", ElytronComponent.class).setXXX a bit nicer casting</technical_language>

Target:
protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); context.getPropertiesComponent().setLocation("ref:prop"); context.getComponent("elytron", ElytronComponent.class).setSecurityDomainBuilder(getSecurityDomainBuilder()); context.getComponent("elytron", ElytronComponent.class).setMechanismName(getMechanismName()); context.getComponent("elytron", ElytronComponent.class).setElytronProvider(getElytronProvider()); return context; }
Source:
<code>public void prepareRun(BatchSourceContext context) throws Exception { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); try { <START> Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); <END> Job job = JobUtils.createInstance(); Configuration conf = job.getConfiguration(); conf.set(HiveConf.ConfVars.METASTOREURIS.varname, config.metaStoreURI); if (UserGroupInformation.isSecurityEnabled()) { conf.set(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL.varname, "true"); conf.set("hive.metastore.token.signature", HiveAuthFactory.HS2_CLIENT_TOKEN); } HCatInputFormat.setInput(conf, config.dbName, config.tableName, config.partitions); HCatSchema hCatSchema = HCatInputFormat.getTableSchema(conf); if (config.schema != null) { hCatSchema = HiveSchemaConverter.toHiveSchema(Schema.parseJson(config.schema), hCatSchema); HCatInputFormat.setOutputSchema(job, hCatSchema); } HiveSchemaStore.storeHiveSchema(context, config.dbName, config.tableName, hCatSchema); context.setInput(Input.of(config.referenceName, new SourceInputFormatProvider(HCatInputFormat.class, conf))); } finally { Thread.currentThread().setContextClassLoader(classLoader); } }</code><technical_language>is ok remove this log statement now</technical_language>

Target:
public void prepareRun(BatchSourceContext context) throws Exception { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); try { Job job = JobUtils.createInstance(); Configuration conf = job.getConfiguration(); conf.set(HiveConf.ConfVars.METASTOREURIS.varname, config.metaStoreURI); if (UserGroupInformation.isSecurityEnabled()) { conf.set(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL.varname, "true"); conf.set("hive.metastore.token.signature", HiveAuthFactory.HS2_CLIENT_TOKEN); } HCatInputFormat.setInput(conf, config.dbName, config.tableName, config.partitions); HCatSchema hCatSchema = HCatInputFormat.getTableSchema(conf); if (config.schema != null) { hCatSchema = HiveSchemaConverter.toHiveSchema(Schema.parseJson(config.schema), hCatSchema); HCatInputFormat.setOutputSchema(job, hCatSchema); } HiveSchemaStore.storeHiveSchema(context, config.dbName, config.tableName, hCatSchema); context.setInput(Input.of(config.referenceName, new SourceInputFormatProvider(HCatInputFormat.class, conf))); } finally { Thread.currentThread().setContextClassLoader(classLoader); } }
Source:
<code>public List<Alert> getExampleAlerts() { List<Alert> alerts = new ArrayList<Alert>(); alerts.add( buildAlert( new Result( "ExampleLibrary", "x.y.z", <START> Collections.<String, Set<String>>emptyMap(), <END> null), "") .build()); return alerts; }</code><technical_language>types removed</technical_language>

Target:
public List<Alert> getExampleAlerts() { List<Alert> alerts = new ArrayList<Alert>(); alerts.add( buildAlert(new Result("ExampleLibrary", "x.y.z", Collections.emptyMap(), null), "") .build()); return alerts; }
Source:
<code><START> JsonIterator getNextLineIterator() <END> { if (lineIterator != null) { lineIterator = null; } final JsonIterator iterator = resultIterator.next(); return iterator; }</code><technical_language>this method private</technical_language>

Target:
private JsonIterator getNextLineIterator() { if (lineIterator != null) { lineIterator = null; } final JsonIterator iterator = resultIterator.next(); return iterator; }
Source:
<code>public E previous() { <START> E e = iterator.previous(); <END> lastRet = ObservableArrayList.this.list.indexOf(e); return e; }</code><technical_language>final</technical_language>

Target:
public E previous() { final E e = iterator.previous(); lastRet = ObservableArrayList.this.list.indexOf(e); return e; }
Source:
<code>public boolean visitMethodInvocation(MethodInvocation node) { if (!hasRuntimePermissionAnnotation) { return super.visitMethodInvocation(node); } if (!"onRequestPermissionsResult".equals(node.astName().astValue())) { return super.visitMethodInvocation(node); } if (node.astOperand() instanceof VariableReference) { <START> VariableReference ref = (VariableReference) node.astOperand(); <END> if (generatedClassName.equals(ref.astIdentifier().astValue())) { hasOnRequestPermissionResultCall = true; } } return super.visitMethodInvocation(node); }</code><technical_language>I wish Kotlin :sob:</technical_language>

Target:
public boolean visitMethodInvocation(MethodInvocation node) { if (!hasRuntimePermissionAnnotation || hasOnRequestPermissionResultCall) { return super.visitMethodInvocation(node); } if (!"onRequestPermissionsResult".equals(node.astName().astValue())) { return super.visitMethodInvocation(node); } if (node.astOperand() instanceof VariableReference) { VariableReference ref = (VariableReference) node.astOperand(); if (generatedClassName.equals(ref.astIdentifier().astValue())) { hasOnRequestPermissionResultCall = true; } } return super.visitMethodInvocation(node); }
Source:
<code>public void retryCustomConfirmation(String email) throws AppException { <START> Util.checkEmpty(email, "email"); <END> AtomicReference<AppException> error = new AtomicReference<>(null); call(TYPE_CALL_CUSTOM_CONFIRMATION_FUNCTION, new OsJNIVoidResultCallback(error), email); ResultHandler.handleResult(null, error); }</code><technical_language>include a test for validations</technical_language>

Target:
public void retryCustomConfirmation(String email) throws AppException { Util.checkEmpty(email, "email"); AtomicReference<AppException> error = new AtomicReference<>(null); call(TYPE_RETRY_CUSTOM_CONFIRMATION, new OsJNIVoidResultCallback(error), email); ResultHandler.handleResult(null, error); }
Source:
<code>public GrayOutUnavailableLabelProvider(ViewerFilter filter) { <START> this.display = Display.getDefault(); <END> this.filter = filter; toDispose = new HashSet<Image>(); }</code><technical_language>this display instantiating class, CPD? Display.getDefault() in workbench, return correct value</technical_language>

Target:
public GrayOutUnavailableLabelProvider(ViewerFilter filter) { this.display = PlatformUI.getWorkbench().getDisplay(); this.filter = filter; toDispose = new HashSet<Image>(); }
Source:
<code>private void addSequence(Object generatorKey, String sequenceName, int initialValue) { Label generatorKeyLabel = DynamicLabel.label( generatorKey.toString() ); Map<String, Object> params = new HashMap<String, Object>(); <START> params.put( INITIAL_VALUE_QUERY_PARAM, initialValue ); <END> String query = "MERGE (n" + labels( sequenceName, generatorKeyLabel.name(), NodeLabel.SEQUENCE.name() ) + " ) ON CREATE SET n.`" + sequenceName + "` = {" + INITIAL_VALUE_QUERY_PARAM + "} RETURN n"; engine.execute( query, params ); }</code><technical_language>Collections#singletonMap()</technical_language>

Target:
private void addSequence(Object generatorKey, String sequenceName, int initialValue) { Label generatorKeyLabel = generatorKeyLabel( generatorKey ); String query = "MERGE (n" + labels( generatorKeyLabel.name(), NodeLabel.SEQUENCE.name() ) + " { " + SEQUENCE_NAME_PROPERTY + ": {" + SEQUENCE_NAME_QUERY_PARAM + "}} ) ON CREATE SET n." + CURRENT_VALUE_PROPERTY + " = {" + INITIAL_VALUE_QUERY_PARAM + "} RETURN n"; engine.execute( query, params( sequenceName, initialValue ) ); }