auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Builder quantile(double quantile, double error) { if (quantile < 0.0 || quantile > 1.0) { throw new IllegalArgumentException("Quantile " + quantile + " invalid: Expected percentage between 0.0 and 1.0."); } if (error < 0.0 || error > 1.0) { <START> throw new IllegalArgumentException("Error " + error + " invalid: Expected percentage between 0.0 and 1.0."); <END> } quantiles.add(new Quantile(quantile, error)); return this; }</code><technical_language>A percentage is 0 100</technical_language>

Target:
public Builder quantile(double quantile, double error) { if (quantile < 0.0 || quantile > 1.0) { throw new IllegalArgumentException("Quantile " + quantile + " invalid: Expected number between 0.0 and 1.0."); } if (error < 0.0 || error > 1.0) { throw new IllegalArgumentException("Error " + error + " invalid: Expected number between 0.0 and 1.0."); } quantiles.add(new Quantile(quantile, error)); return this; }
Source:
<code>private List<String> getRollingOperationIds(final ZooKeeperClient client, final String groupName) throws DeploymentGroupDoesNotExistException { try { final Node node = client.getNode(Paths.statusDeploymentGroupRollingOps(groupName)); return Json.read(node.getBytes(), new TypeReference<List<String>>() {}); } catch (JsonMappingException e) { return emptyList(); } catch (NoNodeException e) { throw new DeploymentGroupDoesNotExistException(groupName, e); } catch (KeeperException | IOException e) { <START> throw new HeliosRuntimeException("getting deployment group rolling-operations failed", e); <END> } }</code><technical_language>include group name ids failed</technical_language>

Target:
private List<String> getRollingOperationIds(final ZooKeeperClient client, final String groupName) throws DeploymentGroupDoesNotExistException { try { final Node node = client.getNode(Paths.statusDeploymentGroupRollingOps(groupName)); return Json.read(node.getBytes(), new TypeReference<List<String>>() {}); } catch (JsonMappingException e) { return emptyList(); } catch (NoNodeException e) { throw new DeploymentGroupDoesNotExistException(groupName, e); } catch (KeeperException | IOException e) { throw new HeliosRuntimeException( "getting rolling-operations for deployment group " + groupName + " failed", e); } }
Source:
<code>public void onUsernameChanged(OnUsernameChanged event) { if (event.isError()) { AnalyticsTracker.track(mIsEmailSignup ? AnalyticsTracker.Stat.SIGNUP_EMAIL_EPILOGUE_UPDATE_USERNAME_FAILED : AnalyticsTracker.Stat.SIGNUP_SOCIAL_EPILOGUE_UPDATE_USERNAME_FAILED); AppLog.e(T.API, "SignupEpilogueFragment.onUsernameChanged: " + event.error.type + " - " + event.error.message); endProgress(); showErrorDialog(getString(R.string.signup_epilogue_error_generic)); <START> } else if (mSignupEpilogueListener != null) { <END> mHasMadeUpdates = true; AnalyticsTracker.track(mIsEmailSignup ? AnalyticsTracker.Stat.SIGNUP_EMAIL_EPILOGUE_UPDATE_USERNAME_SUCCEEDED : AnalyticsTracker.Stat.SIGNUP_SOCIAL_EPILOGUE_UPDATE_USERNAME_SUCCEEDED); updateAccountOrContinue(); } }</code><technical_language>suggestion } else { mSignupEpilogueListener.onContinue(); statement moved, remove mSignupEpilogueListener != null condition update else if else statement? mSignupEpilogueListener is in updateAccountOrContinue() method, mSignupEpilogueListener != null check is made</technical_language>

Target:
public void onUsernameChanged(OnUsernameChanged event) { if (event.isError()) { AnalyticsTracker.track(mIsEmailSignup ? AnalyticsTracker.Stat.SIGNUP_EMAIL_EPILOGUE_UPDATE_USERNAME_FAILED : AnalyticsTracker.Stat.SIGNUP_SOCIAL_EPILOGUE_UPDATE_USERNAME_FAILED); AppLog.e(T.API, "SignupEpilogueFragment.onUsernameChanged: " + event.error.type + " - " + event.error.message); endProgress(); showErrorDialog(getString(R.string.signup_epilogue_error_generic)); } else { mHasMadeUpdates = true; AnalyticsTracker.track(mIsEmailSignup ? AnalyticsTracker.Stat.SIGNUP_EMAIL_EPILOGUE_UPDATE_USERNAME_SUCCEEDED : AnalyticsTracker.Stat.SIGNUP_SOCIAL_EPILOGUE_UPDATE_USERNAME_SUCCEEDED); updateAccountOrContinue(); } }
Source:
<code>public InputVFile getInputVFile(@Nonnull VPath path) throws NotFileOrDirectoryException, NoSuchFileException { Iterator<String> iterator = path.split().iterator(); String firstElement = iterator.next(); InputVElement ive = subs.get(firstElement); String pathAsString = path.getPathAsString(IN_ZIP_SEPARATOR); if (ive == null) { throw new NoSuchFileException(new FileLocation(pathAsString)); } if (iterator.hasNext()) { if (ive instanceof InputVDir) { ive = ((InputVDir) ive).getInputVFile(new VPath( pathAsString.substring(pathAsString.indexOf(IN_ZIP_SEPARATOR) + 1), IN_ZIP_SEPARATOR)); } } if (!(ive instanceof InputVFile)) { throw new <START> NoSuchFileException(new <END> FileLocation(pathAsString)); } return (InputVFile) ive; }</code><technical_language>NotFileOrDirectoryException</technical_language>

Target:
public InputVFile getInputVFile(@Nonnull VPath path) throws NotFileOrDirectoryException, NoSuchFileException { Iterator<String> iterator = path.split().iterator(); String firstElement = iterator.next(); InputVElement ive = subs.get(firstElement); String pathAsString = path.getPathAsString(IN_ZIP_SEPARATOR); if (ive == null) { throw new NoSuchFileException(new FileLocation(pathAsString)); } if (iterator.hasNext()) { if (ive instanceof InputVDir) { ive = ((InputVDir) ive).getInputVFile(new VPath( pathAsString.substring(pathAsString.indexOf(IN_ZIP_SEPARATOR) + 1), IN_ZIP_SEPARATOR)); } } if (ive.isVDir()) { throw new NotFileOrDirectoryException(new DirectoryLocation(pathAsString)); } return (InputVFile) ive; }
Source:
<code>protected void processMultiValuedEReference(EReference eReference, PageDescription processedDescription, PageDescription currentDescription, TransformationCache cache) { if (!eReference.equals(PropertiesPackage.Literals.ABSTRACT_PAGE_DESCRIPTION__GROUPS)) { super.processMultiValuedEReference(eReference, processedDescription, currentDescription, cache); } else { <START> currentDescription.getGroups().forEach(groupDescription -> { Optional<Object> inputDescription = cache.getInput(processedDescription); Optional<PageDescription> inputPageDescription = inputDescription.filter(PageDescription.class::isInstance).map(PageDescription.class::cast); if (inputPageDescription.isPresent() && !groupDescription.eResource().equals(inputPageDescription.get().eResource())) { IDescriptionPreprocessor descriptionPreprocessor = SiriusPropertiesCorePlugin.getPlugin().getDescriptionPreprocessor(groupDescription); if (descriptionPreprocessor != null) { EObject processedGroup = descriptionPreprocessor.convert(groupDescription, cache); processedDescription.getGroups().add((GroupDescription) processedGroup); } } else { processedDescription.getGroups().add(groupDescription); } }); <END> } }</code><technical_language>extract this in a method named processGroups in order this special case visible processVaildationSet, thanks</technical_language>

Target:
protected void processMultiValuedEReference(EReference eReference, PageDescription processedDescription, PageDescription currentDescription, TransformationCache cache) { if (!eReference.equals(PropertiesPackage.Literals.ABSTRACT_PAGE_DESCRIPTION__GROUPS)) { super.processMultiValuedEReference(eReference, processedDescription, currentDescription, cache); } else { processGroups(processedDescription, currentDescription, cache); } }
Source:
<code>public ZkJobCoordinator(String processorId, Config config, ScheduleAfterDebounceTime debounceTimer, SamzaContainerController containerController) { this.debounceTimer = debounceTimer; this.containerController = containerController; this.config = config; this.processorId = processorId; <START> JobConfig jobConfig = new JobConfig(config); <END> this.coordinationUtils = Util. <CoordinationServiceFactory>getObj( new JobCoordinatorConfig(config) .getJobCoordinationServiceFactoryClassName()) .getCoordinationService(new ApplicationConfig(config).getGlobalAppId(), String.valueOf(processorId), config); this.zkUtils = ((ZkCoordinationUtils) coordinationUtils).getZkUtils(); this.keyBuilder = zkUtils.getKeyBuilder(); this.zkController = new ZkControllerImpl(processorId, zkUtils, debounceTimer, this); streamMetadataCache = getStreamMetadataCache(); }</code><technical_language>Unused variable</technical_language>

Target:
public ZkJobCoordinator(String processorId, Config config, ScheduleAfterDebounceTime debounceTimer, SamzaContainerController containerController) { this.debounceTimer = debounceTimer; this.containerController = containerController; this.config = config; this.processorId = processorId; this.coordinationUtils = Util. <CoordinationServiceFactory>getObj( new JobCoordinatorConfig(config) .getJobCoordinationServiceFactoryClassName()) .getCoordinationService(new ApplicationConfig(config).getGlobalAppId(), String.valueOf(processorId), config); this.zkUtils = ((ZkCoordinationUtils) coordinationUtils).getZkUtils(); this.keyBuilder = zkUtils.getKeyBuilder(); this.zkController = new ZkControllerImpl(processorId, zkUtils, debounceTimer, this); streamMetadataCache = getStreamMetadataCache(); }
Source:
<code>public NullScoreAwareAveragingCombiner() { <START> ignoreNullScoringContent = false; <END> }</code><technical_language>ignoreNullScoringCandidate</technical_language>

Target:
public NullScoreAwareAveragingCombiner() { this.ignoreNullScoringCandidate = false; }
Source:
<code>protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException { Pattern patternA = Pattern.compile("Patch Set ([0-9]+):.*", Pattern.DOTALL); Pattern patternB = Pattern.compile("Uploaded patch set ([0-9]+)."); ResultSet<ChangeMessage> results = db.changeMessages().all(); List<ChangeMessage> updates = new LinkedList<ChangeMessage>(); for (ChangeMessage cm : results) { Change.Id id = cm.getKey().getParentKey(); String msg = cm.getMessage(); Matcher matcherA = patternA.matcher(msg); Matcher matcherB = patternB.matcher(msg); PatchSet.Id newId = null; if (matcherA.matches()) { int patchSetNum = Integer.parseInt(matcherA.group(1)); newId = new PatchSet.Id(id, patchSetNum); } else if (matcherB.matches()) { int patchSetNum = Integer.parseInt(matcherB.group(1)); newId = new PatchSet.Id(id, patchSetNum); } if (newId == null) { <START> newId = db.changes().get(id).currentPatchSetId(); <END> } cm.setPatchSetId(newId); updates.add(cm); if (updates.size() >= 100) { db.changeMessages().update(updates); updates.clear(); } } if (!updates.isEmpty()) { db.changeMessages().update(updates); } }</code><technical_language>If determine a patch set message contents, I assuming current one</technical_language>

Target:
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException { Pattern patternA = Pattern.compile("Patch Set ([0-9]+):.*", Pattern.DOTALL); Pattern patternB = Pattern.compile("Uploaded patch set ([0-9]+)."); ResultSet<ChangeMessage> results = db.changeMessages().all(); List<ChangeMessage> updates = new LinkedList<ChangeMessage>(); for (ChangeMessage cm : results) { Change.Id id = cm.getKey().getParentKey(); String msg = cm.getMessage(); Matcher matcherA = patternA.matcher(msg); Matcher matcherB = patternB.matcher(msg); PatchSet.Id newId = null; if (matcherA.matches()) { int patchSetNum = Integer.parseInt(matcherA.group(1)); newId = new PatchSet.Id(id, patchSetNum); } else if (matcherB.matches()) { int patchSetNum = Integer.parseInt(matcherB.group(1)); newId = new PatchSet.Id(id, patchSetNum); } if (newId != null) { cm.setPatchSetId(newId); updates.add(cm); } if (updates.size() >= 100) { db.changeMessages().update(updates); updates.clear(); } } if (!updates.isEmpty()) { db.changeMessages().update(updates); } }
Source:
<code>public void updateUnauthorized() throws Exception { context.turnOffAuthorisationSystem(); MetadataSchema metadataSchema = MetadataSchemaBuilder.createMetadataSchema(context, TEST_NAME, TEST_NAMESPACE) <START> .build(); <END> MetadataSchemaRest metadataSchemaRest = new MetadataSchemaRest(); metadataSchemaRest.setId(metadataSchema.getID()); metadataSchemaRest.setPrefix(TEST_NAME_UPDATED); metadataSchemaRest.setNamespace(TEST_NAMESPACE_UPDATED); getClient() .perform(put("/api/core/metadataschemas/" + metadataSchema.getID()) .content(new ObjectMapper().writeValueAsBytes(metadataSchemaRest)) .contentType(contentType)) .andExpect(status().isUnauthorized()); getClient().perform(get("/api/core/metadataschemas/" + metadataSchema.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", MetadataschemaMatcher .matchEntry(TEST_NAME, TEST_NAMESPACE))); }</code><technical_language>turn auth system creating test data</technical_language>

Target:
public void updateUnauthorized() throws Exception { context.turnOffAuthorisationSystem(); MetadataSchema metadataSchema = MetadataSchemaBuilder.createMetadataSchema(context, TEST_NAME, TEST_NAMESPACE) .build(); context.restoreAuthSystemState(); MetadataSchemaRest metadataSchemaRest = new MetadataSchemaRest(); metadataSchemaRest.setId(metadataSchema.getID()); metadataSchemaRest.setPrefix(TEST_NAME_UPDATED); metadataSchemaRest.setNamespace(TEST_NAMESPACE_UPDATED); getClient() .perform(put("/api/core/metadataschemas/" + metadataSchema.getID()) .content(new ObjectMapper().writeValueAsBytes(metadataSchemaRest)) .contentType(contentType)) .andExpect(status().isUnauthorized()); getClient().perform(get("/api/core/metadataschemas/" + metadataSchema.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$", MetadataschemaMatcher .matchEntry(TEST_NAME, TEST_NAMESPACE))); }
Source:
<code><START> public int getGlobalMinimumClock() { <END> return globalMinimumClock; }</code><technical_language>Package-private accessor is enough for this</technical_language>

Target:
int getGlobalMinimumClock() { return globalMinimumClock; }
Source:
<code>public Icon toIcon(@Nullable Context context) { Icon icon; switch (mType) { case TYPE_UNKNOWN: return (Icon) mObj1; case TYPE_BITMAP: icon = Icon.createWithBitmap((Bitmap) mObj1); break; case TYPE_ADAPTIVE_BITMAP: if (Build.VERSION.SDK_INT >= 26) { icon = Icon.createWithAdaptiveBitmap((Bitmap) mObj1); } else { icon = Icon.createWithBitmap( createLegacyIconFromAdaptiveIcon((Bitmap) mObj1, false)); } break; case TYPE_RESOURCE: icon = Icon.createWithResource(getResPackage(), mInt1); break; case TYPE_DATA: icon = Icon.createWithData((byte[]) mObj1, mInt1, mInt2); break; case TYPE_URI: icon = Icon.createWithContentUri((String) mObj1); break; case TYPE_URI_ADAPTIVE_BITMAP: <START> if (Build.VERSION.SDK_INT >= 30) { try { icon = (Icon) Icon.class.getMethod("createWithContentUriForAdaptiveBitmap") .invoke(mObj1); } catch (IllegalAccessException e) { throw new IllegalStateException( "Unable to resolve icon from uri:" + mObj1, e); } catch (InvocationTargetException e) { throw new IllegalStateException( "Unable to resolve icon from uri:" + mObj1, e); } catch (NoSuchMethodException e) { throw new IllegalStateException( "Unable to resolve icon from uri:" + mObj1, e); } <END> } else if (Build.VERSION.SDK_INT >= 26) { icon = Icon.createWithAdaptiveBitmap(getBitmapFromUri(context)); } else { icon = Icon.createWithBitmap(getBitmapFromUri(context)); } break; default: throw new IllegalArgumentException("Unknown type"); } if (mTintList != null) { icon.setTintList(mTintList); } if (mTintMode != DEFAULT_TINT_MODE) { icon.setTintMode(mTintMode); } return icon; }</code><technical_language>Lets remove this part wait framework API is in SDK 30, add a TODO: bug number. need load method reflection</technical_language>

Target:
public Icon toIcon(@Nullable Context context) { Icon icon; switch (mType) { case TYPE_UNKNOWN: return (Icon) mObj1; case TYPE_BITMAP: icon = Icon.createWithBitmap((Bitmap) mObj1); break; case TYPE_ADAPTIVE_BITMAP: if (Build.VERSION.SDK_INT >= 26) { icon = Icon.createWithAdaptiveBitmap((Bitmap) mObj1); } else { icon = Icon.createWithBitmap( createLegacyIconFromAdaptiveIcon((Bitmap) mObj1, false)); } break; case TYPE_RESOURCE: icon = Icon.createWithResource(getResPackage(), mInt1); break; case TYPE_DATA: icon = Icon.createWithData((byte[]) mObj1, mInt1, mInt2); break; case TYPE_URI: icon = Icon.createWithContentUri((String) mObj1); break; case TYPE_URI_ADAPTIVE_BITMAP: InputStream is = getUriInputStream(context); if (is != null) { if (Build.VERSION.SDK_INT >= 26) { icon = Icon.createWithAdaptiveBitmap(BitmapFactory.decodeStream(is)); } else { icon = Icon.createWithBitmap(createLegacyIconFromAdaptiveIcon( BitmapFactory.decodeStream(is), false)); } } break; default: throw new IllegalArgumentException("Unknown type"); } if (mTintList != null) { icon.setTintList(mTintList); } if (mTintMode != DEFAULT_TINT_MODE) { icon.setTintMode(mTintMode); } return icon; }
Source:
<code>public JwtAuthenticationToken(Jwt jwt) { super(jwt); <START> this.name = this.getToken().getSubject(); <END> }</code><technical_language>This sense, getToken() is final, of doing: suggestion this.name = jwt.getSubject(); readers of this code methods jump understand code</technical_language>

Target:
public JwtAuthenticationToken(Jwt jwt) { super(jwt); this.name = jwt.getSubject(); }
Source:
<code><START> public ClientCredentials getClientCredential() throws IOException { <END> ClientCredentials credentials = new ClientCredentials(); Properties properties = getCredential(); mergeProperties(properties, configurationMap); credentials.setClientID(configurationMap.get(Constants.CLIENT_ID)); credentials.setClientSecret(configurationMap.get(Constants.CLIENT_SECRET)); return credentials; }</code><technical_language>if able do ? getClientCredentials is a public method already</technical_language>

Target:
public ClientCredentials getClientCredential() { return PayPalResource.getCredential(); }
Source:
<code>public void testFinishInitializeWhenDefaultThenRemoveCatroidNavigationItems() { presenter.removeMoreOptionsItems(menu); <START> verify(topBarViewHolder).removeItem(R.id.pocketpaint_nav_export); <END> verify(topBarViewHolder).removeItem(R.id.pocketpaint_nav_back_to_pocket_code); }</code><technical_language>this call removeStandaloneMenuItems()</technical_language>

Target:
public void testFinishInitializeWhenDefaultThenRemoveCatroidNavigationItems() { presenter.removeMoreOptionsItems(menu); verify(topBarViewHolder).removeCatroidMenuItems(menu); }
Source:
<code>public void fillContextMenu(final IMenuManager menu) { super.fillContextMenu(menu); final ISelection selection = getContext().getSelection(); if (selection.isEmpty()) { return; } try { Job.getJobManager().join(AbstractRepresentationsFileJob.FAMILY, new NullProgressMonitor()); } catch (InterruptedException e) { <START> throw new RuntimeException(e); <END> } contextMenuFiller.fillContextMenu(menu, selection); }</code><technical_language>Before, waitOtherJobs, "Do nothing" in case of InterruptedException. do change that? test difference</technical_language>

Target:
public void fillContextMenu(final IMenuManager menu) { super.fillContextMenu(menu); final ISelection selection = getContext().getSelection(); if (selection.isEmpty()) { return; } try { Job.getJobManager().join(AbstractRepresentationsFileJob.FAMILY, new NullProgressMonitor()); } catch (InterruptedException e) { } contextMenuFiller.fillContextMenu(menu, selection); }
Source:
<code>public boolean onLongPressEvent(PointF point) { if ((Build.VERSION.SDK_INT < 14) && !view.getSettings().SCROLL_MAP_BY_GESTURES.get()) { if (!selectedObjects.isEmpty()) view.showMessage(activity.getMyApplication().getLocationProvider().getNavigationHint(latLon)); return true; } if(pressedInTextView(point.x, point.y) > 0){ setLocation(null, ""); view.refreshMap(); return true; } LatLon latLon = selectObjectsForContextMenu(point); <START> for(OsmandMapLayer l : view.getLayers()){ <END> if(l instanceof DistanceCalculatorLayer){ if(((DistanceCalculatorLayer) l).getDistanceMeasurementMode() > 0 && !selectedObjects.isEmpty()) return false; break; } } String description = getSelectedObjectDescription(); setLocation(latLon, description); view.refreshMap(); return true; }</code><technical_language>Is a possibility avoid this check? try avoid direct dependencies plugin package</technical_language>

Target:
public boolean onLongPressEvent(PointF point) { if ((Build.VERSION.SDK_INT < 14) && !view.getSettings().SCROLL_MAP_BY_GESTURES.get()) { if (!selectedObjects.isEmpty()) view.showMessage(activity.getMyApplication().getLocationProvider().getNavigationHint(latLon)); return true; } if(pressedInTextView(point.x, point.y) > 0){ setLocation(null, ""); view.refreshMap(); return true; } LatLon latLon = selectObjectsForContextMenu(point); String description = getSelectedObjectDescription(); setLocation(latLon, description); view.refreshMap(); return false; }
Source:
<code>public static String fromUtf8Nullable(final ByteBuffer buffer, final int numBytes) { final byte[] bytes = new byte[numBytes]; buffer.get(bytes); <START> return StringUtils.fromUtf8Nullable(bytes); <END> }</code><technical_language>bytes null</technical_language>

Target:
public static String fromUtf8Nullable(final ByteBuffer buffer, final int numBytes) { if (numBytes < 0) { return null; } final byte[] bytes = new byte[numBytes]; buffer.get(bytes); return fromUtf8Nullable(bytes); }
Source:
<code>private void vmUpdateStatus(final VM vm, final VM.VMStatus status, final long delay, final String msg, final boolean removeClient) throws InterruptedException { <START> scheduledExecutorService.schedule(new Callable() { <END> public Object call() throws Exception { try { vm.setStatus(status); sendNotification(msg, vm.getId(), removeClient); log.info("VM set to {}", vm.getId(), msg); if (isUpdateRequired(status)) { VdsmManager.getInstance().updateHost(vm.getHost()); } } catch (Exception e) { e.printStackTrace(); } return null; } }, delay, TimeUnit.MILLISECONDS); }</code><technical_language>callable a lambda</technical_language>

Target:
private void vmUpdateStatus(final VM vm, final VM.VMStatus status, final long delay, final String msg, final boolean removeClient) throws InterruptedException { scheduledExecutorService.schedule(() -> { try { vm.setStatus(status); sendNotification(msg, vm.getId(), removeClient); log.info("VM set to {}", vm.getId(), msg); if (isUpdateRequired(status)) { VdsmManager.getInstance().updateHost(vm.getHost()); } } catch (Exception e) { e.printStackTrace(); } return null; }, delay, TimeUnit.MILLISECONDS); }
Source:
<code>public Scheduler makeDefaultScheduler() throws Exception { <START> File configFile = new File(CONFIG_PATH); <END> File dbFile = new File(DB_PATH); WorkflowConfiguration config = new WorkflowConfigurationParser().parseConfiguration(configFile); StateDatabase db = new FileSystemStateDatabase(dbFile); int slidingWindowHours = 24 * 7; return new Scheduler(config, db, slidingWindowHours); }</code><technical_language>names CONFIG_PATH configFile in context of a SchedulerConfiguration a confusing. I read referring Scheduler configuration (as opposed information workflows), I hard-coded slidingWindowHours I scratching head wondering added existing configuration</technical_language>

Target:
public Scheduler makeDefaultScheduler() throws Exception { File configDir = new File(WORKFLOW_CONFIGURATION_PATH); File dbDir = new File(STATE_DATABASE_PATH); WorkflowConfiguration config = new WorkflowConfigurationParser().parseConfiguration(configDir); StateDatabase db = new FileSystemStateDatabase(dbDir); int slidingWindowHours = 24 * 7; return new Scheduler(config, db, slidingWindowHours); }
Source:
<code>protected void doExecute() { DiagramDescription diagramdesc = DescriptionFactory.eINSTANCE.createDiagramDescription(); diagramdesc.setName(BASE_ID + ".default.layer"); viewpoint.getOwnedRepresentations().add(diagramdesc); Layer layer = DescriptionFactory.eINSTANCE.createLayer(); diagramdesc.setDefaultLayer(layer); ToolSection toolSection = createToolSection(layer); <START> ContainerMapping packageMapping = createPackageMapping(layer); <END> NodeMapping attributes = createAttributes(toolSection); ContainerMapping classMapping = createClassListMapping(toolSection, layer, attributes); EdgeMapping edgeMappingInheritance = createEdgeMappingInheritance(toolSection, layer, classMapping); EdgeMapping edgeMappingReference = createEdgeMappingReference(toolSection, layer, classMapping); createContainerClassMapping(toolSection, classMapping); createContainerPackageMapping(toolSection, packageMapping); ArrayList<DiagramElementMapping> mappings = new ArrayList<DiagramElementMapping>(); mappings.add(classMapping); mappings.add(packageMapping); mappings.add(edgeMappingReference); mappings.add(edgeMappingInheritance); createDeleteTool(toolSection, mappings); createEditTool(toolSection, mappings); createNodeCreation(toolSection, classMapping); }</code><technical_language>createPackage mapping toolsection in parameters create a ContainerCreationDescription tool</technical_language>

Target:
protected void doExecute() { DiagramDescription diagramdesc = DescriptionFactory.eINSTANCE.createDiagramDescription(); diagramdesc.setName(BASE_ID + ".default.layer"); viewpoint.getOwnedRepresentations().add(diagramdesc); Layer layer = DescriptionFactory.eINSTANCE.createLayer(); diagramdesc.setDefaultLayer(layer); ToolSection toolSection = createToolSection(layer); ContainerMapping packageMapping = createPackageMapping(layer, toolSection); ContainerMapping classMapping = createClassListMapping(layer, toolSection); createAttributes(classMapping, toolSection); EdgeMapping edgeMappingInheritance = createEdgeMappingInheritance(layer, toolSection, classMapping); EdgeMapping edgeMappingReference = createEdgeMappingReference(layer, toolSection, classMapping); DiagramElementMapping[] mappings = { classMapping, packageMapping, edgeMappingInheritance, edgeMappingReference }; createDeleteTool(toolSection, mappings); createEditTool(toolSection, mappings); }
Source:
<code>private StorageType updateLUNConnectionsInfo(LUNs lun) { if (lun.getLunConnections() == null) { lun.setLunConnections(new ArrayList<storage_server_connections>(getDbFacade() .getStorageServerConnectionDao() .getAllForLun(lun.getLUN_id()))); } <START> return lun.getLunConnections().isEmpty() ? StorageType.FCP : lun.getLunConnections().get(0).getstorage_type(); <END> }</code><technical_language>lun.getLunConnections().get(0).getstorage_type() assume LUN connections of type. This is false. LUN exposed transports. empty connection list = FCP inference is False. A local LUN connections too. plugging LUN host connected storage server proper type. if connections is need for explicit connection Assuming FCP is wrong unnecessary all</technical_language>

Target:
private void updateLUNConnectionsInfo(LUNs lun) { lun.setLunConnections(new ArrayList<storage_server_connections>(getDbFacade() .getStorageServerConnectionDao() .getAllForLun(lun.getLUN_id()))); }
Source:
<code>public EventHubMessage(EventData eventdata, String partitionId) { this.partitionId = partitionId; if (eventdata.getBytes() != null) { content = eventdata.getBytes(); } else if (eventdata.getObject() != null) { try { content = SerializeDeserializeUtil.serialize(eventdata.getObject()); } catch (IOException e) { throw new RuntimeException(e); } } else { throw new RuntimeException("Failed to retrieve payload from EventData"); } applicationProperties = eventdata.getProperties(); EventData.SystemProperties props = eventdata.getSystemProperties(); <START> systemProperties = props; <END> if (systemProperties != null) { offset = props.getOffset(); partitionKey = props.getPartitionKey(); enqueuedTime = props.getEnqueuedTime(); sequenceNumber = props.getSequenceNumber(); publisher = props.getPublisher(); } else { this.offset = null; this.partitionKey = null; this.enqueuedTime = null; this.sequenceNumber = FieldConstants.DEFAULT_SEQUENCE_NUMBER; this.publisher = null; } messageId = new MessageId(partitionId, offset, sequenceNumber); }</code><technical_language>Nit: props variable unnecessary, assign</technical_language>

Target:
public EventHubMessage(EventData eventdata, String partitionId) { this.partitionId = partitionId; if (eventdata.getBytes() != null) { content = eventdata.getBytes(); } else if (eventdata.getObject() != null) { try { content = SerializeDeserializeUtil.serialize(eventdata.getObject()); } catch (IOException e) { throw new RuntimeException(e); } } else { throw new RuntimeException("Failed to retrieve payload from EventData"); } applicationProperties = eventdata.getProperties(); systemProperties = eventdata.getSystemProperties(); if (eventdata.getSystemProperties() != null) { offset = eventdata.getSystemProperties().getOffset(); partitionKey = eventdata.getSystemProperties().getPartitionKey(); enqueuedTime = eventdata.getSystemProperties().getEnqueuedTime(); sequenceNumber = eventdata.getSystemProperties().getSequenceNumber(); publisher = eventdata.getSystemProperties().getPublisher(); } else { this.offset = null; this.partitionKey = null; this.enqueuedTime = null; this.sequenceNumber = FieldConstants.DEFAULT_SEQUENCE_NUMBER; this.publisher = null; } messageId = new MessageId(partitionId, offset, sequenceNumber); }
Source:
<code>private void displayCurrent() { Element item = items.getItem(index); $(contents).children().remove(); $(contents).append(item); if (index == 0) { $(prev).addClass(sliderResources.style().disabled()); $(next).removeClass(sliderResources.style().disabled()); } else if (index == maxIndex) { $(prev).removeClass(sliderResources.style().disabled()); $(next).addClass(sliderResources.style().disabled()); } else { $(prev).removeClass(sliderResources.style().disabled()); $(next).removeClass(sliderResources.style().disabled()); } <START> $("." + sliderResources.style().actif(), pager).removeClass(sliderResources.style().actif()); <END> $(pager).children().eq(index).addClass(sliderResources.style().actif()); }</code><technical_language>extract style name a variable 3 times</technical_language>

Target:
private void displayCurrent() { Element item = items.getItem(index); $(contents).children().remove(); $(contents).append(item); String disabled = sliderResources.style().disabled(); if (index == 0) { $(prev).addClass(disabled); $(next).removeClass(disabled); } else if (index == maxIndex) { $(prev).removeClass(disabled); $(next).addClass(disabled); } else { $(prev).removeClass(disabled); $(next).removeClass(disabled); } String active = sliderResources.style().active(); $("." + active, pager).removeClass(active); $(pager).children().eq(index).addClass(active); }
Source:
<code>public boolean isBlacklisted(WebSocketMessageDTO message) { if (isShowJustInScope && !message.channel.isInScope()) { return true; } if (opcodeList != null) { if (!opcodeList.contains(message.opcode)) { return true; } } if (direction != null) { if (message.isOutgoing && !direction.equals(Direction.OUTGOING)) { return true; } else if (!message.isOutgoing && !direction.equals(Direction.INCOMING)) { return true; } } if(payloadFilter != null && payloadFilter.getPayloadPattern() != null){ if(message.payload instanceof String){ if(!payloadFilter.isMessageValidWithPattern(message)) { return true; } } else{ return true; } } <START> logger.info("White Listed"); <END> return false; }</code><technical_language>this removed moved debug level</technical_language>

Target:
public boolean isBlacklisted(WebSocketMessageDTO message) { if (isShowJustInScope && !message.channel.isInScope()) { return true; } if (opcodeList != null) { if (!opcodeList.contains(message.opcode)) { return true; } } if (direction != null) { if (message.isOutgoing && !direction.equals(Direction.OUTGOING)) { return true; } else if (!message.isOutgoing && !direction.equals(Direction.INCOMING)) { return true; } } if(payloadFilter != null && message.payload instanceof String && !payloadFilter.isMessageValidWithPattern(message)){ return true; } return false; }
Source:
<code>private JComboBox createDatastoreCombobox() { final String[] comboBoxModel = CollectionUtils.array(new String[1], _datastoreCatalog.getDatastoreNames()); <START> final JComboBox comboBox = new JComboBox<>(comboBoxModel); <END> comboBox.setEditable(false); final JDialog parent = this; comboBox.addActionListener(e -> { try { ComboBoxUpdater comboBoxUpdater = new ComboBoxUpdater(parent); comboBoxUpdater.execute(); } catch (Exception exception) { logger.error(exception.getMessage()); } }); return comboBox; }</code><technical_language>JComboBox is a raw type, preferably JComboBox<String> instead (also for return type of method)</technical_language>

Target:
private JComboBox<String> createDatastoreCombobox() { final String[] comboBoxModel = CollectionUtils.array(new String[1], _datastoreCatalog.getDatastoreNames()); final JComboBox<String> comboBox = new JComboBox<>(comboBoxModel); comboBox.setEditable(false); final JDialog parent = this; comboBox.addActionListener(e -> { try { ComboBoxUpdater comboBoxUpdater = new ComboBoxUpdater(parent); comboBoxUpdater.execute(); } catch (Exception exception) { final String exceptionMessage = "An unexpected error occurred while updating combo boxes:\n" + exception.getMessage(); logger.error(exceptionMessage); WidgetUtils.showErrorMessage("Unexpected error", exceptionMessage); } }); return comboBox; }
Source:
<code>protected void checkContainerIsRunning(String container) throws IOException, ServerException { ContainerInfo containerInfo = docker.inspectContainer(container); if ("exited".equals(containerInfo.getState().getStatus())) { <START> throw new ServerException("We detected that machine container exited right after start. " + <END> "It may happen in certain situations including container designed to be used " + "in interactive mode or container that require additional arguments. " + "We detect and fix some of these situations but can't cover all the cases."); } }</code><technical_language>Please change message to: >We detected a machine exited unexpectedly. This caused a container in interactive mode a container requires additional arguments start. Please check container recipe</technical_language>

Target:
protected void checkContainerIsRunning(String container) throws IOException, ServerException { ContainerInfo containerInfo = docker.inspectContainer(container); if ("exited".equals(containerInfo.getState().getStatus())) { throw new ServerException(CONTAINER_EXITED_ERROR); } }
Source:
<code>private void verifyAbcdAdIsDisplayed(AdsBaseObject ads) { ads.scrollToSlot(AdsContent.TOP_LB); <START> Assertion.assertTrue(ads.getGptParams(AdsContent.TOP_LB, "data-gpt-line-item-id").equals("4376117186"), <END> "TOP_LEADERBOARD slot has ABCD ad line item id 4376117186, ABCD slot should not be displayed"); Assertion.assertTrue(ads.getGptParams(AdsContent.TOP_LB, "data-slot-result").equals("success"), "ABCD slot result: success is not present"); }</code><technical_language>AdsBaseObject.verifyGptAdInSlot function</technical_language>

Target:
private void verifyAbcdAdIsDisplayed(AdsBaseObject ads) { ads.verifyLineItemId(AdsContent.TOP_LB, ABCD_LINE_ITEM_ID); ads.verifySlotAttribute(AdsContent.TOP_LB, "data-slot-result", "success"); }
Source:
<code>public static PropertiesConfiguration getConfig() { if (config == null) { synchronized (Config.class) { PropertiesConfiguration initialized = config; if (initialized == null) { <START> AbstractConfiguration.setDefaultListDelimiter('&'); <END> try { initialized = new PropertiesConfiguration(CONFIG_FILE); } catch (ConfigurationException e) { logger.warn("Loading of " + CONFIG_FILE + " failed. Trying to start with empty configuration.", e); initialized = new PropertiesConfiguration(); } initialized.setListDelimiter('&'); initialized.setReloadingStrategy(new FileChangedReloadingStrategy()); initialized.setThrowExceptionOnMissing(true); config = initialized; } } } return config; }</code><technical_language>I this method needs some deeper analyze. if (config == null) { PropertiesConfiguration initialized = config; if (initialized == null) { null in if is obvious</technical_language>

Target:
public static PropertiesConfiguration getConfig() { if (config == null) { synchronized (Config.class) { PropertiesConfiguration initialized = config; if (initialized == null) { PropertiesConfiguration.setDefaultListDelimiter('&'); try { initialized = new PropertiesConfiguration(CONFIG_FILE); } catch (ConfigurationException e) { logger.warn("Loading of " + CONFIG_FILE + " failed. Trying to start with empty configuration.", e); initialized = new PropertiesConfiguration(); } initialized.setListDelimiter('&'); initialized.setReloadingStrategy(new FileChangedReloadingStrategy()); config = initialized; config.setThrowExceptionOnMissing(true); } } } return config; }
Source:
<code><START> synchronized public void refreshSearcherManagerMap() { <END> ArrayList<String> toRemove = new ArrayList<>(); for (Map.Entry<String, SearcherManager> entry : searcherManagerMap.entrySet()) { if (!getProjectDescriptions().contains(entry.getKey())) { try { LOGGER.log(Level.FINE, "closing SearcherManager for project" + entry.getKey()); entry.getValue().close(); } catch (IOException ex) { LOGGER.log(Level.SEVERE, "cannot close SearcherManager for project" + entry.getKey(), ex); } toRemove.add(entry.getKey()); } } for (String proj : toRemove) { searcherManagerMap.remove(proj); } }</code><technical_language>is necessary for this synchronized map is concurrent</technical_language>

Target:
public void refreshSearcherManagerMap() { ArrayList<String> toRemove = new ArrayList<>(); for (Map.Entry<String, SearcherManager> entry : searcherManagerMap.entrySet()) { if (!getProjectDescriptions().contains(entry.getKey())) { try { LOGGER.log(Level.FINE, "closing SearcherManager for project" + entry.getKey()); entry.getValue().close(); } catch (IOException ex) { LOGGER.log(Level.SEVERE, "cannot close SearcherManager for project" + entry.getKey(), ex); } toRemove.add(entry.getKey()); } } for (String proj : toRemove) { searcherManagerMap.remove(proj); } }
Source:
<code>protected boolean processCurrentFileAndExtractPdpFeedFromSAEFile(String saeFileName) { boolean success = true; LOG.debug("processCurrentFileAndExtractPdpFeedFromSAEFile, current File: " + saeFileName); try { ConcurStandardAccountingExtractFile concurStandardAccoutingExtractFile = getConcurStandardAccountingExtractService() .parseStandardAccoutingExtractFileToStandardAccountingExtractFile(saeFileName); success = getConcurStandardAccountingExtractService() .extractPdpFeedFromStandardAccounitngExtract(concurStandardAccoutingExtractFile); <START> } catch (ValidationException ve) { <END> success = false; LOG.error("processCurrentFileAndExtractPdpFeedFromSAEFile, There was a validation error processing " + saeFileName, ve); } return success; }</code><technical_language>catching a ValidationException clear method thrown exception. I a bit more clear if call validate method parse return true/false fo extract if validation passed</technical_language>

Target:
protected boolean processCurrentFileAndExtractPdpFeedFromSAEFile(String saeFileName) { boolean success = true; LOG.debug("processCurrentFileAndExtractPdpFeedFromSAEFile, current File: " + saeFileName); ConcurStandardAccountingExtractFile concurStandardAccoutingExtractFile = getConcurStandardAccountingExtractService() .parseStandardAccoutingExtractFile(saeFileName); if (getConcurStandardAccountingExtractValidationService().validateConcurStandardAccountExtractFile(concurStandardAccoutingExtractFile)) { success = getConcurStandardAccountingExtractService().extractPdpFeedFromStandardAccounitngExtract(concurStandardAccoutingExtractFile); } else { success = false; LOG.error("processCurrentFileAndExtractPdpFeedFromSAEFile, the SAE file failed high level validation."); } return success; }
Source:
<code>private void resizeWindow(DroneEvent event) { DronePoint<?> dronePoint = event.getDronePoint(); if (!dronePoint.conformsTo(WebDriver.class)) { return; } DroneContext context = droneContext.get(); WebDriver driver = context.get(dronePoint).getInstanceAs(WebDriver.class); Validate.stateNotNull(context, "DroneContext must not be null"); WebDriverConfiguration configuration = context.get(dronePoint).getConfigurationAs(WebDriverConfiguration.class); Validate.stateNotNull(configuration, "WebDriver configuration must not be null"); String browser = configuration.getBrowser().toLowerCase(); <START> if(!browser.equals("chromeheadless")) { <END> if (configuration.getDimensions() != null) { String dimensions = configuration.getDimensions().toLowerCase().trim(); Matcher m = DIMENSIONS_PATTERN.matcher(dimensions); if (m.matches()) { int width = Integer.valueOf(m.group(1)); int height = Integer.valueOf(m.group(2)); safelyResizeWindow(driver, width, height, dronePoint); } else if (dimensions.equals("full") || dimensions.equals("fullscreen") || dimensions.equals("max")) { safelyMaximizeWindow(driver, dronePoint); } } } }</code><technical_language>btw, behaves in case of HtmlUnit PhantomJS</technical_language>

Target:
private void resizeWindow(DroneEvent event) { DronePoint<?> dronePoint = event.getDronePoint(); if (!dronePoint.conformsTo(WebDriver.class)) { return; } DroneContext context = droneContext.get(); WebDriver driver = context.get(dronePoint).getInstanceAs(WebDriver.class); Validate.stateNotNull(context, "DroneContext must not be null"); WebDriverConfiguration configuration = context.get(dronePoint).getConfigurationAs(WebDriverConfiguration.class); Validate.stateNotNull(configuration, "WebDriver configuration must not be null"); String browser = configuration.getBrowser().toLowerCase(); if (!browser.equals("chromeheadless")) { Dimensions dimensions = new Dimensions(configuration); if (dimensions.hasFullscreenEnabled()) { safelyMaximizeWindow(driver, dronePoint); } else { safelyResizeWindow(driver, dimensions.getWidth(), dimensions.getHeight(), dronePoint); } } }
Source:
<code>protected Object decode(final ChannelHandlerContext ctx, final ByteBuf inputBuf) throws Exception { if (inputBuf.readableBytes() <= 0) { return null; } if (outputBuf == null) { outputBuf = Unpooled.buffer(INITIAL_BUF_LEN); } while (inputBuf.readableBytes() > 0) { if (literalCount <= 0) { final ByteBuf lineBuf = (ByteBuf) super.decode(ctx, inputBuf); if (lineBuf == null) { <START> outputBuf.writeBytes(inputBuf); <END> return null; } final int lineLen = lineBuf.readableBytes(); final boolean noLiterals = (lineLen < FIVE || lineBuf.getByte(lineLen - THREE) != '}'); outputBuf.writeBytes(lineBuf); if (noLiterals) { return getFinalResponse(); } int i; for (i = lineLen - FOUR; i >= 0; i--) { if (lineBuf.getByte(i) == '{') { break; } } if (i < 0) { return getFinalResponse(); } try { final int numDigits = lineLen - THREE - (i + 1); final byte[] digits = new byte[numDigits]; lineBuf.getBytes(i + 1, digits, 0, numDigits); this.literalCount = ASCIIUtility.parseInt(digits, 0, digits.length); } catch (final NumberFormatException e) { return getFinalResponse(); } } else { final int avail = inputBuf.readableBytes(); final int actual = (literalCount <= avail) ? literalCount : avail; outputBuf.writeBytes(inputBuf, actual); literalCount -= actual; } } return null; }</code><technical_language>writing data output buffer</technical_language>

Target:
protected Object decode(final ChannelHandlerContext ctx, final ByteBuf inputBuf) throws Exception { while (inputBuf.readableBytes() > 0) { if (literalCount <= 0) { final ByteBuf lineBuf = (ByteBuf) super.decode(ctx, inputBuf); if (lineBuf == null) { return null; } final int lineLen = lineBuf.readableBytes(); final boolean noLiterals = (lineLen < FIVE || lineBuf.getByte(lineLen - THREE) != '}'); if (noLiterals) { return getFinalResponse(lineBuf); } this.literalCount = getLiteralCount(lineBuf, lineLen); if (this.literalCount < 0) { return getFinalResponse(lineBuf); } if (literalBuf == null) { literalBuf = Unpooled.buffer(lineLen + literalCount + EXTRA_PADDING_LEN); } literalBuf.writeBytes(lineBuf); } else { final int avail = inputBuf.readableBytes(); final int actual = (literalCount <= avail) ? literalCount : avail; literalBuf.writeBytes(inputBuf, actual); literalCount -= actual; } } return null; }
Source:
<code>private void createAndInvoke(ChannelOperation callback) { try { newChannelInvoker.createChannel().whenComplete((channel, throwable) -> { if (throwable != null) { int currentActive = active.decrementAndGet(); assert currentActive >= 0; int currentCreated = created.decrementAndGet(); assert currentCreated >= 0; if (trace) log.tracef(throwable, "Channel could not be created, created = %d, active = %d", currentCreated, currentActive); callback.cancel(address, throwable); } else { callback.invoke(channel); } }); } catch (Throwable t) { int currentActive = active.decrementAndGet(); <START> assert currentActive >= 0; <END> int currentCreated = created.decrementAndGet(); assert currentCreated >= 0; if (trace) log.tracef(t, "Channel could not be created, created = %d, active = %d", currentCreated, currentActive); callback.cancel(address, t); } }</code><technical_language>adding assert instead of firing logs exceptions</technical_language>

Target:
private void createAndInvoke(ChannelOperation callback) { try { newChannelInvoker.createChannel().whenComplete((channel, throwable) -> { if (throwable != null) { int currentActive = active.decrementAndGet(); assert currentActive >= 0; int currentCreated = created.decrementAndGet(); assert currentCreated >= 0; if (trace) log.tracef(throwable, "Channel could not be created, created = %d, active = %d", currentCreated, currentActive); callback.cancel(address, throwable); } else { callback.invoke(channel); } }); } catch (Throwable t) { int currentActive = active.decrementAndGet(); int currentCreated = created.decrementAndGet(); if (trace) log.tracef(t, "Channel could not be created, created = %d, active = %d", currentCreated, currentActive); if (currentCreated < 0) { HOTROD.warnf("Invalid created count after channel create failure"); } if (currentActive < 0) { HOTROD.warnf("Invalid active count after channel create failure"); } callback.cancel(address, t); } }
Source:
<code>public void stopReadingEarlyWhenEncounteringEntryKnownToBeCommittedAfterSweepTs() { immutableTs = 100L; enqueueWriteCommitted(TABLE_CONS, 10); enqueueWriteCommitedAt(TABLE_CONS, 30, 150); putTimestampIntoTransactionTable(50, 200); Map<Integer, Integer> largeWriteDistribution = enqueueAtLeastThresholdWritesInDefaultShardWithStartTs(100, 50); int writesInDedicated = largeWriteDistribution.get(CONS_SHARD); enqueueWriteUncommitted(TABLE_CONS, 70); enqueueWriteCommitted(TABLE_CONS, 90); sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertThat(metricsManager).hasEntriesReadConservativeEqualTo( 4 + writesInDedicated + (readBatchSize > 1 ? 1 : 0)); sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertThat(metricsManager).hasEntriesReadConservativeEqualTo( 4 + writesInDedicated + 1 + (readBatchSize > 1 ? 1 : 0)); immutableTs = 170; sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertThat(metricsManager).hasEntriesReadConservativeEqualTo( 4 + writesInDedicated + 3 + (readBatchSize > 1 ? 2 : 0)); immutableTs = 250; sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertThat(metricsManager).hasEntriesReadConservativeEqualTo( <START> 4 + writesInDedicated + 3 + writesInDedicated + 2 + + (readBatchSize > 1 ? 2 : 0)); <END> }</code><technical_language>+ +</technical_language>

Target:
public void stopReadingEarlyWhenEncounteringEntryKnownToBeCommittedAfterSweepTs() { immutableTs = 100L; enqueueWriteCommitted(TABLE_CONS, 10); enqueueWriteCommitedAt(TABLE_CONS, 30, 150); putTimestampIntoTransactionTable(50, 200); Map<Integer, Integer> largeWriteDistribution = enqueueAtLeastThresholdWritesInDefaultShardWithStartTs(100, 50); int writesInDedicated = largeWriteDistribution.get(CONS_SHARD); enqueueWriteUncommitted(TABLE_CONS, 70); enqueueWriteCommitted(TABLE_CONS, 90); sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertThat(metricsManager).hasEntriesReadConservativeEqualTo( 4 + writesInDedicated + (readBatchSize > 1 ? 1 : 0)); sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertThat(metricsManager).hasEntriesReadConservativeEqualTo( 4 + writesInDedicated + 1 + (readBatchSize > 1 ? 1 : 0)); immutableTs = 170; sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertThat(metricsManager).hasEntriesReadConservativeEqualTo( 4 + writesInDedicated + 3 + (readBatchSize > 1 ? 2 : 0)); immutableTs = 250; sweepNextBatch(ShardAndStrategy.conservative(CONS_SHARD)); assertThat(metricsManager).hasEntriesReadConservativeEqualTo( 4 + writesInDedicated + 3 + writesInDedicated + 2 + (readBatchSize > 1 ? 2 : 0)); }