auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public InlineFixedWidthHexIntegerURIHandler(final String namespace, final int fixedWidth) { super(namespace); this.fixedWidth = fixedWidth; zeroPadding = new StringBuilder(); for (int i = 0; i < fixedWidth; i++) { zeroPadding.append('0'); } }

Target:
public InlineFixedWidthHexIntegerURIHandler(final String namespace, final int fixedWidth) { super(namespace); this.fixedWidth = fixedWidth; zeroPadding = new StringBuilder(fixedWidth); for (int i = 0; i < fixedWidth; i++) { zeroPadding.append('0'); } }
Source:
public int compare(ProtoSnippet o1, ProtoSnippet o2) { if (Float.compare(o1.weight, o2.weight) != 0) { return o1.weight > o2.weight ? -1 : 1; } return 0; }

Target:
public int compare(ProtoSnippet o1, ProtoSnippet o2) { if (o1.maxStartOffset != o2.maxStartOffset) { return o1.maxStartOffset < o2.maxStartOffset ? -1 : 1; } if (o1.minEndOffset != o2.minEndOffset) { return o1.minEndOffset < o2.minEndOffset ? -1 : 1; } return 0; }
Source:
public void cleanup() throws IOException { long start = System.currentTimeMillis(); System.out.println("About to invoke cluster.cleanup()"); if (plaintextCluster != null) { plaintextCluster.cleanup(); } System.out.println("ServerPlaintextTokenTest::cluster.cleanup() took " + (System.currentTimeMillis() - start) + " ms."); }

Target:
public void cleanup() throws IOException { long start = System.currentTimeMillis(); System.out.println("ServerPlaintextTokenTest::About to invoke cluster.cleanup()"); if (plaintextCluster != null) { plaintextCluster.cleanup(); } System.out.println( "ServerPlaintextTokenTest::cluster.cleanup() took " + (System.currentTimeMillis() - start) + " ms."); }
Source:
private boolean securityKeyExpired(final SecurityKey securityKey) { final Date now = new Date(); final Date validTo = securityKey.getValidTo(); return (validTo != null && validTo.before(now)); }

Target:
private boolean securityKeyExpired(final SecurityKey securityKey) { final Date now = new Date(); final Date validTo = securityKey.getValidTo(); return validTo != null && validTo.before(now); }
Source:
public RunQuickAccessProvider() { super(DebugPlugin.getDefault().getLaunchManager().getLaunchMode("run")); }

Target:
public RunQuickAccessProvider() { super(DebugPlugin.getDefault().getLaunchManager().getLaunchMode(ILaunchManager.RUN_MODE)); }
Source:
public static void main(String[] args) throws IOException, GeneralSecurityException { Options options = OptionsParser.parse(args, Options.class, TransmissionProbability.class.getSimpleName()); options.validateOptions(); GenomicsAuth auth = options.getGenomicsAuth(); GetVariantsSummaryResponse summary = auth.getService().variants().getSummary() .setDatasetId(options.datasetId).setFields("contigBounds").execute(); List<SearchVariantsRequest> requests = getVariantRequests(summary, options); Pipeline p = Pipeline.create(); DataflowWorkarounds.registerGenomicsCoders(p); DataflowWorkarounds.getPCollection(requests, p, options.numWorkers) .apply(ParDo.named("VariantReader") .of(new VariantReader(auth, VARIANT_FIELDS))) .apply(ParDo.named("ExtractFamilyVariantStatus") .of(new ExtractFamilyVariantStatus())) .apply(GroupByKey.<String, Boolean>create()) .apply(ParDo.named("CalculateTransmissionProbability") .of(new DoFn<KV<String, Iterable<Boolean>>, KV<String, Double>>() { @Override public void processElement(ProcessContext c) { KV<String, Iterable<Boolean>> input = c.element(); long m=0,f=0; for (Boolean b : input.getValue()) { if (b) m++; else f++; } double tdt = Math.pow(m-f, 2.0) / (m+f); c.output(KV.of(input.getKey(), tdt)); } })) .apply(ParDo.named("WriteDataToFile") .of(new DoFn<KV<String, Double>, String>() { @Override public void processElement(ProcessContext c) { KV<String, Double> pair = c.element(); String output = "Id : " + pair.getKey(); output += "\tValue:" + pair.getValue() + "\n"; c.output(output); } })) .apply(TextIO.Write.named("WriteCounts").to(options.output)); p.run(DataflowWorkarounds.getRunner(options)); }

Target:
public static void main(String[] args) throws IOException, GeneralSecurityException { Options options = OptionsParser.parse(args, Options.class, TransmissionProbability.class.getSimpleName()); options.validateOptions(); GenomicsAuth auth = options.getGenomicsAuth(); List<SearchVariantsRequest> requests = getVariantRequests(auth, options); Pipeline p = GenomicsPipeline.create(options); DataflowWorkarounds.registerGenomicsCoders(p); DataflowWorkarounds.getPCollection(requests, p, options.numWorkers) .apply(ParDo.named("VariantReader") .of(new VariantReader(auth, VARIANT_FIELDS))) .apply(ParDo.named("ExtractFamilyVariantStatus") .of(new ExtractAlleleTransmissionStatus())) .apply(GroupByKey.<Allele, Boolean>create()) .apply(ParDo.named("CalculateTransmissionProbability") .of(new CalculateTransmissionProbability())) .apply(ParDo.named("WriteDataToFile") .of(new DoFn<KV<Allele, Double>, String>() { @Override public void processElement(ProcessContext c) { KV<Allele, Double> pair = c.element(); String output = pair.getKey().getReferenceName() + "\t" + pair.getKey().getAllele() + "\t" + pair.getValue() + "\n"; c.output(output); } })) .apply(TextIO.Write.named("WriteResults").to(options.output)); p.run(); }
Source:
public Boolean extract(Cursor cursor, Column column) { int columnIndex = cursor.getColumnIndex(column.getName()); if (cursor.isNull(columnIndex)) { return null; } try { int intValue = cursor.getInt(columnIndex); if (intValue != 0 && intValue != 1) { throw new NumberFormatException("A Boolean Column must have the value 0 or 1"); } return (intValue == 1); } catch (NumberFormatException e) { String value = cursor.getString(columnIndex); throw new IllegalStateException("Cannot extract Boolean value from Column " + column.getName() + ". Cannot convert value stored in column to a Boolean : " + value); } }

Target:
public Boolean extract(Cursor cursor, Column column) { int columnIndex = cursor.getColumnIndex(column.getName()); if (columnIndex < 0) { throw new IllegalArgumentException("Column with name " + column.getName() + " not found."); } if (cursor.isNull(columnIndex)) { return null; } try { int intValue = cursor.getInt(columnIndex); if (intValue != 0 && intValue != 1) { throw new NumberFormatException("A Boolean Column must have the value 0 or 1"); } return (intValue == 1); } catch (NumberFormatException e) { String value = cursor.getString(columnIndex); throw new IllegalStateException("Cannot extract Boolean value from Column " + column.getName() + ". Cannot convert value stored in column to a Boolean : " + value); } }
Source:
public <T> Mono<T> insert(String containerName, Object objectToSave, PartitionKey partitionKey) { Assert.hasText(containerName, "containerName should not be null, empty or only whitespaces"); Assert.notNull(objectToSave, "objectToSave should not be null"); final Class<T> domainType = (Class<T>) objectToSave.getClass(); generateIdIfNullAndAutoGenerationEnabled(objectToSave, domainType); final JsonNode originalItem = prepareToPersistAndConvertToItemProperties(objectToSave); final CosmosItemRequestOptions options = new CosmosItemRequestOptions(); CosmosAsyncContainer cosmosAsyncContainer = cosmosAsyncClient.getDatabase(this.databaseName) .getContainer(containerName); Mono<CosmosItemResponse<JsonNode>> item; if (partitionKey == null) { item = cosmosAsyncContainer.createItem(originalItem, options); } else { item = cosmosAsyncContainer.createItem(originalItem, partitionKey, options); } return item.publishOn(Schedulers.parallel()) .onErrorResume(throwable -> CosmosExceptionUtils.exceptionHandler("Failed to insert item", throwable)) .flatMap(cosmosItemResponse -> { CosmosUtils.fillAndProcessResponseDiagnostics(this.responseDiagnosticsProcessor, cosmosItemResponse.getDiagnostics(), null); return Mono.just(toDomainObject(domainType, cosmosItemResponse.getItem())); }); }

Target:
public <T> Mono<T> insert(String containerName, Object objectToSave, PartitionKey partitionKey) { Assert.hasText(containerName, "containerName should not be null, empty or only whitespaces"); Assert.notNull(objectToSave, "objectToSave should not be null"); final Class<T> domainType = (Class<T>) objectToSave.getClass(); generateIdIfNullAndAutoGenerationEnabled(objectToSave, domainType); final JsonNode originalItem = prepareToPersistAndConvertToItemProperties(objectToSave); final CosmosItemRequestOptions options = new CosmosItemRequestOptions(); return cosmosAsyncClient .getDatabase(this.databaseName) .getContainer(containerName) .createItem(originalItem, partitionKey, options) .publishOn(Schedulers.parallel()) .onErrorResume(throwable -> CosmosExceptionUtils.exceptionHandler("Failed to insert item", throwable)) .flatMap(cosmosItemResponse -> { CosmosUtils.fillAndProcessResponseDiagnostics(this.responseDiagnosticsProcessor, cosmosItemResponse.getDiagnostics(), null); return Mono.just(toDomainObject(domainType, cosmosItemResponse.getItem())); }); }
Source:
public CustomizedScanInfoBuilder(ScanInfo scanInfo, Scan scan) throws IOException { this.scanInfo = scanInfo; this.scan = new Scan(scan); }

Target:
public CustomizedScanInfoBuilder(ScanInfo scanInfo, Scan scan) { this.scanInfo = scanInfo; try { this.scan = new Scan(scan); } catch (IOException e) { throw new AssertionError("Scan should not throw IOException", e); } }
Source:
public void refresh() { query = getStringExtra(QUERY); super.refresh(true); }

Target:
public void refresh() { query = getStringExtra(QUERY); super.refresh(); }
Source:
private static Map<String, String> createMapForSimpleDataTypes() { Map<String, String> mapDataTypeNamesToDisplayNames = new HashMap<>(); for (String simpleDataType : simpleDataTypes) { mapDataTypeNamesToDisplayNames.put(simpleDataType, simpleDataType); } return mapDataTypeNamesToDisplayNames; }

Target:
static Map<String, String> createMapForSimpleDataTypes() { if (simpleDataTypes == null) { return new HashMap<>(); } return simpleDataTypes.stream().collect(toMap(x -> x, x -> x)); }
Source:
private void attachNetwork(Guid clusterId, NetworkCluster networkCluster, Network network) { getNetworkClusterDao().save(new NetworkCluster(clusterId, network.getId(), NetworkStatus.OPERATIONAL, false, networkCluster.isRequired(), false, false, false)); List<VDS> hosts = getVdsDao().getAllForVdsGroup(clusterId); List<Network> clusterNetworks = networkDao.getAllForCluster(clusterId); for (VDS host : hosts) { HostNetworkAttachmentsPersister persister = new HostNetworkAttachmentsPersister(this.networkAttachmentDao, host.getId(), interfaceDao.getAllInterfacesForVds(host.getId()), Collections.<NetworkAttachment> emptyList(), clusterNetworks); persister.persistNetworkAttachments(); } if (network.getCluster().isDisplay()) { final DisplayNetworkClusterHelper displayNetworkClusterHelper = new DisplayNetworkClusterHelper( getNetworkClusterDao(), getVmDao(), networkCluster, network.getName(), auditLogDirector); if (displayNetworkClusterHelper.isDisplayToBeUpdated()) { displayNetworkClusterHelper.warnOnActiveVm(); } getNetworkClusterDao().setNetworkExclusivelyAsDisplay(clusterId, network.getId()); } if (network.getCluster().isMigration()) { getNetworkClusterDao().setNetworkExclusivelyAsMigration(clusterId, network.getId()); } NetworkClusterHelper.setStatus(clusterId, network); }

Target:
private void attachNetwork(Guid clusterId, NetworkCluster networkCluster, Network network) { getNetworkClusterDao().save(new NetworkCluster(clusterId, network.getId(), NetworkStatus.OPERATIONAL, false, networkCluster.isRequired(), false, false, false)); List<VDS> hosts = vdsDao.getAllForVdsGroup(clusterId); List<Network> clusterNetworks = networkDao.getAllForCluster(clusterId); for (VDS host : hosts) { HostNetworkAttachmentsPersister persister = new HostNetworkAttachmentsPersister(this.networkAttachmentDao, host.getId(), interfaceDao.getAllInterfacesForVds(host.getId()), Collections.<NetworkAttachment> emptyList(), clusterNetworks); persister.persistNetworkAttachments(); } if (network.getCluster().isDisplay()) { final DisplayNetworkClusterHelper displayNetworkClusterHelper = new DisplayNetworkClusterHelper( getNetworkClusterDao(), getVmDao(), networkCluster, network.getName(), auditLogDirector); if (displayNetworkClusterHelper.isDisplayToBeUpdated()) { displayNetworkClusterHelper.warnOnActiveVm(); } getNetworkClusterDao().setNetworkExclusivelyAsDisplay(clusterId, network.getId()); } if (network.getCluster().isMigration()) { getNetworkClusterDao().setNetworkExclusivelyAsMigration(clusterId, network.getId()); } NetworkClusterHelper.setStatus(clusterId, network); }
Source:
public static void listFiles(Path projectPath, PathConsumer consumer) throws IOException { listFilesRecursively(projectPath, projectPath, consumer, new HashSet<>()); }

Target:
static void listFiles(Path projectPath, PathConsumer consumer) throws IOException { listFilesRecursively(projectPath, projectPath, consumer, new HashSet<>()); }
Source:
public ChildrenIterator(E root) { this.expectedModCount = Graph.this.modcount; this.iteratorStack = new LinkedList<Iterator<Node<E>>>(); iteratorStack.add(Iterators.singletonIterator(Graph.this.nodes.get(root))); consumedNodes = new LinkedHashSet<Node<E>>(); }

Target:
public ChildrenIterator(E root) { this.expectedModCount = Graph.this.modcount; this.iteratorStack = new LinkedList<Iterator<Node<E>>>(); iteratorStack.add(Iterators.singletonIterator(Graph.this.nodes.get(root))); consumedNodes = new HashSet<Node<E>>(); }
Source:
public <T> Class<? extends T> loadClass(CatalogItem<T> item) { if (log.isDebugEnabled()) log.debug("Instantiating catalog item "+item); Preconditions.checkNotNull(item); CatalogItemDo<?> loadedItem = getCatalogItemDo(item.getId()); if (loadedItem==null) throw new NoSuchElementException("Unable to load '"+item.getId()+"' to instantiate it"); return (Class<? extends T>) loadedItem.getJavaClass(); }

Target:
public <T> Class<? extends T> loadClass(CatalogItem<T> item) { if (log.isDebugEnabled()) log.debug("Loading class for catalog item "+item); Preconditions.checkNotNull(item); CatalogItemDo<?> loadedItem = getCatalogItemDo(item.getId()); if (loadedItem==null) throw new NoSuchElementException("Unable to load '"+item.getId()+"' to instantiate it"); return (Class<? extends T>) loadedItem.getJavaClass(); }
Source:
public void testCastNullToColumnTypes() { String tableName = "test_cast_null_to_column_types"; Session session = Session.builder(getSession()) .setCatalogSessionProperty(catalog, "orc_optimized_writer_enabled", "true") .build(); assertUpdate(session, "" + "CREATE TABLE " + tableName + " (" + " col1 bigint," + " col2 map(bigint, bigint)," + " partition_key varchar)" + "WITH (" + " format = 'ORC', " + " partitioned_by = ARRAY[ 'partition_key' ] " + ")"); assertUpdate( session, "INSERT INTO " + tableName + " (col1) " + "VALUES " + " (1), " + " (2), " + " (3)", 3); assertUpdate("DROP TABLE " + tableName); }

Target:
public void testCastNullToColumnTypes() { String tableName = "test_cast_null_to_column_types"; Session session = Session.builder(getSession()) .setCatalogSessionProperty(catalog, "orc_optimized_writer_enabled", "true") .build(); assertUpdate(session, "" + "CREATE TABLE " + tableName + " (" + " col1 bigint," + " col2 map(bigint, bigint)," + " partition_key varchar)" + "WITH (" + " format = 'ORC', " + " partitioned_by = ARRAY[ 'partition_key' ] " + ")"); assertUpdate(session, format("INSERT INTO %s (col1) VALUES (1), (2), (3)", tableName), 3); assertUpdate("DROP TABLE " + tableName); }
Source:
public void removeContainersWithoutContents() { ListIterator<BriefObjectMetadata> resultIt = this.getResultList().listIterator(this.getResultList().size()); while (resultIt.hasPrevious()) { BriefObjectMetadata briefObject = resultIt.previous(); if (briefObject == null || briefObject.getResourceType() == null) { continue; } String resourceType = briefObject.getResourceType(); if ((!briefObject.getCountMap().containsKey("child") || briefObject.getCountMap().get("child") == 0) && !ResourceType.File.equals(resourceType)) { if (this.matchingContainerPids != null && this.matchingContainerPids.contains(briefObject.getId())) { } else { log.debug("Removing container " + briefObject.getId() + "from hierarchical result because it has no children"); resultIt.remove(); if (briefObject.getAncestorPathFacet() != null && briefObject.getAncestorPathFacet().getFacetNodes() != null) { for (HierarchicalFacetNode facetTier : briefObject.getAncestorPathFacet().getFacetNodes()) { String tierIdentifier = facetTier.getSearchValue(); Long count = this.subcontainerCounts.get(tierIdentifier); if (count != null) { this.subcontainerCounts.put(tierIdentifier, count - 1); } } } } } } }

Target:
public void removeContainersWithoutContents() { ListIterator<BriefObjectMetadata> resultIt = this.getResultList().listIterator(this.getResultList().size()); while (resultIt.hasPrevious()) { BriefObjectMetadata briefObject = resultIt.previous(); if (briefObject == null || briefObject.getResourceType() == null) { continue; } String resourceType = briefObject.getResourceType(); if ((!briefObject.getCountMap().containsKey("child") || briefObject.getCountMap().get("child") == 0) && !ResourceType.File.equals(resourceType)) { if (this.matchingContainerPids != null && this.matchingContainerPids.contains(briefObject.getId())) { } else { log.debug("Removing container " + briefObject.getId() + "from hierarchical result because it has no children"); resultIt.remove(); } } } }
Source:
private void onSave() { UnitVmModel model = (UnitVmModel) getWindow(); if (!model.validate()) { return; } String name = model.getName().getEntity(); boolean isBaseTemplate = false; if (model.getBehavior().isExistingTemplateBehavior()) { isBaseTemplate = ((TemplateVmModelBehavior) model.getBehavior()).getVmTemplate().isBaseTemplate(); } else if (model.getBehavior().isBlankTemplateBehavior()) { isBaseTemplate = true; } if (isBaseTemplate) { AsyncDataProvider.getInstance().isTemplateNameUnique(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { TemplateListModel templateListModel = (TemplateListModel) target; boolean isNameUnique = (Boolean) returnValue; templateListModel.postNameUniqueCheck(isNameUnique); } }), name, model.getDataCenterWithClustersList().getSelectedItem().getDataCenter().getId()); } else { postNameUniqueCheck(true); } }

Target:
private void onSave() { UnitVmModel model = (UnitVmModel) getWindow(); if (!model.validate()) { return; } String name = model.getName().getEntity(); boolean isBaseTemplate = false; if (model.getBehavior().isExistingTemplateBehavior()) { isBaseTemplate = ((TemplateVmModelBehavior) model.getBehavior()).getVmTemplate().isBaseTemplate(); } else if (model.getBehavior().isBlankTemplateBehavior()) { isBaseTemplate = true; } if (isBaseTemplate) { AsyncDataProvider.getInstance().isTemplateNameUnique(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { TemplateListModel templateListModel = (TemplateListModel) target; boolean isNameUnique = (Boolean) returnValue; templateListModel.postNameUniqueCheck(isNameUnique); } }), name, model.getSelectedDataCenter().getId()); } else { postNameUniqueCheck(true); } }
Source:
public void checkAutomaticChangeContributeToFalse() { openContributeTab(); setStateContributeChecboxAndCloseForm(true); projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); pullRequestPanel.waitOpenPanel(); pullRequestPanel.clickHideButtonAndWaitClosePanel(); notificationsPopupPanel.waitExpectedMessageOnProgressPanelAndClosed(NOTIFICATION_MESS); openContributeTab(); preferences.waitContributeCheckboxIsNotSelected(); setStateContributeChecboxAndCloseForm(true); projectExplorer.waitAndSelectItem(SECOND_PROJECT_NAME); pullRequestPanel.waitOpenPanel(); pullRequestPanel.openOptionsMenu(); pullRequestPanel.clickContextHideButtonAndWAitClosedPanel(); notificationsPopupPanel.waitExpectedMessageOnProgressPanelAndClosed(NOTIFICATION_MESS); openContributeTab(); preferences.waitContributeCheckboxIsNotSelected(); setStateContributeChecboxAndCloseForm(true); projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); pullRequestPanel.waitOpenPanel(); pullRequestPanel.clickPullRequestBtn(); menu.runCommand(ASSISTANT, TOOL_WINDOWS, CONTRIBUTE_TOOL_WIDOWS); pullRequestPanel.waitClosePanel(); openContributeTab(); preferences.waitContributeCheckboxIsNotSelected(); preferences.clickOnCloseBtnAndWaitClosedForm(); }

Target:
public void checkAutomaticChangeContributeToFalse() { openContributeTab(); setStateContributeChecboxAndCloseForm(true); projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); pullRequestPanel.waitOpenPanel(); pullRequestPanel.closePanelByHideButton(); notificationsPopupPanel.waitExpectedMessageOnProgressPanelAndClosed(NOTIFICATION_MESSAGE); openContributeTab(); preferences.waitContributeCheckboxIsNotSelected(); setStateContributeChecboxAndCloseForm(true); projectExplorer.waitAndSelectItem(SECOND_PROJECT_NAME); pullRequestPanel.waitOpenPanel(); pullRequestPanel.openOptionsMenu(); pullRequestPanel.closePanelFromContextMenu(); notificationsPopupPanel.waitExpectedMessageOnProgressPanelAndClosed(NOTIFICATION_MESSAGE); openContributeTab(); preferences.waitContributeCheckboxIsNotSelected(); setStateContributeChecboxAndCloseForm(true); projectExplorer.waitAndSelectItem(FIRST_PROJECT_NAME); pullRequestPanel.waitOpenPanel(); pullRequestPanel.clickPullRequestBtn(); menu.runCommand(ASSISTANT, TOOL_WINDOWS, CONTRIBUTE_TOOL_WIDOWS); pullRequestPanel.waitClosePanel(); openContributeTab(); preferences.waitContributeCheckboxIsNotSelected(); preferences.closeForm(); }
Source:
public GeofenceCircle() { super(); }

Target:
public GeofenceCircle() { }
Source:
public void testAsyncTaskWithMultiplePartitionMultithreaded() throws Exception { Map<Integer, List<KV>> input = new HashMap<>(); Map<Integer, List<Integer>> output = new HashMap<>(); List<Integer> partition = Arrays.asList(1, 2, 3, 4, 5); List<Integer> outputPartition = partition.stream().map(x -> x * 10).collect(Collectors.toList()); for (int i = 0; i < 5; i++) { List<KV> keyedPartition = new ArrayList<>(); for (Integer val : partition) { keyedPartition.add(KV.of(i, val)); } input.put(i, keyedPartition); output.put(i, new ArrayList<Integer>(outputPartition)); } CollectionStream<KV> inputStream = CollectionStream.of("async-test", "ints", input); CollectionStream outputStream = CollectionStream.empty("async-test", "ints-out", 5); TestRunner .of(MyAsyncStreamTask.class) .addInputStream(inputStream) .addOutputStream(outputStream) .addOverrideConfig("task.max.concurrency", "4") .run(Duration.ofSeconds(2)); StreamAssert.that(outputStream).containsInAnyOrder(output, Duration.ofMillis(1000)); }

Target:
public void testAsyncTaskWithMultiplePartitionMultithreaded() throws Exception { Map<Integer, List<KV>> inputPartitionData = new HashMap<>(); Map<Integer, List<Integer>> expectedOutputPartitionData = new HashMap<>(); List<Integer> partition = Arrays.asList(1, 2, 3, 4, 5); List<Integer> outputPartition = partition.stream().map(x -> x * 10).collect(Collectors.toList()); for (int i = 0; i < 5; i++) { List<KV> keyedPartition = new ArrayList<>(); for (Integer val : partition) { keyedPartition.add(KV.of(i, val)); } inputPartitionData.put(i, keyedPartition); expectedOutputPartitionData.put(i, new ArrayList<Integer>(outputPartition)); } CollectionStream<KV> inputStream = CollectionStream.of("async-test", "ints", inputPartitionData); CollectionStream outputStream = CollectionStream.empty("async-test", "ints-out", 5); TestRunner .of(MyAsyncStreamTask.class) .addInputStream(inputStream) .addOutputStream(outputStream) .addOverrideConfig("task.max.concurrency", "4") .run(Duration.ofSeconds(2)); StreamAssert.containsInAnyOrder(outputStream, expectedOutputPartitionData, Duration.ofMillis(1000)); }
Source:
Set<AlternateHandle.Id> skipMe(Set<AlternateHandle.Id> skips) { Set<AlternateHandle.Id> withMe = new HashSet<AlternateHandle.Id>(); if (skips != null) withMe.addAll(skips); withMe.add(getAlternateId()); return withMe; }

Target:
Set<AlternateHandle.Id> skipMe(Set<AlternateHandle.Id> skips) { Set<AlternateHandle.Id> withMe = new HashSet<AlternateHandle.Id>(); if (skips != null) { withMe.addAll(skips); } withMe.add(getAlternateId()); return withMe; }
Source:
public boolean validateChecksum() { if (StringUtils.isNotBlank(checksum)) { try { return DigestHelper.check(checksum, new FileInputStream(downloadedFilePath)); } catch (IOException e) { throw new CloudRuntimeException("could not check sum for file: " + downloadedFilePath); } catch (NoSuchAlgorithmException e) { throw new CloudRuntimeException("Unknown checksum algorithm: " + checksum, e); } } return true; }

Target:
public boolean validateChecksum() { if (StringUtils.isNotBlank(checksum)) { try { return DigestHelper.check(checksum, new FileInputStream(downloadedFilePath)); } catch (IOException e) { throw new CloudRuntimeException("could not check sum for file: " + downloadedFilePath,e); } catch (NoSuchAlgorithmException e) { throw new CloudRuntimeException("Unknown checksum algorithm: " + checksum, e); } } return true; }
Source:
public String getFirstImageText() { waitForElementByElement(thumbnails.get(0)); int firstNumber = thumbnails.get(0).getAttribute("src").indexOf("px-"); int secondNumber = thumbnails.get(0).getAttribute("src").indexOf("-Wikia-Visualization-Main"); return thumbnails.get(0).getAttribute("src").substring(firstNumber + 3, secondNumber - 1); }

Target:
public String getFirstImageText() { int indexComparisonStart = thumbnails.get(0).getAttribute("src").indexOf("px-"); int indexComparisonFinish = thumbnails.get(0).getAttribute("src").indexOf("-Wikia-Visualization-Main"); return thumbnails.get(0).getAttribute("src").substring(indexComparisonStart + 3, indexComparisonFinish - 1); }
Source:
public PlannerTool(final Database database, byte[] catalogHash) { assert(database != null); m_database = database; m_catalogHash = catalogHash; m_cache = AdHocCompilerCache.getCacheForCatalogHash(catalogHash); m_hsql = HSQLInterface.loadHsqldb(); String binDDL = m_database.getSchema(); String ddl = Encoder.decodeBase64AndDecompress(binDDL); String[] commands = ddl.split("\n"); for (String command : commands) { String decoded_cmd = Encoder.hexDecodeToString(command); decoded_cmd = decoded_cmd.trim(); if (decoded_cmd.length() == 0) continue; try { m_hsql.runDDLCommand(decoded_cmd); } catch (HSQLParseException e) { throw new RuntimeException("Error creating hsql: " + e.getMessage() + " in DDL statement: " + decoded_cmd); } } if (hostLog.isDebugEnabled()) { hostLog.debug("hsql loaded"); } if (m_plannerStats == null) { synchronized (this.getClass()) { if (m_plannerStats == null) { final StatsAgent statsAgent = VoltDB.instance().getStatsAgent(); if (statsAgent != null) { m_plannerStats = new PlannerStatsCollector(-1); statsAgent.registerStatsSource(StatsSelector.PLANNER, -1, m_plannerStats); } } } } }

Target:
public PlannerTool(final Database database, byte[] catalogHash) { assert(database != null); m_database = database; m_catalogHash = catalogHash; m_cache = AdHocCompilerCache.getCacheForCatalogHash(catalogHash); m_hsql = HSQLInterface.loadHsqldb(); String binDDL = m_database.getSchema(); String ddl = Encoder.decodeBase64AndDecompress(binDDL); String[] commands = ddl.split("\n"); for (String command : commands) { String decoded_cmd = Encoder.hexDecodeToString(command); decoded_cmd = decoded_cmd.trim(); if (decoded_cmd.length() == 0) continue; try { m_hsql.runDDLCommand(decoded_cmd); } catch (HSQLParseException e) { throw new RuntimeException("Error creating hsql: " + e.getMessage() + " in DDL statement: " + decoded_cmd); } } hostLog.debug("hsql loaded"); if (m_plannerStats == null) { synchronized (this.getClass()) { if (m_plannerStats == null) { final StatsAgent statsAgent = VoltDB.instance().getStatsAgent(); if (statsAgent != null) { m_plannerStats = new PlannerStatsCollector(-1); statsAgent.registerStatsSource(StatsSelector.PLANNER, -1, m_plannerStats); } } } } }
Source:
public EntityController(DataServiceV3 dataServiceV3, EntityMapper entityMapper) { super(API_ENTITY_ID, 3); this.dataServiceV3 = requireNonNull(dataServiceV3); this.entityMapper = requireNonNull(entityMapper); }

Target:
EntityController(DataServiceV3 dataServiceV3, EntityMapper entityMapper) { super(API_ENTITY_ID, 3); this.dataServiceV3 = requireNonNull(dataServiceV3); this.entityMapper = requireNonNull(entityMapper); }
Source:
private boolean isManagerNode() { try { Registry configRegistry = BPELServiceComponent.getRegistryService().getConfigSystemRegistry(-1234); RegistryContext registryContext = configRegistry.getRegistryContext(); if (registryContext != null) { return !registryContext.isReadOnly(); } } catch (RegistryException e) { log.error("Error occurred while retrieving config registry", e); } return false; }

Target:
private boolean isManagerNode() { try { Registry configRegistry = BPELServiceComponent.getRegistryService().getConfigSystemRegistry( MultitenantConstants.SUPER_TENANT_ID); RegistryContext registryContext = configRegistry.getRegistryContext(); if (registryContext != null) { return !registryContext.isReadOnly(); } } catch (RegistryException e) { log.error("Error occurred while retrieving config registry", e); } return false; }
Source:
public synchronized void lock() { hasBeenInitialized = true; internalMap = ImmutableMap.copyOf(internalMap); }

Target:
private void lock() { hasBeenInitialized = true; internalMap = ImmutableMap.copyOf(internalMap); }
Source:
public void testHasChangedAttributesMultiple() { TaskAttribute attributeCustom = newData.getRoot().createAttribute("custom"); attributeCustom.setValue("1"); TaskAttribute attributeSummary = newData.getRoot().createAttribute(TaskAttribute.SUMMARY); attributeSummary.setValue("1"); TaskDataDiff diff = manger.createDiff(newData, oldData, new NullProgressMonitor()); assertTrue(diff.hasChanged()); }

Target:
public void testHasChangedAttributesMultiple() { TaskAttribute attributeCustom = newData.getRoot().createAttribute("custom"); attributeCustom.setValue("1"); TaskAttribute attributeSummary = newData.getRoot().createAttribute(TaskAttribute.SUMMARY); attributeSummary.setValue("1"); TaskDataDiff diff = manager.createDiff(newData, oldData, new NullProgressMonitor()); assertTrue(diff.hasChanged()); }
Source:
public static IOContainer fromConfig() { if ( FROM_CONFIG_INSTANCE == null ) { synchronized (IOContainer.class) { String driver = configuration.getStringProperty(CoreConfig.CASSANDRA_DRIVER); FROM_CONFIG_INSTANCE = new IOContainer(DriverType.getDriverType(driver)); } } return FROM_CONFIG_INSTANCE; }

Target:
public static synchronized IOContainer fromConfig() { if ( FROM_CONFIG_INSTANCE == null ) { String driver = configuration.getStringProperty(CoreConfig.CASSANDRA_DRIVER); FROM_CONFIG_INSTANCE = new IOContainer(DriverType.getDriverType(driver)); } return FROM_CONFIG_INSTANCE; }
Source:
public <T extends Event> void offerPaymentStateTransition( String externalId, ChargeStatus fromChargeState, ChargeStatus targetChargeState, ChargeEventEntity chargeEventEntity, Class<T> eventClass) { PaymentStateTransition transition = new PaymentStateTransition(chargeEventEntity.getId(), eventClass); stateTransitionQueue.offer(transition); var logMessage = format("Offered payment state transition to emitter queue [from=%s] [to=%s] [chargeEventId=%s] [chargeId=%s]", fromChargeState, targetChargeState, chargeEventEntity.getId(), externalId); metricRegistry.counter(String.format( "gateway-operations.%s.%s.%s.payment-state-transition-to.%s", chargeEventEntity.getChargeEntity().getGatewayAccount().getGatewayName(), chargeEventEntity.getChargeEntity().getGatewayAccount().getType(), chargeEventEntity.getChargeEntity().getGatewayAccount().getId(), targetChargeState)).inc(); Object[] structuredArgs = ArrayUtils.addAll( chargeEventEntity.getChargeEntity().getStructuredLoggingArgs(), kv("from_state", fromChargeState), kv("to_state", targetChargeState)); logger.info(logMessage, structuredArgs); eventService.recordOfferedEvent(ResourceType.PAYMENT, externalId, Event.eventTypeForClass(eventClass), chargeEventEntity.getUpdated()); }

Target:
public <T extends Event> void offerPaymentStateTransition( String externalId, ChargeStatus fromChargeState, ChargeStatus targetChargeState, ChargeEventEntity chargeEventEntity, Class<T> eventClass) { PaymentStateTransition transition = new PaymentStateTransition(chargeEventEntity.getId(), eventClass); stateTransitionQueue.offer(transition); var logMessage = format("Offered payment state transition to emitter queue [from=%s] [to=%s] [chargeEventId=%s] [chargeId=%s]", fromChargeState, targetChargeState, chargeEventEntity.getId(), externalId); metricRegistry.counter(String.format( "state-transition.%s.%s.%s.to.%s", chargeEventEntity.getChargeEntity().getGatewayAccount().getType(), chargeEventEntity.getChargeEntity().getGatewayAccount().getGatewayName(), chargeEventEntity.getChargeEntity().getGatewayAccount().getId(), targetChargeState)).inc(); Object[] structuredArgs = ArrayUtils.addAll( chargeEventEntity.getChargeEntity().getStructuredLoggingArgs(), kv("from_state", fromChargeState), kv("to_state", targetChargeState)); logger.info(logMessage, structuredArgs); eventService.recordOfferedEvent(ResourceType.PAYMENT, externalId, Event.eventTypeForClass(eventClass), chargeEventEntity.getUpdated()); }
Source:
private void addReviewers(ChangeResource rsrc, PostResult result, Map<Account.Id, ChangeControl> reviewers) throws OrmException, EmailException, IOException { ReviewDb db = dbProvider.get(); ChangeUpdate update = updateFactory.create(rsrc.getChange()); List<PatchSetApproval> added; db.changes().beginTransaction(rsrc.getChange().getId()); try { ChangeUtil.bumpRowVersionNotLastUpdatedOn(rsrc.getChange().getId(), db); added = approvalsUtil.addReviewers(db, rsrc.getNotes(), update, rsrc.getControl().getLabelTypes(), rsrc.getChange(), reviewers.keySet()); db.commit(); } finally { db.rollback(); } CheckedFuture<?, IOException> indexFuture = indexer.indexAsync(rsrc.getChange().getId()); update.commit(); result.reviewers = Lists.newArrayListWithCapacity(added.size()); for (PatchSetApproval psa : added) { result.reviewers.add(json.format( new ReviewerInfo(psa.getAccountId()), rsrc.getNotes(), reviewers.get(psa.getAccountId()), ImmutableList.of(psa))); } accountLoaderFactory.create(true).fill(result.reviewers); postAdd(rsrc.getChange(), added); indexFuture.checkedGet(); }

Target:
private void addReviewers(ChangeResource rsrc, PostResult result, Map<Account.Id, ChangeControl> reviewers) throws OrmException, EmailException, IOException { ReviewDb db = dbProvider.get(); ChangeUpdate update = updateFactory.create(rsrc.getChange()); List<PatchSetApproval> added; db.changes().beginTransaction(rsrc.getChange().getId()); try { ChangeUtil.bumpRowVersionNotLastUpdatedOn(rsrc.getChange().getId(), db); added = approvalsUtil.addReviewers(db, rsrc.getNotes(), update, rsrc.getControl().getLabelTypes(), rsrc.getChange(), reviewers.keySet()); db.commit(); } finally { db.rollback(); } update.commit(); CheckedFuture<?, IOException> indexFuture = indexer.indexAsync(rsrc.getChange().getId()); result.reviewers = Lists.newArrayListWithCapacity(added.size()); for (PatchSetApproval psa : added) { result.reviewers.add(json.format( new ReviewerInfo(psa.getAccountId()), rsrc.getNotes(), reviewers.get(psa.getAccountId()), ImmutableList.of(psa))); } accountLoaderFactory.create(true).fill(result.reviewers); postAdd(rsrc.getChange(), added); indexFuture.checkedGet(); }
Source:
private SortQueryOperation validateAndGetChildSort(QueryOperation child, PostResolverFactory postResolverFactory) { final SortQueryOperation previousSort; if (child instanceof SortQueryOperation) { previousSort = (SortQueryOperation) child; } else { previousSort = (SortQueryOperation) createSort(Collections.emptyList(), child, postResolverFactory); } return previousSort; }

Target:
private SortQueryOperation validateAndGetChildSort(QueryOperation child, PostResolverFactory postResolverFactory) { final SortQueryOperation previousSort; if (child instanceof SortQueryOperation) { previousSort = (SortQueryOperation) child; } else { previousSort = (SortQueryOperation) createSort(Collections.emptyList(), child, postResolverFactory); } if ((previousSort).getFetch() != -1) { throw new ValidationException("FETCH is already defined."); } return previousSort; }
Source:
public static String regularURL(String url){ String url_regularized = null; if (url.startsWith("https://")){ url_regularized = url.substring(8, url.length()); } else if (url.startsWith("http://")) { url_regularized = url.substring(7, url.length()); } else return url; return url_regularized; }

Target:
public static String regularURL(String url){ String url_regularized = null; if (url.startsWith(HTTPS_SCHEME)){ url_regularized = url.substring(8, url.length()); } else if (url.startsWith(HTTP_SCHEME)) { url_regularized = url.substring(7, url.length()); } else return url; return url_regularized; }
Source:
public void test4_10CopyExperiment() { SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), TRACE_NAME); createCopy(traceItem, false); SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); tracesFolder.contextMenu().menu("Open As Experiment...", "Generic Experiment").click(); fBot.waitUntil(new ConditionHelpers.ActiveEventsEditor(fBot, "ExampleCustomTxt.log")); SWTBotTreeItem experimentsItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectProject(fBot, TRACE_PROJECT_NAME), "Experiments"); experimentsItem.expand(); fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable("Experiment [2]", experimentsItem)); SWTBotTreeItem expItem = SWTBotUtils.getTraceProjectItem(fBot, experimentsItem, "Experiment"); createExperimentCopy(expItem, false); SWTBotTreeItem copiedExpItem = SWTBotUtils.getTraceProjectItem(fBot, experimentsItem, RENAMED_EXP_NAME); verifyExperimentCopy(copiedExpItem, false); createExperimentCopy(expItem, true); SWTBotTreeItem deepCopiedExpItem = SWTBotUtils.getTraceProjectItem(fBot, experimentsItem, RENAMED_EXP_DEEP_COPY); verifyExperimentCopy(deepCopiedExpItem, true); assertEquals(3, experimentsItem.getItems().length); }

Target:
public void test4_10CopyExperiment() { SWTBotTreeItem traceItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME), TRACE_NAME); createCopy(traceItem, false); SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, TRACE_PROJECT_NAME); tracesFolder.contextMenu().menu("Open As Experiment...", "Generic Experiment").click(); fBot.waitUntil(new ConditionHelpers.ActiveEventsEditor(fBot, "Experiment")); SWTBotTreeItem experimentsItem = SWTBotUtils.getTraceProjectItem(fBot, SWTBotUtils.selectProject(fBot, TRACE_PROJECT_NAME), "Experiments"); experimentsItem.expand(); fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable("Experiment [2]", experimentsItem)); SWTBotTreeItem expItem = SWTBotUtils.getTraceProjectItem(fBot, experimentsItem, "Experiment"); createExperimentCopy(expItem, false); SWTBotTreeItem copiedExpItem = SWTBotUtils.getTraceProjectItem(fBot, experimentsItem, RENAMED_EXP_NAME); verifyExperimentCopy(copiedExpItem, false); createExperimentCopy(expItem, true); SWTBotTreeItem deepCopiedExpItem = SWTBotUtils.getTraceProjectItem(fBot, experimentsItem, RENAMED_EXP_DEEP_COPY); verifyExperimentCopy(deepCopiedExpItem, true); assertEquals(3, experimentsItem.getItems().length); }
Source:
public void onClick(View arg0) { Geopoint gp = null; if (waypoint != null && waypoint.latitude != null && waypoint.longitude != null) gp = new Geopoint(waypoint.latitude, waypoint.longitude); cgeocoords coordsDialog = new cgeocoords(cgeowaypointadd.this, settings, gp, geo); coordsDialog.setCancelable(true); coordsDialog.setOnCoordinateUpdate(new cgeocoords.CoordinateUpdate() { @Override public void update(Geopoint gp) { ((Button) findViewById(R.id.buttonLatitude)).setText(cgBase.formatLatitude(gp.getLatitude(), true)); ((Button) findViewById(R.id.buttonLongitude)).setText(cgBase.formatLongitude(gp.getLongitude(), true)); if (waypoint != null) { waypoint.latitude = gp.getLatitude(); waypoint.longitude = gp.getLongitude(); } } }); coordsDialog.show(); }

Target:
public void onClick(View arg0) { Geopoint gp = null; if (waypoint != null && waypoint.latitude != null && waypoint.longitude != null) gp = new Geopoint(waypoint.latitude, waypoint.longitude); cgeocoords coordsDialog = new cgeocoords(cgeowaypointadd.this, settings, gp, geo); coordsDialog.setCancelable(true); coordsDialog.setOnCoordinateUpdate(new cgeocoords.CoordinateUpdate() { @Override public void update(Geopoint gp) { ((Button) findViewById(R.id.buttonLatitude)).setText(gp.format(GeopointFormatter.Format.LAT_DECMINUTE)); ((Button) findViewById(R.id.buttonLongitude)).setText(gp.format(GeopointFormatter.Format.LON_DECMINUTE)); if (waypoint != null) { waypoint.latitude = gp.getLatitude(); waypoint.longitude = gp.getLongitude(); } } }); coordsDialog.show(); }
Source:
private void callShutdownOnStrategy() { if (!getRecordsRetrievalStrategy.isShutdown()) { getRecordsRetrievalStrategy.shutdown(); } isShutdown = true; }

Target:
private void callShutdownOnStrategy() { if (!getRecordsRetrievalStrategy.isShutdown()) { getRecordsRetrievalStrategy.shutdown(); } }
Source:
public List<String> getUsages() { return Arrays.asList(new String[] { buildCommandUsage(SUBCMD_LIST + " <thingUID>", "lists the available firmwares for a thing with specified UID"), buildCommandUsage(SUBCMD_STATUS + " <thingUID>", "lists the firmware status for a thing"), buildCommandUsage(SUBCMD_CANCEL + " <thingUID>", "cancels the update for a thing"), buildCommandUsage( SUBCMD_UPDATE + " <thingUID> <firmware version>", "updates the firmware for a thing") }); }

Target:
public List<String> getUsages() { return Arrays.asList(new String[] { buildCommandUsage(SUBCMD_LIST + " <thingUID>", "lists the available firmwares for a thing"), buildCommandUsage(SUBCMD_STATUS + " <thingUID>", "lists the firmware status for a thing"), buildCommandUsage(SUBCMD_CANCEL + " <thingUID>", "cancels the update for a thing"), buildCommandUsage( SUBCMD_UPDATE + " <thingUID> <firmware version>", "updates the firmware for a thing") }); }
Source:
public DefaultIndexBuilder fillDrlIndexBuilder( final Path path, final String drl ) throws Exception { final DrlParser drlParser = new DrlParser(); final PackageDescr packageDescr = drlParser.parse( true, drl ); if ( drlParser.hasErrors() ) { final List<DroolsError> errors = drlParser.getErrors(); logger.warn( ErrorMessageUtilities.makeErrorMessage( path, errors.toArray( new DroolsError[ errors.size() ] ) ) ); return null; } if ( packageDescr == null ) { logger.warn( ErrorMessageUtilities.makeErrorMessage( path ) ); return null; } final ProjectDataModelOracle dmo = getProjectDataModelOracle( path ); final DefaultIndexBuilder builder = getIndexBuilder(path); if( builder == null ) { return null; } final PackageDescrIndexVisitor visitor = new PackageDescrIndexVisitor( dmo, builder, packageDescr ); visitor.visit(); addReferencedResourcesToIndexBuilder(builder, visitor); return builder; }

Target:
public DefaultIndexBuilder fillDrlIndexBuilder( final Path path, final String drl ) throws Exception { final DrlParser drlParser = new DrlParser(); final PackageDescr packageDescr = drlParser.parse( true, drl ); if ( drlParser.hasErrors() ) { final List<DroolsError> errors = drlParser.getErrors(); logger.warn( ErrorMessageUtilities.makeErrorMessage( path, errors.toArray( new DroolsError[ errors.size() ] ) ) ); return null; } if ( packageDescr == null ) { logger.warn( ErrorMessageUtilities.makeErrorMessage( path ) ); return null; } final ProjectDataModelOracle dmo = getProjectDataModelOracle( path ); final DefaultIndexBuilder builder = getIndexBuilder(path); if( builder == null ) { return null; } builder.setPackageName(packageDescr.getName()); final PackageDescrIndexVisitor visitor = new PackageDescrIndexVisitor( dmo, builder, packageDescr ); visitor.visit(); addReferencedResourcesToIndexBuilder(builder, visitor); return builder; }
Source:
public void wait(long timeout, TimeUnit timeUnit) throws InterruptedException, InfrastructureException { try { completionFuture.get(timeout, timeUnit); } catch (ExecutionException e) { throw new InfrastructureException( "Error occured while executing command in pod: " + e.getMessage(), e); } catch (TimeoutException ignored) { throw new InfrastructureException("Timeout reached while execution of command"); } }

Target:
public void wait(long timeout, TimeUnit timeUnit) throws InterruptedException, InfrastructureException { try { completionFuture.get(timeout, timeUnit); } catch (ExecutionException e) { throw new InfrastructureException( "Error occured while executing command in pod: " + e.getMessage(), e); } catch (TimeoutException e) { throw new InfrastructureException("Timeout reached while execution of command"); } }
Source:
public TraversalControl visitFragmentSpread(FragmentSpread fragmentSpread, TraverserContext<Node> context) { if (!conditionalNodes.shouldInclude(variables, fragmentSpread.getDirectives())) { return TraversalControl.ABORT; } FragmentDefinition fragmentDefinition = fragmentsByName.get(fragmentSpread.getName()); if (!conditionalNodes.shouldInclude(variables, fragmentDefinition.getDirectives())) { return TraversalControl.ABORT; } QueryVisitorFragmentSpreadEnvironment fragmentSpreadEnvironment = new QueryVisitorFragmentSpreadEnvironmentImpl(fragmentSpread, fragmentDefinition, context); if (context.getVar(LeaveOrEnter.class) == LEAVE) { postOrderCallback.visitFragmentSpread(fragmentSpreadEnvironment); return TraversalControl.CONTINUE; } preOrderCallback.visitFragmentSpread(fragmentSpreadEnvironment); QueryTraversalContext parentEnv = context.getVarFromParents(QueryTraversalContext.class); GraphQLCompositeType typeCondition = (GraphQLCompositeType) schema.getType(fragmentDefinition.getTypeCondition().getName()); Assert.assertTrue(typeCondition != null, "Invalid type condition '%s' in fragment '%s'", fragmentDefinition.getTypeCondition().getName(), fragmentDefinition.getName()); context .setVar(QueryTraversalContext.class, new QueryTraversalContext(typeCondition, typeCondition, parentEnv.getEnvironment(), fragmentDefinition)); return TraversalControl.CONTINUE; }

Target:
public TraversalControl visitFragmentSpread(FragmentSpread fragmentSpread, TraverserContext<Node> context) { if (!conditionalNodes.shouldInclude(variables, fragmentSpread.getDirectives())) { return TraversalControl.ABORT; } FragmentDefinition fragmentDefinition = fragmentsByName.get(fragmentSpread.getName()); if (!conditionalNodes.shouldInclude(variables, fragmentDefinition.getDirectives())) { return TraversalControl.ABORT; } QueryVisitorFragmentSpreadEnvironment fragmentSpreadEnvironment = new QueryVisitorFragmentSpreadEnvironmentImpl(fragmentSpread, fragmentDefinition, context); if (context.getVar(LeaveOrEnter.class) == LEAVE) { postOrderCallback.visitFragmentSpread(fragmentSpreadEnvironment); return TraversalControl.CONTINUE; } preOrderCallback.visitFragmentSpread(fragmentSpreadEnvironment); QueryTraversalContext parentEnv = context.getVarFromParents(QueryTraversalContext.class); GraphQLCompositeType typeCondition = (GraphQLCompositeType) schema.getType(fragmentDefinition.getTypeCondition().getName()); assertNotNull(typeCondition, "Invalid type condition '%s' in fragment '%s'", fragmentDefinition.getTypeCondition().getName(), fragmentDefinition.getName()); context .setVar(QueryTraversalContext.class, new QueryTraversalContext(typeCondition, typeCondition, parentEnv.getEnvironment(), fragmentDefinition)); return TraversalControl.CONTINUE; }
Source:
private void renumberMediaUnits(Workpiece workpiece) { int mininum = 1; for (MediaUnit mediaUnit : workpiece.getMediaUnits()) { if (mediaUnit.getOrder() > mininum) { mininum = mediaUnit.getOrder() + 1; } else { mediaUnit.setOrder(mininum); mininum++; } } }

Target:
private void renumberMediaUnits(Workpiece workpiece) { int minimum = 1; for (MediaUnit mediaUnit : workpiece.getMediaUnits()) { if (mediaUnit.getOrder() > minimum) { minimum = mediaUnit.getOrder() + 1; } else { mediaUnit.setOrder(minimum); minimum++; } } }
Source:
public void releaseServerStoreProxy(ServerStoreProxy storeProxy, boolean isReconnect) { connectionState.removeClusterTierClientEntity(storeProxy.getCacheId()); if (!isReconnect) { storeProxy.close(); } else { LOGGER.info("Adding to reconnect set"); reconnectSet.add(storeProxy.getCacheId()); } }

Target:
public void releaseServerStoreProxy(ServerStoreProxy storeProxy, boolean isReconnect) { connectionState.removeClusterTierClientEntity(storeProxy.getCacheId()); if (!isReconnect) { storeProxy.close(); } else { reconnectSet.add(storeProxy.getCacheId()); } }