auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testAddIgnoredFolder() throws Exception { testRepository.connect(project.project); project.createFile(".gitignore", "ignore\n".getBytes("UTF-8")); project.createFolder("ignore"); project.createFolder("sub"); project.createFolder("sub/ignore"); project.createFile("ignore/file.txt", new byte[] {}); testRepository.addToIndex(project.project); testRepository.createInitialCommit("testAddFileInIgnoredFolder\n\nfirst commit\n"); prepareCacheEntry(); <START> <END> project.createFile("sub/ignorenot", new byte[] {}); IndexDiffData data3 = waitForListenerCalled(); assertThat(data3.getUntracked(), hasItem("Project-1/sub/ignorenot")); assertThat(data3.getIgnoredNotInIndex(), hasItem("Project-1/ignore")); assertThat(data3.getIgnoredNotInIndex(), hasItem("Project-1/sub/ignore")); }</code><technical_language>Please explain this change</technical_language>

Target:
public void testAddIgnoredFolder() throws Exception { testRepository.connect(project.project); project.createFile(".gitignore", "ignore\n".getBytes("UTF-8")); project.createFolder("ignore"); project.createFile("ignore/file.txt", new byte[] {}); project.createFolder("sub"); testRepository.addToIndex(project.project); testRepository.createInitialCommit("testAddFileInIgnoredFolder\n\nfirst commit\n"); prepareCacheEntry(); IndexDiffData data1 = waitForListenerCalled(); assertThat(data1.getIgnoredNotInIndex(), hasItem("Project-1/ignore")); project.createFolder("sub/ignore"); IndexDiffData data2 = waitForListenerCalled(); assertThat(data2.getIgnoredNotInIndex(), hasItem("Project-1/ignore")); assertThat(data2.getIgnoredNotInIndex(), hasItem("Project-1/sub/ignore")); project.createFile("sub/ignorenot", new byte[] {}); IndexDiffData data3 = waitForListenerCalled(); assertThat(data3.getUntracked(), hasItem("Project-1/sub/ignorenot")); assertThat(data3.getIgnoredNotInIndex(), hasItem("Project-1/ignore")); assertThat(data3.getIgnoredNotInIndex(), hasItem("Project-1/sub/ignore")); }
Source:
<code>public ConnectionFactory buildConnectionFactory() { ConnectionFactory cf; try { cf = new org.apache.activemq.ActiveMQConnectionFactory(); BeanUtils.populate(cf, super.connectionFactoryProperties); logger.debug("creation successful."); return cf; } catch (Exception e) { <START> throw new RuntimeException("Failed to create connection factory.", e); <END> } }</code><technical_language>DTThrowabled.rethrow() throw Throwables.propagate wrapping exception if is a RuntimeException</technical_language>

Target:
public ConnectionFactory buildConnectionFactory() { ConnectionFactory cf; try { cf = new org.apache.activemq.ActiveMQConnectionFactory(); BeanUtils.populate(cf, connectionFactoryProperties); logger.debug("creation successful."); return cf; } catch (Exception e) { DTThrowable.rethrow(e); return null; } }
Source:
<code>public StoreResource[] getAtomicFilesSnapshot() throws IOException { Stream<StoreFileMetadata> countStoreStream = neoStoreDataSource.listStoreFilesInclusively().includeNeoStoreFiles().build().stream().filter( isCountFile() ); Stream<StoreFileMetadata> explicitIndexStream = neoStoreDataSource.listStoreFilesInclusively().includeExplicitIndexStoreStoreFiles().includeAdditionalProviders().build().stream(); StoreFileMetadata[] metaDataStores = <START> closeablesListener.sample( Stream.concat( countStoreStream, explicitIndexStream ) ).toArray( StoreFileMetadata[]::new ); <END> StoreResource[] storeResources = new StoreResource[metaDataStores.length]; for ( int i = 0; i < metaDataStores.length; i++ ) { storeResources[i] = toStoreResource( metaDataStores[i] ); } return storeResources; }</code><technical_language>I add resource iterators closeablesListener a time, if build() fails, forget close one. If add resource iterators directly, build streams, map StoreResources, return final array</technical_language>

Target:
StoreResource[] getAtomicFilesSnapshot() throws IOException { ResourceIterator<StoreFileMetadata> neoStoreFilesIterator = closeablesListener.add( neoStoreDataSource.getNeoStoreFileListing().builder().excludeAll().includeNeoStoreFiles().build() ); ResourceIterator<StoreFileMetadata> explicitIndexIterator = closeablesListener.add( neoStoreDataSource.getNeoStoreFileListing().builder().excludeAll().includeExplicitIndexStoreStoreFiles().includeAdditionalProviders().build() ); return Stream.concat( neoStoreFilesIterator.stream().filter( isCountFile() ), explicitIndexIterator.stream() ).map( mapToStoreResource() ).toArray( StoreResource[]::new ); }
Source:
<code>protected Properties getSslConfig(final FilterConfig filterConfig) { <START> Properties properties = new Properties(); <END> final String fileName = getPropertyFromInitParams(filterConfig, "sslConfigFile", null); if(fileName != null) { try { FileInputStream fis = new FileInputStream(fileName); properties.load(fis); log.trace("Loaded " + properties.size() + " entries from " + fileName); } catch(java.io.IOException ioe) { log.warn(ioe, ioe); } } return properties; }</code><technical_language>Another of final</technical_language>

Target:
protected Properties getSslConfig(final FilterConfig filterConfig) { final Properties properties = new Properties(); final String fileName = getPropertyFromInitParams(filterConfig, "sslConfigFile", null); if(fileName != null) { try { FileInputStream fis = null; try { fis = new FileInputStream(fileName); properties.load(fis); log.trace("Loaded " + properties.size() + " entries from " + fileName); } finally { if(fis != null) { IOUtils.closeQuietly(fis); } } } catch(final IOException ioe) { log.warn(ioe, ioe); } } return properties; }
Source:
<code>public static float convertRawToHumidity(final int humidRaw) { if (humidRaw < 0) { return CLIENT_SENTINEL_NULL_VALUE; <START> } if (humidRaw > DataUtils.floatToDBInt(100.0f)) { <END> return CLIENT_SENTINEL_NULL_VALUE; } return DataUtils.dbIntToFloat(humidRaw); }</code><technical_language>combined in a liner</technical_language>

Target:
public static float convertRawToHumidity(final int humidRaw) { if (humidRaw < 0 || humidRaw > DataUtils.floatToDBInt(100.0f)) { return CLIENT_SENTINEL_NULL_VALUE; } return DataUtils.dbIntToFloat(humidRaw); }
Source:
<code>private static int getPositionOfArgument(@NotNull ErlangQAtom argument) { ErlangArgumentList argumentList = PsiTreeUtil.getParentOfType(argument, ErlangArgumentList.class); ErlangExpression expression = PsiTreeUtil.getParentOfType(argument, ErlangExpression.class, false); if (expression != null && expression.getParent() instanceof ErlangColonQualifiedExpression) { expression = (ErlangExpression) expression.getParent(); <START> } <END> return argumentList != null ? argumentList.getExpressionList().indexOf(expression) : -1; }</code><technical_language>ObjectUtils.tryCast(expression != null ? expression.getParent() : null, ErlangColonQualifiedExpression.class);</technical_language>

Target:
private static int getPositionOfArgument(@NotNull ErlangQAtom argument) { ErlangArgumentList argumentList = PsiTreeUtil.getParentOfType(argument, ErlangArgumentList.class); ErlangExpression expression = ObjectUtils.tryCast(argument.getParent(), ErlangExpression.class); return argumentList != null ? argumentList.getExpressionList().indexOf(expression) : -1; }
Source:
<code>public FilterRegistrationBean<Filter30Dispatcher> resteasyServletRegistration(@Value("${ot.jaxrs.prefix:/}") String prefix) { if (StringUtils.isEmpty(prefix)) { prefix = "/"; } FilterRegistrationBean<Filter30Dispatcher> registrationBean = new FilterRegistrationBean<>(new Filter30Dispatcher()); registrationBean.addUrlPatterns("/*"); <START> registrationBean.setInitParameters(Collections.singletonMap("resteasy.servlet.mapping.prefix", prefix)); END> return registrationBean; }</code><technical_language>want trim string</technical_language>

Target:
public FilterRegistrationBean<Filter30Dispatcher> resteasyServletRegistration( @Value("${ot.jaxrs.prefix:/}") String prefix) { if (StringUtils.isBlank(prefix)) { prefix = "/"; } else { prefix = prefix.trim(); } FilterRegistrationBean<Filter30Dispatcher> registrationBean = new FilterRegistrationBean<>(new Filter30Dispatcher()); registrationBean.addUrlPatterns("/*"); registrationBean.setInitParameters(Collections.singletonMap("resteasy.servlet.mapping.prefix", prefix)); return registrationBean; }
Source:
<code>public void initPlayer(){ playerDb.setId("123"); playerDb.setName("Chunky"); playerDb.setFavoriteColor("Fuschia"); playerDb.setLocation("Home"); playerDb.setRev("high"); playerDb.setApiKey("FISH"); playerDb.setStory("fish"); <START> playerDb.setPlayerMode("full"); <END> playerArg.setId("123"); playerArg.setName("Chunky"); playerArg.setFavoriteColor("Fuschia"); playerArg.setRev("high"); }</code><technical_language>default guided</technical_language>

Target:
public void initPlayer(){ playerDb.setId("123"); playerDb.setName("Chunky"); playerDb.setFavoriteColor("Fuschia"); playerDb.setLocation("Home"); playerDb.setRev("high"); playerDb.setApiKey("FISH"); playerDb.setStory("fish"); playerDb.setPlayerMode("default"); playerArg.setId("123"); playerArg.setName("Chunky"); playerArg.setFavoriteColor("Fuschia"); playerArg.setRev("high"); }
Source:
<code>public static void sortFeedbackSessionsByCreationTimeDescending(List<FeedbackSessionAttributes> sessions) { sessions.sort((FeedbackSessionAttributes session1, FeedbackSessionAttributes session2) -> { <START> int result = session2.createdTime.compareTo(session1.createdTime); <END> if (result == 0) { if (session1.endTime == null || session2.endTime == null) { if (session1.endTime == null) { --result; } if (session2.endTime == null) { ++result; } } else { result = session2.endTime.compareTo(session1.endTime); } } if (result == 0) { result = session2.startTime.compareTo(session1.startTime); } if (result == 0) { result = session1.courseId.compareTo(session2.courseId); } if (result == 0) { result = session1.feedbackSessionName.compareTo(session2.feedbackSessionName); } return result; }); }</code><technical_language>chained comparator done in else. non-standard comparator is endTime comparator built thenComparing block</technical_language>

Target:
public static void sortFeedbackSessionsByCreationTimeDescending(List<FeedbackSessionAttributes> sessions) { sessions.sort(Comparator.comparing((FeedbackSessionAttributes session) -> session.createdTime, Comparator.reverseOrder()) .thenComparing(session -> session.endTime, Comparator.nullsFirst(Comparator.reverseOrder())) .thenComparing(session -> session.startTime, Comparator.reverseOrder()) .thenComparing(session -> session.courseId) .thenComparing(session -> session.feedbackSessionName)); }
Source:
<code>protected boolean canDoAction() { if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } cdImagePath = getParameters().getCdImagePath(); if (!getVm().isRunningOrPaused()) { <START> setSucceeded(false); <END> addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM); if (!StringUtils.isEmpty(cdImagePath)) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); } else { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__EJECT_CD); } return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, LocalizedVmStatus.from(getVm().getStatus())); } if (!canRunActionOnNonManagedVm()) { return false; } if ((IsoDomainListSyncronizer.getInstance().findActiveISODomain(getVm().getStoragePoolId()) == null) && !StringUtils.isEmpty(cdImagePath)) { setSucceeded(false); addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); return failCanDoAction(VdcBllMessages.VM_CANNOT_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO); } if (StringUtils.isNotEmpty(cdImagePath) && !cdImagePath.endsWith(ValidationUtils.ISO_SUFFIX)) { setSucceeded(false); addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_INVALID_CDROM_DISK_FORMAT); } cdImagePath = ImagesHandler.cdPathWindowsToLinux(getParameters().getCdImagePath(), getVm().getStoragePoolId(), getVm().getRunOnVds()); return true; }</code><technical_language>need for setSucceeded(false) - removed places in this method (it is false default)</technical_language>

Target:
protected boolean canDoAction() { if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } if (!canRunActionOnNonManagedVm()) { return false; } cdImagePath = getParameters().getCdImagePath(); if (!getVm().isRunningOrPaused()) { addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM); if (!StringUtils.isEmpty(cdImagePath)) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); } else { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__EJECT_CD); } return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, LocalizedVmStatus.from(getVm().getStatus())); } if ((IsoDomainListSyncronizer.getInstance().findActiveISODomain(getVm().getStoragePoolId()) == null) && !StringUtils.isEmpty(cdImagePath)) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); return failCanDoAction(VdcBllMessages.VM_CANNOT_WITHOUT_ACTIVE_STORAGE_DOMAIN_ISO); } if (StringUtils.isNotEmpty(cdImagePath) && !cdImagePath.endsWith(ValidationUtils.ISO_SUFFIX)) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CHANGE_CD); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_INVALID_CDROM_DISK_FORMAT); } return true; }
Source:
<code>protected boolean validateScreenDescriptor() { <START> if (screenBackgroundColor >= screenColors) { <END> return false; } return true; }</code><technical_language>Please simplify this</technical_language>

Target:
protected boolean validateScreenDescriptor() { return screenBackgroundColor < screenColors; }
Source:
<code>public void testGenotypePhenotypeSearchEnsureEvidence() throws InvalidProtocolBufferException, UnirestException, GAWrapperException { <START> final String obfuscated = "WyJkYXRhc2V0MSIsImNnZCIsImh0dHA6Ly9vaHN1LmVkdS9jZ2QvMjdkMjE2OWMiXQ"; <END> final String phenotypeAssociationSetId = Utils.getPhenotypeAssociationSetId(client); GenotypePhenotypeServiceOuterClass.SearchGenotypePhenotypeRequest request = GenotypePhenotypeServiceOuterClass.SearchGenotypePhenotypeRequest .newBuilder() .setPhenotypeAssociationSetId(phenotypeAssociationSetId) .addFeatureIds(obfuscated) .build(); SearchGenotypePhenotypeResponse response = client.genotypePhenotype.searchGenotypePhenotypes(request); assertThat(response.getAssociationsList()).isNotNull(); assertThat(response.getAssociationsList()).isNotEmpty(); GenotypePhenotype.Evidence evidence = response.getAssociations(0).getEvidence(0); assertThat(evidence.getDescription()).isEqualTo(TestData.EVIDENCE_LEVEL); }</code><technical_language>This generalize. I need a method get a feature ID programmatically</technical_language>

Target:
public void testGenotypePhenotypeSearchEnsureEvidence() throws InvalidProtocolBufferException, UnirestException, GAWrapperException { SearchFeaturesRequest featuresRequest = SearchFeaturesRequest .newBuilder() .setFeatureSetId(Utils.getFeatureG2PSetId(client)) .setName(TestData.FEATURE_NAME) .build(); SequenceAnnotationServiceOuterClass.SearchFeaturesResponse featuresResponse = client.sequenceAnnotations.searchFeatures(featuresRequest); assertThat(featuresResponse.getFeaturesList()).isNotNull() ; assertThat(featuresResponse.getFeaturesList()).isNotEmpty() ; assertThat(featuresResponse.getFeaturesList().size()).isEqualTo(3) ; final String obfuscated = featuresResponse.getFeaturesList().get(2).getId(); final String phenotypeAssociationSetId = Utils.getPhenotypeAssociationSetId(client); GenotypePhenotypeServiceOuterClass.SearchGenotypePhenotypeRequest request = GenotypePhenotypeServiceOuterClass.SearchGenotypePhenotypeRequest .newBuilder() .setPhenotypeAssociationSetId(phenotypeAssociationSetId) .addFeatureIds(obfuscated) .build(); SearchGenotypePhenotypeResponse response = client.genotypePhenotype.searchGenotypePhenotypes(request); assertThat(response.getAssociationsList()).isNotNull(); assertThat(response.getAssociationsList()).isNotEmpty(); GenotypePhenotype.Evidence evidence = response.getAssociations(0).getEvidence(0); assertThat(evidence.getDescription()).isEqualTo(TestData.EVIDENCE_LEVEL); }
Source:
<code>private void verifyResourceConflicts(AppleBundleResources resources, SourcePathResolver resolver) { Set<Path> filenames = new HashSet<>(); for (SourcePath path : Iterables.concat( resources.getResourceDirs(), resources.getDirsContainingResourceDirs(), resources.getResourceFiles())) { Path filename = resolver.getRelativePath(path).getFileName(); if (filenames.contains(filename)) { throw new HumanReadableException( "Bundle contains multiple resources with filename %s", filename); } else { filenames.add(filename); } <START> } <END> }</code><technical_language>this is duplicating resource paths form lines 427-429: resources.getResourceDirs(), resources.getDirsContainingResourceDirs(), resources.getResourceFiles() extract pass method instead</technical_language>

Target:
private void verifyResourceConflicts(AppleBundleResources resources, SourcePathResolver resolver) { Set<Path> resourcePaths = new HashSet<>(); for (SourcePath path : Iterables.concat( resources.getResourceDirs(), resources.getResourceFiles())) { Path pathInBundle = resolver.getRelativePath(path).getFileName(); if (resourcePaths.contains(pathInBundle)) { throw new HumanReadableException( "Bundle contains multiple resources with path %s", pathInBundle); } else { resourcePaths.add(pathInBundle); } } }
Source:
<code>public HaplotypeProbabilitiesFromGenotype(final HaplotypeProbabilitiesFromGenotype other){ <START> super(other.getHaplotype()); <END> snp = other.snp; likelihoods = Arrays.copyOf(other.likelihoods,other.likelihoods.length); }</code><technical_language>this(snp, getHaplotype(), likelihoods[0], likelihoods[1], likelihoods[2]);</technical_language>

Target:
public HaplotypeProbabilitiesFromGenotype(final HaplotypeProbabilitiesFromGenotype other) { this(other.snp, other.getHaplotype(), other.likelihoods[0], other.likelihoods[1], other.likelihoods[2]); }
Source:
<code>public RegisterDataPackValueEventImpl(final Cause cause, final Game game) { super(cause, game); this.serializables = new Object2ObjectOpenHashMap<>(); <START> this.serializables.computeIfAbsent((SpongeDataPackType) DataPackTypes.RECIPE, k -> new ArrayList<>()); <END> this.serializables.computeIfAbsent((SpongeDataPackType) DataPackTypes.ADVANCEMENT, k -> new ArrayList<>()); }</code><technical_language>this fixed in a getter call? hard code this especially more datapack added..</technical_language>

Target:
public RegisterDataPackValueEventImpl(final Cause cause, final Game game) { super(cause, game); this.serializables = new Object2ObjectOpenHashMap<>(); }
Source:
<code>public synchronized void init(Server server) { ModClusterLogger.LOGGER.init(Version.INSTANCE.toString()); this.server = server; this.mcmpHandler.init(this.mcmpConfig.getProxies(), this); this.autoEnableContexts = this.mcmpConfig.isAutoEnableContexts(); this.excludedContexts.clear(); Map<String, Set<String>> excludedContextPaths = this.mcmpConfig.getExcludedContextsPerHost(); if (!excludedContextPaths.isEmpty()) { for (Engine engine : server.getEngines()) { String defaultHost = engine.getDefaultHost(); for (Host host : engine.getHosts()) { Set<String> excluded = new HashSet<String>(); Set<String> paths = excludedContextPaths.get(host.getName()); if (paths != null) { excluded.addAll(paths); } if (host.getName().equals(defaultHost)) { paths = excludedContextPaths.get(null); if (paths != null) { excluded.addAll(paths); } } if (!excluded.isEmpty()) { this.excludedContexts.put(host, Collections.unmodifiableSet(excluded)); } } } } this.resetRequestSource.init(server, this); this.loadBalanceFactorProvider = this.loadBalanceFactorProviderFactory.createLoadBalanceFactorProvider(); Boolean advertise = this.mcmpConfig.getAdvertise(); if (Boolean.TRUE.equals(advertise) || (advertise == null && this.mcmpConfig.getProxies().isEmpty())) { try { this.advertiseListener = this.listenerFactory.createListener(this.mcmpHandler, this.mcmpConfig); this.advertiseListener.start(); } catch (IOException e) { <START> ModClusterLogger.LOGGER.advertiseStartFailed(e.getLocalizedMessage()); <END> ModClusterLogger.LOGGER.catchingDebug(e); } } }</code><technical_language>I this log stack trace. startup, is symptomatic of a networking issue</technical_language>

Target:
public synchronized void init(Server server) { ModClusterLogger.LOGGER.init(Version.INSTANCE.toString()); this.server = server; this.mcmpHandler.init(this.mcmpConfig.getProxies(), this); this.autoEnableContexts = this.mcmpConfig.isAutoEnableContexts(); this.excludedContexts.clear(); Map<String, Set<String>> excludedContextPaths = this.mcmpConfig.getExcludedContextsPerHost(); if (!excludedContextPaths.isEmpty()) { for (Engine engine : server.getEngines()) { String defaultHost = engine.getDefaultHost(); for (Host host : engine.getHosts()) { Set<String> excluded = new HashSet<String>(); Set<String> paths = excludedContextPaths.get(host.getName()); if (paths != null) { excluded.addAll(paths); } if (host.getName().equals(defaultHost)) { paths = excludedContextPaths.get(null); if (paths != null) { excluded.addAll(paths); } } if (!excluded.isEmpty()) { this.excludedContexts.put(host, Collections.unmodifiableSet(excluded)); } } } } this.resetRequestSource.init(server, this); this.loadBalanceFactorProvider = this.loadBalanceFactorProviderFactory.createLoadBalanceFactorProvider(); Boolean advertise = this.mcmpConfig.getAdvertise(); if (Boolean.TRUE.equals(advertise) || (advertise == null && this.mcmpConfig.getProxies().isEmpty())) { try { this.advertiseListener = this.listenerFactory.createListener(this.mcmpHandler, this.mcmpConfig); this.advertiseListener.start(); } catch (IOException e) { ModClusterLogger.LOGGER.advertiseStartFailed(e); } } }
Source:
<code>public static VersionNotFoundException versionsNotFoundException(List<MissingVersion> missingVersions) { String details = missingVersions .stream() .map(i -> i.getCurrentURI()) .collect(Collectors.toSet()) <START> .stream() <END> .collect(Collectors.joining(",")); String message = format(VERSION_NOT_FOUND_FMT, details); return new VersionNotFoundException(message); }</code><technical_language>is this collected a set streamed again? I de-dupe collection. If so, consider .distinct() save collecting streaming</technical_language>

Target:
public static VersionNotFoundException versionsNotFoundException(List<MissingVersion> missingVersions) { String details = missingVersions .stream() .map(i -> i.getCurrentURI()) .distinct() .collect(Collectors.joining(",")); String message = format(VERSION_NOT_FOUND_FMT, details); return new VersionNotFoundException(message); }
Source:
<code>public <T> List<T> findByIndex(String selectorJson, Class<T> classOfT, FindByIndexOptions options) { assertNotEmpty(selectorJson, "selectorJson"); assertNotEmpty(options, "options"); URI uri = buildUri(getDBUri()).path("_find").build(); String body = getFindByIndexBody(selectorJson, options); InputStream stream = null; try { stream = getStream(client.executeRequest(createPost(uri, body, "application/json"))); Reader reader = new InputStreamReader(stream, "UTF-8"); JsonArray jsonArray = new JsonParser().parse(reader) .getAsJsonObject().getAsJsonArray("docs"); List<T> list = new ArrayList<T>(); for (JsonElement jsonElem : jsonArray) { JsonElement elem = jsonElem.getAsJsonObject(); T t = client.getGson().fromJson(elem, classOfT); list.add(t); } return list; } catch (UnsupportedEncodingException e) { <START> return null; <END> } finally { close(stream); } }</code><technical_language>for discussion: wondering if throw a RuntimeException is happen java platforms, thoughts @brynh</technical_language>

Target:
public <T> List<T> findByIndex(String selectorJson, Class<T> classOfT, FindByIndexOptions options) { assertNotEmpty(selectorJson, "selectorJson"); assertNotEmpty(options, "options"); URI uri = buildUri(getDBUri()).path("_find").build(); String body = getFindByIndexBody(selectorJson, options); InputStream stream = null; try { stream = getStream(client.executeRequest(createPost(uri, body, "application/json"))); Reader reader = new InputStreamReader(stream, "UTF-8"); JsonArray jsonArray = new JsonParser().parse(reader) .getAsJsonObject().getAsJsonArray("docs"); List<T> list = new ArrayList<T>(); for (JsonElement jsonElem : jsonArray) { JsonElement elem = jsonElem.getAsJsonObject(); T t = client.getGson().fromJson(elem, classOfT); list.add(t); } return list; } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } finally { close(stream); } }
Source:
<code>Set<TaskId> closeLostTasks(final Collection<TopicPartition> lostPartitions) { final Set<TaskId> zombieTasks = partitionsToTaskSet(lostPartitions); log.debug("Closing lost tasks as zombies: {}", zombieTasks); final List<TopicPartition> lostTaskChangelogs = new ArrayList<>(); final RuntimeException exception = active.closeZombieTasks(zombieTasks, lostTaskChangelogs); assignedActiveTasks.keySet().removeAll(zombieTasks); changelogReader.remove(lostTaskChangelogs); removeChangelogsFromRestoreConsumer(lostTaskChangelogs, false); if (exception != null) { throw exception; } else if (!(active.isEmpty())) { log.error("The set of active tasks was non-empty: {}", active); <START> throw new IllegalStateException("TaskManager found leftover active task state after closing all zombies"); <END> } else if (!(assignedActiveTasks.isEmpty())) { log.error("The set assignedActive tasks was non-empty: {}", assignedActiveTasks); throw new IllegalStateException("TaskManager found leftover active task state after closing all zombies"); } else if (!(changelogReader.isEmpty())) { log.error("The changelog-reader's internal state was non-empty: {}", changelogReader); throw new IllegalStateException("TaskManager found leftover active task state after closing all zombies"); } return zombieTasks; }</code><technical_language>If throw there, check other conditions miss some logs. log for condition throw condition checked (and if condition hit)</technical_language>

Target:
Set<TaskId> closeLostTasks(final Collection<TopicPartition> lostPartitions) { final Set<TaskId> zombieTasks = partitionsToTaskSet(lostPartitions); log.debug("Closing lost tasks as zombies: {}", zombieTasks); final List<TopicPartition> lostTaskChangelogs = new ArrayList<>(); final RuntimeException exception = active.closeZombieTasks(zombieTasks, lostTaskChangelogs); assignedActiveTasks.keySet().removeAll(zombieTasks); changelogReader.remove(lostTaskChangelogs); removeChangelogsFromRestoreConsumer(lostTaskChangelogs, false); if (exception != null) { throw exception; } verifyActiveTaskStateIsEmpty(); return zombieTasks; }
Source:
<code>protected int doWork() { IOUtil.assertFileIsWritable(OUTPUT); final Map<String, String> nameMap = new HashMap<>(INPUT.size()); for (final String variantPathString : INPUT) { final Path variantPath = getVariantPath(variantPathString); final VCFHeader header = getHeaderFromPath(variantPath); final int numberOfSamples = header.getNGenotypeSamples(); if (numberOfSamples != 1) { throw new PicardException("Input: " + variantPathString + " was expected to contain a single sample" + " but actually contained " + numberOfSamples + " samples."); } final String sampleName = header.getGenotypeSamples().get(0); final String previousPath = nameMap.put(sampleName, variantPathString); if (previousPath != null) { <START> throw new PicardException("Duplicate sample: " + sampleName + ". Sample was found in both " + <END> previousPath + " and in " + variantPath.toUri() + "."); } } final List<String> mapLines = new ArrayList<>(INPUT.size()); nameMap.forEach((name, path) -> mapLines.add(name + "\t" + path)); try { Files.write(OUTPUT.toPath(), mapLines); } catch (IOException e) { throw new PicardException("Error while writing output", e); } return 0; }</code><technical_language>this error...unfortunately. emit a warning? (also, need switch map..</technical_language>

Target:
protected int doWork() { IOUtil.assertFileIsWritable(OUTPUT); final Map<String, String> pathToNameMap = new HashMap<>(INPUT.size()); final Map<String, String> nameToPathMap = new HashMap<>(INPUT.size()); for (final String variantPathString : INPUT) { final Path variantPath = getVariantPath(variantPathString); final VCFHeader header = getHeaderFromPath(variantPath); final int numberOfSamples = header.getNGenotypeSamples(); if (numberOfSamples != 1) { throw new PicardException("Input: " + variantPathString + " was expected to contain a single sample" + " but actually contained " + numberOfSamples + " samples."); } final String sampleName = header.getGenotypeSamples().get(0); pathToNameMap.put(variantPathString, sampleName); final String previousPath = nameToPathMap.put(sampleName, variantPathString); if (previousPath != null) { log.warn("Duplicate sample: " + sampleName + ". Sample was found in both " + previousPath + " and in " + variantPathString); } } final List<String> mapLines = new ArrayList<>(INPUT.size()); pathToNameMap.forEach((path, name) -> mapLines.add(path + "\t" + name)); try { Files.write(OUTPUT.toPath(), mapLines); } catch (IOException e) { throw new PicardException("Error while writing output", e); } return 0; }
Source:
<code>public void run() { while (autoReconnect) { try { if (!enabled) { if (ready) { try { getInstance().ipcClient.close(); } catch (Exception ex) { } } Thread.sleep(1); continue; } if (dontTryAgain) { Thread.sleep(1); continue; } if (!connectedBefore && !ready) { lastPing = 0; try { ipcClient.connect(); } catch (Exception ex) { } <START> Thread.sleep(15 * 1000); <END> if (!ready) { reconnectTries += 1; if (reconnectTries >= 5) { dontTryAgain = true; } } continue; } if (ready) { Thread.sleep(1); lastPing += 1; if (lastPing >= 5 * 1000) { ipcClient.sendRichPresence(this.lastRichPresence); this.lastPing = 0; } } else { lastPing = 0; reconnecting = true; int timeout = (reconnectTries * 2) * 1000; getLogger().info("Discord RPC >> Reconnecting... (Timeout: " + timeout + "ms)"); try { ipcClient.connect(); } catch (Exception ex) { if (reconnectTries <= 5) { reconnectTries += 1; } if (reconnectTries >= 5) { dontTryAgain = true; } Thread.sleep(timeout); } } } catch (Exception ex) { } } }</code><technical_language>a "magic numbers" in this area involved in math. generally constants named informative. instead of reconnectTries >= 5 add a constant RECONNECT_TRIES = 5</technical_language>

Target:
public void run() { while (autoReconnect) { try { if (!enabled) { if (ready) { getInstance().ipcClient.close(); } Thread.sleep(1); continue; } if (dontTryAgain) { Thread.sleep(1); continue; } if (!connectedBefore && !ready) { lastPing = 0; try { ipcClient.connect(); } catch (Exception ex) { } Thread.sleep(15 * 1000); if (!ready) { reconnectTries += 1; if (reconnectTries >= RECONNECT_TRIES) { dontTryAgain = true; } } continue; } if (ready) { Thread.sleep(1); lastPing += 1; if (lastPing >= RECONNECT_TRIES * 1000) { ipcClient.sendRichPresence(this.lastRichPresence); this.lastPing = 0; } } else { lastPing = 0; reconnecting = true; int timeout = (reconnectTries * 2) * 1000; logger.info("Discord RPC >> Reconnecting... (Timeout: " + timeout + "ms)"); try { ipcClient.connect(); } catch (Exception ex) { if (reconnectTries <= RECONNECT_TRIES) { reconnectTries += 1; } if (reconnectTries >= RECONNECT_TRIES) { dontTryAgain = true; } Thread.sleep(timeout); } } } catch (InterruptedException ex) { } catch (Exception ex) { logger.trace(ex.getMessage(), ex.getCause()); } } }
Source:
<code>public DefaultClasspathScanner(final List<String> rootPackages) { Assert.requireNonNull(rootPackages, "rootPackages"); LOG.info("Scanning class path for root packages {}", Arrays.toString(rootPackages.toArray())); ConfigurationBuilder configuration = ConfigurationBuilder.build(DefaultClasspathScanner.class.getClassLoader()); configuration = configuration.setExpandSuperTypes(false); <START> if(rootPackages != null && rootPackages.size() > 0) { <END> configuration = configuration.forPackages(rootPackages.toArray(new String[rootPackages.size()])); configuration = configuration.setUrls(rootPackages.stream().map(rootPackage -> ClasspathHelper.forPackage(rootPackage)).flatMap(list -> list.stream()).collect(Collectors.toList())); configuration = configuration.filterInputsBy(new FilterBuilder().includePackage(rootPackages.toArray(new String[rootPackages.size()]))); } try { Enumeration<URL> res = DefaultClasspathScanner.class.getClassLoader().getResources(""); configuration.getUrls().addAll(Collections.list(res)); } catch (IOException e) { throw new RuntimeException("Error in Dolphin Platform controller class scan", e); } Set<URL> urls = configuration.getUrls(); List<URL> toRemove = new ArrayList<>(); for (URL url : urls) { if (url.toString().endsWith(".jnilib")) { toRemove.add(url); } } for (URL url : toRemove) { LOG.info("Url removed {}", url.toString()); configuration.getUrls().remove(url); } reflections = new Reflections(configuration); }</code><technical_language>rootPackages != null removed</technical_language>

Target:
public DefaultClasspathScanner(final List<String> rootPackages) { Assert.requireNonNull(rootPackages, "rootPackages"); LOG.trace("Scanning class path for root packages {}", Arrays.toString(rootPackages.toArray())); ConfigurationBuilder configuration = ConfigurationBuilder.build(DefaultClasspathScanner.class.getClassLoader()); configuration = configuration.setExpandSuperTypes(false); if(rootPackages.size() > 0) { configuration = configuration.forPackages(rootPackages.toArray(new String[rootPackages.size()])); configuration = configuration.setUrls(rootPackages.stream().map(rootPackage -> ClasspathHelper.forPackage(rootPackage)).flatMap(list -> list.stream()).collect(Collectors.toList())); configuration = configuration.filterInputsBy(new FilterBuilder().includePackage(rootPackages.toArray(new String[rootPackages.size()]))); } try { Enumeration<URL> res = DefaultClasspathScanner.class.getClassLoader().getResources(""); configuration.getUrls().addAll(Collections.list(res)); } catch (IOException e) { throw new RuntimeException("Error in Dolphin Platform controller class scan", e); } Set<URL> urls = configuration.getUrls(); List<URL> toRemove = new ArrayList<>(); for (URL url : urls) { if (url.toString().endsWith(".jnilib")) { toRemove.add(url); } } LOG.trace("Configuration Urls {}", Arrays.toString(configuration.getUrls().toArray())); for (URL url : toRemove) { LOG.trace("Url removed {}", url.toString()); configuration.getUrls().remove(url); } reflections = new Reflections(configuration); }
Source:
<code>public void createControl(Composite parent) { <START> Composite top; <END> top = new Composite(parent, SWT.NONE); setControl(top); top.setLayout(new GridLayout()); this.top = top; }</code><technical_language>please combine definition initialization line</technical_language>

Target:
public void createControl(Composite parent) { Composite top = new Composite(parent, SWT.NONE); setControl(top); top.setLayout(new GridLayout()); this.top = top; }
Source:
<code>void validateQuery( IndexOrder indexOrder, IndexQuery[] predicates ) { if ( predicates.length != 1 ) { throw new UnsupportedOperationException(); } if ( indexOrder != IndexOrder.NONE ) { <START> throw new UnsupportedOperationException( "unsupported order " + indexOrder ); <END> } }</code><technical_language>In StringCapabilities claim support ASCENDING index order. do allow here?, capabilities for validation of predicates well</technical_language>

Target:
void validateQuery( IndexOrder indexOrder, IndexQuery[] predicates ) { if ( predicates.length != 1 ) { throw new UnsupportedOperationException(); } CapabilityValidator.validateQuery( StringSchemaIndexProvider.CAPABILITY, indexOrder, predicates ); }
Source:
<code>public static final DisplayStyle getTableDisplayStyle(final Table <START> table) { <END> TableDisplayStyle displayStyle = (TableDisplayStyle) table.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle()); if (null == displayStyle && null != table.getTableConfiguration()) { displayStyle = (TableDisplayStyle) table.getTableConfiguration().getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle()); } if (displayStyle != null) { return displayStyle.getDisplayStyle(); } return DisplayStyle.NORMAL; }</code><technical_language>Please add a check table write in doc table parameter null of that</technical_language>

Target:
public static final DisplayStyle getTableDisplayStyle(final Table table) { DisplayStyle result = DisplayStyle.NORMAL; if (null != table) { TableDisplayStyle displayStyle = (TableDisplayStyle) table.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle()); if (null == displayStyle && null != table.getTableConfiguration()) { displayStyle = (TableDisplayStyle) table.getTableConfiguration().getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle()); } if (displayStyle != null) { result = displayStyle.getDisplayStyle(); } } return result; }
Source:
<code>public List<FirmwareCountInfo> getAllSeenFirmwares(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken) { final Jedis jedis = jedisPool.getResource(); final List<FirmwareCountInfo> firmwareCounts = new ArrayList<>(); try { final Set<Tuple> seenFirmwares = jedis.zrangeWithScores(REDIS_SEEN_FIRMWARE_KEY, 0, -1); for (final Tuple fwInfo:seenFirmwares) { <START> final long lastSeen = (long) fwInfo.getScore(); <END> final long fwCount = jedis.zcard(fwInfo.getElement()); if (fwCount > 0) { firmwareCounts.add(new FirmwareCountInfo(fwInfo.getElement(), fwCount, lastSeen)); } } } catch (Exception e) { LOGGER.error("Failed retrieving all seen firmwares.", e.getMessage()); } finally { jedisPool.returnResource(jedis); } return firmwareCounts; }</code><technical_language>a Redis pipe well</technical_language>

Target:
public List<FirmwareCountInfo> getAllSeenFirmwares(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken) { final Jedis jedis = jedisPool.getResource(); final List<FirmwareCountInfo> firmwareCounts = Lists.newArrayList(); try { final Set<Tuple> seenFirmwares = jedis.zrangeWithScores(REDIS_SEEN_FIRMWARE_KEY, 0, -1); final Pipeline pipe = jedis.pipelined(); final Map<String, redis.clients.jedis.Response<Long>> responseMap = Maps.newHashMap(); for (final Tuple fwInfo:seenFirmwares) { responseMap.put(fwInfo.getElement(), pipe.zcard(fwInfo.getElement())); } pipe.sync(); for (final Tuple fwInfo:seenFirmwares) { final String fwVersion = fwInfo.getElement(); final long fwCount = responseMap.get(fwVersion).get(); final long lastSeen = (long) fwInfo.getScore(); if (fwCount > 0) { firmwareCounts.add(new FirmwareCountInfo(fwInfo.getElement(), fwCount, lastSeen)); } } } catch (Exception e) { LOGGER.error("Failed retrieving all seen firmwares.", e.getMessage()); } finally { jedisPool.returnResource(jedis); } return firmwareCounts; }
Source:
<code>public int rename(String oldPath, String newPath) { final AlluxioURI oldUri = mPathResolverCache.getUnchecked(oldPath); final AlluxioURI newUri = mPathResolverCache.getUnchecked(newPath); final String name = newUri.getName(); LOG.trace("rename({}, {}) [Alluxio: {}, {}]", oldPath, newPath, oldUri, newUri); if (name.length() > MAX_NAME_LENGTH) { LOG.error("Failed to rename to {}, name is longer than characters", oldPath, newPath, name, MAX_NAME_LENGTH); return -ErrorCodes.ENAMETOOLONG(); } try { mFileSystem.rename(oldUri, newUri); <START> if (mOpenFiles.contains(PATH_INDEX, oldPath)) { <END> OpenFileEntry oe = mOpenFiles.getFirstByField(PATH_INDEX, oldPath); oe.setPath(newPath); } } catch (FileDoesNotExistException e) { LOG.debug("Failed to rename to {}, file does not exist", oldPath, newPath, oldPath); return -ErrorCodes.ENOENT(); } catch (FileAlreadyExistsException e) { LOG.debug("Failed to rename to {}, file already exists", oldPath, newPath, newPath); return -ErrorCodes.EEXIST(); } catch (Throwable t) { LOG.error("Failed to rename to {}", oldPath, newPath, t); return AlluxioFuseUtils.getErrorCode(t); } return 0; }</code><technical_language>I this behaves differently now, lock</technical_language>

Target:
public int rename(String oldPath, String newPath) { final AlluxioURI oldUri = mPathResolverCache.getUnchecked(oldPath); final AlluxioURI newUri = mPathResolverCache.getUnchecked(newPath); final String name = newUri.getName(); LOG.trace("rename({}, {}) [Alluxio: {}, {}]", oldPath, newPath, oldUri, newUri); if (name.length() > MAX_NAME_LENGTH) { LOG.error("Failed to rename to {}, name is longer than characters", oldPath, newPath, name, MAX_NAME_LENGTH); return -ErrorCodes.ENAMETOOLONG(); } try { mFileSystem.rename(oldUri, newUri); OpenFileEntry oe = mOpenFiles.getFirstByField(PATH_INDEX, oldPath); if (oe != null) { oe.setPath(newPath); } } catch (FileDoesNotExistException e) { LOG.debug("Failed to rename to {}, file does not exist", oldPath, newPath, oldPath); return -ErrorCodes.ENOENT(); } catch (FileAlreadyExistsException e) { LOG.debug("Failed to rename to {}, file already exists", oldPath, newPath, newPath); return -ErrorCodes.EEXIST(); } catch (Throwable t) { LOG.error("Failed to rename to {}", oldPath, newPath, t); return AlluxioFuseUtils.getErrorCode(t); } return 0; }
Source:
<code>public void loadState(SonarLintGlobalSettings state) { XmlSerializerUtil.copyBean(state, this); includedRules.forEach(it -> { rules.put(it, new Rule(true)); }); excludedRules.forEach(it -> { rules.put(it, new Rule(false)); <START> }); <END> }</code><technical_language>If clear (or set null) sets migration, means next time reopen IDE, migration happen again, override values added in user in rules map</technical_language>

Target:
public void loadState(SonarLintGlobalSettings state) { XmlSerializerUtil.copyBean(state, this); if(includedRules != null) { includedRules.forEach(it -> { rules.put(it, new Rule(true)); }); } if(excludedRules != null) { excludedRules.forEach(it -> { rules.put(it, new Rule(false)); }); } includedRules = null; excludedRules = null; }
Source:
<code>private void reloadWindowLayout() { assert window != null && windowMainLayout != null; Platform.runLater(() -> { windowMainLayout.getChildren().clear(); if (downloads.isEmpty()) { Label noDownloadLabel = new Label(); noDownloadLabel.setText(LABEL_NO_DOWNLOAD); noDownloadLabel.setPadding(new Insets(50)); windowMainLayout.getChildren().add(noDownloadLabel); } else { for (LabeledDownloadProgressBar progressTracker : downloads) { Label downloadLabel = new Label(); downloadLabel.setText(progressTracker.getDownloadLabel()); ProgressBar progressBar = progressTracker.getProgressBar(); VBox downloadProgressItem = new VBox(); downloadProgressItem.setSpacing(20); downloadProgressItem.setPadding(new Insets(20)); downloadProgressItem.setAlignment(Pos.CENTER_LEFT); <START> downloadProgressItem.getChildren().addAll(downloadLabel, progressBar); <END> windowMainLayout.getChildren().add(downloadProgressItem); } } }); }</code><technical_language>factor out parts create JavaFX nodes here? A bit more SLAP</technical_language>

Target:
private void reloadWindowLayout() { assert window != null && windowMainLayout != null; Platform.runLater(() -> { windowMainLayout.getChildren().clear(); if (downloads.isEmpty()) { Label noDownloadLabel = createNoDownloadLabel(); windowMainLayout.getChildren().add(noDownloadLabel); } else { for (LabeledDownloadProgressBar progressTracker : downloads) { VBox downloadProgressItem = createDownloadProgressItem(progressTracker); windowMainLayout.getChildren().add(downloadProgressItem); } } }); }
Source:
<code>public void testGetStringDefault() { jsonObject.put("foo", "bar"); assertEquals("bar", jsonObject.getString("foo", "wibble")); assertEquals("bar", jsonObject.getString("foo", null)); jsonObject.put("bar", 123); try { assertEquals("123", jsonObject.getString("bar", "wibble")); } catch (ClassCastException e) { <START> fail(); <END> } jsonObject.putNull("foo"); assertNull(jsonObject.getString("foo", "wibble")); assertEquals("wibble", jsonObject.getString("absent", "wibble")); assertNull(jsonObject.getString("foo", null)); assertNull(jsonObject.getString("absent", null)); try { jsonObject.getString(null, null); fail(); } catch (NullPointerException e) { } }</code><technical_language>simply remove catch block</technical_language>

Target:
public void testGetStringDefault() { jsonObject.put("foo", "bar"); assertEquals("bar", jsonObject.getString("foo", "wibble")); assertEquals("bar", jsonObject.getString("foo", null)); jsonObject.put("bar", 123); assertEquals("123", jsonObject.getString("bar", "wibble")); jsonObject.putNull("foo"); assertNull(jsonObject.getString("foo", "wibble")); assertEquals("wibble", jsonObject.getString("absent", "wibble")); assertNull(jsonObject.getString("foo", null)); assertNull(jsonObject.getString("absent", null)); try { jsonObject.getString(null, null); fail(); } catch (NullPointerException e) { } }
Source:
<code>public void testPruneExpiredTombstonesSpecifiedPath() throws Exception { List<String> keepFilenames = new ArrayList<>( Arrays.asList("/dir1/fileK1", "/dir1/fileK2", "/dir1/fileK3")); List<String> removeFilenames = new ArrayList<>( Arrays.asList("/dir2/fileR1", "/dir2/fileR2", "/dir2/fileR3")); long cutoff = 9001; for(String fN : keepFilenames) { final PathMetadata pathMetadata = new PathMetadata(makeFileStatus(fN, 1)); pathMetadata.setLastUpdated(9002L); ms.put(pathMetadata); } for(String fN : removeFilenames) { final PathMetadata pathMetadata = new PathMetadata(makeFileStatus(fN, 1)); pathMetadata.setLastUpdated(9000L); pathMetadata.setIsDeleted(true); ms.put(pathMetadata); } final Map<String, String> diagnostics = ms.getDiagnostics(); <START> if (ms instanceof LocalMetadataStore){ <END> ms.prune(MetadataStore.PruneMode.TOMBSTONES_BY_LASTUPDATED, cutoff, "/dir2"); } else if (ms instanceof DynamoDBMetadataStore){ String bucket = getTestBucketName(getContract().getFileSystem().getConf()); ms.prune(MetadataStore.PruneMode.TOMBSTONES_BY_LASTUPDATED, cutoff, "/" + bucket + "/dir2"); } if(!allowMissing()) { for (String fN : keepFilenames) { final PathMetadata pathMetadata = ms.get(strToPath(fN)); assertNotNull(pathMetadata); } } for(String fN : removeFilenames) { final PathMetadata pathMetadata = ms.get(strToPath(fN)); assertNull(pathMetadata); } }</code><technical_language>I this all: superclass is based subclass. Prefer: factor out abstract method subclass thing</technical_language>

Target:
public void testPruneExpiredTombstonesSpecifiedPath() throws Exception { List<String> keepFilenames = new ArrayList<>( Arrays.asList("/dir1/fileK1", "/dir1/fileK2", "/dir1/fileK3")); List<String> removeFilenames = new ArrayList<>( Arrays.asList("/dir2/fileR1", "/dir2/fileR2", "/dir2/fileR3")); long cutoff = 9001; for(String fN : keepFilenames) { final PathMetadata pathMetadata = new PathMetadata(makeFileStatus(fN, 1)); pathMetadata.setLastUpdated(9002L); ms.put(pathMetadata); } for(String fN : removeFilenames) { final PathMetadata pathMetadata = new PathMetadata(makeFileStatus(fN, 1)); pathMetadata.setLastUpdated(9000L); pathMetadata.setIsDeleted(true); ms.put(pathMetadata); } final String prunePath = getPathStringForPrune("/dir2"); ms.prune(MetadataStore.PruneMode.TOMBSTONES_BY_LASTUPDATED, cutoff, prunePath); if(!allowMissing()) { for (String fN : keepFilenames) { final PathMetadata pathMetadata = ms.get(strToPath(fN)); assertNotNull("Kept files should be in the metastore after prune", pathMetadata); } } for(String fN : removeFilenames) { final PathMetadata pathMetadata = ms.get(strToPath(fN)); assertNull("Expired tombstones should be removed from metastore after " + "the prune.", pathMetadata); } }
Source:
<code>public long size() { return isInTransaction() ? quadsIndex().listGraphNodes().count() <START> : calculateRead(this, ()->quadsIndex().listGraphNodes().count()); <END> }</code><technical_language>I realized I this code in here, need only: return access(quadsIndex().listGraphNodes()::count); match other usage</technical_language>

Target:
public long size() { return access(() -> quadsIndex().listGraphNodes().count()); }