auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void addHtmlHeaders(MultivaluedMap<String, Object> headers) { BrowserSecurityHeaders.headerAttributeMap.keySet().forEach(k -> addHeader(k, headers)); if (options != null) { if (options.isAllowAsIframe()) { headers.remove(BrowserSecurityHeaders.X_FRAME_OPTIONS); String value = BrowserSecurityHeaders.ContentSecurityPolicyBuilder.create().frameAncestors(null).build(); headers.putSingle(BrowserSecurityHeaders.CONTENT_SECURITY_POLICY, value); } String allowedFrameSrc = options.getAllowedFrameSrc(); if (allowedFrameSrc != null) { if (BrowserSecurityHeaders.CONTENT_SECURITY_POLICY_DEFAULT.equals(headers.getFirst(BrowserSecurityHeaders.CONTENT_SECURITY_POLICY))) { String value = BrowserSecurityHeaders.ContentSecurityPolicyBuilder.create().frameSrc(allowedFrameSrc).build(); headers.putSingle(BrowserSecurityHeaders.CONTENT_SECURITY_POLICY, value); } } } }

Target:
private void addHtmlHeaders(MultivaluedMap<String, Object> headers) { BrowserSecurityHeaders.headerAttributeMap.keySet().forEach(k -> addHeader(k, headers)); if (options != null) { BrowserSecurityHeaders.ContentSecurityPolicyBuilder csp = BrowserSecurityHeaders.ContentSecurityPolicyBuilder.create(); if (options.isAllowAnyFrameAncestor()) { headers.remove(BrowserSecurityHeaders.X_FRAME_OPTIONS); csp.frameAncestors(null); } String allowedFrameSrc = options.getAllowedFrameSrc(); if (allowedFrameSrc != null) { csp.frameSrc(allowedFrameSrc); } if (BrowserSecurityHeaders.CONTENT_SECURITY_POLICY_DEFAULT.equals(headers.getFirst(BrowserSecurityHeaders.CONTENT_SECURITY_POLICY))) { headers.putSingle(BrowserSecurityHeaders.CONTENT_SECURITY_POLICY, csp.build()); } } }
Source:
public boolean include(TreeWalk walker) throws MissingObjectException, IncorrectObjectTypeException, IOException { final int n = walker.getTreeCount(); if (n == 1) return true; final int m = walker.getRawMode(dirCacheIndex); for (int i = 0; i < n; i++) if (i != dirCacheIndex && i != workingTreeIndex && (walker.getRawMode(i) != m || !walker.idEqual( dirCacheIndex, i))) return true; if (m == FileMode.MISSING.getBits()) return true; int wm = walker.getRawMode(workingTreeIndex); if (wm == FileMode.MISSING.getBits()) return true; WorkingTreeIterator work = walker.getTree(workingTreeIndex, WorkingTreeIterator.class); DirCacheIterator dircache = walker.getTree(dirCacheIndex, DirCacheIterator.class); if (work.isModified(dircache.getDirCacheEntry(), false, false, false)) return true; return false; }

Target:
public boolean include(TreeWalk walker) throws MissingObjectException, IncorrectObjectTypeException, IOException { final int n = walker.getTreeCount(); final int m = walker.getRawMode(dirCacheIndex); for (int i = 0; i < n; i++) if (i != dirCacheIndex && i != workingTreeIndex && (walker.getRawMode(i) != m || !walker.idEqual( dirCacheIndex, i))) return true; if (m == 0) return true; final int wm = walker.getRawMode(workingTreeIndex); if (wm == 0) return true; WorkingTreeIterator work = walker.getTree(workingTreeIndex, WorkingTreeIterator.class); DirCacheIterator dircache = walker.getTree(dirCacheIndex, DirCacheIterator.class); return work.isModified(dircache.getDirCacheEntry(), false, false); }
Source:
public static Long tryLong(@SqlType("function(T)") TryLongLambda function) { try { return function.apply(); } catch (PrestoException e) { return (Long) tryFunctionExceptionHandler(e); } }

Target:
public static Long tryLong(@SqlType("function(T)") TryLongLambda function) { try { return function.apply(); } catch (PrestoException e) { propagateIfUnhandled(e); return null; } }
Source:
public void doesNotHaveMimeType() throws MessagingException{ matcher.init(FakeMatcherConfig.builder() .matcherName("HasMimeType") .condition(NON_MATCHING_MIME_TYPES) .build()); assertEquals(matcher.match(mail), Collections.emptyList()); }

Target:
public void doesNotHaveMimeType() throws MessagingException{ matcher.init(FakeMatcherConfig.builder() .matcherName("HasMimeType") .condition(NON_MATCHING_MIME_TYPES) .build()); assertThat(matcher.match(mail)).isEmpty(); }
Source:
private boolean isCancelActivityEnabled(final String uuid) { ArrayList cancelActivityEnabledClasses = new ArrayList(); cancelActivityEnabledClasses.add(IntermediateSignalEventCatching.class); cancelActivityEnabledClasses.add(IntermediateTimerEvent.class); cancelActivityEnabledClasses.add(IntermediateConditionalEvent.class); cancelActivityEnabledClasses.add(IntermediateMessageEventCatching.class); cancelActivityEnabledClasses.add(IntermediateEscalationEvent.class); AbstractCanvasHandler canvasHandler = (AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(); Node<View<?>, Edge> node = canvasHandler.getGraphIndex().getNode(uuid); if (null != node && null != node.getContent() && node.getContent() instanceof View) { Class intermediateEventClass = ((Node<View<?>, Edge>) node) .getContent() .getDefinition() .getClass(); boolean result = cancelActivityEnabledClasses.contains(intermediateEventClass); return result; } return false; }

Target:
private boolean isCancelActivityEnabled(final String uuid) { AbstractCanvasHandler canvasHandler = (AbstractCanvasHandler) sessionManager.getCurrentSession().getCanvasHandler(); Node<View<?>, Edge> node = canvasHandler.getGraphIndex().getNode(uuid); if (null != node && null != node.getContent() && node.getContent() instanceof View) { Class intermediateEventClass = ((Node<View<?>, Edge>) node) .getContent() .getDefinition() .getClass(); return cancelActivityEnabledClasses.contains(intermediateEventClass); } return false; }
Source:
private static String getStringValue(Node node) { return node.getFirstChild().getNodeValue(); }

Target:
private static Optional<String> getStringValue(Node node) { Node firstChild = node.getFirstChild(); if (firstChild == null) { return Optional.empty(); } return Optional.of(firstChild.getNodeValue()); }
Source:
public void init() throws IOException { inited = true; schemaColumns = schema.toArray(); if (fragment != null) { tableStats.setNumBytes(0); tableStats.setNumBlocks(1); } if (schema != null) { for(Column eachColumn: schema.getColumns()) { ColumnStats columnStats = new ColumnStats(eachColumn); tableStats.addColumnStat(columnStats); } } scanFetchSize = Integer.parseInt(meta.getOption("hbase.scanner.fetch,size", "" + DEFAULT_FETCH_SIZE)); if (targets == null) { targets = schema.toArray(); } columnMapping = new ColumnMapping(schema, meta); targetIndexes = new int[targets.length]; int index = 0; for (Column eachTargetColumn: targets) { targetIndexes[index++] = schema.getColumnId(eachTargetColumn.getQualifiedName()); } mappingColumnFamilies = columnMapping.getMappingColumns(); isRowKeyMappings = columnMapping.getIsRowKeyMappings(); isBinaryColumns = columnMapping.getIsBinaryColumns(); isColumnKeys = columnMapping.getIsColumnKeys(); isColumnValues = columnMapping.getIsColumnValues(); rowKeyDelimiter = columnMapping.getRowKeyDelimiter(); rowKeyFieldIndexes = columnMapping.getRowKeyFieldIndexes(); hbaseConf = HBaseStorageManager.getHBaseConfiguration(conf, meta); initScanner(); }

Target:
public void init() throws IOException { inited = true; schemaColumns = schema.toArray(); if (fragment != null) { tableStats.setNumBytes(0); tableStats.setNumBlocks(1); } if (schema != null) { for(Column eachColumn: schema.getColumns()) { ColumnStats columnStats = new ColumnStats(eachColumn); tableStats.addColumnStat(columnStats); } } scanFetchSize = Integer.parseInt(meta.getOption(HBaseStorageConstants.META_FETCH_ROWNUM_KEY, "" + DEFAULT_FETCH_SIZE)); if (targets == null) { targets = schema.toArray(); } columnMapping = new ColumnMapping(schema, meta); targetIndexes = new int[targets.length]; int index = 0; for (Column eachTargetColumn: targets) { targetIndexes[index++] = schema.getColumnId(eachTargetColumn.getQualifiedName()); } mappingColumnFamilies = columnMapping.getMappingColumns(); isRowKeyMappings = columnMapping.getIsRowKeyMappings(); isBinaryColumns = columnMapping.getIsBinaryColumns(); isColumnKeys = columnMapping.getIsColumnKeys(); isColumnValues = columnMapping.getIsColumnValues(); rowKeyDelimiter = columnMapping.getRowKeyDelimiter(); rowKeyFieldIndexes = columnMapping.getRowKeyFieldIndexes(); hbaseConf = HBaseStorageManager.getHBaseConfiguration(conf, meta); initScanner(); }
Source:
public void hasNoRestrictionsTest() throws Exception { returnRepo = repository; final SocialActivitiesEvent vsfEvent = new SocialActivitiesEvent(socialUser, "type", new Date()); final SocialActivitiesEvent projectEvent = new SocialActivitiesEvent(socialUser, OrganizationalUnitEventType.NEW_ORGANIZATIONAL_UNIT, new Date()) .withLink("otherName", "otherName", SocialActivitiesEvent.LINK_TYPE.CUSTOM); this.socialEventRepositoryConstraint.init(); assertFalse(this.socialEventRepositoryConstraint.hasRestrictions(vsfEvent)); assertFalse(this.socialEventRepositoryConstraint.hasRestrictions(projectEvent)); }

Target:
public void hasNoRestrictionsTest() throws Exception { returnRepo = repository; final SocialActivitiesEvent vfsEvent = new SocialActivitiesEvent(socialUser, "type", new Date()); final SocialActivitiesEvent projectEvent = new SocialActivitiesEvent(socialUser, OrganizationalUnitEventType.NEW_ORGANIZATIONAL_UNIT, new Date()) .withLink("otherName", "otherName", SocialActivitiesEvent.LINK_TYPE.CUSTOM); this.socialEventRepositoryConstraint.init(); assertFalse(this.socialEventRepositoryConstraint.hasRestrictions(vfsEvent)); assertFalse(this.socialEventRepositoryConstraint.hasRestrictions(projectEvent)); }
Source:
void testFailFilterBookByAuthorAddress() throws IOException { JsonNode result = getAsNode("book?filter[book.authors.homeAddress]=main&include=authors"); JsonNode data = result.get("data"); assertEquals(0, data.size(), result.toString()); result = getAsNode( String.format("book?filter[book]=authors.homeAddress=='main'", hemingwayId), HttpStatus.SC_BAD_REQUEST); assertEquals(0, data.size(), result.toString()); }

Target:
void testFailFilterBookByAuthorAddress() throws IOException { JsonNode result = getAsNode("book?filter[book.authors.homeAddress]=main&include=authors"); JsonNode data = result.get("data"); assertEquals(0, data.size(), result.toString()); result = getAsNode("book?filter=authors.homeAddress=='main'"); data = result.get("data"); assertEquals(0, data.size(), result.toString()); }
Source:
public int getVersion() { lazyDecoding(); return tbsCert.getVersion() + 1; }

Target:
public int getVersion() { lazyDecoding(); return tbsCert.getVersion(); }
Source:
private AnnotatedConstructor buildAnnotatedConstructorForMapper(Mapper mapper) { List<AnnotationMapperReference> mapperReferencesForConstructor = new ArrayList<AnnotationMapperReference>( mapper.getReferencedMappers().size() ); for ( MapperReference mapperReference : mapper.getReferencedMappers() ) { if ( !mapperReference.isUsed() ) { continue; } mapperReferencesForConstructor.add( (AnnotationMapperReference) mapperReference ); } List<Annotation> mapperReferenceAnnotations = getMapperReferenceAnnotations(); removeDuplicateAnnotations( mapperReferencesForConstructor, mapperReferenceAnnotations ); return new AnnotatedConstructor( mapper.getName(), mapperReferencesForConstructor, mapperReferenceAnnotations, additionalPublicEmptyConstructor() ); }

Target:
private AnnotatedConstructor buildAnnotatedConstructorForMapper(Mapper mapper) { List<AnnotationMapperReference> mapperReferencesForConstructor = new ArrayList<AnnotationMapperReference>( mapper.getReferencedMappers().size() ); for ( MapperReference mapperReference : mapper.getReferencedMappers() ) { if ( mapperReference.isUsed() ) { mapperReferencesForConstructor.add( (AnnotationMapperReference) mapperReference ); } } List<Annotation> mapperReferenceAnnotations = getMapperReferenceAnnotations(); removeDuplicateAnnotations( mapperReferencesForConstructor, mapperReferenceAnnotations ); return new AnnotatedConstructor( mapper.getName(), mapperReferencesForConstructor, mapperReferenceAnnotations, additionalPublicEmptyConstructor() ); }
Source:
public MergeStrategyRegistryListener(IExtensionRegistry registry) { strategies = new LinkedHashMap<>(); IConfigurationElement[] elements = registry .getConfigurationElementsFor("org.eclipse.egit.core.mergeStrategy"); loadMergeStrategies(elements); }

Target:
private MergeStrategyRegistryListener(IExtensionRegistry registry) { strategies = new LinkedHashMap<>(); IConfigurationElement[] elements = registry .getConfigurationElementsFor("org.eclipse.egit.core.mergeStrategy"); loadMergeStrategies(elements); }
Source:
protected Image(String id, @Nullable String name, java.util.Set<Link> links, @Nullable Date updated, @Nullable Date created, String tenantId, @Nullable String userId, @Nullable Status status, int progress, int minDisk, int minRam, @Nullable List<BlockDeviceMapping> blockDeviceMapping, @Nullable Resource server, @Nullable Map<String, String> metadata) { super(id, name, links); this.updated = updated; this.created = created; this.tenantId = tenantId; this.userId = userId; this.status = status; this.progress = progress; this.minDisk = minDisk; this.minRam = minRam; this.blockDeviceMapping = blockDeviceMapping; this.server = server; this.metadata = metadata == null ? ImmutableMap.<String, String>of() : ImmutableMap.copyOf(metadata); }

Target:
protected Image(String id, @Nullable String name, java.util.Set<Link> links, @Nullable Date updated, @Nullable Date created, String tenantId, @Nullable String userId, @Nullable Status status, int progress, int minDisk, int minRam, @Nullable List<BlockDeviceMapping> blockDeviceMapping, @Nullable Resource server, @Nullable Map<String, String> metadata) { super(id, name, links); this.updated = updated; this.created = created; this.tenantId = tenantId; this.userId = userId; this.status = status; this.progress = progress; this.minDisk = minDisk; this.minRam = minRam; this.blockDeviceMapping = blockDeviceMapping == null ? ImmutableList.<BlockDeviceMapping>of() : blockDeviceMapping; this.server = server; this.metadata = metadata == null ? ImmutableMap.<String, String>of() : ImmutableMap.copyOf(metadata); }
Source:
public void testSeparated() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(ImportOrderCheck.class); checkConfig.addAttribute("groups", "java.awt, javax.swing, java.io, java.util"); checkConfig.addAttribute("separated", "true"); checkConfig.addAttribute("separatedStaticGroups", "true"); checkConfig.addAttribute("ordered", "false"); final String[] expected = { "9: " + getCheckMessage(MSG_SEPARATION, "javax.swing.JComponent"), "11: " + getCheckMessage(MSG_SEPARATION, "java.io.File"), "16: " + getCheckMessage(MSG_ORDERING, "javax.swing.WindowConstants.*"), }; verify(checkConfig, getNonCompilablePath("InputImportOrder.java"), expected); }

Target:
public void testSeparated() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(ImportOrderCheck.class); checkConfig.addAttribute("groups", "java.awt, javax.swing, java.io, java.util"); checkConfig.addAttribute("separated", "true"); checkConfig.addAttribute("ordered", "false"); final String[] expected = { "9: " + getCheckMessage(MSG_SEPARATION, "javax.swing.JComponent"), "11: " + getCheckMessage(MSG_SEPARATION, "java.io.File"), "16: " + getCheckMessage(MSG_ORDERING, "javax.swing.WindowConstants.*"), }; verify(checkConfig, getNonCompilablePath("InputImportOrder.java"), expected); }
Source:
public int queryReplicationStatus() { if (ClusterRole.ACTIVE == localClusterDescriptor.getRole()) { return Integer.parseInt(logReplicationMetadataManager.getReplicationStatus()); } return Integer.parseInt(logReplicationMetadataManager.getDataConsistentOnStandby()); }

Target:
public Map<String, LogReplicationMetadata.ReplicationStatusVal> queryReplicationStatus() { LogReplicationMetadata.ReplicationStatusVal status; if (ClusterRole.ACTIVE == localClusterDescriptor.getRole()) { return logReplicationMetadataManager.getReplicationRemainingPercent(); } else if (ClusterRole.STANDBY == localClusterDescriptor.getRole()) { return logReplicationMetadataManager.getDataConsistentOnStandby(); } log.error("Received Replication Status Query in Incorrect Role {}.", localClusterDescriptor.getRole()); return null; }
Source:
public void setUp() throws InjectionException { final Configuration conf = Tang.Factory.getTang().newConfigurationBuilder() .bindImplementation(SpanReceiver.class, MockedSpanReceiver.class) .bindImplementation(MemoryStore.class, MemoryStoreImpl.class) .bindNamedParameter(EMEvalId.class, new Integer(0).toString()) .build(); final Injector injector = Tang.Factory.getTang().newInjector(conf); memoryStore = injector.getInstance(MemoryStore.class); }

Target:
public void setUp() throws InjectionException { final Configuration conf = Tang.Factory.getTang().newConfigurationBuilder() .bindImplementation(SpanReceiver.class, MockedSpanReceiver.class) .bindImplementation(MemoryStore.class, MemoryStoreImpl.class) .bindNamedParameter(EMEvalId.class, String.valueOf(0)) .build(); final Injector injector = Tang.Factory.getTang().newInjector(conf); memoryStore = injector.getInstance(MemoryStore.class); }
Source:
private void assignNewBatch(Collection<AssignableReplica> replicas) { Map<String, Integer> totalPartitionCapacity = new HashMap<>(); for (AssignableReplica replica : replicas) { addToAssignmentRecord(replica, _currentAssignments); if (replica.isReplicaTopState()) { addToAssignmentRecord(replica, _currentTopStateAssignments); } for (Map.Entry<String, Integer> capacity : replica.getCapacity().entrySet()) { totalPartitionCapacity.compute(capacity.getKey(), (k, v) -> (v == null) ? capacity.getValue() : v + capacity.getValue()); } } _totalReplicaAssignmentCount += replicas.size(); for (String key : totalPartitionCapacity.keySet()) { updateCapacityAndUtilization(key, totalPartitionCapacity.get(key)); } }

Target:
private void assignNewBatch(Collection<AssignableReplica> replicas) { Map<String, Integer> totalPartitionCapacity = new HashMap<>(); for (AssignableReplica replica : replicas) { addToAssignmentRecord(replica, _currentAssignments); if (replica.isReplicaTopState()) { addToAssignmentRecord(replica, _currentTopStateAssignments); } for (Map.Entry<String, Integer> capacity : replica.getCapacity().entrySet()) { totalPartitionCapacity.compute(capacity.getKey(), (key, totalValue) -> (totalValue == null) ? capacity.getValue() : totalValue + capacity.getValue()); } } for (String key : totalPartitionCapacity.keySet()) { updateCapacityAndUtilization(key, totalPartitionCapacity.get(key)); } }
Source:
public List<Tuple> getTuples(EntityKey[] keys, TupleContext tupleContext) { if ( log.isTraceEnabled() ) { log.tracef( "Reading tuple with keys %1$s and context %2$s", Arrays.toString( keys ), tupleContext ); } return super.getTuples( keys, tupleContext ); }

Target:
public List<Tuple> getTuples(EntityKey[] keys, TupleContext tupleContext) { if ( log.isTraceEnabled() ) { log.tracef( "Reading tuples with keys %1$s and context %2$s", Arrays.toString( keys ), tupleContext ); } return super.getTuples( keys, tupleContext ); }
Source:
public Spanned getAboutText() { Resources res = aboutActivity.getResources(); String appName = res.getString(R.string.app_name); String versionName = BuildConfig.VERSION_NAME; ((TextView)aboutActivity.findViewById(R.id.aboutTextView)).setMovementMethod(LinkMovementMethod.getInstance()); String mergedAboutText = res.getString(R.string.about_text, appName, versionName); return Html.fromHtml(mergedAboutText); }

Target:
public Spanned getAboutText() { String appName = resources.getString(R.string.app_name); String versionName = BuildConfig.VERSION_NAME; String mergedAboutText = resources.getString(R.string.about_text, appName, versionName); return Html.fromHtml(mergedAboutText); }
Source:
public void testProcessQuotaBalanceForAccount() { AccountVO accountVO = new AccountVO(); accountVO.setId(2L); accountVO.setDomainId(1L); accountVO.setType(Account.ACCOUNT_TYPE_NORMAL); QuotaUsageVO quotaUsageVO = new QuotaUsageVO(); quotaUsageVO.setAccountId(2L); quotaUsageVO.setStartDate(new Date()); quotaUsageVO.setEndDate(new Date()); List<QuotaUsageVO> quotaListForAccount = new ArrayList<>(); quotaListForAccount.add(quotaUsageVO); quotaManager.processQuotaBalanceForAccount(accountVO, quotaListForAccount); Mockito.verify(quotaAcc, Mockito.times(1)).persistQuotaAccount(Mockito.any(QuotaAccountVO.class)); }

Target:
public void testProcessQuotaBalanceForAccount() { Date now = new Date(); AccountVO accountVO = new AccountVO(); accountVO.setId(2L); accountVO.setDomainId(1L); accountVO.setType(Account.ACCOUNT_TYPE_NORMAL); QuotaUsageVO quotaUsageVO = new QuotaUsageVO(); quotaUsageVO.setAccountId(2L); quotaUsageVO.setStartDate(new Date(now.getTime())); quotaUsageVO.setEndDate(new Date(now.getTime())); List<QuotaUsageVO> quotaListForAccount = new ArrayList<>(); quotaListForAccount.add(quotaUsageVO); quotaManager.processQuotaBalanceForAccount(accountVO, quotaListForAccount); Mockito.verify(quotaAcc, Mockito.times(1)).persistQuotaAccount(Mockito.any(QuotaAccountVO.class)); }
Source:
public Server start() { mods.loadExternal(mods.getDefaultModLocation()); mods.loadExternal(Paths.get(config.getModsDirectory())); if(mods.getAvailableMods().isEmpty()) { logger.warn("No mods were loaded from the different folders. Please check your installation."); throw new IllegalStateException("No mod loaded"); } try { logger.info("Starting Server..."); server.addConnections(new ServerSock(server, config)); server.addConnections(new ServerWeb(server, config)); logger.info("Starting Console..."); CommandHandler commandHandler = server.getCommandHandler(); initializeCommands(commandHandler); ServerConsole console = new ServerConsole(server, commandHandler); consoleThread = new Thread(console, "Console-Thread"); consoleThread.start(); mods.getAIs().entrySet().forEach(entry -> { ClientIO tcgAI = new FakeAIClientTCG(server, entry.getValue()); server.newClient(tcgAI); server.getIncomingHandler().perform(new LoginMessage("AI " + entry.getKey()), tcgAI); }); final Supplier<ScheduledExecutorService> aiExecutor = () -> server.getScheduler(); mods.getAvailableMods().forEach(name -> server.addGameFactory(name, (serv, id) -> new TCGGame(aiExecutor, name, id, mods.getModFor(name)))); logger.info("Started"); } catch (Exception e) { logger.error("Initializing Error", e); } return server; }

Target:
public Server start() { mods.loadExternal(mods.getDefaultModLocation()); mods.loadExternal(Paths.get(config.getModsDirectory())); if (mods.getAvailableMods().isEmpty()) { logger.warn(NoModsLoadedException.NO_MOD_MESSAGE); throw new NoModsLoadedException(); } try { logger.info("Starting Server..."); server.addConnections(new ServerSock(server, config)); server.addConnections(new ServerWeb(server, config)); logger.info("Starting Console..."); CommandHandler commandHandler = server.getCommandHandler(); initializeCommands(commandHandler); ServerConsole console = new ServerConsole(server, commandHandler); consoleThread = new Thread(console, "Console-Thread"); consoleThread.start(); mods.getAIs().entrySet().forEach(entry -> { ClientIO tcgAI = new FakeAIClientTCG(server, entry.getValue()); server.newClient(tcgAI); server.getIncomingHandler().perform(new LoginMessage("AI " + entry.getKey()), tcgAI); }); final Supplier<ScheduledExecutorService> aiExecutor = () -> server.getScheduler(); mods.getAvailableMods().forEach(name -> server.addGameFactory(name, (serv, id) -> new TCGGame(aiExecutor, name, id, mods.getModFor(name)))); logger.info("Started"); } catch (Exception e) { logger.error("Initializing Error", e); } return server; }
Source:
protected void publishServerListeningEvent(int port) { if (getApplicationEventPublisher() != null) { TcpConnectionServerListeningEvent event = new TcpConnectionServerListeningEvent(this, port); TaskScheduler taskScheduler = this.getTaskScheduler(); if (taskScheduler != null) { try { taskScheduler.schedule(new Runnable() { @Override public void run() { getApplicationEventPublisher().publishEvent(event); } }, new Date()); } catch (TaskRejectedException e) { getApplicationEventPublisher().publishEvent(event); } } else { getApplicationEventPublisher().publishEvent(event); } } }

Target:
protected void publishServerListeningEvent(int port) { final ApplicationEventPublisher eventPublisher = getApplicationEventPublisher(); if (eventPublisher != null) { final TcpConnectionServerListeningEvent event = new TcpConnectionServerListeningEvent(this, port); TaskScheduler taskScheduler = this.getTaskScheduler(); if (taskScheduler != null) { try { taskScheduler.schedule(new Runnable() { @Override public void run() { eventPublisher.publishEvent(event); } }, new Date()); } catch (TaskRejectedException e) { eventPublisher.publishEvent(event); } } else { eventPublisher.publishEvent(event); } } }
Source:
public boolean onOptionsItemSelected(final MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { NavigationHelper.openSettings(requireContext()); return true; } if (isLoading.get()) { return true; } switch (id) { case R.id.menu_item_share: if (currentInfo != null) { ShareUtils.shareUrl(requireContext(), currentInfo.getName(), currentInfo.getOriginalUrl()); } return true; case R.id.menu_item_share_stream: if (currentInfo != null) { Stream stream; if (currentInfo.getVideoStreams().isEmpty() && currentInfo.getVideoOnlyStreams().isEmpty()) { stream = getDefaultAudioStream(); } else { stream = getSelectedVideoStream(); } ShareUtils.shareUrl(requireContext(), currentInfo.getName(), stream.getUrl()); } return true; case R.id.menu_item_openInBrowser: if (currentInfo != null) { ShareUtils.openUrlInBrowser(requireContext(), currentInfo.getOriginalUrl()); } return true; case R.id.action_play_with_kodi: try { NavigationHelper.playWithKore(activity, Uri.parse(currentInfo.getUrl())); } catch (Exception e) { if (DEBUG) { Log.i(TAG, "Failed to start kore", e); } KoreUtil.showInstallKoreDialog(activity); } return true; default: return super.onOptionsItemSelected(item); } }

Target:
public boolean onOptionsItemSelected(final MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { NavigationHelper.openSettings(requireContext()); return true; } if (isLoading.get()) { return true; } switch (id) { case R.id.menu_item_share: if (currentInfo != null) { ShareUtils.shareUrl(requireContext(), currentInfo.getName(), currentInfo.getOriginalUrl()); } return true; case R.id.menu_item_share_stream: if (currentInfo != null) { final Stream stream; if (currentInfo.getVideoStreams().isEmpty() && currentInfo.getVideoOnlyStreams().isEmpty()) { stream = getDefaultAudioStream(); } else { stream = getSelectedVideoStream(); } ShareUtils.shareUrl(requireContext(), currentInfo.getName(), stream.getUrl()); } return true; case R.id.menu_item_openInBrowser: if (currentInfo != null) { ShareUtils.openUrlInBrowser(requireContext(), currentInfo.getOriginalUrl()); } return true; case R.id.action_play_with_kodi: try { NavigationHelper.playWithKore(activity, Uri.parse(currentInfo.getUrl())); } catch (Exception e) { if (DEBUG) { Log.i(TAG, "Failed to start kore", e); } KoreUtil.showInstallKoreDialog(activity); } return true; default: return super.onOptionsItemSelected(item); } }
Source:
protected boolean isPage500(HttpMessage msg) { if (isCustomPage(msg, CustomPage.Type.OK_200) || isCustomPage(msg, CustomPage.Type.NOTFOUND_404)) { return false; } return isCustomPage(msg, CustomPage.Type.ERROR_500) ? true : msg.getResponseHeader().getStatusCode() == HttpStatusCode.INTERNAL_SERVER_ERROR; }

Target:
protected boolean isPage500(HttpMessage msg) { if (isCustomPage(msg, CustomPage.Type.OK_200) || isCustomPage(msg, CustomPage.Type.NOTFOUND_404)) { return false; } if (isCustomPage(msg, CustomPage.Type.ERROR_500)) { return true; } return msg.getResponseHeader().getStatusCode() == HttpStatusCode.INTERNAL_SERVER_ERROR; }
Source:
public void testSTStartEndPoint() throws Exception { assertQuery("select ST_AsText(ST_StartPoint(ST_GeometryFromText('LineString(8 4, 4 8, 5 6)')))", "select 'POINT (8 4)'"); assertQuery("select ST_AsText(ST_EndPoint(ST_GeometryFromText('LineString(8 4, 4 8, 5 6)')))", "select 'POINT (5 6)'"); assertQueryFails("select ST_AsText(ST_StartPoint(ST_GeometryFromText('Polygon ((2 0, 2 1, 3 1))')))", "ST_StartPoint only applies to LineString. Input type is: Polygon"); assertQueryFails("select ST_AsText(ST_EndPoint(ST_GeometryFromText('Polygon ((2 0, 2 1, 3 1))')))", "ST_EndPoint only applies to LineString. Input type is: Polygon"); assertQueryFails("select ST_AsText(ST_StartPoint(ST_GeometryFromText('LINESTRING EMPTY')))", "ST_StartPoint only applies to LineString. Input type is: MultiLineString"); }

Target:
public void testSTStartEndPoint() throws Exception { assertFunction("ST_AsText(ST_StartPoint(ST_GeometryFromText('LINESTRING (8 4, 4 8, 5 6)')))", VARCHAR, "POINT (8 4)"); assertFunction("ST_AsText(ST_EndPoint(ST_GeometryFromText('LINESTRING (8 4, 4 8, 5 6)')))", VARCHAR, "POINT (5 6)"); assertInvalidFunction("ST_AsText(ST_StartPoint(ST_GeometryFromText('POLYGON ((2 0, 2 1, 3 1))')))", "ST_StartPoint only applies to LINE_STRING. Input type is: POLYGON"); assertInvalidFunction("ST_AsText(ST_EndPoint(ST_GeometryFromText('POLYGON ((2 0, 2 1, 3 1))')))", "ST_EndPoint only applies to LINE_STRING. Input type is: POLYGON"); }
Source:
public MockRemoteTask createTableScanTask(TaskId taskId, Node newNode, List<Split> splits, PartitionedSplitCountTracker partitionedSplitCountTracker) { Symbol symbol = new Symbol("column"); PlanNodeId sourceId = new PlanNodeId("sourceId"); PlanFragment testFragment = new PlanFragment( new PlanFragmentId("test"), new TableScanNode( sourceId, new TableHandle(new ConnectorId("test"), new TestingTableHandle()), ImmutableList.of(symbol), ImmutableMap.of(symbol, new TestingColumnHandle("column"))), ImmutableMap.of(symbol, VARCHAR), SOURCE_DISTRIBUTION, ImmutableList.of(sourceId), new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), ImmutableList.of(symbol)), StageExecutionStrategy.ungroupedExecution(), emptyMap(), emptyMap()); ImmutableMultimap.Builder<PlanNodeId, Split> initialSplits = ImmutableMultimap.builder(); for (Split sourceSplit : splits) { initialSplits.put(sourceId, sourceSplit); } return createRemoteTask(TEST_SESSION, taskId, newNode, testFragment, initialSplits.build(), OptionalInt.empty(), createInitialEmptyOutputBuffers(BROADCAST), partitionedSplitCountTracker, true); }

Target:
public MockRemoteTask createTableScanTask(TaskId taskId, Node newNode, List<Split> splits, PartitionedSplitCountTracker partitionedSplitCountTracker) { Symbol symbol = new Symbol("column"); PlanNodeId sourceId = new PlanNodeId("sourceId"); PlanFragment testFragment = new PlanFragment( new PlanFragmentId("test"), new TableScanNode( sourceId, new TableHandle(new ConnectorId("test"), new TestingTableHandle()), ImmutableList.of(symbol), ImmutableMap.of(symbol, new TestingColumnHandle("column"))), ImmutableMap.of(symbol, VARCHAR), SOURCE_DISTRIBUTION, ImmutableList.of(sourceId), new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), ImmutableList.of(symbol)), StageExecutionStrategy.ungroupedExecution(), StatsAndCosts.empty()); ImmutableMultimap.Builder<PlanNodeId, Split> initialSplits = ImmutableMultimap.builder(); for (Split sourceSplit : splits) { initialSplits.put(sourceId, sourceSplit); } return createRemoteTask(TEST_SESSION, taskId, newNode, testFragment, initialSplits.build(), OptionalInt.empty(), createInitialEmptyOutputBuffers(BROADCAST), partitionedSplitCountTracker, true); }
Source:
public SummarizerConfiguration build() { return new SummarizerConfiguration(className, configId, Collections.unmodifiableMap(imBuilder)); }

Target:
public SummarizerConfiguration build() { return new SummarizerConfiguration(className, configId, imBuilder.build()); }
Source:
public void onStatusUpdate(QpidStatus oldStatus, QpidStatus newStatus) { if (oldStatus.equals(newStatus)) { return; } Reason reason; if (QpidStatus.CONNECTED.equals(newStatus)) { reason = Reason.QPID_UP; } else if (QpidStatus.DOWN.equals(newStatus)) { reason = Reason.QPID_DOWN; } else if (QpidStatus.FLOW_STOPPED.equals(newStatus)) { reason = Reason.QPID_FLOW_STOPPED; } else { String msg = String.format("Could not transition candlpin mode: Unknown Qpid status: %s", newStatus); throw new IllegalArgumentException(msg); } transitionAppropriately(reason); }

Target:
public void onStatusUpdate(QpidStatus oldStatus, QpidStatus newStatus) { if (oldStatus.equals(newStatus)) { return; } Reason reason; if (QpidStatus.CONNECTED.equals(newStatus)) { reason = Reason.QPID_UP; } else if (QpidStatus.DOWN.equals(newStatus)) { reason = Reason.QPID_DOWN; } else if (QpidStatus.FLOW_STOPPED.equals(newStatus)) { reason = Reason.QPID_FLOW_STOPPED; } else { String msg = String.format("Could not transition candlepin mode: Unknown Qpid status: %s", newStatus); throw new IllegalArgumentException(msg); } transitionAppropriately(reason); }
Source:
public void testSchemaIdRestore() throws Exception { MysqlIsolatedServer server = masterServer; Position oldlogPosition = MaxwellTestSupport.capture(server.getConnection()); LOGGER.info("Initial pos: " + oldlogPosition); MaxwellContext context = getContext(server.getPort(), false); context.getPositionStore().set(oldlogPosition); MysqlSavedSchema savedSchema = MysqlSavedSchema.restore(context, oldlogPosition); if (savedSchema == null) { Connection c = context.getMaxwellConnection(); Schema newSchema = new SchemaCapturer(c, context.getCaseSensitivity()).capture(); savedSchema = new MysqlSavedSchema(context, newSchema, context.getInitialPosition()); savedSchema.save(c); } Long oldSchemaId = savedSchema.getSchemaID(); LOGGER.info("old schema id: " + oldSchemaId); server.execute("CREATE TABLE shard_1.new (id int(11))"); BufferedMaxwell maxwell = new BufferedMaxwell(getConfig(server.getPort(), false)); List<RowMap> rows = new ArrayList<>(); new Thread(maxwell).start(); drainReplication(maxwell, rows); maxwell.terminate(); Position newPosition = MaxwellTestSupport.capture(server.getConnection()); LOGGER.info("New pos: " + newPosition); MysqlSavedSchema newSavedSchema = MysqlSavedSchema.restore(context, newPosition); LOGGER.info("New schema id: " + newSavedSchema.getSchemaID()); assertEquals(new Long(oldSchemaId + 3), newSavedSchema.getSchemaID()); assertTrue(newPosition.newerThan(savedSchema.getPosition())); MysqlSavedSchema restored = MysqlSavedSchema.restore(context, oldlogPosition); assertEquals(oldSchemaId, restored.getSchemaID()); }

Target:
public void testSchemaIdRestore() throws Exception { MysqlIsolatedServer server = masterServer; Position oldlogPosition = MaxwellTestSupport.capture(server.getConnection()); LOGGER.info("Initial pos: " + oldlogPosition); MaxwellContext context = getContext(server.getPort(), false); context.getPositionStore().set(oldlogPosition); MysqlSavedSchema savedSchema = MysqlSavedSchema.restore(context, oldlogPosition); if (savedSchema == null) { Connection c = context.getMaxwellConnection(); Schema newSchema = new SchemaCapturer(c, context.getCaseSensitivity()).capture(); savedSchema = new MysqlSavedSchema(context, newSchema, context.getInitialPosition()); savedSchema.save(c); } Long oldSchemaId = savedSchema.getSchemaID(); LOGGER.info("old schema id: " + oldSchemaId); server.execute("CREATE TABLE shard_1.new (id int(11))"); BufferedMaxwell maxwell = new BufferedMaxwell(getConfig(server.getPort(), false)); List<RowMap> rows = new ArrayList<>(); new Thread(maxwell).start(); drainReplication(maxwell, rows); maxwell.terminate(); Position newPosition = MaxwellTestSupport.capture(server.getConnection()); LOGGER.info("New pos: " + newPosition); MysqlSavedSchema newSavedSchema = MysqlSavedSchema.restore(context, newPosition); LOGGER.info("New schema id: " + newSavedSchema.getSchemaID()); assertEquals(new Long(oldSchemaId + 1), newSavedSchema.getSchemaID()); assertTrue(newPosition.newerThan(savedSchema.getPosition())); MysqlSavedSchema restored = MysqlSavedSchema.restore(context, oldlogPosition); assertEquals(oldSchemaId, restored.getSchemaID()); }
Source:
public DbSimpleImportCommandBuilder db_columns(String[] db_columns) { node.put("db_columns", Arrays.toString(db_columns).replaceAll("\\[", "").replaceAll("\\]", "")); return this; }

Target:
public DbSimpleImportCommandBuilder db_columns(String[] db_columns) { String dbCols = Arrays.toString(db_columns); node.put("db_columns", dbCols.substring(1, dbCols.length()-1)); return this; }
Source:
void handleContainerLaunch(SamzaResourceRequest request, String preferredHost, SamzaResource allocatedResource, ResourceRequestState resourceRequestState, ContainerAllocator allocator) { if (getControlActionMetadata(request.getProcessorId()).isPresent()) { handleContainerAllocationForExistingControlAction(request.getProcessorId(), allocator, resourceRequestState, request, preferredHost); } else if (this.standbyContainerManager.isPresent()) { standbyContainerManager.get() .checkStandbyConstraintsAndRunStreamProcessor(request, preferredHost, allocatedResource, allocator, resourceRequestState); } else { allocator.runStreamProcessor(request, preferredHost); } }

Target:
boolean handleContainerLaunch(SamzaResourceRequest request, String preferredHost, SamzaResource allocatedResource, ResourceRequestState resourceRequestState, ContainerAllocator allocator) { if (hasActiveContainerPlacementAction(request.getProcessorId())) { String processorId = request.getProcessorId(); ContainerPlacementMetadata actionMetaData = getPlacementActionMetadata(processorId).get(); ContainerPlacementMetadata.ContainerStatus actionStatus = actionMetaData.getContainerStatus(); if (samzaApplicationState.runningProcessors.containsKey(processorId) && actionStatus == ContainerPlacementMetadata.ContainerStatus.RUNNING) { LOG.info("Requesting running container to shutdown due to existing container placement action {}", actionMetaData); actionMetaData.setContainerStatus(ContainerPlacementMetadata.ContainerStatus.STOP_IN_PROGRESS); clusterResourceManager.stopStreamProcessor(samzaApplicationState.runningProcessors.get(processorId)); return false; } else if (actionStatus == ContainerPlacementMetadata.ContainerStatus.STOP_IN_PROGRESS) { LOG.info("Waiting for running container to shutdown due to existing container placement action {}", actionMetaData); return false; } else if (actionStatus == ContainerPlacementMetadata.ContainerStatus.STOPPED) { allocator.runStreamProcessor(request, preferredHost); return true; } } if (this.standbyContainerManager.isPresent()) { standbyContainerManager.get() .checkStandbyConstraintsAndRunStreamProcessor(request, preferredHost, allocatedResource, allocator, resourceRequestState); } else { allocator.runStreamProcessor(request, preferredHost); } return true; }
Source:
public CompletableFuture<V> getAsync(K key) { return failsafe(retryPolicy, retryMetrics, retryExecutor) .future(k -> readFn.getAsync(key)) .exceptionally(e -> { throw new SamzaException("Failed to get the record for " + key + " after retries.", e); }); }

Target:
public CompletableFuture<V> getAsync(K key) { return failsafe(retryPolicy, retryMetrics, retryExecutor) .future(() -> readFn.getAsync(key)) .exceptionally(e -> { throw new SamzaException("Failed to get the record for " + key + " after retries.", e); }); }
Source:
private void setProperty(String partitionName, CustomizedStateProperty property, String value) { Map<String, Map<String, String>> mapFields = _record.getMapFields(); if (mapFields.get(partitionName) == null) { mapFields.put(partitionName, new TreeMap<String, String>()); } mapFields.get(partitionName).put(property.name(), value); }

Target:
private void setProperty(String partitionName, CustomizedStateProperty property, String value) { Map<String, Map<String, String>> mapFields = _record.getMapFields(); mapFields.putIfAbsent(partitionName, new TreeMap<String, String>()); mapFields.get(partitionName).put(property.name(), value); }
Source:
public void testUsingDefaultConfigurationFileDebugLogging() { ByteArrayOutputStream output = new ByteArrayOutputStream(); PrintStream outputStream = new PrintStream(output); PrintStream originalStream = System.out; System.setOut(outputStream); final Request request = new Request(HttpMethod.GET, Domains.API.toString(), "/2010-04-01/Accounts/AC123/Messages/MM123.json"); request.addHeaderParam("Authorization", "authorization value"); request.addHeaderParam("Test Header", "test value"); TwilioRestClient twilioRestClient = Twilio.getRestClient(); twilioRestClient.logRequest(request); System.out.flush(); System.setOut(originalStream); Assert.assertTrue(output.toString().isEmpty()); }

Target:
public void testUsingDefaultConfigurationFileDebugLogging() { logCapturingSetup(); final Request request = new Request(HttpMethod.GET, Domains.API.toString(), "/2010-04-01/Accounts/AC123/Messages/MM123.json"); request.addHeaderParam("Authorization", "authorization value"); request.addHeaderParam("Test Header", "test value"); finishLogCapturingSetup(request); Assert.assertTrue(output.toString().isEmpty()); }
Source:
protected void ensureDetailFormCreated() { if (getDetailForm() != null) { return; } IForm form; if (isTileOverviewVisible()) { form = new P_TileOverviewForm(); } else { form = createDetailForm(); } if (form != null) { setDetailForm(form); interceptInitDetailForm(); } }

Target:
protected void ensureDetailFormCreated() { if (getDetailForm() != null) { return; } IForm form; if (isUseTileOverview()) { form = createTileOverviewForm(); } else { form = createDetailForm(); } if (form != null) { setDetailForm(form); interceptInitDetailForm(); } }
Source:
public void hardKillWithWaitingRuns() throws Exception { story.addStep(new Statement() { @Override public void evaluate() throws Throwable { LockableResourcesManager.get().createResource("resource1"); WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p"); p.setDefinition(new CpsFlowDefinition("retry(99) {\n" + " lock('resource1') {\n" + " semaphore('wait-inside')\n" + " }\n" + "}", true)); WorkflowRun prevBuild = null; for (int i = 0; i < 3; i++) { WorkflowRun rNext = p.scheduleBuild2(0).waitForStart(); if (prevBuild != null) { story.j.waitForMessage("[resource1] is locked, waiting...", rNext); Executor ex = prevBuild.getExecutor(); assertNotNull(ex); ex.interrupt(); story.j.waitForMessage("Click here to forcibly terminate running steps", prevBuild); prevBuild.doTerm(); story.j.waitForMessage("Click here to forcibly kill entire build", prevBuild); prevBuild.doKill(); story.j.waitForMessage("Hard kill!", prevBuild); story.j.waitForCompletion(prevBuild); story.j.assertBuildStatus(Result.ABORTED, prevBuild); } story.j.waitForMessage("Lock acquired on [resource1]", rNext); SemaphoreStep.waitForStart("wait-inside/" + (i + 1), rNext); prevBuild = rNext; } prevBuild.doKill(); story.j.assertBuildStatus(Result.ABORTED, story.j.waitForCompletion(prevBuild)); } }); }

Target:
public void hardKillWithWaitingRuns() throws Exception { story.addStep(new Statement() { @Override public void evaluate() throws Throwable { LockableResourcesManager.get().createResource("resource1"); WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p"); p.setDefinition(new CpsFlowDefinition("retry(99) {\n" + " lock('resource1') {\n" + " semaphore('wait-inside')\n" + " }\n" + "}", true)); WorkflowRun prevBuild = null; for (int i = 0; i < 3; i++) { WorkflowRun rNext = p.scheduleBuild2(0).waitForStart(); if (prevBuild != null) { story.j.waitForMessage("[resource1] is locked, waiting...", rNext); interruptTermKill(prevBuild); } story.j.waitForMessage("Lock acquired on [resource1]", rNext); SemaphoreStep.waitForStart("wait-inside/" + (i + 1), rNext); prevBuild = rNext; } SemaphoreStep.success("wait-inside/3", null); story.j.assertBuildStatus(Result.SUCCESS, story.j.waitForCompletion(prevBuild)); } }); }
Source:
private static boolean isSame(final int size, AbstractInsnNode e, AbstractInsnNode n) { for (int i = 0; i < size; i++) { if (e.getOpcode() != n.getOpcode()) { return false; } e = next(e); n = next(n); } return true; }

Target:
private static boolean isSame(final int size, AbstractInsnNode e, AbstractInsnNode n) { for (int i = 0; i < size; i++) { if (n == null || e.getOpcode() != n.getOpcode()) { return false; } e = next(e); n = next(n); } return true; }
Source:
private List<RowGroup> createRowGroups( int rowsInStripe, Map<StreamId, Stream> streams, Map<StreamId, ValueInputStream<?>> valueStreams, Map<StreamId, List<RowGroupIndex>> columnIndexes, Set<Integer> selectedRowGroups, List<ColumnEncoding> encodings) throws InvalidCheckpointException { ImmutableList.Builder<RowGroup> rowGroupBuilder = ImmutableList.builder(); for (int rowGroupId : selectedRowGroups) { Map<StreamId, StreamCheckpoint> checkpoints = getStreamCheckpoints(includedOrcColumns, types, decompressor.isPresent(), rowGroupId, encodings, streams, columnIndexes); int rowOffset = rowGroupId * rowsInRowGroup; int rowsInGroup = Math.min(rowsInStripe - rowOffset, rowsInRowGroup); long minAverageRowBytes = columnIndexes .values() .stream() .mapToLong(rowGroupIndexes -> rowGroupIndexes.get(rowGroupId) .getColumnStatistics() .getMinAverageValueSizeInBytes()) .sum(); rowGroupBuilder.add(createRowGroup(rowGroupId, rowOffset, rowsInGroup, minAverageRowBytes, valueStreams, checkpoints)); } return rowGroupBuilder.build(); }

Target:
private List<RowGroup> createRowGroups( int rowsInStripe, Map<StreamId, Stream> streams, Map<StreamId, ValueInputStream<?>> valueStreams, Map<StreamId, List<RowGroupIndex>> columnIndexes, Set<Integer> selectedRowGroups, List<ColumnEncoding> encodings) throws InvalidCheckpointException { ImmutableList.Builder<RowGroup> rowGroupBuilder = ImmutableList.builder(); for (int rowGroupId : selectedRowGroups) { Map<StreamId, StreamCheckpoint> checkpoints = getStreamCheckpoints(includedOrcColumns, types, decompressor.isPresent(), rowGroupId, encodings, streams, columnIndexes); int rowOffset = rowGroupId * rowsInRowGroup; int rowsInGroup = Math.min(rowsInStripe - rowOffset, rowsInRowGroup); long minAverageRowBytes = columnIndexes .entrySet() .stream() .mapToLong(e -> e.getValue() .get(rowGroupId) .getColumnStatistics() .getMinAverageValueSizeInBytes()) .sum(); rowGroupBuilder.add(createRowGroup(rowGroupId, rowOffset, rowsInGroup, minAverageRowBytes, valueStreams, checkpoints)); } return rowGroupBuilder.build(); }