auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private BlockBreakHandler onBreak() { <START> return new BlockBreakHandler(true, true) { @Override public void onPlayerBreak(BlockBreakEvent e, ItemStack item, List<ItemStack> drops) { remove(e.getBlock()); } @Override public void onExplode(Block b, List<ItemStack> drops) { remove(b); } @Override public void onAndroidBreak(AndroidMineEvent e) { remove(e.getBlock()); } }; <END> }</code><technical_language>suggestion return new SimpleBlockBreakHandler() { @Override public void onBlockBreaking(@Nonnull Block b) { remove(b); } };</technical_language>

Target:
private BlockBreakHandler onBreak() { return new SimpleBlockBreakHandler() { @Override public void onBlockBreak(@Nonnull Block b) { remove(b); } }; }
Source:
<code>public boolean removeAttributeWithoutCheck(PerunSession sess, Member member, Group group, AttributeDefinition attribute) throws InternalErrorException, WrongAttributeAssignmentException { getAttributesManagerImpl().checkNamespace(sess, attribute, NS_MEMBER_GROUP_ATTR); if (getAttributesManagerImpl().isCoreAttribute(sess, attribute)) throw new WrongAttributeAssignmentException(attribute); boolean changed = getAttributesManagerImpl().removeAttribute(sess, member, group, attribute); if (changed) { try { getAttributesManagerImpl().changedAttributeHook(sess, member, group, new Attribute(attribute)); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } <START> log.info("{} removed this attribute({}) from member in group. Id member = {}, id group = {}",sess.getPerunClient().getId(), attribute.getName(), member.getId(), group.getId()); <END> getPerunBl().getAuditer().log(sess, "{} removed for and {}.", new AttributeDefinition(attribute), member, group); } return changed; }</code><technical_language>I prefer format id next entity type, log.info("{} removed attribute member in group {}",..</technical_language>

Target:
public boolean removeAttributeWithoutCheck(PerunSession sess, Member member, Group group, AttributeDefinition attribute) throws InternalErrorException, WrongAttributeAssignmentException { getAttributesManagerImpl().checkNamespace(sess, attribute, NS_MEMBER_GROUP_ATTR); if (getAttributesManagerImpl().isCoreAttribute(sess, attribute)) throw new WrongAttributeAssignmentException(attribute); boolean changed = getAttributesManagerImpl().removeAttribute(sess, member, group, attribute); if (changed) { try { getAttributesManagerImpl().changedAttributeHook(sess, member, group, new Attribute(attribute)); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } log.info("{} removed attribute from member in group {}.",sess.getLogId(), attribute.getName(), member.getId(), group.getId()); getPerunBl().getAuditer().log(sess, "{} removed for and {}.", new AttributeDefinition(attribute), member, group); } return changed; }
Source:
<code>public static TransactionChannel getDemoTransactionChannel() throws MambuApiException { OrganizationService organizationService = MambuAPIFactory.getOrganizationService(); List<TransactionChannel> transactionChannels = organizationService.getTransactionChannels(); if (transactionChannels == null) { return null; } int randomIndex = (int) Math.round(Math.random() * (transactionChannels.size() - 1)); <START> randomIndex = 1; <END> return transactionChannels.get(randomIndex); }</code><technical_language>random anymore ;)</technical_language>

Target:
public static TransactionChannel getDemoTransactionChannel() throws MambuApiException { OrganizationService organizationService = MambuAPIFactory.getOrganizationService(); List<TransactionChannel> transactionChannels = organizationService.getTransactionChannels(); if (transactionChannels == null) { return null; } int randomIndex = (int) Math.round(Math.random() * (transactionChannels.size() - 1)); return transactionChannels.get(randomIndex); }
Source:
<code>public void test_evaluate_string() { final AtomicReference<String> returnValue = new AtomicReference<>(); browser.addProgressListener(new ProgressListener() { @Override public void changed(ProgressEvent event) { } @Override public void completed(ProgressEvent event) { String evalResult = (String) browser.evaluate("return document.getElementById('myid').childNodes[0].nodeValue;"); returnValue.set(evalResult); if (browser_debug) System.out.println("Node value: "+ evalResult); } }); browser.setText("<html><body><p id='myid'>HelloWorld</p></body></html>"); shell.open(); for (int i = 0; i < (loopMultipier * secondsToWaitTillFail); i++) { runLoopTimer(waitMS); <START> if ("HelloWorldz".equals(returnValue.get())) { <END> return; } } fail(name.getMethodName() + " failed. Evaluation did not return a value. Test timed out."); }</code><technical_language>this "z" belongs here</technical_language>

Target:
public void test_evaluate_string() { assumeFalse(webkit1SkipMsg(), isWebkit1); final AtomicReference<String> returnValue = new AtomicReference<>(); browser.addProgressListener(new ProgressListener() { @Override public void changed(ProgressEvent event) { } @Override public void completed(ProgressEvent event) { String evalResult = (String) browser.evaluate("return document.getElementById('myid').childNodes[0].nodeValue;"); returnValue.set(evalResult); if (browser_debug) System.out.println("Node value: "+ evalResult); } }); browser.setText("<html><body><p id='myid'>HelloWorld</p></body></html>"); shell.open(); for (int i = 0; i < (loopMultipier * secondsToWaitTillFail); i++) { runLoopTimer(waitMS); if ("HelloWorld".equals(returnValue.get())) { return; } } fail("Evaluation did not return a value. Or test timed out."); }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { IResourceUIModel selected = getSelectedElement(event, IResourceUIModel.class); if(selected == null) { return null; } String name = null; Deployment deployment = null; IReplicationController rc = null; if(selected instanceof Deployment) { deployment = (Deployment)selected; rc = findReplicationController(deployment); name = deployment.getResource().getName(); <START> } else if(selected.getResource() instanceof IReplicationController) { <END> rc = (IReplicationController)selected.getResource(); name = rc.getName(); Object parent = selected.getParent(); if(parent instanceof Deployment) { deployment = (Deployment)parent; } else if(parent instanceof IProjectAdapter) { deployment = findDeployment((IProjectAdapter)parent, rc); } } if(rc == null) { return null; } String diff = event.getParameter(REPLICA_DIFF); if(!NumberUtils.isNumber(diff)) { IDeploymentConfig dc = null; if(!(rc instanceof IDeploymentConfig)) { String dcName = rc.getAnnotation(OpenShiftAPIAnnotations.DEPLOYMENT_CONFIG_NAME); if(!StringUtils.isNotBlank(dcName)) { dc = findDeploymentConfig(deployment, dcName); } } scaleUsing(event, name, rc, deployment, dc); } else { scaleDeployment(name, rc, rc.getDesiredReplicaCount() + Integer.parseInt(diff), null); } return null; }</code><technical_language>compare kind ResourceKind.ReplicationController.equals(selected.getResource().getKind())</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { IResourceWrapper<?, ?> selected = getSelectedElement(event, IResourceWrapper.class); if(selected == null) { return null; } String name = null; IServiceWrapper deployment = null; IReplicationController rc = null; if(selected instanceof IServiceWrapper) { deployment = (IServiceWrapper)selected; rc = findReplicationController(deployment); name = deployment.getWrapped().getName(); } else if(ResourceKind.REPLICATION_CONTROLLER.equals(selected.getWrapped().getKind()) || ResourceKind.DEPLOYMENT_CONFIG.equals(selected.getWrapped().getKind())) { rc = (IReplicationController)selected.getWrapped(); name = rc.getName(); Object parent = selected.getParent(); if(parent instanceof IServiceWrapper) { deployment = (IServiceWrapper)parent; } else if(parent instanceof IProjectWrapper) { deployment = findDeployment((IProjectWrapper)parent, rc); } } if(rc == null) { return null; } String diff = event.getParameter(REPLICA_DIFF); if(!NumberUtils.isNumber(diff)) { IDeploymentConfig dc = null; if(!(ResourceKind.DEPLOYMENT_CONFIG.equals(rc.getKind()))) { String dcName = rc.getAnnotation(OpenShiftAPIAnnotations.DEPLOYMENT_CONFIG_NAME); if(StringUtils.isNotBlank(dcName)) { dc = findDeploymentConfig(deployment, dcName); } } scaleUsing(event, name, rc, deployment, dc); } else { scaleDeployment(name, rc, rc.getDesiredReplicaCount() + Integer.parseInt(diff), null); } return null; }
Source:
<code>private boolean downloadFiles(String username, String remoteHost, String sourcePath, String destinationPath) { <START> ; <END> ChannelSftp channelSftp = null; try { channelSftp = setupJsch(username, remoteHost); channelSftp.connect(); channelSftp.cd(sourcePath); Vector<ChannelSftp.LsEntry> fileAndFolderList = channelSftp.ls(sourcePath); for (ChannelSftp.LsEntry item : fileAndFolderList) { if (!item.getAttrs().isDir()) { if (!(new File(destinationPath + PATHSEPARATOR + item.getFilename())).exists() || (item.getAttrs().getMTime() > Long .valueOf(new File(destinationPath + PATHSEPARATOR + item.getFilename()).lastModified() / (long) 1000) .intValue())) { new File(destinationPath + PATHSEPARATOR + item.getFilename()); channelSftp.get(sourcePath + PATHSEPARATOR + item.getFilename(), destinationPath + PATHSEPARATOR + item.getFilename()); } } } } catch (JSchException | SftpException ex) { ex.printStackTrace(); return false; } finally { if (channelSftp != null) { channelSftp.disconnect(); } } return true; }</code><technical_language>Minor: Unnecessary ;</technical_language>

Target:
private boolean downloadFiles(String username, String remoteHost, String sourcePath, String destinationPath) { ChannelSftp channelSftp = null; try { channelSftp = setupJsch(username, remoteHost); channelSftp.connect(); channelSftp.cd(sourcePath); Vector<ChannelSftp.LsEntry> fileAndFolderList = channelSftp.ls(sourcePath); for (ChannelSftp.LsEntry item : fileAndFolderList) { if (!item.getAttrs().isDir()) { if (!(new File(destinationPath + PATHSEPARATOR + item.getFilename())).exists() || (item.getAttrs().getMTime() > Long.valueOf(new File(destinationPath + PATHSEPARATOR + item.getFilename()).lastModified() / (long) 1000).intValue())) { new File(destinationPath + PATHSEPARATOR + item.getFilename()); channelSftp.get(sourcePath + PATHSEPARATOR + item.getFilename(), destinationPath + PATHSEPARATOR + item.getFilename()); } } } } catch (JSchException | SftpException ex) { ex.printStackTrace(); return false; } finally { if (channelSftp != null) { channelSftp.disconnect(); } } return true; }
Source:
<code>protected RenderingContext doPrint(PrintParams params) throws DocumentException { final String layoutName = params.jsonSpec.getString(Constants.JSON_LAYOUT_KEY); Layout layout = params.config.getLayout(layoutName); if (layout == null) { throw new RuntimeException("Unknown layout '" + layoutName + "'"); } Document doc = new Document(layout.getFirstPageSize(null,params.jsonSpec)); PdfWriter writer = PdfWriter.getInstance(doc, params.outputStream); if (!layout.isSupportLegacyReader()) { writer.setFullCompression(); writer.setPdfVersion(PdfWriter.PDF_VERSION_1_5); writer.setCompressionLevel(PdfStream.BEST_COMPRESSION); } RenderingContext context = new RenderingContext(doc, writer, params.config, params.jsonSpec, params.configDir.getPath(), layout, params.headers); layout.render(params.jsonSpec, context); doc.close(); writer.close(); List<PdfReader> readerList = context.getCustomBlocks().getReaders(); <START> if (readerList != null) { <END> for (int i = 0; i < readerList.size(); i++) { try { readerList.get(i).close(); } catch (Exception e) { context.addError(e); } } } return context; }</code><technical_language>null, this if is useless</technical_language>

Target:
protected RenderingContext doPrint(PrintParams params) throws DocumentException { final String layoutName = params.jsonSpec.getString(Constants.JSON_LAYOUT_KEY); Layout layout = params.config.getLayout(layoutName); if (layout == null) { throw new RuntimeException("Unknown layout '" + layoutName + "'"); } Document doc = new Document(layout.getFirstPageSize(null,params.jsonSpec)); PdfWriter writer = PdfWriter.getInstance(doc, params.outputStream); if (!layout.isSupportLegacyReader()) { writer.setFullCompression(); writer.setPdfVersion(PdfWriter.PDF_VERSION_1_5); writer.setCompressionLevel(PdfStream.BEST_COMPRESSION); } RenderingContext context = new RenderingContext(doc, writer, params.config, params.jsonSpec, params.configDir.getPath(), layout, params.headers); layout.render(params.jsonSpec, context); doc.close(); writer.close(); context.getCustomBlocks().closeReaders(); return context; }
Source:
<code>public void receivingAConfirmRequest(final Map<String, String> requestParameters) throws Throwable { ScenarioContext.Current().put("NumberToAddAsNextSequenceNumber", getInteger(requestParameters, "AddNumberToSequenceNumber")); this.oslpDeviceSteps.theDeviceReturnsAStartDeviceResponseOverOSLP("OK"); this.startDeviceTestSteps.receivingAStartDeviceTestRequest(requestParameters); this.startDeviceTestSteps.theStartDeviceAsyncResponseContains(requestParameters); this.oslpDeviceSteps.aStartDeviceOSLPMessageIsSentToDevice( getString(requestParameters, Keys.KEY_DEVICE_IDENTIFICATION, Defaults.DEFAULT_DEVICE_IDENTIFICATION)); <START> <END> final StartDeviceTestAsyncRequest request = new StartDeviceTestAsyncRequest(); final AsyncRequest asyncRequest = new AsyncRequest(); asyncRequest.setDeviceId( getString(requestParameters, Keys.KEY_DEVICE_IDENTIFICATION, Defaults.DEFAULT_DEVICE_IDENTIFICATION)); asyncRequest.setCorrelationUid((String) ScenarioContext.Current().get(Keys.KEY_CORRELATION_UID)); request.setAsyncRequest(asyncRequest); try { ScenarioContext.Current().put(Keys.RESPONSE, this.client.getStartDeviceTestResponse(request)); } catch (final SoapFaultClientException ex) { ScenarioContext.Current().put(Keys.RESPONSE, ex); } }</code><technical_language>in here? seperate steps meantioned in feature file</technical_language>

Target:
public void receivingAConfirmRequest(final Map<String, String> requestParameters) throws Throwable { ScenarioContext.Current().put("NumberToAddAsNextSequenceNumber", getInteger(requestParameters, "AddNumberToSequenceNumber")); }
Source:
<code>public ReconnectingServerStoreProxy(ServerStoreProxy serverStoreProxy, Runnable onReconnect) { this.delegate = serverStoreProxy; this.delegateRef = new AtomicReference<>(serverStoreProxy); this.onReconnect = onReconnect; <START> this.swap = new SwappableProxy(serverStoreProxy.getCacheId()); <END> }</code><technical_language>Bunch of weird here. 1. do need a create this now? do demand? 2. is called SwappableProxy, ReconnectInProgressProxy? 3. Lots of code duplication here. Wondering if solve this a method this: java private <T> T onStoreProxy(Function<ServerStoreProxy, T> function) { ServerStoreProxy storeProxy = proxy(); try { return function.apply(storeProxy); } catch (ServerStoreProxyException sspe) { if (sspe.getCause() instanceof ConnectionClosedException) { if (delegateRef.compareAndSet(storeProxy, new ReconnectInProgress(storeProxy.getCacheId()))) { onReconnect.run(); } return onStoreProxy(function); } else { throw sspe; } } }</technical_language>

Target:
public ReconnectingServerStoreProxy(ServerStoreProxy serverStoreProxy, Runnable onReconnect) { this.delegateRef = new AtomicReference<>(serverStoreProxy); this.onReconnect = onReconnect; }
Source:
<code>private boolean upgradeNineTen(SQLiteDatabase db) { <START> upgradeXFormAndroidInstallerV1(UPGRADE_RESOURCE_TABLE_NAME, db); <END> upgradeXFormAndroidInstallerV1(RECOVERY_RESOURCE_TABLE_NAME, db); return true; }</code><technical_language>sounds strange, part of wants guess a Cursor leak triggering failure I justify visible a straight exception. I other issues PR understanding this. I other I need close out today I check if I look</technical_language>

Target:
private boolean upgradeNineTen(SQLiteDatabase db) { db.beginTransaction(); try { upgradeToResourcesV10(UPGRADE_RESOURCE_TABLE_NAME, db); upgradeToResourcesV10(RECOVERY_RESOURCE_TABLE_NAME, db); db.setTransactionSuccessful(); } finally { db.endTransaction(); } return true; }
Source:
<code><START> public void showCourseContainerOutline(Activity activity, EnrolledCoursesResponse courseData, <END> CourseUpgradeResponse courseUpgradeData, String courseComponentId) { showCourseContainerOutline(activity, -1, courseData, courseUpgradeData, courseComponentId, null, false); }</code><technical_language>is need overload method, other method is called else</technical_language>

Target:
public void showCourseContainerOutline(Activity activity, EnrolledCoursesResponse courseData, CourseUpgradeResponse courseUpgradeData, String courseComponentId) { Intent courseDetail = CourseOutlineActivity.newIntent(activity, courseData, courseUpgradeData, courseComponentId, null, false); activity.startActivityForResult(courseDetail, -1); }
Source:
<code>private boolean updateReplicaCapacityIfRequired(String partitionName, InstanceConfig instanceConfig, String mountPath, long actualReplicaCapacity) { boolean instanceConfigUpdated = false; Map<String, String> diskInfo = instanceConfig.getRecord().getMapField(mountPath); String currentReplicasStr = diskInfo.get(ClusterMapUtils.REPLICAS_STR); <START> String newReplicaStr = ""; <END> List<String> replicaInfoList = Arrays.asList(currentReplicasStr.split(ClusterMapUtils.REPLICAS_DELIM_STR)); for (String replicaInfo : replicaInfoList) { String[] info = replicaInfo.split(ClusterMapUtils.REPLICAS_STR_SEPARATOR); if (info[0].equals(partitionName)) { long capacityInHelix = Long.valueOf(info[1]); if (capacityInHelix != actualReplicaCapacity) { info[1] = Long.toString(actualReplicaCapacity); } } newReplicaStr += info[0] + ClusterMapUtils.REPLICAS_STR_SEPARATOR + info[1] + ClusterMapUtils.REPLICAS_DELIM_STR; } if (!currentReplicasStr.equals(newReplicaStr)) { diskInfo.put(ClusterMapUtils.REPLICAS_STR, newReplicaStr); instanceConfig.getRecord().setMapField(mountPath, diskInfo); instanceConfigUpdated = true; } return instanceConfigUpdated; }</code><technical_language>a StringBuilder here</technical_language>

Target:
private boolean updateReplicaCapacityIfRequired(String partitionName, InstanceConfig instanceConfig, String mountPath, long actualReplicaCapacity) { boolean instanceConfigUpdated = false; Map<String, String> diskInfo = instanceConfig.getRecord().getMapField(mountPath); String currentReplicasStr = diskInfo.get(ClusterMapUtils.REPLICAS_STR); StringBuilder newReplicaStrBuilder = new StringBuilder(); List<String> replicaInfoList = Arrays.asList(currentReplicasStr.split(ClusterMapUtils.REPLICAS_DELIM_STR)); for (String replicaInfo : replicaInfoList) { String[] info = replicaInfo.split(ClusterMapUtils.REPLICAS_STR_SEPARATOR); if (info[0].equals(partitionName)) { long capacityInHelix = Long.valueOf(info[1]); if (capacityInHelix != actualReplicaCapacity) { info[1] = Long.toString(actualReplicaCapacity); } } newReplicaStrBuilder.append(info[0]) .append(ClusterMapUtils.REPLICAS_STR_SEPARATOR) .append(info[1]) .append(ClusterMapUtils.REPLICAS_DELIM_STR); } String newReplicaStr = newReplicaStrBuilder.toString(); if (!currentReplicasStr.equals(newReplicaStr)) { diskInfo.put(ClusterMapUtils.REPLICAS_STR, newReplicaStr); instanceConfig.getRecord().setMapField(mountPath, diskInfo); instanceConfigUpdated = true; } return instanceConfigUpdated; }
Source:
<code>private void parseSecondArgWithoutDash(String arg, boolean passFileExists) { int delimiterIndex = arg.indexOf("="); if <START> ((getConfigAction().equals(ConfigActionType.ACTION_SET) || getConfigAction().equals(ConfigActionType.ACTION_MERGE)) <END> && delimiterIndex == -1 && !passFileExists) { throw new IllegalArgumentException("Argument for set/concat action must be in format of key=value."); } String key = getStringBeforeEqualChar(arg, delimiterIndex); String value = getStringAfterEqualChar(arg, delimiterIndex); if (!key.isEmpty()) { if (!value.isEmpty()) { parseSecondArgWithKeyValue(arg, key, value); } else if ((getConfigAction().equals(ConfigActionType.ACTION_SET) || getConfigAction().equals(ConfigActionType.ACTION_MERGE)) && getKey() == null) { engineConfigMap.setKey(key); engineConfigMap.setValue(value); } else if ((getConfigAction().equals(ConfigActionType.ACTION_GET) || getConfigAction().equals(ConfigActionType.ACTION_HELP)) && getKey() == null) { engineConfigMap.setKey(arg); } else { log.debug("parsing error: illegal argument " + arg + ". Skipping argument."); } } else { log.debug("parsing error: illegal argument " + arg + ", starts with '='. Skipping argument."); } }</code><technical_language>appears 3 times in this file , worths wrapping a bool function : getConfigAction().equals(ConfigActionType.ACTION_SET) || getConfigAction().equals(ConfigActionType.ACTION_MERGE</technical_language>

Target:
private void parseSecondArgWithoutDash(String arg, boolean passFileExists) { int delimiterIndex = arg.indexOf("="); if (isSetOrMergeAction() && delimiterIndex == -1 && !passFileExists) { throw new IllegalArgumentException("Argument for set/concat action must be in format of key=value."); } String key = getStringBeforeEqualChar(arg, delimiterIndex); String value = getStringAfterEqualChar(arg, delimiterIndex); if (!key.isEmpty()) { if (!value.isEmpty()) { parseSecondArgWithKeyValue(arg, key, value); } else if (isSetOrMergeAction() && getKey() == null) { engineConfigMap.setKey(key); engineConfigMap.setValue(value); } else if ((getConfigAction().equals(ConfigActionType.ACTION_GET) || getConfigAction().equals(ConfigActionType.ACTION_HELP)) && getKey() == null) { engineConfigMap.setKey(arg); } else { log.debug("parsing error: illegal argument " + arg + ". Skipping argument."); } } else { log.debug("parsing error: illegal argument " + arg + ", starts with '='. Skipping argument."); } }
Source:
<code><START> public Interval getInterval() { <END> return this.interval; }</code><technical_language>Locatable</technical_language>

Target:
public Locatable getInterval() { return this.interval; }
Source:
<code>public String toTableId(String tableName) { <START> Preconditions.checkNotNull(tableName, "table name cannot be null"); <END> String tablesPrefix = clusterName + "/" + TABLE_SEPARATOR + "/"; Preconditions.checkState(tableName.startsWith(tablesPrefix), "'%s' does not start with '%s'", tableName, tablesPrefix); String tableId = tableName.substring(tablesPrefix.length()); Preconditions.checkState(!tableId.isEmpty(), "TableName is blank"); return tableId; }</code><technical_language>nit: "Table name null."</technical_language>

Target:
public String toTableId(String tableName) { Preconditions.checkNotNull(tableName, "Table name cannot be null"); String tablesPrefix = clusterName + "/" + TABLE_SEPARATOR + "/"; Preconditions.checkState(tableName.startsWith(tablesPrefix), "'%s' does not start with '%s'", tableName, tablesPrefix); String tableId = tableName.substring(tablesPrefix.length()).trim(); Preconditions.checkState(!tableId.isEmpty(), "Table id is blank"); return tableId; }
Source:
<code>protected GCSBatchSink(GCSSinkConfig config) { super(config); this.config = config; if (!this.config.containsMacro("fileSystemProperties") && !this.config.containsMacro("Bucket_Key") && !this.config.containsMacro("Project_Id")) { <START> this.config.fileSystemProperties = updateFileSystemProperties(this.config.fileSystemProperties, <END> this.config.projectId, this.config.jsonKey); } }</code><technical_language>If fields configured macros, config.fileSystemProperties set in constructor, set in prepareRun in case</technical_language>

Target:
protected GCSBatchSink(GCSSinkConfig config) { super(config); this.config = config; if (!this.config.containsMacro("fileSystemProperties") && !this.config.containsMacro("JsonKeyFile") && !this.config.containsMacro("ProjectId")) { this.config.fileSystemProperties = updateFileSystemProperties(this.config.fileSystemProperties, this.config.projectId, this.config.jsonKey); } }
Source:
<code>public List<Long> getAffinityGroupIdList() { if (affinityGroupNameList != null && affinityGroupIdList != null) { throw new InvalidParameterValueException("affinitygroupids parameter is mutually exclusive with affinitygroupnames parameter"); } if (affinityGroupNameList == null && affinityGroupIdList == null) { throw new InvalidParameterValueException("affinitygroupids parameter or affinitygroupnames parameter must be given"); } <START> <END> if (affinityGroupNameList != null) { List<Long> affinityGroupIds = new ArrayList<Long>(); for (String groupName : affinityGroupNameList) { Long groupId = _responseGenerator.getAffinityGroupId(groupName, getEntityOwnerId()); if (groupId == null) { throw new InvalidParameterValueException("Unable to find group by name " + groupName + " for account " + getEntityOwnerId()); } else { affinityGroupIds.add(groupId); } } return affinityGroupIds; } else { return affinityGroupIdList; } }</code><technical_language>Lines 95-102 beginning of execute method in accessor</technical_language>

Target:
public List<Long> getAffinityGroupIdList() { if (affinityGroupNameList != null) { List<Long> affinityGroupIds = new ArrayList<Long>(); for (String groupName : affinityGroupNameList) { Long groupId = _responseGenerator.getAffinityGroupId(groupName, getEntityOwnerId()); if (groupId == null) { throw new InvalidParameterValueException("Unable to find group by name " + groupName + " for account " + getEntityOwnerId()); } else { affinityGroupIds.add(groupId); } } return affinityGroupIds; } else { return affinityGroupIdList; } }
Source:
<code><START> public List<String> getDynamicDataColsForSkipScan() { <END> if (pdataTable.isMultiTenant()) { return getDynamicDataCols(); } List<String> dataSqlTypes = Lists.newArrayList(); for (String colName : dataColNamesForSkipScan) { dataSqlTypes.add(dataColSqlTypeNamesForSkipScan.get(colName)); } return getDynamicCols(getUnqualifiedColNames(dataColNamesForSkipScan), dataSqlTypes); }</code><technical_language>good a test dynamic columns well</technical_language>

Target:
public List<String> getDynamicDataColsForSkipScan() { if (pdataTable.isMultiTenant()) { return getDynamicDataCols(); } return getDynamicCols(getUnqualifiedColNames(dataColNamesForSkipScan), dataColSqlTypeNames); }
Source:
<code>public static void packRefs(ProgressMonitor pm, FileRepository repo) throws IOException { Set<Entry<String, Ref>> refEntries = repo.getAllRefs().entrySet(); pm.beginTask("pack refs", refEntries.size()); Collection<RefDirectoryUpdate> updates = new LinkedList<RefDirectoryUpdate>(); for (Map.Entry<String, Ref> entry : refEntries) { Ref ref = entry.getValue(); if (!ref.isSymbolic() && ref.getStorage().isLoose()) { updates.add(new RefDirectoryUpdate((RefDirectory) repo .getRefDatabase(), ref)); } <START> pm.update(1); <END> } ((RefDirectory) repo.getRefDatabase()).pack(updates); }</code><technical_language>null check for 'pm' progress monitor beginning of this method avoid a NPE in case caller calls null. check in gc method above</technical_language>

Target:
public static void packRefs(ProgressMonitor pm, FileRepository repo) throws IOException { Set<Entry<String, Ref>> refEntries = repo.getAllRefs().entrySet(); pm.beginTask("pack refs", refEntries.size()); try { Collection<RefDirectoryUpdate> updates = new LinkedList<RefDirectoryUpdate>(); for (Map.Entry<String, Ref> entry : refEntries) { Ref ref = entry.getValue(); if (!ref.isSymbolic() && ref.getStorage().isLoose()) { updates.add(new RefDirectoryUpdate((RefDirectory) repo .getRefDatabase(), ref)); } pm.update(1); } ((RefDirectory) repo.getRefDatabase()).pack(updates); } finally { pm.endTask(); } }
Source:
<code>public void logDone() { log( "pageId", pageId, "pageHeight", pageHeight, "scrollFluxDown", scrollFluxDown, "scrollFluxUp", scrollFluxUp, <START> "percentReached", getPercentReached() <END> ); }</code><technical_language>minor: consider renaming "maxPercentViewed". This (pageHeightReached + viewportHeight) logic more intuitive a screenfull scrolling</technical_language>

Target:
public void logDone() { log( "pageID", pageId, "pageHeight", (int) (pageHeight / app.getScreenDensity()), "scrollFluxDown", (int) (scrollFluxDown / app.getScreenDensity()), "scrollFluxUp", (int) (scrollFluxUp / app.getScreenDensity()), "maxPercentViewed", getMaxPercentViewed() ); }
Source:
<code><START> private void readHttpHeaders(MessageContext messageContext, AssertionType assertion) { <END> Message message = ((WrappedMessageContext) messageContext).getWrappedMessage(); if (message != null && message.get(Message.PROTOCOL_HEADERS) != null) { Map<String, List<String>> headers = CastUtils.cast((Map) message.get(Message.PROTOCOL_HEADERS)); if (headers != null && headers.keySet() != null && !headers.keySet().isEmpty()) { for (String headerName : headers.keySet()) { if (!headerHelper.isStandardHeader(headerName) && !headers.get(headerName).isEmpty()) { CONNECTCustomHttpHeadersType assertionHeader = new CONNECTCustomHttpHeadersType(); assertionHeader.setHeaderName(headerName); assertionHeader.setHeaderValue(headers.get(headerName).get(0)); assertion.getCONNECTCustomHttpHeaders().add(assertionHeader); } } } } }</code><technical_language>![MINOR](<LINK_1> "readHttpHeaders" a "static" method. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private static void readHttpHeaders(MessageContext messageContext, AssertionType assertion) { Message message = ((WrappedMessageContext) messageContext).getWrappedMessage(); if (message != null && message.get(Message.PROTOCOL_HEADERS) != null) { Map<String, List<String>> headers = CastUtils.cast((Map) message.get(Message.PROTOCOL_HEADERS)); if (MapUtils.isNotEmpty(headers)) { addHeadersToAssertion(headers, assertion); } } }
Source:
<code>private MucWrapper getOrCreateMucState(Jid mucJid) { <START> synchronized (mucs) <END> { MucWrapper mucWrapper = mucs.get(mucJid); if (mucWrapper == null) { mucWrapper = new MucWrapper(); mucs.put(mucJid, mucWrapper); } return mucWrapper; } }</code><technical_language>i computeIfAbsent get rid of need for synchronized block here</technical_language>

Target:
private MucWrapper getOrCreateMucState(Jid mucJid) { return mucs.computeIfAbsent(mucJid, (k) -> new MucWrapper()); }
Source:
<code>public void aWinIsThreePointsALossIsZeroPoints() throws Exception { Tournament tournament = new Tournament(); tournament.applyResults("Allegoric Alaskans;Blithering Badgers;win"); assertArrayEquals(new String[]{ "Team | MP | W | D | L | P", "Allegoric Alaskans | 1 | 1 | 0 | 0 | 3", "Blithering Badgers | 1 | 0 | 0 | 1 | 0" <START> }, tournament.printTable().split("\n")); <END> }</code><technical_language>compare string? I more obvious users need implement. do think? :)</technical_language>

Target:
public void aWinIsThreePointsALossIsZeroPoints() { tournament.applyResults("Allegoric Alaskans;Blithering Badgers;win"); assertEquals( "Team | MP | W | D | L | P\n" + "Allegoric Alaskans | 1 | 1 | 0 | 0 | 3\n" + "Blithering Badgers | 1 | 0 | 0 | 1 | 0\n", tournament.printTable()); }
Source:
<code>public static boolean hasFileScheme(String uri) { URI constructedURI = constructURI(uri); if (constructedURI == null) { <START> constructedURI = new File(uri).toURI(); <END> } String scheme = constructedURI.getScheme(); return scheme == null || "file".equalsIgnoreCase(scheme); }</code><technical_language>start "file", return true</technical_language>

Target:
public static boolean hasFileScheme(String uri) { URI constructedURI = constructURI(uri); if (constructedURI == null) { return true; } String scheme = constructedURI.getScheme(); return scheme == null || "file".equalsIgnoreCase(scheme); }
Source:
<code>public MessageConverterConfigurer(BindingServiceProperties bindingServiceProperties, CompositeMessageConverterFactory compositeMessageConverterFactory, Map<String, PartitionKeyExtractorStrategy> partitionKeyExtractors, Map<String, PartitionSelectorStrategy> partitionSelectors) { Assert.notNull(compositeMessageConverterFactory, "The message converter factory cannot be null"); this.bindingServiceProperties = bindingServiceProperties; this.compositeMessageConverterFactory = compositeMessageConverterFactory; <START> this.partitionKeyExtractors = partitionKeyExtractors == null ? Collections.EMPTY_MAP : partitionKeyExtractors; <END> this.partitionSelectors = partitionSelectors == null ? Collections.EMPTY_MAP : partitionSelectors; }</code><technical_language>Remove @SuppressWarnings type-safe variant - Collections.emptyMap()</technical_language>

Target:
public MessageConverterConfigurer(BindingServiceProperties bindingServiceProperties, CompositeMessageConverterFactory compositeMessageConverterFactory, Map<String, PartitionKeyExtractorStrategy> partitionKeyExtractors, Map<String, PartitionSelectorStrategy> partitionSelectors) { Assert.notNull(compositeMessageConverterFactory, "The message converter factory cannot be null"); this.bindingServiceProperties = bindingServiceProperties; this.compositeMessageConverterFactory = compositeMessageConverterFactory; this.partitionKeyExtractors = partitionKeyExtractors == null ? Collections.emptyMap() : partitionKeyExtractors; this.partitionSelectors = partitionSelectors == null ? Collections.emptyMap() : partitionSelectors; }
Source:
<code>public List<ODataEntry> readTable(String tableName) { List<ODataEntry> entryList = new ArrayList<>(); <START> DBCollection result = jongo.getDatabase().getCollection(tableName); <END> Iterator<DBObject> cursor = result.find(); DBObject current; String tempValue; while (cursor.hasNext()) { ODataEntry dataEntry; current = cursor.next(); tempValue = current.toString(); Iterator<?> keys = new JSONObject(tempValue).keys(); dataEntry = createDataEntryFromResult(tempValue, keys); dataEntry.addValue(ETAG, ODataUtils.generateETag(this.configId, tableName, dataEntry)); entryList.add(dataEntry); } return entryList; }</code><technical_language>Add meaningful variable names. This is in multiple places</technical_language>

Target:
public List<ODataEntry> readTable(String tableName) { List<ODataEntry> entryList = new ArrayList<>(); DBCollection readResult = jongo.getDatabase().getCollection(tableName); Iterator<DBObject> cursor = readResult.find(); DBObject documentData; String tempValue; while (cursor.hasNext()) { ODataEntry dataEntry; documentData = cursor.next(); tempValue = documentData.toString(); Iterator<?> keys = new JSONObject(tempValue).keys(); dataEntry = createDataEntryFromResult(tempValue, keys); dataEntry.addValue(ETAG, ODataUtils.generateETag(this.configId, tableName, dataEntry)); entryList.add(dataEntry); } return entryList; }
Source:
<code>@Override protected List<?> run() throws Exception { if (step.generateInclusions) { return ParallelTestExecutor.findTestSplits(step.parallelism, build, listener, step.generateInclusions, <START> new PreviousTestResultLookup.LookupInStage(step.stage)); <END> } else { List<List<String>> result = new ArrayList<>(); for (InclusionExclusionPattern pattern : ParallelTestExecutor.findTestSplits(step.parallelism, build, listener, step.generateInclusions, new PreviousTestResultLookup.LookupInStage(step.stage))) { result.add(pattern.getList()); } return result; } }</code><technical_language>This bypasses requirePlugins simply throw NoClassDefFoundErrors if some of plugins missing</technical_language>

Target:
@Override protected List<?> run() throws Exception { if (step.generateInclusions) { return ParallelTestExecutor.findTestSplits(step.parallelism, build, listener, step.generateInclusions, step.stage); } else { List<List<String>> result = new ArrayList<>(); for (InclusionExclusionPattern pattern : ParallelTestExecutor.findTestSplits(step.parallelism, build, listener, step.generateInclusions, step.stage)) { result.add(pattern.getList()); } return result; } }
Source:
<code>public void saveLoadStateTest() throws FileTailerStateProcessorException { FileTailerStateProcessor stateProcessor = new FileTailerStateProcessorImpl(System.getProperty("user.home") + "/ft_state_dir", "ft.state"); FileTailerState state = new FileTailerState("name", 101, "hash".hashCode(), 102); File file = new File(System.getProperty("user.home") + "/ft_state_dir/ft.state"); stateProcessor.saveState(state); Assert.assertTrue(file.exists()); FileTailerState loadedState = stateProcessor.loadState(); Assert.assertEquals(state.getFileName(), loadedState.getFileName()); Assert.assertEquals(state.getPosition(), loadedState.getPosition()); Assert.assertEquals(state.getHash(), loadedState.getHash()); Assert.assertEquals(state.getLastModifyTime(), loadedState.getLastModifyTime()); <START> new File(System.getProperty("user.home") + "/ft_state_dir").delete(); <END> }</code><technical_language>places writing temp files user.home</technical_language>

Target:
public void saveLoadStateTest() throws FileTailerStateProcessorException { FileTailerStateProcessor stateProcessor = new FileTailerStateProcessorImpl(new File("/tmp/ft_state_dir"), "ft.state"); FileTailerState state = new FileTailerState("name", 101, "hash".hashCode(), 102); File file = new File("/tmp/ft_state_dir/ft.state"); stateProcessor.saveState(state); Assert.assertTrue(file.exists()); FileTailerState loadedState = stateProcessor.loadState(); Assert.assertEquals(state.getFileName(), loadedState.getFileName()); Assert.assertEquals(state.getPosition(), loadedState.getPosition()); Assert.assertEquals(state.getHash(), loadedState.getHash()); Assert.assertEquals(state.getLastModifyTime(), loadedState.getLastModifyTime()); new File("/tmp/ft_state_dir/ft.state").delete(); new File("/tmp/ft_state_dir").delete(); }
Source:
<code>public void updatePhysics(GlowBlock me) { <START> super.updatePhysics(me); <END> boolean powered = me.isBlockPowered() || me.isBlockIndirectlyPowered(); if (powered != (me.getType() == Material.REDSTONE_LAMP_ON)) { me.setType(powered ? Material.REDSTONE_LAMP_ON : Material.REDSTONE_LAMP_OFF); } }</code><technical_language>This need update super</technical_language>

Target:
public void updatePhysics(GlowBlock me) { boolean powered = me.isBlockPowered() || me.isBlockIndirectlyPowered(); if (powered != (me.getType() == Material.REDSTONE_LAMP_ON)) { me.setType(powered ? Material.REDSTONE_LAMP_ON : Material.REDSTONE_LAMP_OFF); } }
Source:
<code>private static String formatForDisplay(String setterMethodName, List<Object> args) { <START> StringBuffer sb = new StringBuffer(CompilerOptions.class.getName()); <END> sb.append(".").append(setterMethodName).append("("); int i = 0; for (Object arg : args) { sb.append(i++ > 0 ? ", " : "").append(arg.toString()); } sb.append(")"); return sb.toString(); }</code><technical_language>write code google's joiner java Joiner.on(',').appendTo(sb, args);</technical_language>

Target:
private static String formatForDisplay(String setterMethodName, List<Object> args) { StringBuilder sb = new StringBuilder(CompilerOptions.class.getName()); sb.append(".").append(setterMethodName).append("("); Joiner.on(",").appendTo(sb, args).append(")"); return sb.toString(); }
Source:
<code>public void canDeserializeQosServerConfiguration() throws IOException { File testConfigFile = new File(QosServiceRuntimeConfig.class.getResource("/qos.yml").getPath()); QosServiceRuntimeConfig configuration = OBJECT_MAPPER.readValue(testConfigFile, QosServiceRuntimeConfig.class); assertThat(configuration.clientLimits()).hasSize(2); <START> assertThat(configuration.clientLimits()).containsOnly(entry("test", 10L), entry("test2", 20L)); <END> }</code><technical_language>nit: construct a config object assert equals</technical_language>

Target:
public void canDeserializeQosServerConfiguration() throws IOException { File testConfigFile = new File(QosServiceRuntimeConfig.class.getResource("/qos.yml").getPath()); QosServiceRuntimeConfig configuration = OBJECT_MAPPER.readValue(testConfigFile, QosServiceRuntimeConfig.class); assertThat(configuration).isEqualTo(ImmutableQosServiceRuntimeConfig.builder() .clientLimits(ImmutableMap.of("test", 10L, "test2", 20L)) .build()); }
Source:
<code>private void saveKieServerInstanceData(Properties data) { try (OutputStream out = new FileOutputStream(userFile)) { data.store(out, "Kie Server Router"); } catch (FileNotFoundException e) { <START> log.infof("file not found %1$s", userFile); <END> } catch (IOException e) { log.errorf(e, "somo error ocurred during access to %1$s", userFile); } }</code><technical_language>FileOutputStream a usage of FileNotFoundException FileInputStream. I propose deleting specific handling of FileNotFoundException left IOException, stating file created logging stacktrace. Throws: FileNotFoundException - if file exists is a directory a regular file, exist created, opened for other reason</technical_language>

Target:
private void saveKieServerInstanceData(Properties data) { try (OutputStream out = new FileOutputStream(userFile)) { data.store(out, "Kie Server Router"); } catch (IOException e) { log.errorf(e, "An error ocurred. File <%1$s> is a directory, it cannot be created or it cannot be opened", userFile); } }
Source:
<code>public void fail_when_assignee_is_not_member_of_organization_of_project_issue() throws Exception { OrganizationDto org = db.organizations().insert(organizationDto -> organizationDto.setKey("Organization key")); IssueDto issueDto = db.issues().insertIssue(org); setUserWithBrowsePermission(issueDto); OrganizationDto otherOrganization = db.organizations().insert(); UserDto assignee = db.users().insertUser("arthur"); db.organizations().addMember(otherOrganization, assignee); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("User 'arthur' is not member of organization 'Organization key'"); <START> tester.newRequest() <END> .setParam("issue", issueDto.getKey()) .setParam("assignee", "arthur") .execute(); }</code><technical_language>minor: rename ws</technical_language>

Target:
public void fail_when_assignee_is_not_member_of_organization_of_project_issue() throws Exception { OrganizationDto org = db.organizations().insert(organizationDto -> organizationDto.setKey("Organization key")); IssueDto issueDto = db.issues().insertIssue(org); setUserWithBrowsePermission(issueDto); OrganizationDto otherOrganization = db.organizations().insert(); UserDto assignee = db.users().insertUser("arthur"); db.organizations().addMember(otherOrganization, assignee); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("User 'arthur' is not member of organization 'Organization key'"); ws.newRequest() .setParam("issue", issueDto.getKey()) .setParam("assignee", "arthur") .execute(); }
Source:
<code>public void apply(DirCacheEntry ent) { ent.setFileMode(FileMode.REGULAR_FILE); <START> ent.setLength(1); <END> ent.setObjectId(data); }</code><technical_language>a length of 1? wrong in cases, or</technical_language>

Target:
public void apply(DirCacheEntry ent) { ent.setFileMode(FileMode.REGULAR_FILE); ent.setLength(length); ent.setObjectId(data); }
Source:
<code>public void freezeRealm() { <START> Realm frozenRealm = realm.freeze(); <END> assertEquals(realm.getPath(), frozenRealm.getPath()); assertTrue(frozenRealm.isFrozen()); frozenRealm.close(); }</code><technical_language>add assertFalse(realm.isFrozen());</technical_language>

Target:
public void freezeRealm() { assertFalse(realm.isFrozen()); Realm frozenRealm = realm.freeze(); assertEquals(realm.getPath(), frozenRealm.getPath()); assertTrue(frozenRealm.isFrozen()); frozenRealm.close(); }
Source:
<code>public SignatureVisitor() { <START> super(Opcodes.ASM7_EXPERIMENTAL); <END> }</code><technical_language>ASM7</technical_language>

Target:
public SignatureVisitor() { super(Opcodes.ASM7); }
Source:
<code>private void selectTagInTree(SWTBotShell tagDialog, int numberOfRows, String expectedTag) { try { <START> Thread.sleep(500); <END> TestUtil.joinJobs(JobFamilies.FILL_TAG_LIST); } catch (InterruptedException e1) { } tagDialog.bot().tableWithLabel(UIText.CreateTagDialog_existingTags) .unselect(); tagDialog.bot().textWithLabel(UIText.CreateTagDialog_tagName) .setText(""); try { SWTBotTableItem item = tagDialog.bot() .tableWithLabel(UIText.CreateTagDialog_existingTags) .getTableItem(numberOfRows - 1); assertNotNull("Not all expected tags were present!", item); } catch (Exception e) { Assert.fail("Not all expected tags were present!"); } tagDialog.bot().tableWithLabel(UIText.CreateTagDialog_existingTags) .getTableItem(expectedTag).select(); assertEquals("Did not find the expected tag in the list", expectedTag, tagDialog.bot().textWithLabel(UIText.CreateTagDialog_tagName) .getText()); }</code><technical_language>hard avoid arbitrary waits tests. (I a few, joinJobs similar operations contains some themselves.) FILL_TAG_LIST job, I this job work differently: 1. return Job.ASYNC_FINISH. 2. call done(Status.OK_STATUS) asyncExec runnable (in a try-finally). this pattern of "run normal job, perform asyncExec, return OK_STATUS" is common in EGit, wrong testing a nightmare. Another approach is a normal job a job change listener schedules a UIJob WorkbenchJob, for testing need a family</technical_language>

Target:
private void selectTagInTree(SWTBotShell tagDialog, int numberOfRows, String expectedTag) throws InterruptedException { TestUtil.joinJobs(JobFamilies.FILL_TAG_LIST); assertEquals("tags count mismatch", numberOfRows, tagDialog.bot() .tableWithLabel(UIText.CreateTagDialog_existingTags) .rowCount()); tagDialog.bot().tableWithLabel(UIText.CreateTagDialog_existingTags) .getTableItem(expectedTag).select(); assertEquals("Did not find the expected tag in the list", expectedTag, tagDialog.bot().textWithLabel(UIText.CreateTagDialog_tagName) .getText()); }
Source:
<code>private static boolean isValidType(GoType goType) { if (goType instanceof GoSpecType) { goType = ((GoSpecType)goType).getType(); } return goType instanceof GoArrayOrSliceType || goType instanceof GoMapType || goType instanceof GoChannelType || <START> goType.getText().equals("string"); <END> }</code><technical_language>please check builtin string goType.textMatches()</technical_language>

Target:
private static boolean isValidType(GoType goType) { if (goType instanceof GoSpecType) { goType = ((GoSpecType)goType).getType(); } return goType instanceof GoArrayOrSliceType || goType instanceof GoMapType || goType instanceof GoChannelType || (goType.textMatches("string") && GoPsiImplUtil.builtin(goType)); }
Source:
<code>protected void addReplicationQueueTimeMetrics() { if (TableState.ONLINE != Tables.getTableState(master.getInstance(), ReplicationTable.ID)) { return; } if (replicationUtil.getPeers().isEmpty()) { return; } Set<Path> paths = replicationUtil.getPendingReplicationPaths(); long currentTime = System.currentTimeMillis(); for (Path path : paths) { if (!pathModTimes.containsKey(path)) { try { pathModTimes.put(path, master.getFileSystem().getFileStatus(path).getModificationTime()); } catch (IOException e) { } } } Set<Path> deletedPaths = new HashSet<>(pathModTimes.keySet()); deletedPaths.removeAll(paths); if (deletedPaths.isEmpty()) { return; } replicationQueueTimeStat.resetMinMax(); for (Path path : deletedPaths) { <START> long modTime = pathModTimes.remove(path); <END> long diff = Math.max(0, currentTime - modTime); replicationQueueTimeQuantiles.add(diff); replicationQueueTimeStat.add(diff); } }</code><technical_language>This throw error is pathModTimes a mapping for path unboxing Long a long</technical_language>

Target:
protected void addReplicationQueueTimeMetrics() { Set<Path> paths = replicationUtil.getPendingReplicationPaths(); long currentTime = getCurrentTime(); for (Path path : paths) { if (!pathModTimes.containsKey(path)) { try { pathModTimes.put(path, master.getFileSystem().getFileStatus(path).getModificationTime()); } catch (IOException e) { log.trace("Failed to get file status for {}, file system is unavailable or it does not exist", path); } } } Set<Path> deletedPaths = new HashSet<>(pathModTimes.keySet()); deletedPaths.removeAll(paths); if (deletedPaths.isEmpty()) { return; } replicationQueueTimeStat.resetMinMax(); for (Path path : deletedPaths) { Long modTime = pathModTimes.remove(path); if (modTime != null) { long diff = Math.max(0, currentTime - modTime); replicationQueueTimeQuantiles.add(diff); replicationQueueTimeStat.add(diff); } } }