auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public SearchResultsRest getSearchObjects(final String query, final String dsoType, final String dsoScope, final String configurationName, final List<SearchFilter> searchFilters, final Pageable page) throws InvalidRequestException, BadRequestException { Context context = obtainContext(); DSpaceObject scopeObject = scopeResolver.resolveScope(context, dsoScope); DiscoveryConfiguration configuration = searchConfigurationService .getDiscoveryConfigurationByNameOrDso(configurationName, scopeObject); DiscoverResult searchResult = null; DiscoverQuery discoverQuery = null; try { discoverQuery = queryBuilder .buildQuery(context, scopeObject, configuration, query, searchFilters, dsoType, page); searchResult = searchService.search(context, scopeObject, discoverQuery); } catch (SearchServiceException e) { log.error("Error while searching with Discovery", e); throw new IllegalArgumentException(); } return discoverResultConverter .convert(context, query, dsoType, configurationName, dsoScope, searchFilters, page, searchResult, configuration); }

Target:
public SearchResultsRest getSearchObjects(final String query, final String dsoType, final String dsoScope, final String configurationName, final List<SearchFilter> searchFilters, final Pageable page) throws InvalidRequestException, BadRequestException { Context context = obtainContext(); DSpaceObject scopeObject = scopeResolver.resolveScope(context, dsoScope); DiscoveryConfiguration configuration = searchConfigurationService .getDiscoveryConfigurationByNameOrDso(configurationName, scopeObject); DiscoverResult searchResult = null; DiscoverQuery discoverQuery = null; try { discoverQuery = queryBuilder .buildQuery(context, scopeObject, configuration, query, searchFilters, dsoType, page); searchResult = searchService.search(context, scopeObject, discoverQuery); } catch (SearchServiceException e) { log.error("Error while searching with Discovery", e); throw new IllegalArgumentException("Error while searching with Discovery: " + e.getMessage()); } return discoverResultConverter .convert(context, query, dsoType, configurationName, dsoScope, searchFilters, page, searchResult, configuration); }
Source:
private Resource loadPackage(URI uri, URI normalized) { final URI trimmed = uri.trimFragment(); final Resource resource = createResource(trimmed, ContentHandler.UNSPECIFIED_CONTENT_TYPE); if (resource == null) { return null; } if (LOGGER.isDebugEnabled()) { LOGGER.debug("SRS@" + Integer.toHexString(hashCode()) + ".getResource - caching package " + uri); } Resource former = uriCache.putIfAbsent(normalized, resource); if (former != null) { return former; } InputStream stream = null; try { stream = getURIConverter().createInputStream(trimmed, null); resource.load(stream, Collections.emptyMap()); } catch (IOException e) { handleDemandLoadException(resource, e); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { } } } loadedPackages.add(resource); return resource; }

Target:
private Resource loadPackage(URI uri, URI normalized) { if (uriCache.containsKey(normalized)) { return uriCache.get(normalized); } final URI trimmed = uri.trimFragment(); final Resource resource = createResource(trimmed, ContentHandler.UNSPECIFIED_CONTENT_TYPE); if (resource == null) { return null; } if (LOGGER.isDebugEnabled()) { LOGGER.debug("SRS@" + Integer.toHexString(hashCode()) + ".getResource - caching package " + uri); } InputStream stream = null; try { stream = getURIConverter().createInputStream(trimmed, null); resource.load(stream, Collections.emptyMap()); } catch (IOException e) { handleDemandLoadException(resource, e); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { } } } Resource former = uriCache.putIfAbsent(normalized, resource); if (former != null) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("SRS@" + Integer.toHexString(hashCode()) + ".getResource - duplicate caching has been avoided for " + uri); } return former; } return resource; }
Source:
public CheckpointMetricsBuilder setAlignmentDurationNanos(long alignmentDurationNanos) { this.alignmentDurationNanos = alignmentDurationNanos; return this; }

Target:
public CheckpointMetricsBuilder setAlignmentDurationNanos(long alignmentDurationNanos) { checkState(this.alignmentDurationNanos.complete(alignmentDurationNanos), "alignmentDurationNanos has already been completed by someone else"); return this; }
Source:
public void onPlayerFall(final PlayerMoveEvent e) { if (e.getPlayer().isDead()) { return; } if (!IslandGuard.inWorld(e.getPlayer()) || Settings.allowTeleportWhenFalling || !e.getPlayer().getGameMode().equals(GameMode.SURVIVAL) || e.getPlayer().isOp() || e.getPlayer().isFlying() || VaultHelper.checkPerm(e.getPlayer(), "askyblock.bypassfalling")) { fallingPlayers.remove(e.getPlayer().getUniqueId()); return; } if (e.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.AIR && e.getPlayer().getLocation().getBlock().getType() == Material.AIR) { setFalling(e.getPlayer().getUniqueId()); } else { unsetFalling(e.getPlayer().getUniqueId()); } }

Target:
public void onPlayerFall(final PlayerMoveEvent e) { if (e.getPlayer().isDead()) { return; } if (!IslandGuard.inWorld(e.getPlayer()) || Settings.allowTeleportWhenFalling || !e.getPlayer().getGameMode().equals(GameMode.SURVIVAL) || e.getPlayer().isOp() || e.getPlayer().isFlying() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "bypassfalling")) { fallingPlayers.remove(e.getPlayer().getUniqueId()); return; } if (e.getPlayer().getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.AIR && e.getPlayer().getLocation().getBlock().getType() == Material.AIR) { setFalling(e.getPlayer().getUniqueId()); } else { unsetFalling(e.getPlayer().getUniqueId()); } }
Source:
public String getAccumuloClasspath() { return verifyNotNull(ADMIN_ACCUMULO_CLASSPATH_PROP, getString(ADMIN_ACCUMULO_CLASSPATH_PROP, ADMIN_ACCUMULO_CLASSPATH_DEFAULT)); }

Target:
public String getAccumuloClasspath() { return getString(ADMIN_ACCUMULO_CLASSPATH_PROP, ADMIN_ACCUMULO_CLASSPATH_DEFAULT); }
Source:
private TaskPartitionState updateJobContextAndGetTaskCurrentState( CurrentStateOutput currentStateOutput, String jobResource, Integer pId, String pName, String instance, JobContext jobCtx, TargetState jobTgtState) { String currentStateString = currentStateOutput.getCurrentState(jobResource, new Partition(pName), instance); if (currentStateString == null) { TaskPartitionState stateFromContext = jobCtx.getPartitionState(pId); if (jobTgtState == TargetState.STOP) { if (stateFromContext == TaskPartitionState.RUNNING || stateFromContext == TaskPartitionState.INIT) { jobCtx.setPartitionState(pId, TaskPartitionState.STOPPED); return TaskPartitionState.STOPPED; } } return stateFromContext == null ? TaskPartitionState.INIT : stateFromContext; } TaskPartitionState currentState = TaskPartitionState.valueOf(currentStateString); jobCtx.setPartitionState(pId, currentState); String taskMsg = currentStateOutput.getInfo(jobResource, new Partition(pName), instance); if (taskMsg != null) { jobCtx.setPartitionInfo(pId, taskMsg); } return currentState; }

Target:
private TaskPartitionState updateJobContextAndGetTaskCurrentState( CurrentStateOutput currentStateOutput, String jobResource, Integer pId, String pName, String instance, JobContext jobCtx, TargetState jobTgtState) { String currentStateString = currentStateOutput.getCurrentState(jobResource, new Partition(pName), instance); if (currentStateString == null) { TaskPartitionState stateFromContext = jobCtx.getPartitionState(pId); if (jobTgtState == TargetState.STOP && (stateFromContext == TaskPartitionState.RUNNING || stateFromContext == TaskPartitionState.INIT)) { jobCtx.setPartitionState(pId, TaskPartitionState.STOPPED); return TaskPartitionState.STOPPED; } return stateFromContext == null ? TaskPartitionState.INIT : stateFromContext; } TaskPartitionState currentState = TaskPartitionState.valueOf(currentStateString); jobCtx.setPartitionState(pId, currentState); String taskMsg = currentStateOutput.getInfo(jobResource, new Partition(pName), instance); if (taskMsg != null) { jobCtx.setPartitionInfo(pId, taskMsg); } return currentState; }
Source:
protected void copyFrom(ServiceState s) { mVoiceRegState = s.mVoiceRegState; mDataRegState = s.mDataRegState; mVoiceRoamingType = s.mVoiceRoamingType; mDataRoamingType = s.mDataRoamingType; mVoiceOperatorAlphaLong = s.mVoiceOperatorAlphaLong; mVoiceOperatorAlphaShort = s.mVoiceOperatorAlphaShort; mVoiceOperatorNumeric = s.mVoiceOperatorNumeric; mDataOperatorAlphaLong = s.mDataOperatorAlphaLong; mDataOperatorAlphaShort = s.mDataOperatorAlphaShort; mDataOperatorNumeric = s.mDataOperatorNumeric; mIsManualNetworkSelection = s.mIsManualNetworkSelection; mRilVoiceRadioTechnology = s.mRilVoiceRadioTechnology; mRilDataRadioTechnology = s.mRilDataRadioTechnology; mCssIndicator = s.mCssIndicator; mNetworkId = s.mNetworkId; mSystemId = s.mSystemId; mCdmaRoamingIndicator = s.mCdmaRoamingIndicator; mCdmaDefaultRoamingIndicator = s.mCdmaDefaultRoamingIndicator; mCdmaEriIconIndex = s.mCdmaEriIconIndex; mCdmaEriIconMode = s.mCdmaEriIconMode; mIsEmergencyOnly = s.mIsEmergencyOnly; mIsDataRoamingFromRegistration = s.mIsDataRoamingFromRegistration; mIsUsingCarrierAggregation = s.mIsUsingCarrierAggregation; mChannelNumber = s.mChannelNumber; mCellBandwidths = s.mCellBandwidths == null ? new int[0] : Arrays.copyOf(s.mCellBandwidths, s.mCellBandwidths.length); mLteEarfcnRsrpBoost = s.mLteEarfcnRsrpBoost; mNetworkRegistrationStates = new ArrayList<>(s.mNetworkRegistrationStates); }

Target:
protected void copyFrom(ServiceState s) { mVoiceRegState = s.mVoiceRegState; mDataRegState = s.mDataRegState; mVoiceRoamingType = s.mVoiceRoamingType; mDataRoamingType = s.mDataRoamingType; mVoiceOperatorAlphaLong = s.mVoiceOperatorAlphaLong; mVoiceOperatorAlphaShort = s.mVoiceOperatorAlphaShort; mVoiceOperatorNumeric = s.mVoiceOperatorNumeric; mDataOperatorAlphaLong = s.mDataOperatorAlphaLong; mDataOperatorAlphaShort = s.mDataOperatorAlphaShort; mDataOperatorNumeric = s.mDataOperatorNumeric; mIsManualNetworkSelection = s.mIsManualNetworkSelection; mRilVoiceRadioTechnology = s.mRilVoiceRadioTechnology; mRilDataRadioTechnology = s.mRilDataRadioTechnology; mCssIndicator = s.mCssIndicator; mNetworkId = s.mNetworkId; mSystemId = s.mSystemId; mCdmaRoamingIndicator = s.mCdmaRoamingIndicator; mCdmaDefaultRoamingIndicator = s.mCdmaDefaultRoamingIndicator; mCdmaEriIconIndex = s.mCdmaEriIconIndex; mCdmaEriIconMode = s.mCdmaEriIconMode; mIsEmergencyOnly = s.mIsEmergencyOnly; mIsDataRoamingFromRegistration = s.mIsDataRoamingFromRegistration; mIsUsingCarrierAggregation = s.mIsUsingCarrierAggregation; mChannelNumber = s.mChannelNumber; mCellBandwidths = s.mCellBandwidths == null ? null : Arrays.copyOf(s.mCellBandwidths, s.mCellBandwidths.length); mLteEarfcnRsrpBoost = s.mLteEarfcnRsrpBoost; mNetworkRegistrationStates = new ArrayList<>(s.mNetworkRegistrationStates); }
Source:
private GrowthStage[] buildGrowthStages(Map<String, GrowthStage> growthStages) { Object[] values = growthStages.values().toArray(); Iterator<String> keys = growthStages.keySet().iterator(); GrowthStage[] stages = new GrowthStage[values.length]; for (int i = 0; i < values.length; i++) { String block = keys.next(); stages[i] = new GrowthStage((GrowthStage) values[i]); try { stages[i].block = blockManager.getBlock(block); } catch (NullPointerException e) { logger.error("Unable to get block: " + block); throw e; } stages[i].block.setKeepActive(true); } return stages; }

Target:
private GrowthStage[] buildGrowthStages(Map<String, GrowthStage> growthStages) { Set<Map.Entry<String, GrowthStage>> entrySet = growthStages.entrySet(); GrowthStage[] stages = new GrowthStage[entrySet.size()]; int i = 0; for (Map.Entry<String, GrowthStage> entry : entrySet) { stages[i] = new GrowthStage(entry.getValue()); stages[i].block = blockManager.getBlock(entry.getKey()); stages[i].block.setKeepActive(true); i++; } return stages; }
Source:
public Firehose connect() throws IOException { final BlockingQueue<Map<String, Object>> queue = new ArrayBlockingQueue<Map<String, Object>>(QUEUE_SIZE); Runnable updateStream = new UpdateStream(new WebJsonSupplier(dimensions, url), queue, new DefaultObjectMapper()); final ExecutorService service = Executors.newSingleThreadExecutor(); service.submit(updateStream); return new Firehose() { private final Runnable doNothingRunnable = Runnables.getNoopRunnable(); @Override public boolean hasMore() { return !(service.isTerminated()); } @Override public InputRow nextRow() { try { Map<String, Object> processedMap = processMap(queue.take()); DateTime date = TimestampParser.createTimestampParser("auto") .apply(processedMap.get(timeDimension).toString()); long seconds = (long) date.getMillis(); if (new DateTime(seconds * 1000).getYear() == new DateTime().getYear()) { seconds = (long) date.getMillis() * 1000; } return new MapBasedInputRow( seconds, renamedDimensions, processedMap ); } catch (Exception e) { throw Throwables.propagate(e); } } private Map<String, Object> renameKeys(Map<String, Object> update) { Map<String, Object> renamedMap = Maps.newHashMap(); for (int iter = 0; iter < dimensions.size(); iter++) { if (update.get(dimensions.get(iter)) != null) { Object obj = update.get(dimensions.get(iter)); renamedMap.put(renamedDimensions.get(iter), obj); } } if (renamedMap.get(timeDimension) == null) { renamedMap.put(timeDimension, System.currentTimeMillis()); } return renamedMap; } private Map<String, Object> processMap(Map<String, Object> map) { Map<String, Object> renamedMap = renameKeys(map); return renamedMap; } @Override public Runnable commit() { return doNothingRunnable; } @Override public void close() throws IOException { service.shutdown(); } }; }

Target:
public Firehose connect() throws IOException { final UpdateStream updateStream = factory.build(); updateStream.start(); return new Firehose() { Map<String, Object> map; private final Runnable doNothingRunnable = Runnables.getNoopRunnable(); @Override public boolean hasMore() { try { map = updateStream.pollFromQueue(queueWaitTime, TimeUnit.SECONDS); return map != null; } catch (InterruptedException e) { throw Throwables.propagate(e); } } @Override public InputRow nextRow() { try { DateTime date = TimestampParser.createTimestampParser(timeFormat) .apply(map.get(updateStream.getTimeDimension()).toString()); return new MapBasedInputRow( date.getMillis(), new ArrayList(map.keySet()), map ); } catch (Exception e) { throw Throwables.propagate(e); } finally { map = null; } } @Override public Runnable commit() { return doNothingRunnable; } @Override public void close() throws IOException { updateStream.stop(); } }; }
Source:
public Filter toFilter() { if (extractionFn == null) { return new SelectorFilter(dimension, value); } else { final String valueOrNull = Strings.emptyToNull(value); final DruidPredicateFactory predicateFactory = new DruidPredicateFactory() { @Override public Predicate<String> makeStringPredicate() { return new Predicate<String>() { @Override public boolean apply(String input) { return Objects.equals(valueOrNull, input); } }; } @Override public DruidLongPredicate makeLongPredicate() { initLongValue(); if (valueAsLong == null) { return new DruidLongPredicate() { @Override public boolean applyLong(long input) { return false; } }; } else { final long unboxedLong = valueAsLong.longValue(); return new DruidLongPredicate() { @Override public boolean applyLong(long input) { return input == unboxedLong; } }; } } @Override public DruidFloatPredicate makeFloatPredicate() { initFloatValue(); if (valueAsFloat == null) { return new DruidFloatPredicate() { @Override public boolean applyFloat(float input) { return false; } }; } else { final float unboxedFloat = valueAsFloat.floatValue(); return new DruidFloatPredicate() { @Override public boolean applyFloat(float input) { return input == unboxedFloat; } }; } } }; return new DimensionPredicateFilter(dimension, predicateFactory, extractionFn); } }

Target:
public Filter toFilter() { if (extractionFn == null) { return new SelectorFilter(dimension, value); } else { final String valueOrNull = Strings.emptyToNull(value); final DruidPredicateFactory predicateFactory = new DruidPredicateFactory() { @Override public Predicate<String> makeStringPredicate() { return Predicates.equalTo(valueOrNull); } @Override public DruidLongPredicate makeLongPredicate() { initLongPredicate(); return longPredicate; } @Override public DruidFloatPredicate makeFloatPredicate() { initFloatPredicate(); return floatPredicate; } }; return new DimensionPredicateFilter(dimension, predicateFactory, extractionFn); } }
Source:
private void showWarning(int numItems) { View checkBoxView = View.inflate(this, R.layout.dialog_items_unavailable_warning, null); final CheckBox checkBox = (CheckBox) checkBoxView.findViewById(R.id.checkbox_dont_show_again); DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (checkBox.isChecked()) { SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putBoolean(getString(R.string.setting_item_unavailable_warning), false); editor.apply(); } if (id == AlertDialog.BUTTON_POSITIVE) { showMenu(); } dialog.cancel(); } }; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.title_items_unavailable)); builder.setMessage(String.format(getResources().getQuantityString(R.plurals.items_unavailable_message, numItems, numItems))) .setView(checkBoxView) .setCancelable(false) .setPositiveButton(getString(R.string.items_unavailable_positive_button), listener) .setNegativeButton(getString(R.string.items_unavailable_negative_button), listener).show(); }

Target:
private void showWarning(int numItems) { View checkBoxView = View.inflate(this, R.layout.dialog_items_unavailable_warning, null); final CheckBox checkBox = (CheckBox) checkBoxView.findViewById(R.id.checkbox_dont_show_again); DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (checkBox.isChecked()) { SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putBoolean(getString(R.string.setting_item_unavailable_warning), false); editor.apply(); } if (id == AlertDialog.BUTTON_POSITIVE) { showMenu(); } dialog.cancel(); } }; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.title_items_unavailable)); builder.setMessage(getResources().getQuantityString(R.plurals.items_unavailable_message, numItems, numItems)) .setView(checkBoxView) .setPositiveButton(getString(R.string.items_unavailable_positive_button), listener) .setNegativeButton(getString(R.string.items_unavailable_negative_button), listener).show(); }
Source:
public WriteSupport<T> getWriteSupport(Configuration configuration){ if (writeSupport != null) return writeSupport; Class<?> writeSupportClass = getWriteSupportClass(configuration); try { return (WriteSupport<T>)Objects.requireNonNull(writeSupportClass, "writeSupportClass").newInstance(); } catch (InstantiationException e) { throw new BadConfigurationException("could not instantiate write support class: " + writeSupportClass, e); } catch (IllegalAccessException e) { throw new BadConfigurationException("could not instantiate write support class: " + writeSupportClass, e); } }

Target:
public WriteSupport<T> getWriteSupport(Configuration configuration){ if (writeSupport != null) return writeSupport; Class<?> writeSupportClass = getWriteSupportClass(configuration); try { return (WriteSupport<T>) Objects .requireNonNull(writeSupportClass, "writeSupportClass cannot be null") .newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new BadConfigurationException("could not instantiate write support class: " + writeSupportClass, e); } }
Source:
public static HaxeClass tryResolveClassByQName(@Nullable PsiElement type) { if (type == null || type.getContext() == null) { return null; } HaxeClass result = findClassByQName(type.getText(), type.getContext()); if(result != null) { return result; } String name = getQName(type); result = name == null? tryResolveClassByQNameWhenGetQNameFail(type) : findClassByQName(name, type.getContext()); result = result != null ? result : tryFindHelper(type); result = result != null ? result : findClassByQNameInSuperPackages(type); return result; }

Target:
public static HaxeClass tryResolveClassByQName(@Nullable PsiElement type) { if (type == null || type.getContext() == null) { return null; } final String name = getQName(type); HaxeClass result = name == null ? tryResolveClassByQNameWhenGetQNameFail(type) : findClassByQName(name, type.getContext()); result = result != null ? result : tryFindHelper(type); result = result != null ? result : findClassByQNameInSuperPackages(type); return result; }
Source:
public void close() throws IOException { synchronized (PersistentBinaryDeque.this) { if (m_closed) { return; } if (m_activeSegment != null && !m_segments.isEmpty() && m_activeSegment.m_id != m_segments.lastKey()) { finishWrite(m_activeSegment); } m_activeSegment = null; m_closed = true; m_gapWriter = null; } }

Target:
public void close() throws IOException { synchronized (PersistentBinaryDeque.this) { if (m_closed) { return; } if (m_activeSegment!= null && m_activeSegment.m_id != m_segments.lastKey()) { finishActiveSegmentWrite(); } m_closed = true; m_gapWriter = null; } }
Source:
public void testMemoryUsageInTheContextOfMemoryPoolDestruction() { final int bufferSize = 128; final int numBuffers = 10; NetworkBufferPool globalPool = new NetworkBufferPool(numBuffers, bufferSize); MemorySegment segment = globalPool.requestMemorySegment(); assertThat(segment, is(notNullValue())); assertThat(globalPool.getTotalNumberOfMemorySegments(), is(numBuffers)); assertThat(globalPool.getNumberOfAvailableMemorySegments(), is(numBuffers - 1)); assertThat(globalPool.getNumberOfUsedMemorySegments(), is(1)); assertThat(globalPool.getTotalMemory(), is((long) numBuffers * bufferSize)); assertThat(globalPool.getAvailableMemory(), is((long) (numBuffers - 1) * bufferSize)); assertThat(globalPool.getUsedMemory(), is((long) bufferSize)); assertThat(globalPool.getNumberOfRegisteredBufferPools(), is(0)); globalPool.destroy(); assertThat(globalPool.getTotalNumberOfMemorySegments(), is(0)); assertThat(globalPool.getNumberOfAvailableMemorySegments(), is(0)); assertThat(globalPool.getNumberOfUsedMemorySegments(), is(0)); assertThat(globalPool.getTotalMemory(), is(0L)); assertThat(globalPool.getAvailableMemory(), is(0L)); assertThat(globalPool.getUsedMemory(), is(0L)); assertThat(globalPool.getNumberOfRegisteredBufferPools(), is(0)); }

Target:
public void testMemoryUsageInTheContextOfMemoryPoolDestruction() { final int bufferSize = 128; final int numBuffers = 10; NetworkBufferPool globalPool = new NetworkBufferPool(numBuffers, bufferSize); globalPool.destroy(); assertThat(globalPool.getTotalNumberOfMemorySegments(), is(0)); assertThat(globalPool.getNumberOfAvailableMemorySegments(), is(0)); assertThat(globalPool.getNumberOfUsedMemorySegments(), is(0)); assertThat(globalPool.getTotalMemory(), is(0L)); assertThat(globalPool.getAvailableMemory(), is(0L)); assertThat(globalPool.getUsedMemory(), is(0L)); }
Source:
private boolean corporateAddressExists(PaymentWorksNewVendorDetailDTO paymentWorksNewVendorDetailDTO) { if (ObjectUtils.isNotNull(paymentWorksNewVendorDetailDTO.getRequesting_company().getCorp_address())) { return true; } else { return false; } }

Target:
private boolean corporateAddressExists(PaymentWorksNewVendorDetailDTO paymentWorksNewVendorDetailDTO) { return (ObjectUtils.isNotNull(paymentWorksNewVendorDetailDTO.getRequesting_company().getCorp_address())); }
Source:
public static void main(String[] args) throws Exception { Runtime.getRuntime().addShutdownHook(new ShutDown()); CommandLine cmd = parseArgs(args); String projectVersion = BuildProperties.get().getProperty("project.version"); String appPath = "webapp/target/falcon-webapp-" + projectVersion; if (cmd.hasOption(APP_PATH)) { appPath = cmd.getOptionValue(APP_PATH); } String isSafeMode = "false"; if (cmd.hasOption(SAFE_MODE)) { isSafeMode = cmd.getOptionValue(SAFE_MODE); validateSafemode(isSafeMode); } LOG.info("Setting system property Safemode to : {}", isSafeMode); System.setProperty(StartupProperties.SAFEMODE_PROPERTY, isSafeMode); final String enableTLSFlag = StartupProperties.get().getProperty("falcon.enableTLS"); final int appPort = getApplicationPort(cmd, enableTLSFlag); final boolean enableTLS = isTLSEnabled(enableTLSFlag, appPort); StartupProperties.get().setProperty("falcon.enableTLS", String.valueOf(enableTLS)); startEmbeddedMQIfEnabled(); LOG.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); LOG.info("Server starting with TLS ? on port {}", enableTLS, appPort); LOG.info("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); server = EmbeddedServer.newServer(appPort, appPath, enableTLS); server.start(); }

Target:
public static void main(String[] args) throws Exception { Runtime.getRuntime().addShutdownHook(new ShutDown()); CommandLine cmd = parseArgs(args); String projectVersion = BuildProperties.get().getProperty("project.version"); String appPath = "webapp/target/falcon-webapp-" + projectVersion; if (cmd.hasOption(APP_PATH)) { appPath = cmd.getOptionValue(APP_PATH); } if (cmd.hasOption(SAFE_MODE)) { validateSafemode(cmd.getOptionValue(SAFE_MODE)); boolean isSafeMode = Boolean.parseBoolean(cmd.getOptionValue(SAFE_MODE)); if (isSafeMode) { StartupProperties.createSafemodeFile(); } else { StartupProperties.deleteSafemodeFile(); } } final String enableTLSFlag = StartupProperties.get().getProperty("falcon.enableTLS"); final int appPort = getApplicationPort(cmd, enableTLSFlag); final boolean enableTLS = isTLSEnabled(enableTLSFlag, appPort); StartupProperties.get().setProperty("falcon.enableTLS", String.valueOf(enableTLS)); startEmbeddedMQIfEnabled(); LOG.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); LOG.info("Server starting with TLS ? on port {}", enableTLS, appPort); LOG.info("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); server = EmbeddedServer.newServer(appPort, appPath, enableTLS); server.start(); }
Source:
public boolean getActionResult(String key, OutputStream out) throws IOException, InterruptedException { return getFromFuture(get(key, out)); }

Target:
public ListenableFuture<Boolean> getActionResult(String key, OutputStream out) { return get(key, out, true); }
Source:
public void testIdleEvent() throws Exception { OSDelegatingFileTailingMessageProducer adapter = new OSDelegatingFileTailingMessageProducer(); adapter.setOptions(TAIL_OPTIONS_FOLLOW_NAME_ALL_LINES); ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler(); taskScheduler.afterPropertiesSet(); adapter.setTaskScheduler(taskScheduler); final List<FileTailingIdleEvent> events = new ArrayList<>(); adapter.setApplicationEventPublisher(event -> { if (event instanceof FileTailingIdleEvent) { FileTailingIdleEvent tailEvent = (FileTailingIdleEvent) event; logger.warn(event); events.add(tailEvent); } }); File file = new File(testDir, "foo"); file.delete(); FileOutputStream foo = new FileOutputStream(file); for (int i = 0; i < 50; i++) { foo.write(("hello" + i + "\n").getBytes()); } foo.flush(); foo.close(); adapter.setFile(file); QueueChannel outputChannel = new QueueChannel(); adapter.setOutputChannel(outputChannel); adapter.setIdleEventInterval(1000); adapter.afterPropertiesSet(); adapter.start(); Thread.sleep(4000); assertTrue("expected at least one idle event", events.size() > 0); adapter.stop(); }

Target:
public void testIdleEvent() throws Exception { OSDelegatingFileTailingMessageProducer adapter = new OSDelegatingFileTailingMessageProducer(); adapter.setOptions(TAIL_OPTIONS_FOLLOW_NAME_ALL_LINES); ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler(); taskScheduler.afterPropertiesSet(); adapter.setTaskScheduler(taskScheduler); CountDownLatch idleCountDownLatch = new CountDownLatch(1); CountDownLatch fileExistCountDownLatch = new CountDownLatch(1); adapter.setApplicationEventPublisher(event -> { if (event instanceof FileTailingIdleEvent) { FileTailingIdleEvent tailEvent = (FileTailingIdleEvent) event; idleCountDownLatch.countDown(); } if (event instanceof FileTailingEvent) { FileTailingEvent fileTailingEvent = (FileTailingEvent) event; if (fileTailingEvent.getMessage().contains("No such file or directory")) { fileExistCountDownLatch.countDown(); } } logger.debug(event); }); File file = mock(File.class); when(file.exists()).thenReturn(false); adapter.setFile(file); QueueChannel outputChannel = new QueueChannel(); adapter.setOutputChannel(outputChannel); adapter.setIdleEventInterval(100); adapter.afterPropertiesSet(); adapter.start(); boolean noFile = fileExistCountDownLatch.await(500, TimeUnit.MILLISECONDS); assertTrue("file does not exist event did not emit ", noFile); boolean noEvent = idleCountDownLatch.await(500, TimeUnit.MILLISECONDS); assertFalse("event should not emit when no file exit", noEvent); when(file.exists()).thenReturn(true); boolean eventRaised = idleCountDownLatch.await(1, TimeUnit.SECONDS); assertTrue("idle event did not emit", eventRaised); adapter.stop(); }
Source:
public Table getTable(final String dbName, final String tableName, boolean throwException) throws HiveException { return this.getTable(dbName, tableName, throwException, true); }

Target:
public Table getTable(final String dbName, final String tableName, boolean throwException) throws HiveException { return this.getTable(dbName, tableName, throwException, false); }
Source:
public VideoDecoder( final EventPublisher eventPublisher, final VideoDecoderConfig config, final String broadcast ) { this.eventPublisher = eventPublisher; this.config = config; this.decoderA = new FFmpegFXImageDecoder( config.portA(), config.format(), config.frameRate(), config.socketBacklog(), config.bitrate(), config.preset(), config.numBuffers()); this.decoderB = new FFmpegFXImageDecoder( config.portB(), config.format(), config.frameRate(), config.socketBacklog(), config.bitrate(), config.preset(), config.numBuffers()); final int lastLocation = broadcast.lastIndexOf('.'); broadcastIP = broadcast.substring(0, lastLocation - 1); }

Target:
public VideoDecoder( final EventPublisher eventPublisher, final VideoDecoderConfig config, final String broadcast ) { this.eventPublisher = eventPublisher; this.config = config; this.decoderA = new FFmpegFXImageDecoder( config.portA(), config.format(), config.frameRate(), config.socketBacklog(), config.bitrate(), config.preset(), config.numBuffers(), config.introVideoLocation()); this.decoderB = new FFmpegFXImageDecoder( config.portB(), config.format(), config.frameRate(), config.socketBacklog(), config.bitrate(), config.preset(), config.numBuffers(), config.introVideoLocation()); final int lastLocation = broadcast.lastIndexOf('.'); broadcastIP = broadcast.substring(0, lastLocation - 1); }
Source:
public Neo4jGraph(String path) { service = new GraphDatabaseFactory().newEmbeddedDatabase(path); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { service.shutdown(); } }); nodeLabel = DynamicLabel.label("Node"); try (Transaction tx = service.beginTx()) { service.schema().getConstraints().forEach(e -> e.drop()); service.schema().getIndexes().forEach(e -> e.drop()); service.schema().constraintFor(nodeLabel) .assertPropertyIsUnique("id") .create(); service.schema().indexFor(nodeLabel) .on("rank") .create(); tx.success(); } }

Target:
public Neo4jGraph(String path) { service = new GraphDatabaseFactory().newEmbeddedDatabase(path); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { service.shutdown(); } }); nodeLabel = DynamicLabel.label(NODELABEL); try (Transaction tx = service.beginTx()) { service.schema().getConstraints().forEach(e -> e.drop()); service.schema().getIndexes().forEach(e -> e.drop()); service.schema().constraintFor(nodeLabel) .assertPropertyIsUnique(ID) .create(); service.schema().indexFor(nodeLabel) .on(RANK) .create(); tx.success(); } }
Source:
private static void addDesktopSharingListener(final Call call, JFrame frame) { OperationSetVideoTelephony videoTelephony = call.getProtocolProvider().getOperationSet( OperationSetDesktopSharingServer.class); videoTelephony.addPropertyChangeListener( call, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent ev) { if (OperationSetVideoTelephony.LOCAL_VIDEO_STREAMING .equals(ev.getPropertyName()) && MediaDirection.RECVONLY.equals( ev.getNewValue())) { JFrame desktopFrame = callDesktopFrames.get(call); if (desktopFrame != null) { desktopFrame.dispose(); callDesktopFrames.remove(call); } } } }); }

Target:
private static void addDesktopSharingListener(final Call call, JFrame frame) { OperationSetVideoTelephony videoTelephony = call.getProtocolProvider().getOperationSet( OperationSetVideoTelephony.class); videoTelephony.addPropertyChangeListener( call, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent ev) { if (OperationSetVideoTelephony.LOCAL_VIDEO_STREAMING .equals(ev.getPropertyName()) && MediaDirection.RECVONLY.equals( ev.getNewValue())) { JFrame desktopFrame = callDesktopFrames.get(call); if (desktopFrame != null) { desktopFrame.dispose(); callDesktopFrames.remove(call); } } } }); }
Source:
private void processRemoteNotification(Bundle msg) { if (!isSwrveRemoteNotification(msg)) { SwrveLogger.i(TAG, "ADM notification: but not processing as it doesn't contain: " + SwrveAdmConstants.SWRVE_TRACKING_KEY); return; } Context context = getApplicationContext(); Object rawId = msg.get(SwrveAdmConstants.SWRVE_TRACKING_KEY); String msgId = (rawId != null) ? rawId.toString() : null; final String timestamp = msg.getString(SwrveAdmConstants.TIMESTAMP_KEY); if (SwrveHelper.isNullOrEmpty(timestamp)) { SwrveLogger.e(TAG, "ADM notification: but not processing as it's missing " + SwrveAdmConstants.TIMESTAMP_KEY); return; } String curId = msgId + ":" + timestamp; LinkedList<String> recentIds = getRecentNotificationIdCache(context); if (recentIds.contains(curId)) { SwrveLogger.i(TAG, "ADM notification: but not processing because duplicate Id: " + curId); return; } updateRecentNotificationIdCache(recentIds, curId, MAX_ID_CACHE_ITEMS, context); Iterator<SwrveQAUser> iter = SwrveQAUser.getBindedListeners().iterator(); while (iter.hasNext()) { SwrveQAUser sdkListener = iter.next(); sdkListener.pushNotification(msgId, msg); } processNotification(msg, context); }

Target:
private void processRemoteNotification(Bundle msg) { if (!isSwrveRemoteNotification(msg)) { SwrveLogger.i(TAG, "ADM notification: but not processing as it doesn't contain: " + SwrveAdmConstants.SWRVE_TRACKING_KEY); return; } Context context = getApplicationContext(); Object rawId = msg.get(SwrveAdmConstants.SWRVE_TRACKING_KEY); String msgId = (rawId != null) ? rawId.toString() : null; final String timestamp = msg.getString(SwrveAdmConstants.TIMESTAMP_KEY); if (SwrveHelper.isNullOrEmpty(timestamp)) { SwrveLogger.e(TAG, "ADM notification: but not processing as it's missing " + SwrveAdmConstants.TIMESTAMP_KEY); return; } String curId = msgId + ":" + timestamp; LinkedList<String> recentIds = getRecentNotificationIdCache(context); if (recentIds.contains(curId)) { SwrveLogger.i(TAG, "ADM notification: but not processing because duplicate Id: " + curId); return; } int pushIdCacheSize = msg.getInt(SwrveAdmConstants.PUSH_ID_CACHE_SIZE_KEY, DEFAULT_PUSH_ID_CACHE_SIZE); updateRecentNotificationIdCache(recentIds, curId, pushIdCacheSize, context); Iterator<SwrveQAUser> iter = SwrveQAUser.getBindedListeners().iterator(); while (iter.hasNext()) { SwrveQAUser sdkListener = iter.next(); sdkListener.pushNotification(msgId, msg); } processNotification(msg, context); }
Source:
public void configure(ElasticsearchAnalysisDefinitionContainerContext context) { super.configure( context ); context.analyzer( OverrideAnalysisDefinitions.ANALYZER_WHITESPACE.name ).custom() .withTokenizer( "whitespace" ); context.analyzer( OverrideAnalysisDefinitions.ANALYZER_WHITESPACE_LOWERCASE.name ).custom() .withTokenizer( "whitespace" ) .withTokenFilters( "lowercase" ); String tokenizerName = AnalysisCustomIT.AnalysisDefinitions.ANALYZER_PATTERNS_STOPWORD.name + "_tokenizer"; context.analyzer( OverrideAnalysisDefinitions.ANALYZER_NGRAM.name ).custom() .withTokenizer( tokenizerName ); context.tokenizer( tokenizerName ) .type( "ngram" ) .param( "min_gram", 5 ) .param( "max_gram", 6 ); }

Target:
public void configure(ElasticsearchAnalysisDefinitionContainerContext context) { super.configure( context ); context.analyzer( OverrideAnalysisDefinitions.ANALYZER_WHITESPACE.name ).custom() .withTokenizer( "whitespace" ); context.analyzer( OverrideAnalysisDefinitions.ANALYZER_WHITESPACE_LOWERCASE.name ).custom() .withTokenizer( "whitespace" ) .withTokenFilters( "lowercase" ); String tokenizerName = OverrideAnalysisDefinitions.ANALYZER_NGRAM.name + "_tokenizer"; context.analyzer( OverrideAnalysisDefinitions.ANALYZER_NGRAM.name ).custom() .withTokenizer( tokenizerName ); context.tokenizer( tokenizerName ) .type( "ngram" ) .param( "min_gram", 5 ) .param( "max_gram", 6 ); }
Source:
public void createNewLauncherApplicationProjectWithDefaultSettings() { ArchetypeProject project = new org.jboss.tools.central.test.ui.reddeer.projects.LauncherApplication(); log.step("Import project start"); JBossCentralProjectWizardLauncherApplication dialog = new JBossCentralProjectWizardLauncherApplication(project); dialog.open(); dialog.setProjectName("project_1_default_settings"); dialog.clickTheFinishButton(); new WaitWhile(new JobIsRunning(), TimePeriod.getCustom(2500)); log.step("Import project finished"); checkForErrors(); }

Target:
public void createNewLauncherApplicationProjectWithDefaultSettings() { log.step("Import project start"); NewLauncherProjectWizard wizard = new NewLauncherProjectWizard(); NewLauncherProjectWizardPage wizardPage = new NewLauncherProjectWizardPage(wizard); wizard.openWizardFromShellMenu(); wizardPage.setProjectName("project_1_default_settings"); wizard.finish(TimePeriod.getCustom(2500)); log.step("Import project finished"); checkForErrors(); }
Source:
public void testCryst1Parsing() throws Exception { String cryst1Line = "CRYST1 11.111 11.111 111.111 70.00 80.00 60.00 P 1"; Structure s; PDBFileParser pdbPars = new PDBFileParser(); try(InputStream is = new ByteArrayInputStream(cryst1Line.getBytes()) ) { s = pdbPars.parsePDBFile(is); } assertEquals("P 1", s.getPDBHeader().getCrystallographicInfo().getSpaceGroup().getShortSymbol()); }

Target:
public void testCryst1Parsing() throws IOException { String cryst1Line = "CRYST1 11.111 11.111 111.111 70.00 80.00 60.00 P 1"; Structure s; PDBFileParser pdbPars = new PDBFileParser(); try(InputStream is = new ByteArrayInputStream(cryst1Line.getBytes()) ) { s = pdbPars.parsePDBFile(is); } assertEquals("P 1", s.getPDBHeader().getCrystallographicInfo().getSpaceGroup().getShortSymbol()); }
Source:
public static boolean shouldRetry(String response, String host) { String decodedResponse = Base64.decode(response); Log.v(LOG_TAG, "Challenge response: "+ decodedResponse); try { JSONObject json = new JSONObject(decodedResponse); if(!json.getString("status").equals(BAD_RESPONSE)) { return false; } } catch (JSONException jsonException) { Log.i(LOG_TAG, "Error decoding JSON response from:" + host + ". Response was:" + decodedResponse); } return true; }

Target:
public static boolean shouldRetry(String response, String host) { String decodedResponse = Base64.decode(response); if (K9MailLib.isDebug()) { Log.v(LOG_TAG, "Challenge response: " + decodedResponse); } try { JSONObject json = new JSONObject(decodedResponse); String status = json.getString("status"); if (!BAD_RESPONSE.equals(status)) { return false; } } catch (JSONException jsonException) { Log.e(LOG_TAG, "Error decoding JSON response from: " + host + ". Response was: " + decodedResponse); } return true; }
Source:
private void testReadAheads(AbfsInputStream inputStream, int readRequestSize, int readAheadRequestSize) throws Exception { if (readRequestSize > readAheadRequestSize) { readAheadRequestSize = readRequestSize; } byte[] firstReadBuffer = new byte[readRequestSize]; byte[] secondReadBuffer = new byte[readAheadRequestSize]; byte[] expectedFirstReadAheadBufferContents = new byte[readRequestSize]; byte[] expectedSecondReadAheadBufferContents = new byte[readAheadRequestSize]; getExpectedBufferData(0, readRequestSize, expectedFirstReadAheadBufferContents); getExpectedBufferData(readRequestSize, readAheadRequestSize, expectedSecondReadAheadBufferContents); assertTrue("Read should be of exact requested size", inputStream.read(firstReadBuffer, 0, readRequestSize) == readRequestSize); assertTrue("Data mismatch found in RAH1", Arrays.equals(firstReadBuffer, expectedFirstReadAheadBufferContents)); assertTrue("Read should be of exact requested size", inputStream.read(secondReadBuffer, 0, readAheadRequestSize) == readAheadRequestSize); assertTrue("Data mismatch found in RAH2", Arrays.equals(secondReadBuffer, expectedSecondReadAheadBufferContents)); }

Target:
private void testReadAheads(AbfsInputStream inputStream, int readRequestSize, int readAheadRequestSize) throws Exception { if (readRequestSize > readAheadRequestSize) { readAheadRequestSize = readRequestSize; } byte[] firstReadBuffer = new byte[readRequestSize]; byte[] secondReadBuffer = new byte[readAheadRequestSize]; byte[] expectedFirstReadAheadBufferContents = new byte[readRequestSize]; byte[] expectedSecondReadAheadBufferContents = new byte[readAheadRequestSize]; getExpectedBufferData(0, readRequestSize, expectedFirstReadAheadBufferContents); getExpectedBufferData(readRequestSize, readAheadRequestSize, expectedSecondReadAheadBufferContents); Assertions.assertThat(inputStream.read(firstReadBuffer, 0, readRequestSize)) .describedAs("Read should be of exact requested size") .isEqualTo(readRequestSize); assertTrue("Data mismatch found in RAH1", Arrays.equals(firstReadBuffer, expectedFirstReadAheadBufferContents)); Assertions.assertThat(inputStream.read(secondReadBuffer, 0, readAheadRequestSize)) .describedAs("Read should be of exact requested size") .isEqualTo(readAheadRequestSize); assertTrue("Data mismatch found in RAH2", Arrays.equals(secondReadBuffer, expectedSecondReadAheadBufferContents)); }
Source:
private boolean canConnectToConsole() { final VM vm = getVm(); if (vm.getAllowConsoleReconnect()) { return true; } userHasReconnectPermission = checkUserAuthorization(ActionGroup.RECONNECT_TO_VM, MultiLevelAdministrationHandler.SYSTEM_OBJECT_ID, VdcObjectType.System); if (userHasReconnectPermission) { return true; } final String currentName = getCurrentUser().getUserName(); final NGuid currentId = getCurrentUser().getUserId(); final String previousName = vm.getConsoleUserName(); final NGuid previousId = vm.getConsoleUserId(); if (previousId != null && !previousId.equals(currentId)) { log.warnFormat("User \"{0}\" is trying to set a ticket for virtual machine \"{1}\" but the machine is already in use by \"{2}\".", currentName, vm.getvm_name(), previousName); log.warnFormat("The id of user \"{0}\" is \"{1}\".", currentName, currentId); log.warnFormat("The id of user \"{0}\" is \"{1}\".", previousName, previousId); log.warnFormat("The id of virtual machine \"{0}\" is \"{1}\".", vm.getvm_name(), vm.getvm_guid()); log.warnFormat("The ticket will not be set."); addCanDoActionMessage(VdcBllMessages.USER_NOT_AUTHORIZED_TO_PERFORM_ACTION); return false; } return true; }

Target:
private boolean canConnectToConsole() { final VM vm = getVm(); if (vm.getAllowConsoleReconnect()) { return true; } userHasReconnectPermission = checkUserAuthorization(ActionGroup.RECONNECT_TO_VM, MultiLevelAdministrationHandler.SYSTEM_OBJECT_ID, VdcObjectType.System); if (userHasReconnectPermission) { return true; } final NGuid currentId = getCurrentUser().getUserId(); final NGuid previousId = vm.getConsoleUserId(); if (previousId != null && !previousId.equals(currentId)) { log.warnFormat("User \"{0}\" is trying to set a ticket for virtual machine \"{1}\" but the machine is already in use by \"{2}\".", currentId, vm.getId(), previousId); addCanDoActionMessage(VdcBllMessages.USER_NOT_AUTHORIZED_TO_PERFORM_ACTION); return false; } return true; }
Source:
private void checkFieldType(int field, Set<Type> expectedTypes) { Type actual = getType(field); checkArgument(expectedTypes.contains(actual), "Field %s expected type inconsistent with %s", field, actual); StringBuilder builder = new StringBuilder(); for (Type type : expectedTypes) { builder.append(", "); builder.append(type.getDisplayName()); } }

Target:
private void checkFieldType(int field, Set<Type> expectedTypes) { checkArgument(expectedTypes.contains(getType(field)), "Field %s expected type inconsistent with %s", field, getType(field)); }
Source:
private void setClockProvider(String clockProviderFqcn, ClassLoader externalClassLoader) { if ( clockProviderFqcn != null ) { try { @SuppressWarnings("unchecked") Class<? extends ClockProvider> clazz = (Class<? extends ClockProvider>) run( LoadClass.action( clockProviderFqcn, externalClassLoader ) ); clockProvider = run( NewInstance.action( clazz, "clock provider class" ) ); log.usingClockProvider( clazz ); } catch (ValidationException e) { throw log.getUnableToInstantiateParameterNameProviderClassException( clockProviderFqcn, e ); } } }

Target:
private void setClockProvider(String clockProviderFqcn, ClassLoader externalClassLoader) { if ( clockProviderFqcn != null ) { try { @SuppressWarnings("unchecked") Class<? extends ClockProvider> clazz = (Class<? extends ClockProvider>) run( LoadClass.action( clockProviderFqcn, externalClassLoader ) ); clockProvider = run( NewInstance.action( clazz, "clock provider class" ) ); log.usingClockProvider( clazz ); } catch (ValidationException e) { throw log.getUnableToInstantiateClockProviderClassException( clockProviderFqcn, e ); } } }
Source:
private void checkPendingCheckpointCompletedFuturesSize() { while (pendingCheckpointCompletedFutures.size() > MAX_TRACKED_CHECKPOINTS) { Long minCheckpointID = Collections.min(pendingCheckpointCompletedFutures.keySet()); pendingCheckpointCompletedFutures.remove(minCheckpointID).completeExceptionally(new IllegalStateException("Too many pending checkpoints")); } }

Target:
private void checkPendingCheckpointCompletedFuturesSize() { if (pendingCheckpointCompletedFutures.size() > MAX_TRACKED_CHECKPOINTS) { ArrayList<Long> pendingCheckpointIds = new ArrayList<>(pendingCheckpointCompletedFutures.keySet()); pendingCheckpointIds.sort(Long::compareTo); for (Long checkpointId : pendingCheckpointIds.subList(0, pendingCheckpointIds.size() - MAX_TRACKED_CHECKPOINTS)) { pendingCheckpointCompletedFutures.remove(checkpointId).completeExceptionally(new IllegalStateException("Too many pending checkpoints")); } } }