auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void execute(SensorContext sensorContext) { final PageLexer pageLexer = new PageLexer(); final VueLexer vueLexer = new VueLexer(); FileSystem fileSystem = sensorContext.fileSystem(); final HtmlAstScanner scanner = setupScanner(sensorContext); FilePredicates predicates = fileSystem.predicates(); Iterable<InputFile> inputFiles = fileSystem.inputFiles( predicates.and( predicates.hasType(InputFile.Type.MAIN), predicates.or( predicates.hasLanguages(HtmlConstants.LANGUAGE_KEY, HtmlConstants.JSP_LANGUAGE_KEY), predicates.or(Stream.of(OTHER_FILE_SUFFIXES).map(predicates::hasExtension).toArray(FilePredicate[]::new)) ) )); for (InputFile inputFile : inputFiles) { if (sensorContext.isCancelled()) { return; } HtmlSourceCode sourceCode = new HtmlSourceCode(inputFile); try (Reader reader = new InputStreamReader(inputFile.inputStream(), inputFile.charset())) { <START> PageLexer lexer = inputFile.filename().endsWith(".vue") ? vueLexer : pageLexer; <END> scanner.scan(lexer.parse(reader), sourceCode); saveMetrics(sensorContext, sourceCode); saveLineLevelMeasures(inputFile, sourceCode); } catch (Exception e) { LOG.error("Cannot analyze file " + inputFile, e); sensorContext.newAnalysisError() .onFile(inputFile) .message(e.getMessage()) .save(); } } }</code><technical_language>of lexers state, safer create a new instance for file, is clear this is case</technical_language>

Target:
public void execute(SensorContext sensorContext) { FileSystem fileSystem = sensorContext.fileSystem(); final HtmlAstScanner scanner = setupScanner(sensorContext); FilePredicates predicates = fileSystem.predicates(); Iterable<InputFile> inputFiles = fileSystem.inputFiles( predicates.and( predicates.hasType(InputFile.Type.MAIN), predicates.or( predicates.hasLanguages(HtmlConstants.LANGUAGE_KEY, HtmlConstants.JSP_LANGUAGE_KEY), predicates.or(Stream.of(OTHER_FILE_SUFFIXES).map(predicates::hasExtension).toArray(FilePredicate[]::new)) ) )); for (InputFile inputFile : inputFiles) { if (sensorContext.isCancelled()) { return; } HtmlSourceCode sourceCode = new HtmlSourceCode(inputFile); try (Reader reader = new InputStreamReader(inputFile.inputStream(), inputFile.charset())) { PageLexer lexer = inputFile.filename().endsWith(".vue") ? new VueLexer() : new PageLexer(); scanner.scan(lexer.parse(reader), sourceCode); saveMetrics(sensorContext, sourceCode); saveLineLevelMeasures(inputFile, sourceCode); } catch (Exception e) { LOG.error("Cannot analyze file " + inputFile, e); sensorContext.newAnalysisError() .onFile(inputFile) .message(e.getMessage()) .save(); } } }
Source:
<code>public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Map<UUID, Cards> cardsToDiscard = new HashMap<>(); if (controller == null) { return true; } for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player == null) { continue; } int numberOfCardsToDiscard = Math.min(1, player.getHand().size()); Cards cards = new CardsImpl(); Target target = new TargetDiscard(numberOfCardsToDiscard, numberOfCardsToDiscard, StaticFilters.FILTER_CARD, playerId); player.chooseTarget(outcome, target, source, game); cards.addAll(target.getTargets()); cardsToDiscard.put(playerId, cards); } for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player == null) { continue; } int amountDiscarded = player.discard(cardsToDiscard.get(playerId), source, game).size(); <START> if (!playerId.equals(controller.getId()) && amountDiscarded == 0) { <END> player.loseLife(3, game, false); } } return true; }</code><technical_language>This Player::hasOpponent want compatible 2HG mode get implementing</technical_language>

Target:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Map<UUID, Cards> cardsToDiscard = new HashMap<>(); if (controller == null) { return true; } for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player == null) { continue; } int numberOfCardsToDiscard = Math.min(1, player.getHand().size()); Cards cards = new CardsImpl(); Target target = new TargetDiscard(numberOfCardsToDiscard, numberOfCardsToDiscard, StaticFilters.FILTER_CARD, playerId); player.chooseTarget(outcome, target, source, game); cards.addAll(target.getTargets()); cardsToDiscard.put(playerId, cards); } for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player == null) { continue; } int amountDiscarded = player.discard(cardsToDiscard.get(playerId), source, game).size(); if (controller.hasOpponent(playerId, game) && amountDiscarded == 0) { player.loseLife(3, game, false); } } return true; }
Source:
<code>private void auditHost(HostVO host) { _hostDao.loadDetails(host); boolean validateDomains = true; List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listByHost(host.getId()); if (!CollectionUtils.isEmpty(nuageVspDevices)) { for (NuageVspDeviceVO nuageVspDevice : nuageVspDevices) { ConfigurationVO cmsIdConfig = _configDao.findByName("nuagevsp.cms.id"); String nuageVspCmsId = findNuageVspCmsIdForDevice(nuageVspDevice.getId(), cmsIdConfig); SyncNuageVspCmsIdCommand syncCmd = new SyncNuageVspCmsIdCommand(SyncType.AUDIT, nuageVspCmsId); SyncNuageVspCmsIdAnswer answer = (SyncNuageVspCmsIdAnswer) _agentMgr.easySend(nuageVspDevice.getHostId(), syncCmd); if (answer != null && !answer.getSuccess()) { <START> s_logger.fatal("Nuage VSP Device with ID " + nuageVspDevice.getId() + " is configured with an unknown CMS ID!"); <END> validateDomains = false; } else if (answer != null && answer.getSyncType() == SyncType.REGISTER) { registerNewNuageVspDevice(cmsIdConfig, nuageVspDevice.getId() + ":" + answer.getNuageVspCmsId()); } } } if (validateDomains) { auditDomainsOnVsp(host, true, false); } }</code><technical_language>logging FATAL? typically log ERROR</technical_language>

Target:
private void auditHost(HostVO host) { _hostDao.loadDetails(host); boolean validateDomains = true; List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listByHost(host.getId()); if (!CollectionUtils.isEmpty(nuageVspDevices)) { for (NuageVspDeviceVO nuageVspDevice : nuageVspDevices) { ConfigurationVO cmsIdConfig = _configDao.findByName("nuagevsp.cms.id"); String nuageVspCmsId = findNuageVspCmsIdForDevice(nuageVspDevice.getId(), cmsIdConfig); SyncNuageVspCmsIdCommand syncCmd = new SyncNuageVspCmsIdCommand(SyncType.AUDIT, nuageVspCmsId); SyncNuageVspCmsIdAnswer answer = (SyncNuageVspCmsIdAnswer) _agentMgr.easySend(nuageVspDevice.getHostId(), syncCmd); if (answer != null && !answer.getSuccess()) { s_logger.error("Nuage VSP Device with ID " + nuageVspDevice.getId() + " is configured with an unknown CMS ID!"); validateDomains = false; } else if (answer != null && answer.getSyncType() == SyncType.REGISTER) { registerNewNuageVspDevice(cmsIdConfig, nuageVspDevice.getId() + ":" + answer.getNuageVspCmsId()); } } } if (validateDomains) { auditDomainsOnVsp(host, true, false); } }
Source:
<code>private void createFilteredTreeViewer(Composite parent) { PatternFilter filter = new ViewPatternFilter(context); int styleBits = SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER; <START> filteredTree = new FilteredTree(parent, styleBits, filter, true); <END> filteredTree.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); TreeViewer treeViewer = filteredTree.getViewer(); Control treeControl = treeViewer.getControl(); RGB dimmedRGB = blend(treeControl.getForeground().getRGB(), treeControl.getBackground() .getRGB(), 60); dimmedForeground = new Color(treeControl.getDisplay(), dimmedRGB); treeControl.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { dimmedForeground.dispose(); } }); treeViewer.setLabelProvider(new ViewLabelProvider(context, modelService, window, dimmedForeground)); treeViewer.setContentProvider(new ViewContentProvider(application)); treeViewer.setComparator(new ViewComparator()); treeViewer.setInput(application); treeViewer.addSelectionChangedListener(this); treeViewer.addDoubleClickListener(this); treeViewer.getControl().addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { handleTreeViewerKeyPressed(e); } }); if (hasAtMostOneView(filteredTree.getViewer())) { Text filterText = filteredTree.getFilterControl(); if (filterText != null) { filterText.setEnabled(false); } } }</code><technical_language>happened quick selection mode</technical_language>

Target:
private void createFilteredTreeViewer(Composite parent) { PatternFilter filter = new ViewPatternFilter(context); int styleBits = SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER; filteredTree = new FilteredTree(parent, styleBits, filter, true); filteredTree.setQuickSelectionMode(true); filteredTree.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); TreeViewer treeViewer = filteredTree.getViewer(); Control treeControl = treeViewer.getControl(); RGB dimmedRGB = blend(treeControl.getForeground().getRGB(), treeControl.getBackground() .getRGB(), 60); dimmedForeground = new Color(treeControl.getDisplay(), dimmedRGB); treeControl.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { dimmedForeground.dispose(); } }); treeViewer.setLabelProvider(new ViewLabelProvider(context, modelService, window, dimmedForeground)); treeViewer.setContentProvider(new ViewContentProvider(application)); treeViewer.setComparator(new ViewComparator()); treeViewer.setInput(application); treeViewer.addSelectionChangedListener(this); treeViewer.addDoubleClickListener(this); treeViewer.getControl().addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { handleTreeViewerKeyPressed(e); } }); if (hasAtMostOneView(filteredTree.getViewer())) { Text filterText = filteredTree.getFilterControl(); if (filterText != null) { filterText.setEnabled(false); } } }
Source:
<code>public void setPercentiles(List<Double> percentiles) { <START> percentilesArray.set(getGroupId(), requireNonNull(percentiles, "percentiles is null")); <END> }</code><technical_language>This create a List => Double for group, in billions. people this function static quantiles. change List => Double for quantiles validate static in function</technical_language>

Target:
public void setPercentiles(List<Double> percentiles) { if (percentiles == null) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Percentiles is null"); } if (percentilesList != null && !percentilesList.equals(percentiles)) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Percentiles must be constant"); } percentilesList = percentiles; }
Source:
<code>public void reset() throws TimeoutException, XBeeException { if (!connectionInterface.isOpen()) throw new InterfaceNotOpenException(); if (!isRemote()) logger.info(toString() + "Resetting the local module..."); else logger.info(toString() + "Resetting the remote module ({})...", get64BitAddress()); ATCommandResponse response = null; try { response = sendATCommand(new ATCommand("FR")); } catch (IOException e) { throw new XBeeException("Error writing in the communication interface.", e); } checkATCommandResponseIsValid(response); <START> if (!waitForModemStatusPacket()) <END> throw new TimeoutException("Timeout waiting for the Modem Status packet."); logger.info(toString() + "Module reset successfully."); }</code><technical_language>I wait for Modem status packet if module is local. If call waitForModemStatusPacket() method resetting a remote node, method wait 5 seconds, it</technical_language>

Target:
public void reset() throws TimeoutException, XBeeException { if (!connectionInterface.isOpen()) throw new InterfaceNotOpenException(); if (!isRemote()) logger.info(toString() + "Resetting the local module..."); else logger.info(toString() + "Resetting the remote module ({})...", get64BitAddress()); ATCommandResponse response = null; try { response = sendATCommand(new ATCommand("FR")); } catch (IOException e) { throw new XBeeException("Error writing in the communication interface.", e); } checkATCommandResponseIsValid(response); if (!isRemote()) { if (!waitForModemStatusPacket()) throw new TimeoutException("Timeout waiting for the Modem Status packet."); logger.info(toString() + "Module reset successfully."); } }
Source:
<code>private ThreadPoolExecutor createBoundedExecutor(int poolSize) { <START> return PTExecutors.newThreadPoolExecutor( <END> poolSize, poolSize, 1, TimeUnit.SECONDS, new LinkedBlockingQueue<>(1)); }</code><technical_language>static</technical_language>

Target:
private static ThreadPoolExecutor createBoundedExecutor(int poolSize) { return PTExecutors.newThreadPoolExecutor( poolSize, poolSize, 1, TimeUnit.SECONDS, new LinkedBlockingQueue<>(1)); }
Source:
<code><START> private DiskVmElement createDiskVmElementUsingScsiReserevation() { <END> DiskVmElement dve = new DiskVmElement(); dve.setUsingScsiReservation(true); return dve; }</code><technical_language>static</technical_language>

Target:
private static DiskVmElement createDiskVmElementUsingScsiReserevation() { DiskVmElement dve = new DiskVmElement(); dve.setUsingScsiReservation(true); return dve; }
Source:
<code>private VmPoolType getVmPoolType() { if (getVm().getVmPoolId() == null) { return null; } <START> VmPool pool = getVmPoolDao().get(getVm().getVmPoolId()); <END> if (pool == null) { return null; } else { return pool.getVmPoolType(); } }</code><technical_language>consider caching pool entity avoid db</technical_language>

Target:
private VmPoolType getVmPoolType() { VmPool pool = getVmPoolCached(); return (pool != null) ? pool.getVmPoolType() : null; }
Source:
<code>public boolean canParseResource(HttpMessage message, String path, boolean wasAlreadyConsumed) { try { <START> String contentType = message.getResponseHeader().getHeader(HttpHeader.CONTENT_TYPE); <END> if (contentType.toLowerCase().startsWith("application/vnd.oai.openapi")) { return true; } else if ((contentType.toLowerCase().contains("json") || contentType.toLowerCase().contains("yaml")) && (message.getResponseBody().toString().toLowerCase().startsWith("swagger:") || message.getResponseBody() .toString() .toLowerCase() .startsWith("openapi:"))) { return true; } } catch (Exception e) { return false; } log.debug("Cant parse " + message.getRequestHeader().getURI()); return false; }</code><technical_language>adding toLowerCase() wont needed later</technical_language>

Target:
public boolean canParseResource(HttpMessage message, String path, boolean wasAlreadyConsumed) { try { String contentType = message.getResponseHeader() .getHeader(HttpHeader.CONTENT_TYPE) .toLowerCase(Locale.ROOT); String responseBodyStart = StringUtils.left(message.getResponseBody().toString(), 250) .toLowerCase(Locale.ROOT); if (contentType.startsWith("application/vnd.oai.openapi")) { return true; } else if ((contentType.contains("json") || contentType.contains("yaml")) && (responseBodyStart.contains("swagger") || responseBodyStart.contains("openapi"))) { return true; } } catch (Exception e) { return false; } log.debug("Cant parse " + message.getRequestHeader().getURI()); return false; }
Source:
<code>private Authentication doAuthenticate(PreAuthenticatedAuthenticationToken preAuthToken) { String pluginId = preAuthToken.getPluginId(); <START> AuthenticationResponse response = authenticateUser(pluginId, preAuthToken); <END> if(authenticationFailed(response)) { return null; } UserDetails userDetails = getUserDetails(response.getUser()); userService.addUserIfDoesNotExist(toDomainUser(response.getUser())); assignRoles(pluginId, userDetails.getUsername(), response.getRoles()); PreAuthenticatedAuthenticationToken result = new PreAuthenticatedAuthenticationToken(userDetails, preAuthToken.getCredentials(), pluginId, userDetails.getAuthorities()); result.setAuthenticated(true); return result; }</code><technical_language>pluginId PreAuthenticatedAuthenticationToken</technical_language>

Target:
private Authentication doAuthenticate(PreAuthenticatedAuthenticationToken preAuthToken) { String pluginId = preAuthToken.getPluginId(); AuthenticationResponse response = authenticateUser(preAuthToken); if (!isAuthenticated(response)) { return null; } UserDetails userDetails = getUserDetails(response.getUser()); userService.addUserIfDoesNotExist(toDomainUser(response.getUser())); assignRoles(pluginId, userDetails.getUsername(), response.getRoles()); PreAuthenticatedAuthenticationToken result = new PreAuthenticatedAuthenticationToken(userDetails, preAuthToken.getCredentials(), pluginId, userDetails.getAuthorities()); result.setAuthenticated(true); return result; }
Source:
<code>private void setRequestIdInNodeConfig(Map<String, Object> nodeConfig, String acquireRequestId) { <START> String nodeTags = (String) nodeConfig.getOrDefault(NODE_CONFIG_TAGS_KEY, ""); <END> if (!nodeTags.isEmpty()) { nodeTags += "," + acquireRequestId; } else { nodeTags = acquireRequestId; } nodeConfig.put(NODE_CONFIG_TAGS_KEY, nodeTags); }</code><technical_language>a class cast exception if json is in incorrect format</technical_language>

Target:
private void setRequestIdInNodeConfig(Map<String, Object> nodeConfig, String acquireRequestId) { String nodeTags; try { nodeTags = (String) nodeConfig.getOrDefault(NODE_CONFIG_TAGS_KEY, ""); } catch (ClassCastException e) { throw new IllegalArgumentException(String.format("The value of node configuration [%s] can't be casted to String", NODE_CONFIG_TAGS_KEY), e); } if (!nodeTags.isEmpty()) { nodeTags += "," + acquireRequestId; } else { nodeTags = acquireRequestId; } nodeConfig.put(NODE_CONFIG_TAGS_KEY, nodeTags); }
Source:
<code>private void openBranch() throws MergeException { alreadyAccepted = new HashSet<RevCommit>(); try { branchUpdate = repo.updateRef(destBranch.get()); if (branchUpdate.getOldObjectId() != null) { branchTip = (CodeReviewCommit) rw.parseCommit(branchUpdate.getOldObjectId()); alreadyAccepted.add(branchTip); } else { branchTip = null; } try { final Ref destRef = repo.getRef(destBranch.get()); <START> if (destRef == null) { <END> throw new MergeException("Destination branch \"" + branchUpdate.getRef().getName() + "\" does not exist"); } branchUpdate.setExpectedOldObjectId(destRef.getObjectId()); } catch (IOException e) { throw new MergeException( "Failed to check existence of destination branch", e); } for (final Ref r : repo.getAllRefs().values()) { if (r.getName().startsWith(Constants.R_HEADS) || r.getName().startsWith(Constants.R_TAGS)) { try { alreadyAccepted.add(rw.parseCommit(r.getObjectId())); } catch (IncorrectObjectTypeException iote) { } } } } catch (IOException e) { throw new MergeException("Cannot open branch", e); } }</code><technical_language>This fails case destBranch exist HEAD points it. For example a brand new repository commits a change submitted master, HEAD points to</technical_language>

Target:
private void openBranch() throws MergeException { alreadyAccepted = new HashSet<RevCommit>(); try { branchUpdate = repo.updateRef(destBranch.get()); if (branchUpdate.getOldObjectId() != null) { branchTip = (CodeReviewCommit) rw.parseCommit(branchUpdate.getOldObjectId()); alreadyAccepted.add(branchTip); } else { branchTip = null; } try { final Ref destRef = repo.getRef(destBranch.get()); if (destRef != null) { branchUpdate.setExpectedOldObjectId(destRef.getObjectId()); } else if (repo.getFullBranch().equals(destBranch.get())) { branchUpdate.setExpectedOldObjectId(ObjectId.zeroId()); } else { throw new MergeException("Destination branch \"" + branchUpdate.getRef().getName() + "\" does not exist"); } } catch (IOException e) { throw new MergeException( "Failed to check existence of destination branch", e); } for (final Ref r : repo.getAllRefs().values()) { if (r.getName().startsWith(Constants.R_HEADS) || r.getName().startsWith(Constants.R_TAGS)) { try { alreadyAccepted.add(rw.parseCommit(r.getObjectId())); } catch (IncorrectObjectTypeException iote) { } } } } catch (IOException e) { throw new MergeException("Cannot open branch", e); } }
Source:
<code>protected List<Image> execute(ListImagesCmd command) { WebTarget webResource = getBaseResource().path("/images/json").queryParam("all", command.hasShowAllEnabled() ? "1" : "0"); if (command.getFilters() != null) webResource = webResource.queryParam("filters", urlPathSegmentEscaper().escape(command.getFilters())); if (command.getImageNameFilter() != null) <START> webResource = webResource.queryParam("filter", urlPathSegmentEscaper().escape(command.getImageNameFilter())); <END> LOGGER.trace("GET: {}", webResource); List<Image> images = webResource.request().accept(MediaType.APPLICATION_JSON) .get(new GenericType<List<Image>>() { }); LOGGER.trace("Response: {}", images); return images; }</code><technical_language>put brackets if contains line, end in obvious errors</technical_language>

Target:
protected List<Image> execute(ListImagesCmd command) { WebTarget webTarget = getBaseResource().path("/images/json"); webTarget = booleanQueryParam(webTarget, "all", command.hasShowAllEnabled()); if (command.getFilters() != null) { webTarget = webTarget.queryParam("filters", urlPathSegmentEscaper().escape(command.getFilters())); } if (command.getImageNameFilter() != null) { webTarget = webTarget.queryParam("filter", urlPathSegmentEscaper().escape(command.getImageNameFilter())); } LOGGER.trace("GET: {}", webTarget); List<Image> images = webTarget.request().accept(MediaType.APPLICATION_JSON).get(new GenericType<List<Image>>() { }); LOGGER.trace("Response: {}", images); return images; }
Source:
<code>public Saveable[] getActiveSaveables() { if (!hasSaveablesProvider()) { IEditorPart saveablePart = getSite().getPage().getActiveEditor(); <START> return saveablePart instanceof ISaveablesSource ? ((ISaveablesSource) saveablePart).getActiveSaveables() <END> : new Saveable[] { new DefaultSaveable(saveablePart) }; } return super.getActiveSaveables(); }</code><technical_language>Case of null return empty array</technical_language>

Target:
public Saveable[] getActiveSaveables() { if (!hasSaveablesProvider()) { IEditorPart saveablePart = getSite().getPage().getActiveEditor(); return saveablePart != null ? saveablePart instanceof ISaveablesSource ? ((ISaveablesSource) saveablePart).getActiveSaveables() : new Saveable[] { new DefaultSaveable(saveablePart) } : new Saveable[] {}; } return super.getActiveSaveables(); }
Source:
<code>private JsonNode getMetric(String query, String ... params) { query = String.format(query, params); if (promUrl == null) { return new <START> LongNode(0); <END> } HttpResponse<String> response = request(query); if (response == null) { return new LongNode(0); } if (response.statusCode() >= 300) { throw new RuntimeException(String.format("Error fetching metric: %s", response.body())); } try { JsonNode node = mapper.readTree(response.body().getBytes()); if (node.has("status")) { if (node.get("status").asText().equals("success")) { JsonNode result = node.get("data").get("result"); if (result.size() > 0) { JsonNode value = result.get(0).get("value"); return value.get(1); } } else { log.warn("Query '{}' failed to execute: - {}", query, node.get("status"), node.get("error")); } } } catch (JsonProcessingException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } return new LongNode(0); }</code><technical_language>IntNode for zero in this method</technical_language>

Target:
private NumericNode getMetric(String query, String ... params) { NumericNode retVal = new IntNode(0); query = String.format(query, params); if (promUrl == null) { return retVal; } HttpResponse<String> response = request(query); if (response == null) { return retVal; } if (response.statusCode() >= 300) { log.warn("Failed to fetch metric {}: {}", query, response.body()); return retVal; } try { JsonNode node = mapper.readTree(response.body().getBytes()); if (node.has("status")) { if (node.get("status").asText().equals("success")) { JsonNode result = node.get("data").get("result"); if (result.size() > 0) { JsonNode value = result.get(0).get("value"); return (NumericNode)value.get(1); } } else { log.warn("Query '{}' failed to execute: - {}", query, node.get("status"), node.get("error")); } } } catch (JsonProcessingException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } return retVal; }
Source:
<code>public InputStream getContents() throws CoreException { <START> return fileRevision.getStorage(null).getContents(); <END> }</code><technical_language>pass in NullProgressMonitor, null</technical_language>

Target:
public InputStream getContents() throws CoreException { return fileRevision.getStorage(new NullProgressMonitor()).getContents(); }
Source:
<code>public void scrollToSlot(String slotName) { if (slotName.equals(AdsContent.BOTTOM_LB)) { triggerComments(); } if (slotName.equals(AdsContent.MOBILE_BOTTOM_LB)) { scrollToFooter(); <START> } <END> scrollToPosition("#" + slotName); }</code><technical_language>nitpick: if ... else more</technical_language>

Target:
public void scrollToSlot(String slotName) { if (slotName.equals(AdsContent.BOTTOM_LB)) { triggerComments(); } else if (slotName.equals(AdsContent.MOBILE_BOTTOM_LB)) { scrollToFooter(); } scrollToPosition("#" + slotName); }
Source:
<code>public <S extends T> Mono<S> findOne(Example<S> example) { Assert.notNull(example, "Sample must not be null!"); Query q = new Query(new Criteria().alike(example)); q.limit(2); return mongoOperations.find(q, example.getProbeType(), entityInformation.getCollectionName()).buffer(2) .flatMap(vals -> { if (vals.size() > 1) { return Mono.error(new IncorrectResultSizeDataAccessException(1)); } return Mono.just(vals.iterator().next()); <START> }).singleOrEmpty(); <END> }</code><technical_language>next() here. covered case if more element</technical_language>

Target:
public <S extends T> Mono<S> findOne(Example<S> example) { Assert.notNull(example, "Sample must not be null!"); Query q = new Query(new Criteria().alike(example)); q.limit(2); return mongoOperations.find(q, example.getProbeType(), entityInformation.getCollectionName()).buffer(2) .flatMap(vals -> { if (vals.size() > 1) { return Mono.error(new IncorrectResultSizeDataAccessException(1)); } return Mono.just(vals.iterator().next()); }).next(); }
Source:
<code>public ObjQualifier getObjQualifier() { return getObjQualifiers().stream() .findFirst() <START> .orElseThrow(() -> new IllegalStateException("The `item` of the object has not been set!")); <END> }</code><technical_language>backticks - I</technical_language>

Target:
public ObjQualifier getObjQualifier() { return getObjQualifiers().stream() .findFirst() .orElse(null); }
Source:
<code>public SqlConsecutiveJoinBenchmark(LocalQueryRunner localQueryRunner) { super(localQueryRunner, "sql_consecutive_join", 4, 5, "SELECT * FROM\n" + "(\n" + <START> " SELECT t1.orderkey AS key, t1.quantity, t2.orderkey, t2.quantity FROM\n" + <END> " (SELECT orderkey, quantity FROM lineitem) t1\n" + " JOIN\n" + " (SELECT orderkey, quantity FROM lineitem) t2\n" + " ON t1.orderkey = t2.orderkey\n" + ") t3\n" + "JOIN\n" + "(\n" + " SELECT t4.orderkey AS key, t4.quantity, t5.orderkey, t5.quantity FROM\n" + " (SELECT orderkey, quantity FROM lineitem) t4\n" + " JOIN\n" + " (SELECT orderkey, quantity FROM lineitem) t5\n" + " ON t4.orderkey = t5.orderkey\n" + ") t6\n" + "ON t3.key = t6.key"); }</code><technical_language>This nice plan nesting a specific query plan (joining tree) shape. Is guaranteed? com.facebook.presto.SystemSessionProperties#REORDER_JOINS</technical_language>

Target:
public SqlConsecutiveJoinBenchmark(LocalQueryRunner localQueryRunner) { super(localQueryRunner, "sql_consecutive_join", 4, 5, "SELECT * FROM " + "( " + " SELECT orders.orderkey as key, * FROM " + " customer JOIN orders " + " ON customer.custkey = orders.custkey " + ") t1 " + "JOIN " + "( " + " SELECT lineitem.orderkey as key, * FROM " + " part JOIN lineitem " + " ON part.partkey = lineitem.partkey " + ") t2 " + "ON t1.key = t2.key"); }
Source:
<code>public static String getEtcDirectory() { final String basedir = System.getenv("STRONGBOX_ETC") != null ? System.getenv("STRONGBOX_ETC") : System.getProperty("strongbox.etc"); if (basedir != null) { return new File(basedir).getAbsolutePath(); } else { <START> return new File("./etc").getAbsolutePath(); <END> } }</code><technical_language>please drop ./ part for this</technical_language>

Target:
public static String getEtcDirectory() { final String basedir = System.getenv("STRONGBOX_ETC") != null ? System.getenv("STRONGBOX_ETC") : System.getProperty("strongbox.etc"); if (basedir != null) { return new File(basedir).getAbsolutePath(); } else { return new File("etc").getAbsolutePath(); } }
Source:
<code>public void testResolvingEmptyKeyValueQueryReturnsNullComparator() { <START> KeyValueQuery<Object> keyValueQuery = new KeyValueQuery<Object>(); <END> HazelcastSortAccessor hazelcastSortAccessor = new HazelcastSortAccessor(); Comparator<Map.Entry<?, ?>> comparator = (Comparator<Map.Entry<?, ?>>) hazelcastSortAccessor.resolve(keyValueQuery); assertNull(comparator); }</code><technical_language>suggestion KeyValueQuery<Object> keyValueQuery = new KeyValueQuery<>();</technical_language>

Target:
public void testResolvingEmptyKeyValueQueryReturnsNullComparator() { KeyValueQuery<Object> keyValueQuery = new KeyValueQuery<>(); HazelcastSortAccessor hazelcastSortAccessor = new HazelcastSortAccessor(); Comparator<Map.Entry<?, ?>> comparator = hazelcastSortAccessor.resolve(keyValueQuery); assertNull(comparator); }
Source:
<code>public static void main(InputStream is, OutputStream os, Mode mode, boolean performPing, JarCache cache) throws IOException, InterruptedException { ExecutorService executor = Executors.newCachedThreadPool(); ChannelBuilder cb = new ChannelBuilder("channel", executor) .withMode(mode) .withJarCache(cache); if (os instanceof StandardOutputStream) cb.withProperty(StandardOutputStream.class,os); final Channel channel = cb.build(is, os); System.err.println("channel started"); long timeout = 1000 * Long.parseLong( System.getProperty("hudson.remoting.Launcher.pingTimeoutSec", "240")), interval = 1000 * Long.parseLong( System.getProperty("hudson.remoting.Launcher.pingIntervalSec", "600")); <START> boolean pingFailureAnalyzer = Boolean.parseBoolean(System.getProperty("hudson.remoting.Launcher.pingFailureAnalyzer", "false")); <END> if (performPing && timeout > 0 && interval > 0) { new PingThread(channel, timeout, interval, pingFailureAnalyzer) { @Deprecated @Override protected void onDead() { System.err.println("Ping failed. Terminating"); System.exit(-1); } @Override protected void onDead(Throwable diagnosis) { if (this.isPingFailureAnalyzer()) { PingFailureAnalyzer pingFailureAnalyzer = new PingFailureAnalyzer(channel, diagnosis); pingFailureAnalyzer.saveStackTrace(diagnosis); pingFailureAnalyzer.takeThreadDump(); } System.err.println("Ping failed. Terminating"); System.exit(-1); } }.start(); } channel.join(); System.err.println("channel stopped"); }</code><technical_language>[Boolean.getBoolean("hudson.remoting.Launcher.pingFailureAnalyzer")](<LINK_0></technical_language>

Target:
public static void main(InputStream is, OutputStream os, Mode mode, boolean performPing, JarCache cache) throws IOException, InterruptedException { ExecutorService executor = Executors.newCachedThreadPool(); ChannelBuilder cb = new ChannelBuilder("channel", executor) .withMode(mode) .withJarCache(cache); if (os instanceof StandardOutputStream) cb.withProperty(StandardOutputStream.class,os); final Channel channel = cb.build(is, os); System.err.println("channel started"); long timeout = 1000 * Long.parseLong( System.getProperty("hudson.remoting.Launcher.pingTimeoutSec", "240")), interval = 1000 * Long.parseLong( System.getProperty("hudson.remoting.Launcher.pingIntervalSec", "600")); final boolean agentFailureAnalyzer = Boolean.getBoolean("hudson.remoting.Launcher.agentFailureAnalyzer"); if (performPing && timeout > 0 && interval > 0) { new PingThread(channel, timeout, interval) { @Deprecated @Override protected void onDead() { System.err.println("Ping failed. Terminating"); System.exit(-1); } @Override protected void onDead(Throwable diagnosis) { if (agentFailureAnalyzer) { AgentFailuresAnalyzer agentFailuresAnalyzer = new AgentFailuresAnalyzer(channel, diagnosis); try { agentFailuresAnalyzer.saveStackTrace(diagnosis); agentFailuresAnalyzer.takeThreadDump(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } System.err.println("Ping failed. Terminating"); System.exit(-1); } }.start(); } channel.join(); System.err.println("channel stopped"); }
Source:
<code><START> public static Optional<String> getAttributeValue(FormEntryPrompt prompt, String attributeName) { <END> List<TreeElement> attributes = prompt.getBindAttributes(); Optional<TreeElement> attribute = attributes.stream().filter(attr -> { return attr.getName().equals(attributeName); }).findAny(); return attribute.map(TreeElement::getAttributeValue); }</code><technical_language>talked briefly optionals sticking nulls. diving optionals</technical_language>

Target:
public static String getAttributeValue(FormEntryPrompt prompt, String attributeName) { List<TreeElement> attributes = prompt.getBindAttributes(); Optional<TreeElement> attribute = attributes.stream().filter(attr -> attr.getName().equals(attributeName) ).findAny(); return attribute.map(TreeElement::getAttributeValue).orElse(null); }
Source:
<code>public void sendRegistrationToken(String gcmToken) { if (!TextUtils.isEmpty(gcmToken)) { AppLog.i(T.NOTIFS, "Sending GCM token to our remote services: " + gcmToken); if (AccountHelper.isSignedInWordPressDotCom()) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); String uuid = preferences.getString(NotificationsUtils.WPCOM_PUSH_DEVICE_UUID, null); if (uuid == null) { uuid = UUID.randomUUID().toString(); preferences.edit().putString(NotificationsUtils.WPCOM_PUSH_DEVICE_UUID, uuid); } preferences.edit().putString(NotificationsUtils.WPCOM_PUSH_DEVICE_TOKEN, gcmToken).apply(); NotificationsUtils.registerDeviceForPushNotifications(this, gcmToken); } HelpshiftHelper.getInstance().registerDeviceToken(this, gcmToken); AnalyticsTracker.registerPushNotificationToken(gcmToken); } else { <START> AppLog.w(T.NOTIFS, "Empty GCM token, can't register the id on remote services"); <END> } }</code><technical_language>remove WPCOM_PUSH_DEVICE_TOKEN preference here</technical_language>

Target:
public void sendRegistrationToken(String gcmToken) { if (!TextUtils.isEmpty(gcmToken)) { AppLog.i(T.NOTIFS, "Sending GCM token to our remote services: " + gcmToken); if (AccountHelper.isSignedInWordPressDotCom()) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); String uuid = preferences.getString(NotificationsUtils.WPCOM_PUSH_DEVICE_UUID, null); if (uuid == null) { uuid = UUID.randomUUID().toString(); preferences.edit().putString(NotificationsUtils.WPCOM_PUSH_DEVICE_UUID, uuid).apply(); } preferences.edit().putString(NotificationsUtils.WPCOM_PUSH_DEVICE_TOKEN, gcmToken).apply(); NotificationsUtils.registerDeviceForPushNotifications(this, gcmToken); } HelpshiftHelper.getInstance().registerDeviceToken(this, gcmToken); AnalyticsTracker.registerPushNotificationToken(gcmToken); } else { AppLog.w(T.NOTIFS, "Empty GCM token, can't register the id on remote services"); PreferenceManager.getDefaultSharedPreferences(this).edit().remove(NotificationsUtils.WPCOM_PUSH_DEVICE_TOKEN).apply(); } }
Source:
<code>public void testLoadContentError() { ArgumentCaptor<ServiceCallback> callbackArgumentCaptor = forClass(ServiceCallback.class); tested.loadContent(); verify(projectDiagramServices, times(1)).getByPath(eq(path), callbackArgumentCaptor.capture()); callbackArgumentCaptor.getValue().onError(new ClientRuntimeError(new DefinitionNotFoundException())); <START> verify(placeManager, times( 1)).forceClosePlace(any(PathPlaceRequest.class)); <END> ArgumentCaptor<Consumer> consumerArgumentCaptor = forClass(Consumer.class); verify(diagramClientErrorHandler, times(1)).handleError(any(ClientRuntimeError.class), consumerArgumentCaptor.capture()); consumerArgumentCaptor.getValue().accept("error message"); verify(errorPopupPresenter, times( 1)).showMessage(anyString()); }</code><technical_language>Formatting, space in times( 1)</technical_language>

Target:
public void testLoadContentError() { ArgumentCaptor<ServiceCallback> callbackArgumentCaptor = forClass(ServiceCallback.class); tested.loadContent(); verify(projectDiagramServices, times(1)).getByPath(eq(path), callbackArgumentCaptor.capture()); callbackArgumentCaptor.getValue().onError(new ClientRuntimeError(new DefinitionNotFoundException())); verify(placeManager, times(1)).forceClosePlace(any(PathPlaceRequest.class)); ArgumentCaptor<Consumer> consumerArgumentCaptor = forClass(Consumer.class); verify(diagramClientErrorHandler, times(1)).handleError(any(ClientRuntimeError.class), consumerArgumentCaptor.capture()); consumerArgumentCaptor.getValue().accept("error message"); verify(errorPopupPresenter, times(1)).showMessage("error message"); }
Source:
<code>public Map<String, String> getJobMessageProperties() { if (jobProperties == null) { jobProperties = super.getJobMessageProperties(); jobProperties.put(VdcObjectType.Snapshot.name().toLowerCase(), <START> (getSnapshotName() == null) ? "" : getSnapshotName()); <END> } return jobProperties; }</code><technical_language>simplify this StringUtiles.defaultString(getSnapshotName())</technical_language>

Target:
public Map<String, String> getJobMessageProperties() { if (jobProperties == null) { jobProperties = super.getJobMessageProperties(); jobProperties.put(VdcObjectType.Snapshot.name().toLowerCase(), StringUtils.defaultString(getSnapshotName())); } return jobProperties; }
Source:
<code>protected boolean canDoAction() { if (getVds() == null) { return failCanDoAction(VdcBllMessages.VDS_NOT_EXIST); } if (getVds().getStatus() != VDSStatus.Up) { return failCanDoAction(VdcBllMessages.CANNOT_FORCE_SELECT_SPM_VDS_NOT_UP); } StoragePool storagePool = getStoragePoolDAO().getForVds(getVds().getId()); if (storagePool == null) { return failCanDoAction(VdcBllMessages.CANNOT_FORCE_SELECT_SPM_VDS_NOT_IN_POOL); } setStoragePool(storagePool); <START> <END> if (getVds().getSpmStatus() != VdsSpmStatus.None) { return failCanDoAction(VdcBllMessages.CANNOT_FORCE_SELECT_SPM_VDS_ALREADY_SPM); } if (getVds().getVdsSpmPriority() == BusinessEntitiesDefinitions.HOST_MIN_SPM_PRIORITY) { return failCanDoAction(VdcBllMessages.CANNOT_FORCE_SELECT_SPM_VDS_MARKED_AS_NEVER_SPM); } if (isAsyncTasksRunningOnPool(getStoragePool().getId())) { return failCanDoAction(VdcBllMessages.CANNOT_FORCE_SELECT_SPM_STORAGE_POOL_HAS_RUNNING_TASKS); } return true; }</code><technical_language>I CDA is place set values</technical_language>

Target:
protected boolean canDoAction() { if (getVds() == null) { return failCanDoAction(VdcBllMessages.VDS_NOT_EXIST); } if (getVds().getStatus() != VDSStatus.Up) { return failCanDoAction(VdcBllMessages.CANNOT_FORCE_SELECT_SPM_VDS_NOT_UP); } if (getStoragePoolForVds() == null) { return failCanDoAction(VdcBllMessages.CANNOT_FORCE_SELECT_SPM_VDS_NOT_IN_POOL); } if (getVds().getSpmStatus() != VdsSpmStatus.None) { return failCanDoAction(VdcBllMessages.CANNOT_FORCE_SELECT_SPM_VDS_ALREADY_SPM); } if (getVds().getVdsSpmPriority() == BusinessEntitiesDefinitions.HOST_MIN_SPM_PRIORITY) { return failCanDoAction(VdcBllMessages.CANNOT_FORCE_SELECT_SPM_VDS_MARKED_AS_NEVER_SPM); } if (isAsyncTasksRunningOnPool(getStoragePoolForVds().getId())) { return failCanDoAction(VdcBllMessages.CANNOT_FORCE_SELECT_SPM_STORAGE_POOL_HAS_RUNNING_TASKS); } return true; }
Source:
<code>public void destroy() throws Exception { SubscriptionListDTO subsDTO = restAPIStore.getAllSubscriptionsOfApplication(applicationID); for (SubscriptionDTO subscriptionDTO : subsDTO.getList()) { restAPIStore.removeSubscription(subscriptionDTO.getSubscriptionId()); } <START> restAPIStore.deleteApplication(applicationID, null); <END> restAPIPublisher.deleteAPI(apiId); if (userManagementClient != null) { userManagementClient.deleteUser(USER_SAM); userManagementClient.deleteUser(USER_MIKE); userManagementClient.deleteRole(SUBSCRIBER_ROLE); } super.cleanUp(); }</code><technical_language>This method is updated removing tenant domain. Lets remove null parameter</technical_language>

Target:
public void destroy() throws Exception { SubscriptionListDTO subsDTO = restAPIStore.getAllSubscriptionsOfApplication(applicationID); for (SubscriptionDTO subscriptionDTO : subsDTO.getList()) { restAPIStore.removeSubscription(subscriptionDTO.getSubscriptionId()); } restAPIStore.deleteApplication(applicationID); restAPIPublisher.deleteAPI(apiId); if (userManagementClient != null) { userManagementClient.deleteUser(USER_SAM); userManagementClient.deleteUser(USER_MIKE); userManagementClient.deleteRole(SUBSCRIBER_ROLE); } super.cleanUp(); }
Source:
<code>private void getImageChildren(Guid snapshot, List<Guid> children) { List<Guid> snapshotIds = diskImageDao.getAllSnapshotsForParent(snapshot).stream() <START> .map(s -> s.getImageId()).collect(Collectors.toList()); <END> children.addAll(snapshotIds); snapshotIds.stream().forEach(id -> getImageChildren(id, children)); }</code><technical_language>replaced method reference</technical_language>

Target:
private void getImageChildren(Guid snapshot, List<Guid> children) { List<Guid> snapshotIds = diskImageDao.getAllSnapshotsForParent(snapshot).stream() .map(DiskImage::getImageId).collect(Collectors.toList()); children.addAll(snapshotIds); snapshotIds.forEach(id -> getImageChildren(id, children)); }
Source:
<code>public boolean touchDragged(int screenX, int screenY, int pointer) { if (!pointerNavigationAllowed()) { return false; } if (viewport != null) { sharedVector.x = screenX; sharedVector.y = screenY; viewport.toWorldCoordinates(sharedVector); <START> screenX = (int) sharedVector.x; <END> screenY = (int) sharedVector.y; } updateLastInputSource(screenX, screenY); lastMouseX = screenX; lastMouseY = screenY; if(passThroughMouseMovement) { renderTree.mouseMoved(screenX, screenY); return false; } return renderTree.mouseMoved(screenX, screenY); }</code><technical_language>MathUtils.round</technical_language>

Target:
public boolean touchDragged(int screenX, int screenY, int pointer) { if (!pointerNavigationAllowed()) { return false; } if (viewport != null) { SHARED_VECTOR.x = screenX; SHARED_VECTOR.y = screenY; viewport.toWorldCoordinates(SHARED_VECTOR); screenX = MathUtils.round(SHARED_VECTOR.x); screenY = MathUtils.round(SHARED_VECTOR.y); } updateLastInputSource(screenX, screenY); lastMouseX = screenX; lastMouseY = screenY; if(passThroughMouseMovement) { renderTree.mouseMoved(screenX, screenY); return false; } return renderTree.mouseMoved(screenX, screenY); }
Source:
<code>public DefaultTimestampCache(MetricRegistry metricRegistry, Supplier<Long> size) { this.size = size; startToCommitTimestampCache = createCache(size.get()); evictionPolicy = startToCommitTimestampCache.policy().eviction().get(); AtlasDbMetrics.registerCache(metricRegistry, startToCommitTimestampCache, <START> MetricRegistry.name(DefaultTimestampCache.class, "startToCommitTimestamp")); <END> }</code><technical_language>This a break, fine</technical_language>

Target:
public DefaultTimestampCache(MetricRegistry metricRegistry, Supplier<Long> size) { this.size = size; startToCommitTimestampCache = createCache(size.get()); evictionPolicy = startToCommitTimestampCache.policy().eviction().get(); AtlasDbMetrics.registerCache(metricRegistry, startToCommitTimestampCache, MetricRegistry.name(TimestampCache.class, "startToCommitTimestamp")); }
Source:
<code>protected DiskShare getShare(String shareName) { <START> DiskShare share = shareCache.get(shareName); <END> if (share == null) { share = (DiskShare) session.connectShare(shareName); if (!(share instanceof DiskShare)) { close(); throw new RuntimeIOException("The share " + shareName + " is not a disk share"); } shareCache.put(shareName, share); } return share; }</code><technical_language>add cache in SMBJ, (see section 3.2.4.2 of MS-SMB2 spec, TreeConnectTable). in 0.0.6</technical_language>

Target:
protected DiskShare getShare(String shareName) { Share share = session.connectShare(shareName); if (!(share instanceof DiskShare)) { close(); throw new RuntimeIOException("The share " + shareName + " is not a disk share"); } return (DiskShare) share; }
Source:
<code>private UnfilteredPartitionIterator querySourceOnKey(int i, DecoratedKey key) { BTreeSet.Builder<Clustering> builder = rowsToFetch.get(i).get(key); assert builder != null; Replica source = sources.get(i); NavigableSet<Clustering> clusterings = builder.build(); tableMetrics.replicaSideFilteringProtectionRequests.mark(); if (logger.isTraceEnabled()) logger.trace("Requesting rows in partition from for replica-side filtering protection", clusterings, key, source); Tracing.trace("Requesting rows in partition from for replica-side filtering protection", clusterings.size(), key, source); ClusteringIndexFilter filter = new ClusteringIndexNamesFilter(clusterings, command.isReversed()); SinglePartitionReadCommand cmd = SinglePartitionReadCommand.create(command.metadata(), command.nowInSec(), key, command.columnFilter(), filter); ReplicaPlan.ForTokenRead replicaPlan = ReplicaPlans.forSingleReplicaRead(keyspace, key.getToken(), source); ReplicaPlan.SharedForTokenRead sharedReplicaPlan = ReplicaPlan.shared(replicaPlan); try { return executeReadCommand(cmd, source, sharedReplicaPlan); } catch (ReadTimeoutException e) { int blockFor = consistency.blockFor(keyspace); throw new ReadTimeoutException(consistency, blockFor - 1, blockFor, true); } catch (UnavailableException e) { int blockFor = consistency.blockFor(keyspace); <START> throw UnavailableException.create(consistency, blockFor, e.alive); <END> } }</code><technical_language>blockFor - 1 instead of e.alive(0) for number of live replicas</technical_language>

Target:
private UnfilteredPartitionIterator querySourceOnKey(int i, DecoratedKey key) { BTreeSet.Builder<Clustering> builder = rowsToFetch.get(i).get(key); assert builder != null; Replica source = sources.get(i); NavigableSet<Clustering> clusterings = builder.build(); tableMetrics.replicaSideFilteringProtectionRequests.mark(); if (logger.isTraceEnabled()) logger.trace("Requesting rows in partition from for replica-side filtering protection", clusterings, key, source); Tracing.trace("Requesting rows in partition from for replica-side filtering protection", clusterings.size(), key, source); DataLimits limits = clusterings.isEmpty() ? DataLimits.cqlLimits(1) : DataLimits.NONE; ClusteringIndexFilter filter = new ClusteringIndexNamesFilter(clusterings, command.isReversed()); SinglePartitionReadCommand cmd = SinglePartitionReadCommand.create(command.metadata(), command.nowInSec(), command.columnFilter(), RowFilter.NONE, limits, key, filter); ReplicaPlan.ForTokenRead replicaPlan = ReplicaPlans.forSingleReplicaRead(keyspace, key.getToken(), source); ReplicaPlan.SharedForTokenRead sharedReplicaPlan = ReplicaPlan.shared(replicaPlan); try { return executeReadCommand(cmd, source, sharedReplicaPlan); } catch (ReadTimeoutException e) { int blockFor = consistency.blockFor(keyspace); throw new ReadTimeoutException(consistency, blockFor - 1, blockFor, true); } catch (UnavailableException e) { int blockFor = consistency.blockFor(keyspace); throw UnavailableException.create(consistency, blockFor, blockFor - 1); } }
Source:
<code>private void unmarkLastUsedStubIfNecessary() { List<Invocation> all = registeredInvocations.getAll(); if (all.isEmpty()) { return; } Invocation lastInvocation = all.get(all.size() - 1); for (StubbedInvocationMatcher s : stubbed) { <START> if (Arrays.equals(s.getInvocation().getRawArguments(), lastInvocation.getRawArguments())) { <END> s.markStubUsed(null); lastInvocation.markStubbed(null); return; } } }</code><technical_language>Testing for arguments work in cases, s.matches(invocation)</technical_language>

Target:
private void unmarkLastUsedStubIfNecessary() { synchronized (stubbed) { Invocation invocation = invocationForStubbing.getInvocation(); for (StubbedInvocationMatcher s : stubbed) { if (s.matches(invocation)) { s.markStubUsed(null); invocation.markStubbed(null); return; } } } }