auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean verifyTopicCleanupPolicyOnlyCompact(String topic, String workerTopicConfig, String topicPurpose) { Set<String> cleanupPolicies = topicCleanupPolicy(topic); if (cleanupPolicies == null || cleanupPolicies.isEmpty()) { log.debug("Unable to use admin client to verify the cleanup policy of '{}' " + "topic is '{}', either because the broker is an older " + "version or because the Kafka principal used for Connect " + "internal topics does not have the required permission to " + "describe topic configurations.", topic, TopicConfig.CLEANUP_POLICY_COMPACT); return false; } String cleanupPolicyStr = String.join(",", cleanupPolicies); log.debug("Found cleanup policy for '{}' topic is '{}'", topic, cleanupPolicyStr); Set<String> expectedPolicies = Collections.singleton(TopicConfig.CLEANUP_POLICY_COMPACT); String expectedPolicyStr = String.join(",", expectedPolicies); if (cleanupPolicies != null && !cleanupPolicies.equals(expectedPolicies)) { String msg = String.format("Topic '%s' supplied via the '%s' property is required " + "to have '%s=%s' to guarantee consistency and durability of " + "%s, but found '%s'. " + "Correct the topic before restarting Connect.", topic, workerTopicConfig, TopicConfig.CLEANUP_POLICY_CONFIG, expectedPolicyStr, topicPurpose, cleanupPolicyStr); throw new ConfigException(msg); } return true; }

Target:
public boolean verifyTopicCleanupPolicyOnlyCompact(String topic, String workerTopicConfig, String topicPurpose) { Set<String> cleanupPolicies = topicCleanupPolicy(topic); if (cleanupPolicies.isEmpty()) { log.info("Unable to use admin client to verify the cleanup policy of '{}' " + "topic is '{}', either because the broker is an older " + "version or because the Kafka principal used for Connect " + "internal topics does not have the required permission to " + "describe topic configurations.", topic, TopicConfig.CLEANUP_POLICY_COMPACT); return false; } Set<String> expectedPolicies = Collections.singleton(TopicConfig.CLEANUP_POLICY_COMPACT); if (!cleanupPolicies.equals(expectedPolicies)) { String expectedPolicyStr = String.join(",", expectedPolicies); String cleanupPolicyStr = String.join(",", cleanupPolicies); String msg = String.format("Topic '%s' supplied via the '%s' property is required " + "to have '%s=%s' to guarantee consistency and durability of " + "%s, but found the topic currently has '%s=%s'. Continuing would likely " + "result in eventually losing %s and problems restarting this Connect " + "cluster in the future. Change the '%s' property in the " + "Connect worker configurations to use a topic with '%s=%s'.", topic, workerTopicConfig, TopicConfig.CLEANUP_POLICY_CONFIG, expectedPolicyStr, topicPurpose, TopicConfig.CLEANUP_POLICY_CONFIG, cleanupPolicyStr, topicPurpose, workerTopicConfig, TopicConfig.CLEANUP_POLICY_CONFIG, expectedPolicyStr); throw new ConfigException(msg); } return true; }
Source:
public static Ds3ApiSpec removeInternalRequestsFromSpec(final Ds3ApiSpec spec, final boolean generateInternal) { if (generateInternal) { return spec; } return new Ds3ApiSpec( removeSpectraInternalRequests(spec.getRequests()), spec.getTypes()); }

Target:
public static Ds3ApiSpec removeInternalRequestsFromSpec(final Ds3ApiSpec spec, final boolean generateInternal) { if (generateInternal) { LOG.info("Generating Spectra Internal requests"); return spec; } LOG.info("Removing Spectra Internal requests from Ds3ApiSpec"); return new Ds3ApiSpec( removeSpectraInternalRequests(spec.getRequests()), spec.getTypes()); }
Source:
public String getName() { return "RecycleRefactoring"; }

Target:
public String getName() { return "AndroidRecycleRefactoring"; }
Source:
public void flushAndReleaseResources() { InfinispanDirectoryProvider directoryProvider = (InfinispanDirectoryProvider) getDirectoryProvider(); int activeDeleteTasks = directoryProvider.pendingDeleteTasks(); boolean wasInterrupted = false; while (activeDeleteTasks > 0) { try { Thread.sleep(POLL_WAIT); log.debugf("Waiting for pending delete tasks, remaining: %s", activeDeleteTasks); activeDeleteTasks = directoryProvider.pendingDeleteTasks(); } catch (InterruptedException e) { wasInterrupted = true; } } if (wasInterrupted) { Thread.currentThread().interrupt(); } log.debugf("Flushing directory provider"); super.flushAndReleaseResources(); }

Target:
public void flushAndReleaseResources() { InfinispanDirectoryProvider directoryProvider = (InfinispanDirectoryProvider) getDirectoryProvider(); int activeDeleteTasks = directoryProvider.pendingDeleteTasks(); boolean wasInterrupted = false; long endTime = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(POLL_WAIT); while (activeDeleteTasks > 0 && endTime - System.nanoTime() > 0) { try { Thread.sleep(10); log.debugf("Waiting for pending delete tasks, remaining: %s", activeDeleteTasks); activeDeleteTasks = directoryProvider.pendingDeleteTasks(); } catch (InterruptedException e) { wasInterrupted = true; } } if (wasInterrupted) { Thread.currentThread().interrupt(); } log.debugf("Flushing directory provider"); super.flushAndReleaseResources(); }
Source:
public void validateEnums(Host host) { if (host.isSetPowerManagement()) { if (host.getPowerManagement().isSetPmProxies()) { for (PmProxy proxy : host.getPowerManagement().getPmProxies().getPmProxy()) { validateEnum(PmProxyType.class, proxy.getPropietary(), true); } } } }

Target:
public void validateEnums(Host host) { if (host.isSetPowerManagement()) { if (host.getPowerManagement().isSetPmProxies()) { for (PmProxy proxy : host.getPowerManagement().getPmProxies().getPmProxy()) { validateEnum(PmProxyType.class, proxy.getType(), true); } } } }
Source:
public void setUp() throws Exception { this.adapter = new DateTimeAdapter(); this.dateTime = new DateTime(2015, 1, 1, 12, 0, DateTimeZone.UTC); this.ValidDateString = "2015-01-01T12:00:00.000Z"; }

Target:
public void setUp() throws Exception { this.adapter = new DateTimeAdapter(); this.dateTime = new DateTime(2015, 1, 1, 12, 0, DateTimeZone.UTC); this.validDateString = "2015-01-01T12:00:00.000Z"; }
Source:
public void sendLayerDeleted(String layerName) { listeners.stream().forEachOrdered(listener->{ listener.layerDeleted(layerName); }); }

Target:
public void sendLayerDeleted(String layerName) { listeners.forEach(listener->{ listener.layerDeleted(layerName); }); }
Source:
private void setupContent() { mPager = findViewById(R.id.postPager); mPostsPagerAdapter = new PostsPagerAdapter(PostListMainViewModelKt.getPOST_LIST_PAGES(), mSite, this, getSupportFragmentManager()); mPager.setAdapter(mPostsPagerAdapter); TabLayout tabLayout = findViewById(R.id.tabLayout); tabLayout.setupWithViewPager(mPager); mPager.addOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { mViewModel.onTabChanged(position); } @Override public void onPageScrollStateChanged(int state) { } }); mFab = findViewById(R.id.fab_button); mFab.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { mViewModel.newPost(); } }); }

Target:
private void setupContent() { mPager = findViewById(R.id.postPager); mPostsPagerAdapter = new PostsPagerAdapter(PostListMainViewModelKt.getPOST_LIST_PAGES(), mSite, getSupportFragmentManager()); mPager.setAdapter(mPostsPagerAdapter); TabLayout tabLayout = findViewById(R.id.tabLayout); tabLayout.setupWithViewPager(mPager); mPager.addOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { mViewModel.onTabChanged(position); } @Override public void onPageScrollStateChanged(int state) { } }); mFab = findViewById(R.id.fab_button); mFab.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { mViewModel.newPost(); } }); }
Source:
public void processLeftData(final MistDataEvent input) { try { final WindowData<Tuple2<T, U>> windowData = (WindowData)input.getValue(); final Collection<T> firstInputList = new LinkedList<>(); final Collection<U> secondInputList = new LinkedList<>(); final Collection<Tuple2<T, U>> outputList = new LinkedList<>(); final Iterator<Tuple2<T, U>> inputIterator = windowData.getDataCollection().iterator(); while (inputIterator.hasNext()) { final Tuple2<T, U> tuple = inputIterator.next(); if (tuple.get(0) != null) { firstInputList.add((T)tuple.get(0)); } else { secondInputList.add((U)tuple.get(1)); } } final Iterator<T> firstInputIterator = firstInputList.iterator(); while (firstInputIterator.hasNext()) { final T firstInput = firstInputIterator.next(); final Iterator<U> secondInputIterator = secondInputList.iterator(); while (secondInputIterator.hasNext()) { final U secondInput = secondInputIterator.next(); if (joinBiPredicate.test(firstInput, secondInput)) { outputList.add(new Tuple2<>(firstInput, secondInput)); } } } final long windowStart = windowData.getStart(); final long windowSize = windowData.getEnd() - windowStart + 1; final WindowImpl<Tuple2<T, U>> window = new WindowImpl<>(windowStart, windowSize, outputList); LOG.log(Level.FINE, "{0} joins input data {1} into window {2}", new Object[]{getOperatorIdentifier(), input, window}); input.setValue(window); outputEmitter.emitData(input); } catch (final ClassCastException e) { throw e; } }

Target:
public void processLeftData(final MistDataEvent input) { try { final WindowData<Tuple2<T, U>> windowData = (WindowData)input.getValue(); final Collection<T> firstInputList = new LinkedList<>(); final Collection<U> secondInputList = new LinkedList<>(); final Collection<Tuple2<T, U>> outputList = new LinkedList<>(); final Iterator<Tuple2<T, U>> inputIterator = windowData.getDataCollection().iterator(); while (inputIterator.hasNext()) { final Tuple2<T, U> tuple = inputIterator.next(); if (tuple.get(0) != null) { firstInputList.add((T)tuple.get(0)); } else { secondInputList.add((U)tuple.get(1)); } } final Iterator<T> firstInputIterator = firstInputList.iterator(); while (firstInputIterator.hasNext()) { final T firstInput = firstInputIterator.next(); final Iterator<U> secondInputIterator = secondInputList.iterator(); while (secondInputIterator.hasNext()) { final U secondInput = secondInputIterator.next(); if (joinBiPredicate.test(firstInput, secondInput)) { outputList.add(new Tuple2<>(firstInput, secondInput)); } } } final long windowStart = windowData.getStart(); final long windowSize = windowData.getEnd() - windowStart + 1; final WindowImpl<Tuple2<T, U>> window = new WindowImpl<>(windowStart, windowSize, outputList); input.setValue(window); outputEmitter.emitData(input); } catch (final ClassCastException e) { throw e; } }
Source:
public void testGetBulkInvalidTable() throws Exception { queryStore.get(UUID.randomUUID().toString(), Arrays.asList("a", "b")); }

Target:
public void testGetBulkInvalidTable() throws Exception { try { queryStore.getAll(UUID.randomUUID().toString(), Arrays.asList("a", "b")); } catch (QueryStoreException e) { assertEquals(QueryStoreException.ErrorCode.NO_SUCH_TABLE, e.getErrorCode()); throw e; } }
Source:
public CorsConfiguration getCorsConfiguration(HttpServletRequest request) { String path = request.getPathInfo(); if (path.indexOf("/organizations/") > -1) { int orgIdStartIndex = path.indexOf("/organizations/") + "/organizations/".length(); String organizationId = path.substring(orgIdStartIndex, path.indexOf('/', orgIdStartIndex)); GraviteeCorsConfiguration corsConfiguration = corsConfigurationByOrganization.get(organizationId); if (corsConfiguration == null) { corsConfiguration = new GraviteeCorsConfiguration(parameterService, eventManager, organizationId); this.corsConfigurationByOrganization.put(organizationId, corsConfiguration); } return corsConfiguration; } return super.getCorsConfiguration(request); }

Target:
public CorsConfiguration getCorsConfiguration(HttpServletRequest request) { String organizationId = computeOrganizationId(request); if (organizationId != null) { GraviteeCorsConfiguration corsConfiguration = corsConfigurationByOrganization.get(organizationId); if (corsConfiguration == null) { corsConfiguration = new GraviteeCorsConfiguration(parameterService, eventManager, organizationId); this.corsConfigurationByOrganization.put(organizationId, corsConfiguration); } return corsConfiguration; } return super.getCorsConfiguration(request); }
Source:
private static PrivateKey generatePrivateKey(PrivateKeyInfo privateKeyInfo) throws IOException, InvalidKeySpecException, NoSuchAlgorithmException { final PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(privateKeyInfo.getEncoded()); return tryGeneratePrivateKey(spec, "RSA", "EC"); }

Target:
private static PrivateKey generatePrivateKey(PrivateKeyInfo privateKeyInfo) throws IOException, InvalidKeySpecException, NoSuchAlgorithmException { final PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(privateKeyInfo.getEncoded()); final KeyFactory kf = KeyFactory.getInstance("RSA"); return kf.generatePrivate(spec); }
Source:
public StatisticChange(final Statistic statistic, final Player player, final Type type, @Nullable final Long oldValue, @Nullable final Long newValue) { this.statistic = checkNotNull(statistic, "Statistic cannot be null!"); this.player = checkNotNull(player, "Player cannot be null!"); this.type = checkNotNull(type, "Type cannot be null!"); this.oldValue = Optional.fromNullable(oldValue); this.newValue = Optional.fromNullable(newValue); }

Target:
public StatisticChange(final Statistic statistic, final Player player, final Type type, @Nullable final Long oldValue, @Nullable final Long newValue) { this.statistic = checkNotNull(statistic, "statistic"); this.player = checkNotNull(player, "player"); this.type = checkNotNull(type, "type"); this.oldValue = Optional.fromNullable(oldValue); this.newValue = Optional.fromNullable(newValue); }
Source:
public BenchmarkSuiteConfig setSuite(String suite) { if (suite != null) { this.suite = suite; } return this; }

Target:
public BenchmarkSuiteConfig setSuite(String suite) { this.suite = suite; return this; }
Source:
public synchronized void start() { logger.debug("start Thread"); if (shutdown) { shutdown = false; if (schedduler2 == null || getManagerState() == ManagerStates.stopped) { this.pollingRunnable = new PollingRunnable(); schedduler2 = new Thread(pollingRunnable); schedduler2.start(); } sceneMan.start(); } if (sceneJobExecuter != null) { this.sceneJobExecuter.startExecuter(); } if (sensorJobExecuter != null) { this.sensorJobExecuter.startExecuter(); } }

Target:
public synchronized void start() { logger.debug("start pollingScheduler"); if (pollingScheduler == null || pollingScheduler.isCancelled()) { pollingScheduler = scheduler.scheduleAtFixedRate(new PollingRunnable(), 0, config.getPollingFrequency(), TimeUnit.MILLISECONDS); sceneMan.start(); } if (sceneJobExecutor != null) { this.sceneJobExecutor.startExecutor(); } if (sensorJobExecutor != null) { this.sensorJobExecutor.startExecutor(); } }
Source:
public void testAddingNewTierWhileUpdating() { ResourcePools existing = new ResourcePoolsImpl(Collections.singletonMap((ResourceType) ResourceType.Core.HEAP, (ResourcePool) new SizedResourcePoolImpl(ResourceType.Core.HEAP, 10L, EntryUnit.ENTRIES, false))); ResourcePools toBeUpdated = new ResourcePoolsImpl(Collections.singletonMap((ResourceType) ResourceType.Core.DISK, (ResourcePool) new SizedResourcePoolImpl(ResourceType.Core.DISK, 10L, MemoryUnit.MB, false))); try { existing.validateAndMerge(toBeUpdated); fail(); } catch (IllegalArgumentException iae) { assertThat(iae.getMessage(), Matchers.is("Pools to be updated cannot contain previously undefined resources pools")); } }

Target:
public void testAddingNewTierWhileUpdating() { ResourcePools existing = new ResourcePoolsImpl(Collections.<ResourceType<?>, ResourcePool>singletonMap( ResourceType.Core.HEAP, new SizedResourcePoolImpl<SizedResourcePool>(ResourceType.Core.HEAP, 10L, EntryUnit.ENTRIES, false))); ResourcePools toBeUpdated = new ResourcePoolsImpl(Collections.<ResourceType<?>, ResourcePool>singletonMap( ResourceType.Core.DISK, new SizedResourcePoolImpl<SizedResourcePool>(ResourceType.Core.DISK, 10L, MemoryUnit.MB, false))); try { existing.validateAndMerge(toBeUpdated); fail(); } catch (IllegalArgumentException iae) { assertThat(iae.getMessage(), Matchers.is("Pools to be updated cannot contain previously undefined resources pools")); } }
Source:
public void closeIndexToCancelPersistorTest() throws StoreException, InterruptedException { state.index.close(); MockScheduledExecutorService mockScheduler = new MockScheduledExecutorService(1, false, 0, 100, TimeUnit.MILLISECONDS); mockScheduler.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); mockScheduler.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); state.initIndex(mockScheduler); Thread.sleep(1); assertEquals("The number of scheduled persistor task should be 1 after initialization", 1, ((ThreadPoolExecutor) state.scheduler).getQueue().size()); state.index.close(); Thread.sleep(150); assertEquals("The number of scheduled persistor task should be 0 after index closed", 0, ((ThreadPoolExecutor) state.scheduler).getQueue().size()); }

Target:
public void closeIndexToCancelPersistorTest() throws StoreException, InterruptedException { long SCHEDULER_PERIOD_MS = 10; state.index.close(); ScheduledThreadPoolExecutor scheduler = (ScheduledThreadPoolExecutor) Utils.newScheduler(1, false); ScheduledThreadPoolExecutor mockScheduler = Mockito.spy(scheduler); AtomicReference<ScheduledFuture> persistorTask = new AtomicReference<>(); class MockPersistor implements Runnable { private CountDownLatch invokeCountDown; @Override public void run() { invokeCountDown.countDown(); } } MockPersistor mockPersistor = new MockPersistor(); mockPersistor.invokeCountDown = new CountDownLatch(1); doAnswer(invocation -> { persistorTask.set( mockScheduler.scheduleAtFixedRate(mockPersistor, 0, SCHEDULER_PERIOD_MS, TimeUnit.MILLISECONDS)); return persistorTask.get(); }).when(mockScheduler) .scheduleAtFixedRate(any(PersistentIndex.IndexPersistor.class), anyLong(), anyLong(), any(TimeUnit.SECONDS.getClass())); state.initIndex(mockScheduler); assertTrue("The persistor task wasn't invoked within the expected time", mockPersistor.invokeCountDown.await(2 * SCHEDULER_PERIOD_MS, TimeUnit.MILLISECONDS)); state.index.close(); mockPersistor.invokeCountDown = new CountDownLatch(1); assertTrue("The persistor task should be canceled after index closed", persistorTask.get().isCancelled()); assertFalse("The persistor task should not be invoked again", mockPersistor.invokeCountDown.await(2 * SCHEDULER_PERIOD_MS, TimeUnit.MILLISECONDS)); }
Source:
public PlanWithProperties visitSpatialJoin(SpatialJoinNode node, HashComputationSet parentPreference) { PlanWithProperties left = planAndEnforce(node.getLeft(), new HashComputationSet(), true, new HashComputationSet()); PlanWithProperties right = planAndEnforce(node.getRight(), new HashComputationSet(), true, new HashComputationSet()); checkState(left.getHashSymbols().isEmpty() && right.getHashSymbols().isEmpty()); return new PlanWithProperties( replaceChildren(node, ImmutableList.of(left.getNode(), right.getNode())), ImmutableMap.of()); }

Target:
public PlanWithProperties visitSpatialJoin(SpatialJoinNode node, HashComputationSet parentPreference) { PlanWithProperties left = planAndEnforce(node.getLeft(), new HashComputationSet(), true, new HashComputationSet()); PlanWithProperties right = planAndEnforce(node.getRight(), new HashComputationSet(), true, new HashComputationSet()); verify(left.getHashSymbols().isEmpty(), "probe side of the spatial join should not include hash symbols"); verify(right.getHashSymbols().isEmpty(), "build side of the spatial join should not include hash symbols"); return new PlanWithProperties( replaceChildren(node, ImmutableList.of(left.getNode(), right.getNode())), ImmutableMap.of()); }
Source:
public void markAsFailed(final ReindexEntry idx, final String cause) throws DotDataException { reindexQueueFactory.markAsFailed(idx, UtilMethods.shortenString(cause, 300)); new Thread( () -> esReadOnlyMonitor.start(idx, cause) ).start(); }

Target:
public void markAsFailed(final ReindexEntry idx, final String cause) throws DotDataException { reindexQueueFactory.markAsFailed(idx, UtilMethods.shortenString(cause, 300)); DotConcurrentFactory.getInstance() .getSubmitter() .submit(() -> { final String message = "Reindex failed for :" + idx + " because " + cause; esReadOnlyMonitor.start(message); }); }
Source:
public RoutingDataCache(String clusterName, Map<PropertyType, List<String>> sourceDataTypeMap) { super(clusterName); _sourceDataTypeMap = sourceDataTypeMap; _currentStateCache = new CurrentStateCache(clusterName); _customizedViewCaches = new HashMap<>(); for (String customizedStateType : sourceDataTypeMap.getOrDefault(PropertyType.CUSTOMIZEDVIEW, Collections.emptyList())) { _customizedViewCaches.put(customizedStateType, new CustomizedViewCache(clusterName, customizedStateType)); } _targetExternalViewCache = new TargetExternalViewCache(clusterName); requireFullRefresh(); }

Target:
public RoutingDataCache(String clusterName, Map<PropertyType, List<String>> sourceDataTypeMap) { super(clusterName); _sourceDataTypeMap = sourceDataTypeMap; _currentStateCache = new CurrentStateCache(clusterName); _customizedViewCaches = new HashMap<>(); sourceDataTypeMap.getOrDefault(PropertyType.CUSTOMIZEDVIEW, Collections.emptyList()) .forEach(customizedStateType -> _customizedViewCaches.put(customizedStateType, new CustomizedViewCache(clusterName, customizedStateType))); _targetExternalViewCache = new TargetExternalViewCache(clusterName); requireFullRefresh(); }
Source:
private QuorumPeer waitForQuorumPeer(MainThread mainThread, int timeout) { long start = Time.currentElapsedTime(); while (true) { QuorumPeer quorumPeer = mainThread.getQuorumPeer(); if (quorumPeer != null) { return quorumPeer; } if (Time.currentElapsedTime() > start + timeout) { LOG.error("Timed out while waiting for QuorumPeer"); break; } try { Thread.sleep(250); } catch (InterruptedException e) { } } throw new NullPointerException(); }

Target:
private QuorumPeer waitForQuorumPeer(MainThread mainThread, int timeout) throws TimeoutException { long start = Time.currentElapsedTime(); while (true) { QuorumPeer quorumPeer = mainThread.isAlive() ? mainThread.getQuorumPeer() : null; if (quorumPeer != null) { return quorumPeer; } if (Time.currentElapsedTime() > start + timeout) { LOG.error("Timed out while waiting for QuorumPeer"); throw new TimeoutException(); } try { Thread.sleep(250); } catch (InterruptedException e) { } } }
Source:
public Set<Diff> getDirectMergeDependencies(Diff diff, boolean mergeRightToLeft) { long startTime = System.currentTimeMillis(); final Set<Diff> dependencies = new LinkedHashSet<Diff>(); if (mergeRightToLeft) { if (DifferenceSource.LEFT == diff.getSource()) { dependencies.addAll(diff.getImplies()); dependencies.addAll(diff.getRequiredBy()); } else { dependencies.addAll(diff.getImpliedBy()); dependencies.addAll(diff.getRequires()); } } else { if (DifferenceSource.LEFT == diff.getSource()) { dependencies.addAll(diff.getImpliedBy()); dependencies.addAll(diff.getRequires()); } else { dependencies.addAll(diff.getImplies()); dependencies.addAll(diff.getRequiredBy()); } } dependencies.addAll(diff.getRefinedBy()); if (diff.getEquivalence() != null) { final Diff masterEquivalence = findMasterEquivalence(diff, mergeRightToLeft); if (masterEquivalence != null && masterEquivalence != diff) { dependencies.add(masterEquivalence); } } if (LOGGER.isDebugEnabled()) { LOGGER.debug("getDirectMergeDependencies(Diff, boolean) - " + dependencies.size() + " dependencies found in " + getTimeSpentInMethod(startTime) + LOG_TIME + diff.hashCode()); } return dependencies; }

Target:
public Set<Diff> getDirectMergeDependencies(Diff diff, boolean mergeRightToLeft) { long start = System.currentTimeMillis(); final Set<Diff> dependencies = new LinkedHashSet<Diff>(); if (mergeRightToLeft) { if (DifferenceSource.LEFT == diff.getSource()) { dependencies.addAll(diff.getImplies()); dependencies.addAll(diff.getRequiredBy()); } else { dependencies.addAll(diff.getImpliedBy()); dependencies.addAll(diff.getRequires()); } } else { if (DifferenceSource.LEFT == diff.getSource()) { dependencies.addAll(diff.getImpliedBy()); dependencies.addAll(diff.getRequires()); } else { dependencies.addAll(diff.getImplies()); dependencies.addAll(diff.getRequiredBy()); } } dependencies.addAll(diff.getRefinedBy()); if (diff.getEquivalence() != null) { final Diff masterEquivalence = findMasterEquivalence(diff, mergeRightToLeft); if (masterEquivalence != null && masterEquivalence != diff) { dependencies.add(masterEquivalence); } } if (LOGGER.isDebugEnabled()) { Long duration = new Long(System.currentTimeMillis() - start); String log = String.format( "getDirectMergeDependencies(Diff, boolean) - %d dependencies found in %d ms for diff %d", new Integer(dependencies.size()), duration, new Integer(diff.hashCode())); LOGGER.debug(log); } return dependencies; }
Source:
private Gson buildGsonWithUpdatePersonAdapter() { return new GsonBuilder() .excludeFieldsWithoutExposeAnnotation() .registerTypeAdapter(Person.class, new Person.PersonUpdateSerializer()) .create(); }

Target:
private Gson buildGsonWithUpdatePersonAdapter() { return new GsonBuilder() .registerTypeAdapter(Person.class, new Person.PersonUpdateSerializer()) .create(); }
Source:
public Set<JpaEntry> getEntriesByRecipient(String username) { Validate.notEmpty(username, "Argument 'username' cannot be empty"); final String jpql = "SELECT e FROM JpaEntry e WHERE e.id = ANY (" + "SELECT v FROM JpaEvent v WHERE v.username = :username))"; TypedQuery<JpaEntry> query = entityManager.createQuery(jpql, JpaEntry.class); log.debug("Query getEntriesByRecipient={}", query.toString()); query.setParameter("username", username); List<JpaEntry> rslt = query.getResultList(); return new HashSet<JpaEntry>(rslt); }

Target:
public Set<JpaEntry> getEntriesByRecipient(String username) { Validate.notEmpty(username, "Argument 'username' cannot be empty"); final String jpql = "SELECT DISTINCT v.entry FROM JpaEvent v " + "WHERE v.username = :username"; TypedQuery<JpaEntry> query = entityManager.createQuery(jpql, JpaEntry.class); log.debug("Query getEntriesByRecipient={}", query.toString()); query.setParameter("username", username); List<JpaEntry> rslt = query.getResultList(); return new HashSet<JpaEntry>(rslt); }
Source:
public void write(@Nonnull final Writer dataWriter) { if (sexGenotypeDataList.size() == 0) { throw new IllegalStateException("The sex genotype data collection is empty"); } boolean extended = true; if (sexGenotypeDataList.stream().filter(dat -> !dat.hasExtendedGenotypingInfo()).count() > 0) { extended = false; } Set<String> commonGenotypes = new HashSet<>(); if (extended) { commonGenotypes = new HashSet<>(sexGenotypeDataList.get(0).getSexGenotypesSet()); for (final SexGenotypeData dat : sexGenotypeDataList) { commonGenotypes = Sets.intersection(commonGenotypes, dat.getSexGenotypesSet()); } if (commonGenotypes.size() == 0) { extended = false; } } final TableColumnCollection columns; if (extended) { final List<String> columnNames = new ArrayList<>(); columnNames.addAll(SexGenotypeTableColumn.MANDATORY_SEX_GENOTYPE_COLUMNS.names()); columnNames.addAll(commonGenotypes); columns = new TableColumnCollection(columnNames); } else { columns = new TableColumnCollection(SexGenotypeTableColumn.MANDATORY_SEX_GENOTYPE_COLUMNS.names()); } try (final SexGenotypeTableWriter writer = new SexGenotypeTableWriter(dataWriter, columns)) { writer.writeAllRecords(sexGenotypeDataList); } catch (final IOException e) { throw new UserException.CouldNotCreateOutputFile("Could not write sex genotype data", e); } }

Target:
public void write(@Nonnull final Writer dataWriter) { if (sexGenotypeDataList.isEmpty()) { throw new IllegalStateException("The sex genotype data collection is empty"); } boolean extended = true; if (sexGenotypeDataList.stream().filter(dat -> !dat.hasExtendedGenotypingInfo()).count() > 0) { extended = false; } Set<String> commonGenotypes = new HashSet<>(); if (extended) { commonGenotypes = new HashSet<>(sexGenotypeDataList.get(0).getSexGenotypesSet()); for (final SexGenotypeData dat : sexGenotypeDataList) { commonGenotypes = Sets.intersection(commonGenotypes, dat.getSexGenotypesSet()); } if (commonGenotypes.isEmpty()) { extended = false; } } final TableColumnCollection columns; if (extended) { final List<String> columnNames = new ArrayList<>(); columnNames.addAll(SexGenotypeTableColumn.MANDATORY_SEX_GENOTYPE_COLUMNS.names()); columnNames.addAll(commonGenotypes); columns = new TableColumnCollection(columnNames); } else { columns = new TableColumnCollection(SexGenotypeTableColumn.MANDATORY_SEX_GENOTYPE_COLUMNS.names()); } try (final SexGenotypeTableWriter writer = new SexGenotypeTableWriter(dataWriter, columns)) { writer.writeAllRecords(sexGenotypeDataList); } catch (final IOException e) { throw new UserException.CouldNotCreateOutputFile("Could not write sex genotype data", e); } }
Source:
public static CorruptionHealthReport corruptionHealthReportForHistory( List<CompletePaxosHistoryForNamespaceAndUseCase> history) { Map<NamespaceAndUseCase, CorruptionCheckViolation> namespaceAndUseCaseCorruptionCheckViolationMap = history.stream() .collect(Collectors.toMap( HistoryAnalyzer::extractNamespaceAndUseCase, HistoryAnalyzer::violatedCorruptionChecksForNamespaceAndUseCase)); SetMultimap<CorruptionCheckViolation, NamespaceAndUseCase> entryEntrySetMultimap = KeyedStream.stream( namespaceAndUseCaseCorruptionCheckViolationMap) .mapEntries((k, v) -> Maps.immutableEntry(v, k)) .filterKeys(CorruptionCheckViolation::raiseErrorAlert) .collectToSetMultimap(); return ImmutableCorruptionHealthReport.builder() .statusesToNamespaceAndUseCase(entryEntrySetMultimap) .build(); }

Target:
public static CorruptionHealthReport corruptionHealthReportForHistory( List<CompletePaxosHistoryForNamespaceAndUseCase> history) { Map<NamespaceAndUseCase, CorruptionCheckViolation> namespaceAndUseCaseCorruptionCheckViolationMap = history.stream() .collect(Collectors.toMap( HistoryAnalyzer::extractNamespaceAndUseCase, HistoryAnalyzer::corruptionCheckViolationLevelForNamespaceAndUseCase)); SetMultimap<CorruptionCheckViolation, NamespaceAndUseCase> namespacesExhibitingViolations = KeyedStream.stream( namespaceAndUseCaseCorruptionCheckViolationMap) .mapEntries((k, v) -> Maps.immutableEntry(v, k)) .filterKeys(CorruptionCheckViolation::raiseErrorAlert) .collectToSetMultimap(); return ImmutableCorruptionHealthReport.builder() .violatingStatusesToNamespaceAndUseCase(namespacesExhibitingViolations) .build(); }
Source:
public void update(final InputStream in, final String filePath, final int startLineIncl, final UpdateFileCallback fileCallback, final UpdateRecordCallback recordCallback) { GZIPInputStream gzis = null; InputStreamReader ir = null; BufferedReader br = null; int lineCount = 0; try { gzis = new GZIPInputStream(in); ir = new InputStreamReader(gzis, StandardCharsets.UTF_8); br = new BufferedReader(ir); List<Record> records = parser.parse(br); for (Record record : records) { lineCount++; if (lineCount >= startLineIncl) { updateRecord(record, filePath, startLineIncl, recordCallback); } } } catch (Throwable e) { } finally { try { if (br != null) { br.close(); } if (ir != null) { ir.close(); } if (gzis != null) { gzis.close(); } } catch (IOException e) { throw new RuntimeException(e); } } try { Thread.sleep(lineCount * 5L); while (!isDone()) { Thread.sleep(1000); } } catch (InterruptedException e) { throw new RuntimeException(e); } UpdateResult result = new UpdateResult(filePath, lineCount, UpdateStatus.SUCCEEDED); fileCallback.call(result); logger.info(result.toString()); }

Target:
public void update(final InputStream in, final String filePath, final int startLineIncl, final UpdateFileCallback fileCallback, final UpdateRecordCallback recordCallback) { GZIPInputStream gzis = null; InputStreamReader ir = null; BufferedReader br = null; int lineCount = 0; try { gzis = new GZIPInputStream(in); ir = new InputStreamReader(gzis, StandardCharsets.UTF_8); br = new BufferedReader(ir); List<Record> records = parser.parse(br); for (Record record : records) { lineCount++; if (lineCount >= startLineIncl) { updateRecord(record, filePath, lineCount, recordCallback); } } } catch (Throwable e) { UpdateResult result = new UpdateResult(filePath, lineCount, UpdateStatus.FAILED); logger.error(result.toString(), e); } finally { try { if (br != null) { br.close(); } if (ir != null) { ir.close(); } if (gzis != null) { gzis.close(); } } catch (IOException e) { throw new RuntimeException(e); } } try { Thread.sleep(lineCount * 5L); while (!isDone()) { Thread.sleep(1000); } } catch (InterruptedException e) { throw new RuntimeException(e); } UpdateResult result = new UpdateResult(filePath, lineCount, UpdateStatus.SUCCEEDED); fileCallback.call(result); logger.info(result.toString()); }
Source:
protected ProjectUploadController createProjectUploadController() { if (projectUploadController == null) { projectUploadController = mock(ProjectUploadController.class); } return projectUploadController; }

Target:
protected ProjectUploadController createProjectUploadController() { projectUploadController = mock(ProjectUploadController.class); return projectUploadController; }
Source:
public boolean addAcl(OzoneObj obj, OzoneAcl acl) throws IOException { boolean auditSuccess = true; try{ if(isAclEnabled) { checkAcls(obj.getResourceType(), obj.getStoreType(), ACLType.WRITE_ACL, obj.getVolumeName(), obj.getBucketName(), obj.getKeyName()); } switch (obj.getResourceType()) { case VOLUME: return volumeManager.addAcl(obj, acl); case BUCKET: return bucketManager.addAcl(obj, acl); case KEY: return keyManager.addAcl(obj, acl); case PREFIX: return prefixManager.addAcl(obj, acl); default: throw new OMException("Unexpected resource type: " + obj.getResourceType(), INVALID_REQUEST); } } catch(Exception ex) { auditSuccess = false; auditAcl(obj, Arrays.asList(acl), OMAction.ADD_ACL, auditSuccess, ex); throw ex; } finally { if(auditSuccess){ auditAcl(obj, Arrays.asList(acl), OMAction.ADD_ACL, auditSuccess, null); } } }

Target:
public boolean addAcl(OzoneObj obj, OzoneAcl acl) throws IOException { boolean auditSuccess = true; try{ if(isAclEnabled) { checkAcls(obj.getResourceType(), obj.getStoreType(), ACLType.WRITE_ACL, obj.getVolumeName(), obj.getBucketName(), obj.getKeyName()); } switch (obj.getResourceType()) { case VOLUME: return volumeManager.addAcl(obj, acl); case BUCKET: return bucketManager.addAcl(obj, acl); case KEY: return keyManager.addAcl(obj, acl); case PREFIX: return prefixManager.addAcl(obj, acl); default: throw new OMException("Unexpected resource type: " + obj.getResourceType(), INVALID_REQUEST); } } catch(Exception ex) { auditSuccess = false; auditAcl(obj, Arrays.asList(acl), OMAction.ADD_ACL, ex); throw ex; } finally { if(auditSuccess){ auditAcl(obj, Arrays.asList(acl), OMAction.ADD_ACL, null); } } }
Source:
public void testSaveGlobalConfigFiles() { GlobalConfigFiles store = j.getInstance().getExtensionList(GlobalConfigFiles.class).get(GlobalConfigFiles.class); Assert.assertTrue(store.getConfigs().isEmpty()); CustomConfig config = new CustomConfig(CONFIG_ID, "name", "comment", "content"); store.save(config); Assert.assertEquals(1, store.getConfigs().size()); Config savedConfig = store.getConfigs().iterator().next(); Assert.assertEquals("name", savedConfig.name); Assert.assertEquals("comment", savedConfig.comment); Assert.assertEquals("content", savedConfig.content); CustomConfig anotherConfig = new CustomConfig("anotherid", "name", "comment", "content"); store.save(anotherConfig); Assert.assertEquals(2, store.getConfigs().size()); config = new CustomConfig(CONFIG_ID, "new name", "new comment", "new content"); store.save(config); Assert.assertEquals(2, store.getConfigs().size()); savedConfig = store.getById(CONFIG_ID); Assert.assertEquals("new name", savedConfig.name); Assert.assertEquals("new comment", savedConfig.comment); Assert.assertEquals("new content", savedConfig.content); store.remove(savedConfig.id); Assert.assertEquals(1, store.getConfigs().size()); Assert.assertThat(store.getById(anotherConfig.id), Matchers.is((Config) anotherConfig)); Assert.assertNull(store.getById(savedConfig.id)); store.remove(anotherConfig.id); Assert.assertEquals(0, store.getConfigs().size()); }

Target:
public void testSaveGlobalConfigFiles() { GlobalConfigFiles store = j.getInstance().getExtensionList(GlobalConfigFiles.class).get(GlobalConfigFiles.class); Assert.assertTrue(store.getConfigs().isEmpty()); CustomConfig config = new CustomConfig(CONFIG_ID, "name", "comment", "content"); store.save(config); Assert.assertEquals(1, store.getConfigs().size()); Config savedConfig = store.getConfigs().iterator().next(); Assert.assertEquals("name", savedConfig.name); Assert.assertEquals("comment", savedConfig.comment); Assert.assertEquals("content", savedConfig.content); CustomConfig anotherConfig = new CustomConfig("anotherid", "name", "comment", "content"); store.save(anotherConfig); Assert.assertEquals(2, store.getConfigs().size()); config = new CustomConfig(CONFIG_ID, "new name", "new comment", "new content"); store.save(config); Assert.assertEquals(2, store.getConfigs().size()); savedConfig = store.getById(CONFIG_ID); Assert.assertEquals("new name", savedConfig.name); Assert.assertEquals("new comment", savedConfig.comment); Assert.assertEquals("new content", savedConfig.content); store.remove(savedConfig.id); Assert.assertEquals(1, store.getConfigs().size()); Assert.assertThat(store.getById(anotherConfig.id), Matchers.<Config>is(anotherConfig)); Assert.assertNull(store.getById(savedConfig.id)); store.remove(anotherConfig.id); Assert.assertEquals(0, store.getConfigs().size()); }
Source:
protected void ExecuteVdsBrokerCommand() { _result = null; if (getParameters().getStoragePoolId() != null) { if (FeatureSupported.saferGetAllTasksRequest(getVds().getVdsGroupCompatibilityVersion())) { _result = getBroker().getAllTasksInfo(getParameters().getStoragePoolId().toString()); } } if (_result == null) { _result = getBroker().getAllTasksInfo(); } ProceedProxyReturnValue(); setReturnValue(ParseTaskInfoList(_result.TaskInfoList)); }

Target:
protected void ExecuteVdsBrokerCommand() { boolean isFilled = false; if (getParameters().getStoragePoolId() != null) { if (FeatureSupported.saferGetAllTasksRequest(getVds().getVdsGroupCompatibilityVersion())) { _result = getBroker().getAllTasksInfo(getParameters().getStoragePoolId().toString()); isFilled = true; } } if (!isFilled) { _result = getBroker().getAllTasksInfo(); } ProceedProxyReturnValue(); setReturnValue(ParseTaskInfoList(_result.TaskInfoList)); }
Source:
public NioNetworking(Context ctx) { this.threadNamePrefix = ctx.threadNamePrefix; this.metricsRegistry = ctx.metricsRegistry; this.metricsRegistryScheduled = new AtomicBoolean(false); this.loggingService = ctx.loggingService; this.inputThreadCount = ctx.inputThreadCount; this.outputThreadCount = ctx.outputThreadCount; this.logger = loggingService.getLogger(NioNetworking.class); this.errorHandler = ctx.errorHandler; this.balancerIntervalSeconds = ctx.balancerIntervalSeconds; this.selectorMode = ctx.selectorMode; this.selectorWorkaroundTest = ctx.selectorWorkaroundTest; this.idleStrategy = ctx.idleStrategy; }

Target:
public NioNetworking(Context ctx) { this.threadNamePrefix = ctx.threadNamePrefix; this.metricsRegistry = ctx.metricsRegistry; this.loggingService = ctx.loggingService; this.inputThreadCount = ctx.inputThreadCount; this.outputThreadCount = ctx.outputThreadCount; this.logger = loggingService.getLogger(NioNetworking.class); this.errorHandler = ctx.errorHandler; this.balancerIntervalSeconds = ctx.balancerIntervalSeconds; this.selectorMode = ctx.selectorMode; this.selectorWorkaroundTest = ctx.selectorWorkaroundTest; this.idleStrategy = ctx.idleStrategy; }
Source:
public void testCommon() throws Throwable { doTest("Remove from import"); }

Target:
public void testCommon() { doTest(); }
Source:
private void createSharedResources(IInvocationContext context) { List<IBuildInfo> infos = context.getBuildInfos(); if (infos.size() <= 1) { return; } try { File resourcesDir = FileUtil.createTempDir("invocation-resources-dir"); for (IBuildInfo info : infos) { if (info.isTestResourceBuild()) { String name = String.format( "%s_%s_%s", info.getBuildBranch(), info.getBuildId(), info.getBuildFlavor()); File buildDir = FileUtil.createTempDir(name, resourcesDir); for (BuildInfoFileKey key : BuildInfoKey.SHARED_KEY) { File f = info.getFile(key); if (f == null) { continue; } File subDir = new File(buildDir, f.getName()); FileUtil.symlinkFile(f, subDir); } } else { info.setFile(BuildInfoFileKey.SHARED_RESOURCE_DIR, resourcesDir, "v1"); } } } catch (IOException e) { CLog.e("Failed to create the shared resources dir."); CLog.e(e); } }

Target:
private void createSharedResources(IInvocationContext context) { List<IBuildInfo> infos = context.getBuildInfos(); if (infos.size() <= 1) { return; } try { File resourcesDir = null; for (IBuildInfo info : infos) { if (info.isTestResourceBuild()) { if (resourcesDir == null) { resourcesDir = FileUtil.createTempDir("invocation-resources-dir"); } String name = String.format( "%s_%s_%s", info.getBuildBranch(), info.getBuildId(), info.getBuildFlavor()); File buildDir = FileUtil.createTempDir(name, resourcesDir); for (BuildInfoFileKey key : BuildInfoKey.SHARED_KEY) { File f = info.getFile(key); if (f == null) { continue; } File subDir = new File(buildDir, f.getName()); FileUtil.symlinkFile(f, subDir); } } } if (resourcesDir == null) { return; } CLog.d("Creating shared resources directory."); for (IBuildInfo info : infos) { if (!info.isTestResourceBuild()) { info.setFile(BuildInfoFileKey.SHARED_RESOURCE_DIR, resourcesDir, "v1"); } } } catch (IOException e) { CLog.e("Failed to create the shared resources dir."); CLog.e(e); } }
Source:
public void testWriteAnnotationDtoToPreparedStatementLongList() throws SQLException{ annotationDto.setValue(Arrays.asList("123", "456", "789")); SQLUtils.writeAnnotationDtoToPreparedStatement(mockPreparedStatement, annotationDto); verify(mockPreparedStatement).setLong(1, annotationDto.getEntityId()); verify(mockPreparedStatement).setString(2, annotationDto.getKey()); verify(mockPreparedStatement).setString(3, annotationDto.getType().name()); verify(mockPreparedStatement).setString(4, annotationDto.getValue().get(0)); verify(mockPreparedStatement).setLong(5, 123L); verify(mockPreparedStatement).setDouble(6, 123); verify(mockPreparedStatement).setNull(7, Types.VARCHAR); verify(mockPreparedStatement).setNull(8, Types.BOOLEAN); verify(mockPreparedStatement).setString(9, "[\"123\",\"456\",\"789\"]"); verify(mockPreparedStatement).setString(10, "[123,456,789]"); verify(mockPreparedStatement).setString(11, null); verify(mockPreparedStatement).setLong(12, 3); }

Target:
public void testWriteAnnotationDtoToPreparedStatementLongList() throws SQLException{ annotationDto.setValue(Arrays.asList("123", "4560", "789")); SQLUtils.writeAnnotationDtoToPreparedStatement(mockPreparedStatement, annotationDto); verify(mockPreparedStatement).setLong(1, annotationDto.getEntityId()); verify(mockPreparedStatement).setString(2, annotationDto.getKey()); verify(mockPreparedStatement).setString(3, annotationDto.getType().name()); verify(mockPreparedStatement).setString(4, annotationDto.getValue().get(0)); verify(mockPreparedStatement).setLong(5, 123L); verify(mockPreparedStatement).setDouble(6, 123); verify(mockPreparedStatement).setNull(7, Types.VARCHAR); verify(mockPreparedStatement).setNull(8, Types.BOOLEAN); verify(mockPreparedStatement).setString(9, "[\"123\",\"4560\",\"789\"]"); verify(mockPreparedStatement).setString(10, "[123,4560,789]"); verify(mockPreparedStatement).setString(11, null); verify(mockPreparedStatement).setLong(12, 4); }
Source:
private void scanFilesForChanges() { if (watchedFiles.isEmpty() || callback == null) { return; } MessageDigest digest = null; try { digest = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { } ImmutableSet.Builder<File> modifiedFilesBuilder = ImmutableSet.builder(); Map<File, FileMetadata> metadataCache = Maps.newHashMap(metadataCacheRef.get()); for (File file : watchedFiles) { try { FileMetadata meta = new FileMetadata(file, digest); if (!metadataCache.containsKey(file) || !metadataCache.get(file).equals(meta)) { metadataCache.put(file, meta); modifiedFilesBuilder.add(file); } } catch (IOException | SecurityException e) { log.warn( "Error trying to stat or read file %s: %s: %s", file.toString(), e.getClass().getName(), e.getMessage()); metadataCache.remove(file); continue; } } try { Set<File> modifiedFiles = modifiedFilesBuilder.build(); if (!modifiedFiles.isEmpty()) { callback.accept(modifiedFiles); } metadataCacheRef.set(ImmutableMap.copyOf(metadataCache)); } catch (Exception e) { log.warn("Error from user callback: %s: %s", e.getClass().toString(), e.getMessage()); } }

Target:
private void scanFilesForChanges() { MessageDigest digest; try { digest = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } ImmutableSet.Builder<File> modifiedFilesBuilder = ImmutableSet.builder(); Map<File, FileMetadata> metadataCache = Maps.newHashMap(metadataCacheRef.get()); for (File file : watchedFiles) { try { FileMetadata meta = new FileMetadata(file, digest); if (!meta.equals(metadataCache.get(file))) { metadataCache.put(file, meta); modifiedFilesBuilder.add(file); } } catch (IOException | SecurityException e) { log.warn( "Error trying to stat or read file %s: %s: %s", file.toString(), e.getClass().getName(), e.getMessage()); metadataCache.remove(file); } } Set<File> modifiedFiles = modifiedFilesBuilder.build(); boolean callbackCalled = false; boolean callbackSucceeded = false; try { if (!modifiedFiles.isEmpty()) { callbackCalled = true; callback.accept(modifiedFiles); callbackSucceeded = true; } metadataCacheRef.set(ImmutableMap.copyOf(metadataCache)); } catch (Exception e) { log.warn("Error from user callback: %s: %s", e.getClass().toString(), e.getMessage()); } if (!modifiedFiles.isEmpty()) { stats.fileChangesDetected.getAndAdd(modifiedFiles.size()); } if (callbackCalled) { stats.callbacksInvoked.getAndIncrement(); if (callbackSucceeded) { stats.callbacksSucceeded.getAndIncrement(); } else { stats.callbacksFailed.getAndIncrement(); } } stats.pollCycles.getAndIncrement(); }
Source:
private boolean processSyncPath(AlluxioURI path) { if (path == null) { return false; } LockingScheme scheme; if (mShouldSync) { scheme = new LockingScheme(path, LockPattern.READ, true); } else { scheme = new LockingScheme(path, LockPattern.READ, mSyncOptions, mUfsSyncPathCache, mIsGetFileInfo); } if (!scheme.shouldSync() && !mShouldSync) { return false; } try (LockedInodePath inodePath = mInodeTree.tryLockInodePath(scheme)) { if (Thread.currentThread().isInterrupted()) { LOG.warn("Thread syncing was interrupted before completion", inodePath.getUri()); return false; } syncInodeMetadata(inodePath); return true; } catch (AccessControlException | BlockInfoException | FileAlreadyCompletedException | FileDoesNotExistException | InvalidFileSizeException | InvalidPathException | IOException e) { LOG.warn("FAILED TO SYNC METADATA: {}", e.getMessage(), e); } finally { mStatusCache.remove(path); } return false; }

Target:
private boolean processSyncPath(AlluxioURI path) { if (path == null) { return false; } LockingScheme scheme; if (mForceSync) { scheme = new LockingScheme(path, LockPattern.READ, true); } else { scheme = new LockingScheme(path, LockPattern.READ, mSyncOptions, mUfsSyncPathCache, mIsGetFileInfo); } if (!scheme.shouldSync() && !mForceSync) { return false; } try (LockedInodePath inodePath = mInodeTree.tryLockInodePath(scheme)) { if (Thread.currentThread().isInterrupted()) { LOG.warn("Thread syncing was interrupted before completion", inodePath.getUri()); return false; } syncInodeMetadata(inodePath); return true; } catch (AccessControlException | BlockInfoException | FileAlreadyCompletedException | FileDoesNotExistException | InterruptedException | InvalidFileSizeException | InvalidPathException | IOException e) { LogUtils.warnWithException(LOG, "Failed to process sync path: {}", path, e); } finally { mStatusCache.remove(path); } return false; }