auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean provides(String pageId) { if (DebugPage.PAGE_ID.equals(pageId)) { return true; } return false; }

Target:
public boolean provides(String pageId) { return DebugPage.PAGE_ID.equals(pageId); }
Source:
public List<Snippet> choose(Segmenter segmenter, HitEnum e, int max) { if (!e.next()) { return Collections.emptyList(); } S state = init(segmenter, max); while (mustKeepGoing(state)) { int startOffset = e.startOffset(); int lastEndOffset = e.endOffset(); if (!segmenter.acceptable(startOffset, lastEndOffset)) { if (!e.next()) { return results(state); } continue; } List<Hit> hits = new ArrayList<Hit>(); hits.add(hitBuilder.buildHit(e)); while (true) { boolean done = !e.next(); if (done) { snippet(state, startOffset, lastEndOffset, hits); return results(state); } final int thisEndOffset = e.endOffset(); if (!segmenter.acceptable(startOffset, thisEndOffset)) { snippet(state, startOffset, lastEndOffset, hits); break; } hits.add(hitBuilder.buildHit(e)); lastEndOffset = thisEndOffset; } } return results(state); }

Target:
public List<Snippet> choose(Segmenter segmenter, HitEnum e, int max) { if (!e.next()) { return Collections.emptyList(); } S state = init(segmenter, max); while (mustKeepGoing(state)) { int startOffset = e.startOffset(); int lastEndOffset = e.endOffset(); if (!segmenter.acceptable(startOffset, lastEndOffset)) { if (!e.next()) { return results(state); } continue; } List<Hit> hits = new ArrayList<Hit>(); hits.add(hitBuilder.buildHit(e)); while (true) { boolean done = !e.next(); if (done) { snippet(state, startOffset, lastEndOffset, hits); return results(state); } int thisEndOffset = e.endOffset(); if (!segmenter.acceptable(startOffset, thisEndOffset)) { snippet(state, startOffset, lastEndOffset, hits); break; } hits.add(hitBuilder.buildHit(e)); lastEndOffset = thisEndOffset; } } return results(state); }
Source:
public void DeleteAndRestoreMapTests_006_SysOpCanDeleteMap() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userNameSysop, credentials.passwordSysop, wikiURL); InteractiveMapPageObject selectedMap = base.openInteractiveMapById(wikiURL, InteractiveMapsContent.mapToDeleteAndRestore); selectedMap.verifyMapOpened(); String deletedMapId = selectedMap.getEmbedMapID(); DeleteAMapComponentObject deleteMapModal = selectedMap.deleteMap(); InteractiveMapsPageObject specialMap = deleteMapModal.deleteMap(); specialMap.verifyMapDeletedMessage(); }

Target:
public void DeleteAndRestoreMapTests_006_SysOpCanDeleteMap() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userNameSysop, credentials.passwordSysop, wikiURL); InteractiveMapPageObject selectedMap = base.openInteractiveMapById(wikiURL, InteractiveMapsContent.mapToDeleteAndRestore[3]); selectedMap.verifyMapOpened(); DeleteAMapComponentObject deleteMapModal = selectedMap.deleteMap(); InteractiveMapsPageObject specialMap = deleteMapModal.deleteMap(); }
Source:
protected void channelRead0( ChannelHandlerContext ctx, T request ) throws Exception { log.debug( "Handling request " + request ); StoreCopyFinishedResponse.Status responseStatus = StoreCopyFinishedResponse.Status.E_UNKNOWN; try { NeoStoreDataSource neoStoreDataSource = dataSource.get(); if ( !hasSameStoreId( request.expectedStoreId(), neoStoreDataSource ) ) { responseStatus = StoreCopyFinishedResponse.Status.E_STORE_ID_MISMATCH; } else if ( !isTransactionWithinReach( request.requiredTransactionId(), checkpointerSupplier.get() ) ) { responseStatus = StoreCopyFinishedResponse.Status.E_TOO_FAR_BEHIND; } else { File storeDir = neoStoreDataSource.getStoreDir(); try ( ResourceIterator<StoreFileMetadata> resourceIterator = files( request, neoStoreDataSource ) ) { while ( resourceIterator.hasNext() ) { StoreFileMetadata storeFileMetadata = resourceIterator.next(); storeFileStreamingProtocol.stream( ctx, new StoreResource( storeFileMetadata.file(), relativePath( storeDir, storeFileMetadata.file() ), storeFileMetadata.recordSize(), pageCache, fs ) ); } } responseStatus = StoreCopyFinishedResponse.Status.SUCCESS; } } finally { storeFileStreamingProtocol.end( ctx, responseStatus ); protocol.expect( CatchupServerProtocol.State.MESSAGE_TYPE ); } }

Target:
protected void channelRead0( ChannelHandlerContext ctx, T request ) throws Exception { log.debug( "Handling request %s", request ); StoreCopyFinishedResponse.Status responseStatus = StoreCopyFinishedResponse.Status.E_UNKNOWN; try { NeoStoreDataSource neoStoreDataSource = dataSource.get(); if ( !hasSameStoreId( request.expectedStoreId(), neoStoreDataSource ) ) { responseStatus = StoreCopyFinishedResponse.Status.E_STORE_ID_MISMATCH; } else if ( !isTransactionWithinReach( request.requiredTransactionId(), checkpointerSupplier.get() ) ) { responseStatus = StoreCopyFinishedResponse.Status.E_TOO_FAR_BEHIND; } else { File storeDir = neoStoreDataSource.getStoreDir(); try ( ResourceIterator<StoreFileMetadata> resourceIterator = files( request, neoStoreDataSource ) ) { while ( resourceIterator.hasNext() ) { StoreFileMetadata storeFileMetadata = resourceIterator.next(); storeFileStreamingProtocol.stream( ctx, new StoreResource( storeFileMetadata.file(), relativePath( storeDir, storeFileMetadata.file() ), storeFileMetadata.recordSize(), pageCache, fs ) ); } } responseStatus = StoreCopyFinishedResponse.Status.SUCCESS; } } finally { storeFileStreamingProtocol.end( ctx, responseStatus ); protocol.expect( CatchupServerProtocol.State.MESSAGE_TYPE ); } }
Source:
private void testEditResponse() throws Exception { ______TS("edit responses"); FeedbackQuestionAttributes fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 1); FeedbackResponseAttributes fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); assertEquals("<p>Student 1 self feedback.</p>", fr.getResponseDetails().getAnswerString()); submitPage = loginToInstructorEditStudentFeedbackPage("IESFPTCourseinstr", "student1InIESFPTCourse@gmail.tmt", "session1InIESFPTCourse"); submitPage.verifyHtmlMainContent("/instructorEditStudentFeedbackPageOpen.html"); submitPage.fillResponseRichTextEditor(1, 0, "Good design"); submitPage.clickSubmitButton(); submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, Const.StatusMessages.FEEDBACK_UNANSWERED_QUESTIONS + "2, 3."); submitPage.verifyAndCloseSuccessfulSubmissionModal("2, 3."); fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 1); fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); assertEquals("<p>Good design</p>", fr.getResponseDetails().getAnswerString()); }

Target:
private void testEditResponse() throws Exception { ______TS("edit responses"); FeedbackQuestionAttributes fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 1); FeedbackResponseAttributes fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); assertEquals("Student 1 self feedback.", fr.getResponseDetails().getAnswerString()); submitPage = loginToInstructorEditStudentFeedbackPage("IESFPTCourseinstr", "student1InIESFPTCourse@gmail.tmt", "session1InIESFPTCourse"); submitPage.verifyHtmlMainContent("/instructorEditStudentFeedbackPageOpen.html"); submitPage.fillResponseRichTextEditor(1, 0, "Good design"); submitPage.clickSubmitButton(); submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, Const.StatusMessages.FEEDBACK_UNANSWERED_QUESTIONS + "2."); submitPage.verifyAndCloseSuccessfulSubmissionModal("2."); fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 1); fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt"); assertEquals("<p>Good design</p>", fr.getResponseDetails().getAnswerString()); }
Source:
public boolean retrieveDocument(PatientSearchBean patientQuerySearch) throws IOException { DocumentRetrieve docRetrieve = new DocumentRetrieve(); docRetrieve.setDocumentId(patientQuerySearch.getSelectedCurrentDocument().getDocumentId()); docRetrieve.setHCID(patientQuerySearch.getOrganization()); docRetrieve.setRepositoryId(patientQuerySearch.getSelectedCurrentDocument().getRepositoryUniqueId()); DocumentRetrieveResults response = documentRetrieveService.retrieveDocuments(docRetrieve); if (response.getDocument() != null) { if (response.getContentType().contains("text/xml")) { InputStream xsl = FacesContext.getCurrentInstance().getExternalContext().getResourceAsStream("/WEB-INF/CDA.xsl"); InputStream xml = new ByteArrayInputStream(response.getDocument()); byte[] convertXmlToHtml = null; if (xsl != null) { convertXmlToHtml = convertXMLToHTML(xml, xsl); xsl.close(); } patientQuerySearch.getSelectedCurrentDocument().setDocumentContent(convertXmlToHtml); } else { patientQuerySearch.getSelectedCurrentDocument().setDocumentContent(response.getDocument()); } patientQuerySearch.getSelectedCurrentDocument().setDocumentRetrieved(true); LOG.debug("Successfully retrieved the content of document with documentid:" + response.getContentType()); return true; } return false; }

Target:
public boolean retrieveDocument(PatientSearchBean patientQuerySearch) { DocumentRetrieve docRetrieve = new DocumentRetrieve(); docRetrieve.setDocumentId(patientQuerySearch.getSelectedCurrentDocument().getDocumentId()); docRetrieve.setHCID(patientQuerySearch.getOrganization()); docRetrieve.setRepositoryId(patientQuerySearch.getSelectedCurrentDocument().getRepositoryUniqueId()); DocumentRetrieveResults response = documentRetrieveService.retrieveDocuments(docRetrieve); if (response.getDocument() != null) { if (response.getContentType().contains("text/xml")) { InputStream xsl = FacesContext.getCurrentInstance().getExternalContext().getResourceAsStream("/WEB-INF/CDA.xsl"); InputStream xml = new ByteArrayInputStream(response.getDocument()); byte[] convertXmlToHtml = null; if (xsl != null) { convertXmlToHtml = convertXMLToHTML(xml, xsl); closeStreamSilently(xsl); } patientQuerySearch.getSelectedCurrentDocument().setDocumentContent(convertXmlToHtml); } else { patientQuerySearch.getSelectedCurrentDocument().setDocumentContent(response.getDocument()); } patientQuerySearch.getSelectedCurrentDocument().setDocumentRetrieved(true); LOG.debug("Successfully retrieved the content of document with documentid:" + response.getContentType()); return true; } return false; }
Source:
public TransportHints(boolean tcpNoDelay) { tcpNoDelay(tcpNoDelay); }

Target:
public TransportHints(boolean tcpNoDelay) { this.tcpNoDelay = tcpNoDelay; }
Source:
private boolean isThreadSuspended(IExecutionDMContext ctx) { assert ctx != null; IRunControl runControl = getServicesTracker().getService(IRunControl.class); return runControl.isSuspended(ctx); }

Target:
private boolean isThreadSuspended(IExecutionDMContext ctx) { assert ctx != null; IRunControl runControl = getServicesTracker().getService(IRunControl.class); if (runControl != null) { return runControl.isSuspended(ctx); } else { return false; } }
Source:
private static SubscriberScopeManager createScopeManager( final IResource[] resources) { ResourceMapping[] mappings = GitScopeUtil .getResourceMappings(resources); GitSynchronizeDataSet set = new GitSynchronizeDataSet(); final GitResourceVariantTreeSubscriber subscriber = new GitResourceVariantTreeSubscriber( set); Job initJob = new WorkspaceJob( UIText.GitModelSynchonize_fetchGitDataJobName) { @Override public IStatus runInWorkspace(IProgressMonitor monitor) { subscriber.init(monitor); return Status.OK_STATUS; } }; initJob.setUser(true); initJob.setRule(RuleUtil.getRuleForRepositories(resources)); initJob.schedule(); try { initJob.join(); } catch (InterruptedException e) { Activator.logError(UIText.GitModelSynchonize_fetchInterrupted, e); } SubscriberScopeManager manager = new SubscriberScopeManager( UIText.GitScopeOperation_GitScopeManager, mappings, subscriber, true); return manager; }

Target:
private static SubscriberScopeManager createScopeManager( final IResource[] resources) { ResourceMapping[] mappings = GitScopeUtil .getResourceMappings(resources); GitSynchronizeDataSet set = new GitSynchronizeDataSet(); final GitResourceVariantTreeSubscriber subscriber = new GitResourceVariantTreeSubscriber( set); Job initJob = new WorkspaceJob( UIText.GitModelSynchronize_fetchGitDataJobName) { @Override public IStatus runInWorkspace(IProgressMonitor monitor) { subscriber.init(monitor); return Status.OK_STATUS; } }; initJob.setUser(true); initJob.setRule(RuleUtil.getRuleForRepositories(resources)); initJob.schedule(); try { initJob.join(); } catch (InterruptedException e) { Activator.logError(UIText.GitModelSynchronize_fetchInterrupted, e); } SubscriberScopeManager manager = new SubscriberScopeManager( UIText.GitScopeOperation_GitScopeManager, mappings, subscriber, true); return manager; }
Source:
protected void commonInitialize() { super.commonInitialize(); getModel().getIsHighlyAvailable().getEntityChangedEvent().addListener((ev, sender, args) -> { boolean ha = getModel().getIsHighlyAvailable().getEntity(); if (ha) { Collection<StorageDomain> domains = getModel().getLease().getItems(); Guid bootableDiskStorageDomainId = getBootableDiskStorageDomainId(); if (bootableDiskStorageDomainId != null) { domains.stream() .filter(Objects::nonNull) .filter(d -> d.getId().equals(bootableDiskStorageDomainId)) .findFirst().ifPresent(d -> getModel().getLease().setSelectedItem(d)); } } }); getModel().getIsStateless().getEntityChangedEvent().addListener(new UpdateTemplateWithVersionListener() { @Override protected void beforeUpdate() { updateStatelessFlag = false; } @Override protected boolean isAddLatestVersion() { return getModel().getIsStateless().getEntity(); } }); }

Target:
protected void commonInitialize() { super.commonInitialize(); getModel().getIsHighlyAvailable().getEntityChangedEvent().addListener((ev, sender, args) -> { boolean ha = getModel().getIsHighlyAvailable().getEntity(); if (ha) { Guid bootableDiskStorageDomainId = getBootableDiskStorageDomainId(); if (bootableDiskStorageDomainId != null) { setVmleaseDefaultStorageDomain(bootableDiskStorageDomainId); } } }); getModel().getIsStateless().getEntityChangedEvent().addListener(new UpdateTemplateWithVersionListener() { @Override protected void beforeUpdate() { updateStatelessFlag = false; } @Override protected boolean isAddLatestVersion() { return getModel().getIsStateless().getEntity(); } }); }
Source:
public BlockSplitBloomFilter(int numBytes, int minimumBytes, int maximumBytes, HashStrategy hashStrategy) { if (minimumBytes > LOWER_BOUND_BYTES && minimumBytes < UPPER_BOUND_BYTES) { this.minimumBytes = minimumBytes; } if (maximumBytes> LOWER_BOUND_BYTES && maximumBytes < UPPER_BOUND_BYTES) { this.maximumBytes = maximumBytes; } initBitset(numBytes); switch (hashStrategy) { case XXH64: this.hashStrategy = hashStrategy; hashFunction = new XxHash(); break; default: throw new RuntimeException("Unsupported hash strategy"); } }

Target:
public BlockSplitBloomFilter(int numBytes, int minimumBytes, int maximumBytes, HashStrategy hashStrategy) { if (minimumBytes > maximumBytes) { throw new IllegalArgumentException("the minimum bytes should be less or equal than maximum bytes"); } if (minimumBytes > LOWER_BOUND_BYTES && minimumBytes < UPPER_BOUND_BYTES) { this.minimumBytes = minimumBytes; } if (maximumBytes > LOWER_BOUND_BYTES && maximumBytes < UPPER_BOUND_BYTES) { this.maximumBytes = maximumBytes; } initBitset(numBytes); cacheBuffer.order(ByteOrder.LITTLE_ENDIAN); switch (hashStrategy) { case XXH64: this.hashStrategy = hashStrategy; hashFunction = new XxHash(); break; default: throw new RuntimeException("Unsupported hash strategy"); } }
Source:
public void close() throws IOException { if (!completedFiles.isEmpty() || !filesInProcess.isEmpty()) { for (File file : completedFiles) { if (!file.delete()) { LOG.warn("Unable to delete file [%s]", file.getPath()); } } for (File file : filesInProcess) { if (!file.delete()) { LOG.warn("Unable to delete file [%s]", file.getPath()); } } throw new ISE(String.format( "%d writers needs to be closed before closing smoosher.", filesInProcess.size() + completedFiles.size() )); } if (currOut != null) { currOut.close(); } File metaFile = metaFile(baseDir); try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(metaFile), Charsets.UTF_8))) { out.write(String.format("v1,%d,%d", maxChunkSize, outFiles.size())); out.write("\n"); for (Map.Entry<String, Metadata> entry : internalFiles.entrySet()) { final Metadata metadata = entry.getValue(); out.write( joiner.join( entry.getKey(), metadata.getFileNum(), metadata.getStartOffset(), metadata.getEndOffset() ) ); out.write("\n"); } } }

Target:
public void close() throws IOException { if (!completedFiles.isEmpty() || !filesInProcess.isEmpty()) { for (File file : completedFiles) { if (!file.delete()) { LOG.warn("Unable to delete file [%s]", file); } } for (File file : filesInProcess) { if (!file.delete()) { LOG.warn("Unable to delete file [%s]", file); } } throw new ISE( "[%d] writers in progress and [%d] completed writers needs to be closed before closing smoosher.", filesInProcess.size(), completedFiles.size() ); } if (currOut != null) { currOut.close(); } File metaFile = metaFile(baseDir); try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(metaFile), Charsets.UTF_8))) { out.write(String.format("v1,%d,%d", maxChunkSize, outFiles.size())); out.write("\n"); for (Map.Entry<String, Metadata> entry : internalFiles.entrySet()) { final Metadata metadata = entry.getValue(); out.write( joiner.join( entry.getKey(), metadata.getFileNum(), metadata.getStartOffset(), metadata.getEndOffset() ) ); out.write("\n"); } } }
Source:
private static Object getTagsValue(Attribute attr) { return StringUtils.join( StreamSupport.stream(attr.getTags().spliterator(), false) .map(Tag::getId) .collect(Collectors.toList()), ","); }

Target:
private static Object getTagsValue(Attribute attr) { return Streams.stream(attr.getTags()).map(Tag::getId).collect(joining(",")); }
Source:
private void initializeTrainingAndValidationSets(Iterable<? extends AbstractInstance> rawTrainingData) { setAndSortAllTrainingData(rawTrainingData); setMaxValidationTime(); int initialTrainingSetSize = getInitialSizeForTrainData(); trainingDataToAddToPredictiveModel = Lists.<AbstractInstance>newArrayListWithExpectedSize(initialTrainingSetSize); validationSet = Lists.<AbstractInstance>newArrayList(); DateTime timeOfInstance; DateTime timeOfFirstInstanceInValidationSet = dateTimeExtractor.extractDateTime(allTrainingData.get(initialTrainingSetSize)); DateTime leastUpperBoundOfValidationSet = timeOfFirstInstanceInValidationSet.plus(durationOfValidationSet); weightOfValidationSet = 0; for (AbstractInstance instance : allTrainingData) { timeOfInstance = dateTimeExtractor.extractDateTime(instance); if (timeOfInstance.isBefore(timeOfFirstInstanceInValidationSet)) { trainingDataToAddToPredictiveModel.add(instance); } else if (timeOfInstance.isBefore(leastUpperBoundOfValidationSet) && !timeOfInstance.isAfter(maxTime)) { validationSet.add(instance); weightOfValidationSet += instance.getWeight(); } else break; } currentTrainingSetSize = trainingDataToAddToPredictiveModel.size(); return; }

Target:
private void initializeTrainingAndValidationSets(Iterable<? extends AbstractInstance> rawTrainingData) { setAndSortAllTrainingData(rawTrainingData); setMaxValidationTime(); int initialTrainingSetSize = getInitialSizeForTrainData(); trainingDataToAddToPredictiveModel = Lists.<AbstractInstance>newArrayListWithExpectedSize(initialTrainingSetSize); validationSet = Lists.<AbstractInstance>newArrayList(); DateTime timeOfInstance; DateTime timeOfFirstInstanceInValidationSet = dateTimeExtractor.extractDateTime(allTrainingData.get(initialTrainingSetSize)); DateTime leastUpperBoundOfValidationSet = timeOfFirstInstanceInValidationSet.plus(durationOfValidationSet); weightOfValidationSet = 0; for (AbstractInstance instance : allTrainingData) { timeOfInstance = dateTimeExtractor.extractDateTime(instance); if (timeOfInstance.isBefore(timeOfFirstInstanceInValidationSet)) { trainingDataToAddToPredictiveModel.add(instance); } else if (timeOfInstance.isBefore(leastUpperBoundOfValidationSet)) { validationSet.add(instance); weightOfValidationSet += instance.getWeight(); } else break; } currentTrainingSetSize = trainingDataToAddToPredictiveModel.size(); return; }
Source:
public void checkOperationDefinition(OperationDefinition operationDefinition) { List<VariableDefinition> variableDefinitions = operationDefinition.getVariableDefinitions(); if (variableDefinitions == null || variableDefinitions.size() <= 1) { return; } Set<String> variableNameList = new HashSet<>(variableDefinitions.size()); for (VariableDefinition variableDefinition : variableDefinitions) { if (variableNameList.contains(variableDefinition.getName())) { addError(ValidationErrorType.DuplicateVariableName, variableDefinition.getSourceLocation(), duplicateVariableNameMessage(variableDefinition.getName())); } else { variableNameList.add(variableDefinition.getName()); } } }

Target:
public void checkOperationDefinition(OperationDefinition operationDefinition) { List<VariableDefinition> variableDefinitions = operationDefinition.getVariableDefinitions(); if (variableDefinitions == null || variableDefinitions.size() <= 1) { return; } Set<String> variableNameList = new LinkedHashSet<>(variableDefinitions.size()); for (VariableDefinition variableDefinition : variableDefinitions) { if (variableNameList.contains(variableDefinition.getName())) { addError(ValidationErrorType.DuplicateVariableName, variableDefinition.getSourceLocation(), duplicateVariableNameMessage(variableDefinition.getName())); } else { variableNameList.add(variableDefinition.getName()); } } }
Source:
private List<Partition> batchGetPartitions(AWSGlueAsync glueClient, String tableName) throws IOException { List<Partition> partitions = new ArrayList<>(); try { GetPartitionsRequest getPartitionsRequest = new GetPartitionsRequest() .withCatalogId(mGlueConfiguration.get(Property.CATALOG_ID)) .withDatabaseName(mGlueDbName) .withTableName(tableName); if (glueClient.getPartitions(getPartitionsRequest).getPartitions() != null) { partitions = glueClient.getPartitions(getPartitionsRequest).getPartitions(); } return partitions; } catch (AWSGlueException e) { throw new IOException("WARNING: Cannot get partition information for table: " + tableName + ". error: " + e.getMessage(), e); } }

Target:
private List<Partition> batchGetPartitions(AWSGlueAsync glueClient, String tableName) throws IOException { List<Partition> partitions = new ArrayList<>(); try { GetPartitionsRequest getPartitionsRequest = new GetPartitionsRequest() .withCatalogId(mGlueConfiguration.get(Property.CATALOG_ID)) .withDatabaseName(mGlueDbName) .withTableName(tableName); if (glueClient.getPartitions(getPartitionsRequest).getPartitions() != null) { partitions = glueClient.getPartitions(getPartitionsRequest).getPartitions(); } return partitions; } catch (AWSGlueException e) { throw new IOException("Cannot get partition information for table: " + tableName + " in Database: " + mGlueDbName + "; Catalog ID: " + mGlueConfiguration.get(Property.CATALOG_ID) + ". error: " + e.getMessage(), e); } }
Source:
public ElytronClientSshdSessionFactory(URI authenticationConfig) throws ConfigXMLParseException, GeneralSecurityException { context = ElytronXmlParser.parseAuthenticationClientConfiguration(authenticationConfig).create(); this.defaultKeys = new ConcurrentHashMap(); this.defaultIdentities = SshConstants.DEFAULT_IDENTITIES; this.keyPair = null; this.knownHostsFile = "known_hosts"; }

Target:
public ElytronClientSshdSessionFactory(URI authenticationConfig) throws ConfigXMLParseException, GeneralSecurityException { if (authenticationConfig != null) { context = ElytronXmlParser.parseAuthenticationClientConfiguration(authenticationConfig).create(); } else { context = null; } this.defaultKeys = new ConcurrentHashMap<>(); this.setSshDirectory(SSHCredential.DEFAULT_SSH_DIRECTORY); this.defaultIdentities = SSHCredential.DEFAULT_PRIVATE_KEYS; this.keyPair = null; this.knownHostsFile = SSHCredential.DEFAULT_KNOWN_HOSTS; }
Source:
private static BehaviorCategory resolveBehaviorCategory(String category) { if(null == category) { return null; } String CAT = category.toUpperCase(); if(CAT.contains("DEMERIT")) { return BehaviorCategory.DEMERIT; } else if(CAT.contains("MERIT")) { return BehaviorCategory.MERIT; } else if(CAT.contains("HOMEWORK")) { return BehaviorCategory.HOMEWORK; } else if(CAT.contains("DETENTION")) { return BehaviorCategory.DETENTION; } else if(CAT.contains("SUSPENSION")) { return BehaviorCategory.OUT_OF_SCHOOL_SUSPENSION; } else if(CAT.contains("D.O.") || CAT.contains("OFFICE") || CAT.contains("REFERRAL")) { return BehaviorCategory.REFERRAL; } else if(CAT.contains("AUTOMATIC") || CAT.contains("GENERAL") || CAT.contains("STORE")) { return null; } else { return BehaviorCategory.OTHER; } }

Target:
private static BehaviorCategory resolveBehaviorCategory(String category) { if(null == category) { return null; } String CAT = category.toUpperCase(); if(CAT.contains("DEMERIT")) { return BehaviorCategory.DEMERIT; } else if(CAT.contains("MERIT")) { return BehaviorCategory.MERIT; } else if(CAT.contains("HOMEWORK")) { return BehaviorCategory.HOMEWORK; } else if(CAT.contains("LUNCH DETENTION")) { return BehaviorCategory.LUNCH_DETENTION; } else if(CAT.contains("DETENTION")) { return BehaviorCategory.DETENTION; } else if(CAT.contains("SUSPENSION")) { return BehaviorCategory.OUT_OF_SCHOOL_SUSPENSION; } else if(CAT.contains("D.O.") || CAT.contains("OFFICE") || CAT.contains("REFERRAL") || CAT.contains("DEAN")) { return BehaviorCategory.REFERRAL; } else { return BehaviorCategory.OTHER; } }
Source:
public Iterable<Directive> process(final XML xml) throws IOException { final ContainerInstance instance = this.amazon.runOnDemand(); Logger.info( this, "ECS instance %s created", instance ); return new Directives().xpath("/talk") .add("ecs") .attr("id", instance.getEc2InstanceId()); }

Target:
public Iterable<Directive> process(final XML xml) throws IOException { final Container container = this.amazon.runOnDemand(); Logger.info( this, "ECS container %s created", container ); return new Directives().xpath("/talk") .add("ec2") .attr("id", container.getContainerArn()); }
Source:
public void cleanup(String workspaceId) { try (OpenShiftClient client = clientFactory.create()) { final String pvcUniqueName = pvcName + '-' + workspaceId; final List<PersistentVolumeClaim> pvcs = client.persistentVolumeClaims().inNamespace(projectName).list().getItems(); for (PersistentVolumeClaim pvc : pvcs) { if (pvc.getMetadata().getName().equals(pvcUniqueName)) { client.persistentVolumeClaims().inNamespace(projectName).delete(pvc); return; } } } }

Target:
public void cleanup(String workspaceId) { try (OpenShiftClient client = clientFactory.create()) { final String pvcUniqueName = pvcName + '-' + workspaceId; client.persistentVolumeClaims().inNamespace(projectName).withName(pvcUniqueName).delete(); } }
Source:
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT); final WeldCapability weldCapability; try { weldCapability = support.getCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class); } catch (CapabilityServiceSupport.NoSuchCapabilityException e) { String msg = String.format("Deployment %s requires use of the '%s' capability but it is not currently registered", phaseContext.getDeploymentUnit().getName(), WELD_CAPABILITY_NAME); throw new DeploymentUnitProcessingException(msg); } if (weldCapability.isPartOfWeldDeployment(deploymentUnit)) { final SmallRyeHealthReporter healthReporter = (SmallRyeHealthReporter) phaseContext.getServiceRegistry().getService(MicroProfileHealthSubsystemDefinition.HEALTH_REPORTER_SERVICE).getValue(); weldCapability.registerExtensionInstance(new CDIExtension(healthReporter), deploymentUnit); } }

Target:
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final CapabilityServiceSupport support = deploymentUnit.getAttachment(Attachments.CAPABILITY_SERVICE_SUPPORT); final WeldCapability weldCapability; try { weldCapability = support.getCapabilityRuntimeAPI(WELD_CAPABILITY_NAME, WeldCapability.class); } catch (CapabilityServiceSupport.NoSuchCapabilityException e) { throw new DeploymentUnitProcessingException(MicroProfileHealthLogger.LOGGER.deploymentRequiresCapability( phaseContext.getDeploymentUnit().getName(), WELD_CAPABILITY_NAME) ); } if (weldCapability.isPartOfWeldDeployment(deploymentUnit)) { final SmallRyeHealthReporter healthReporter = (SmallRyeHealthReporter) phaseContext.getServiceRegistry().getService(MicroProfileHealthSubsystemDefinition.HEALTH_REPORTER_SERVICE).getValue(); weldCapability.registerExtensionInstance(new CDIExtension(healthReporter), deploymentUnit); } }
Source:
public static void main(String[] argv) throws Exception{ Args args = new Args(); CmdLineParser parser = new CmdLineParser(args, ParserProperties.defaults().withUsageWidth(90)); try { parser.parseArgument(argv); } catch (CmdLineException e) { System.err.println(e.getMessage()); parser.printUsage(System.err); return; } Directory directory = FSDirectory.open(new File(args.index).toPath()); IndexReader reader = DirectoryReader.open(directory); if (args.stats) { Terms terms = MultiTerms.getTerms(reader, IndexArgs.CONTENTS); System.out.println("Index statistics"); System.out.println("----------------"); System.out.println("documents: " + reader.numDocs()); System.out.println("documents (non-empty): " + reader.getDocCount(IndexArgs.CONTENTS)); System.out.println("unique terms: " + terms.size()); System.out.println("total terms: " + reader.getSumTotalTermFreq(IndexArgs.CONTENTS)); } reader.close(); directory.close(); }

Target:
public static void main(String[] argv) throws Exception { Args args = new Args(); CmdLineParser parser = new CmdLineParser(args, ParserProperties.defaults().withUsageWidth(90)); try { parser.parseArgument(argv); } catch (CmdLineException e) { System.err.println(e.getMessage()); parser.printUsage(System.err); return; } IndexReader reader = IndexReaderUtils.getReader(args.index); Map<String, Object> results = IndexReaderUtils.getIndexStats(reader); if (args.stats) { Terms terms = MultiTerms.getTerms(reader, IndexArgs.CONTENTS); System.out.println("Index statistics"); System.out.println("----------------"); System.out.println("documents: " + results.get("documents")); System.out.println("documents (non-empty): " + results.get("non_empty_documents")); System.out.println("unique terms: " + results.get("unique_terms")); System.out.println("total terms: " + results.get("total_terms")); } reader.close(); }
Source:
public int getDepartmentsCount(AccessGroupSet accessGroups) { try { StringBuilder queryBuilder = new StringBuilder("*:*"); addAccessRestrictions(queryBuilder, accessGroups); SolrQuery query = new SolrQuery(); query.setQuery(queryBuilder.toString()); query.setRows(0); query.addFacetField("department"); query.setFacetLimit(-1); QueryResponse response = this.executeQuery(query); return response.getFacetField("department").getValueCount(); } catch (SolrServerException | AccessRestrictionException e) { LOG.error("Error retrieving department list", e); } return -1; }

Target:
public int getDepartmentsCount(AccessGroupSet accessGroups) { try { StringBuilder queryBuilder = new StringBuilder("*:*"); addAccessRestrictions(queryBuilder, accessGroups); SolrQuery query = new SolrQuery(); query.setQuery(queryBuilder.toString()); query.setRows(0); query.addFacetField("department"); query.setFacetLimit(-1); QueryResponse response = this.executeQuery(query); return response.getFacetField("department").getValueCount(); } catch (SolrServerException | AccessRestrictionException e) { LOG.error("Error retrieving department list", e); return -1; } }
Source:
public void checkProductItem(ProductItem item) { assertTrue(item.getId() > 0, "item id must be more than 0"); assertNotNull(item.getDescription(), "item description must be not null"); checkCategories(item.getCategories()); assertTrue(item.getPrices().size() >= 0); for (ProductItemPrice price : item.getPrices()) { checkPrice(price); } }

Target:
public void checkProductItem(ProductItem item) { assertTrue(item.getId() > 0, "item id must be more than 0"); assertNotNull(item.getDescription(), "item description must be not null"); checkCategories(item.getCategories()); assertFalse(item.getPrices().isEmpty()); for (ProductItemPrice price : item.getPrices()) { checkPrice(price); } }
Source:
private static String baseMessage() { return String.format( "Neo4j cannot be started, because the database files require upgrading and upgrades are " + "disabled in configuration. Please set '%s' to 'true' in your configuration file and try again.", GraphDatabaseSettings.allow_upgrade.name() ); }

Target:
private static String baseMessage() { return String.format( "Neo4j cannot be started because the database files require upgrading and upgrades are disabled " + "in the configuration. Please set '%s' to 'true' in your configuration file and try again.", GraphDatabaseSettings.allow_upgrade.name() ); }
Source:
public static void main(String[] args) throws Exception { final String baseDir; if (System.getenv("TEST_DATA_DIR") != null) { baseDir = System.getenv("TEST_DATA_DIR"); } else { baseDir = System.getProperty("java.io.tmpdir"); } File output = new File(baseDir, "python_udf_sql_job_result.csv"); if (output.exists()) { output.delete(); } TableEnvironment tEnv = TableEnvironment.create( EnvironmentSettings.newInstance().useBlinkPlanner().inBatchMode().build()); tEnv.getConfig().getConfiguration().set(CoreOptions.DEFAULT_PARALLELISM, 1); tEnv.sqlUpdate("create temporary system function add_one as 'add_one.add_one' language python"); tEnv.connect(new FileSystem().path(output.getAbsolutePath())) .withSchema(new Schema().field("a", DataTypes.BIGINT())) .withFormat(new OldCsv().field("a", DataTypes.BIGINT())) .inAppendMode() .createTemporaryTable("sink"); tEnv.createTemporaryView("source", tEnv.fromValues(1L, 2L, 3L).as("a")); tEnv.sqlUpdate("insert into sink select add_one(a) as a from source"); tEnv.execute("test-blink-batch-pyudf-sql-job"); try (InputStream in = new FileInputStream(output)) { byte[] content = new byte[in.available()]; in.read(content); String result = new String(content); if (!"2\n3\n4\n".equals(result)) { throw new AssertionError(String.format("The output result: '%s' is not as expected!", result)); } } }

Target:
public static void main(String[] args) { TableEnvironment tEnv = TableEnvironment.create( EnvironmentSettings.newInstance().useBlinkPlanner().inBatchMode().build()); tEnv.getConfig().getConfiguration().set(CoreOptions.DEFAULT_PARALLELISM, 1); tEnv.executeSql("create temporary system function add_one as 'add_one.add_one' language python"); tEnv.createTemporaryView("source", tEnv.fromValues(1L, 2L, 3L).as("a")); Iterator<Row> result = tEnv.executeSql("select add_one(a) as a from source").collect(); List<Long> actual = new ArrayList<>(); while (result.hasNext()) { Row r = result.next(); actual.add((Long) r.getField(0)); } List<Long> expected = Arrays.asList(2L, 3L, 4L); if (!actual.equals(expected)) { throw new AssertionError(String.format("The output result: %s is not as expected: %s!", actual, expected)); } }
Source:
public void minimalYamlParsesCorrectly() throws IOException { testYaml("caching-yaml-example.yaml"); }

Target:
public void minimalYamlParsesCorrectly() throws IOException { testYaml("minimal.yaml"); }
Source:
public void rebuildIndexes() { long forumComponentId = componentService.getComponentOfForum().getId(); componentService.checkPermissionsForComponent(forumComponentId); topicSearchService.rebuildSearchIndex(); }

Target:
public void rebuildIndexes() { topicSearchService.rebuildSearchIndex(); }
Source:
public static void start(final Stage primaryStage) { GridPane grid = new GridPane(); grid.setPadding(new javafx.geometry.Insets(10, 10, 10, 10)); grid.setVgap(20); grid.setHgap(20); Style.setBackground("sc2.jpg", grid); Button backButton; backButton = new Button("Back"); Style.setButtonStyle(backButton); GridPane.setConstraints(backButton, 2, 26); final Button soundButton; soundButton = new Button("Sound: ON"); Style.setButtonStyle(soundButton); soundButton.setFont(Font.font("Roboto", FontWeight.BOLD, 20)); GridPane.setConstraints(soundButton, 5, 18); grid.getChildren().addAll(backButton, soundButton); backButton.setOnAction(new EventHandler<ActionEvent>() { public void handle(final ActionEvent event) { StartScreen.start(primaryStage); } }); soundButton.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent event) { if (sound) { soundButton.setText("Sound: OFF"); sound = false; } else { soundButton.setText("Sound: ON"); sound = true; } } }); settings = new Scene(grid, GUIConstant.WIDTH, GUIConstant.HEIGHT); primaryStage.setScene(settings); primaryStage.show(); }

Target:
public static void start(final Stage primaryStage) { GridPane grid = new GridPane(); grid.setPadding(new javafx.geometry.Insets(10, 10, 10, 10)); grid.setVgap(20); grid.setHgap(20); Style.setBackground("sc2.jpg", grid); Button backButton; backButton = new Button("Back"); Style.setButtonStyle(backButton); GridPane.setConstraints(backButton, 2, 26); final Button soundButton; soundButton = new Button("Sound: ON"); Style.setButtonStyle(soundButton); soundButton.setFont(Font.font("Roboto", FontWeight.BOLD, 20)); GridPane.setConstraints(soundButton, 5, 18); grid.getChildren().addAll(backButton, soundButton); backButton.setOnAction(new EventHandler<ActionEvent>() { public void handle(final ActionEvent event) { StartScreen.start(primaryStage); } }); soundButton.setOnAction(new EventHandler<ActionEvent>() { public void handle(final ActionEvent event) { if (sound) { soundButton.setText("Sound: OFF"); sound = false; } else { soundButton.setText("Sound: ON"); sound = true; } } }); settings = new Scene(grid, GUIConstant.WIDTH, GUIConstant.HEIGHT); primaryStage.setScene(settings); primaryStage.show(); }
Source:
protected int getRecommendMaxNumberMessagesPerParam(AttackStrength strength) { int recommendMax = super.getRecommendMaxNumberMessagesPerParam(strength); switch (strength) { case LOW: return recommendMax + 4; case MEDIUM: default: return recommendMax + 6; case HIGH: return recommendMax + 7; case INSANE: return 300; } }

Target:
protected int getRecommendMaxNumberMessagesPerParam(AttackStrength strength) { int recommendMax = super.getRecommendMaxNumberMessagesPerParam(strength); switch (strength) { case LOW: return recommendMax + 4; case MEDIUM: default: return recommendMax + 6; case HIGH: return recommendMax + 7; case INSANE: return recommendMax + 9; } }
Source:
private void replaceVariables(Node root) throws Exception { boolean failFast = false; List<ConfigReplacer> replacers = new ArrayList<ConfigReplacer>(); PropertyReplacer propertyReplacer = new PropertyReplacer(); propertyReplacer.init(getProperties()); replacers.add(propertyReplacer); Node node = (Node) xpath.evaluate(format("/hz:%s/hz:%s", getConfigType().name, CONFIG_REPLACERS.name), root, XPathConstants.NODE); if (node != null) { String failFastAttr = getAttribute(node, "fail-if-value-missing"); failFast = isNullOrEmpty(failFastAttr) || Boolean.parseBoolean(failFastAttr); for (Node n : childElements(node)) { String value = cleanNodeName(n); if ("replacer".equals(value)) { replacers.add(createReplacer(n)); } } } ConfigReplacerHelper.traverseChildrenAndReplaceVariables(root, replacers, failFast, new XmlDomVariableReplacer()); }

Target:
private void replaceVariables(Node root) throws Exception { boolean failFast = false; List<ConfigReplacer> replacers = new ArrayList<ConfigReplacer>(); PropertyReplacer propertyReplacer = new PropertyReplacer(); propertyReplacer.init(getProperties()); replacers.add(propertyReplacer); Node node = (Node) xpath.evaluate(format("/hz:%s/hz:%s", getConfigType().name, CONFIG_REPLACERS.getName()), root, XPathConstants.NODE); if (node != null) { String failFastAttr = getAttribute(node, "fail-if-value-missing"); failFast = isNullOrEmpty(failFastAttr) || Boolean.parseBoolean(failFastAttr); for (Node n : childElements(node)) { String value = cleanNodeName(n); if ("replacer".equals(value)) { replacers.add(createReplacer(n)); } } } ConfigReplacerHelper.traverseChildrenAndReplaceVariables(root, replacers, failFast, new XmlDomVariableReplacer()); }
Source:
protected @NonNull TmfEventsTable createEventsTable(final Composite parent, final int cacheSize) { ITmfTrace trace = fTrace; TmfEventsTable table = TmfTraceTypeUIUtils.getEventTable(trace, parent, cacheSize); if (table != null) { return table; } Iterable<ITmfEventAspect> aspects = getTraceAspects(trace); if (!aspects.iterator().hasNext()) { return new TmfEventsTable(parent, cacheSize); } return new TmfEventsTable(parent, cacheSize, aspects); }

Target:
protected @NonNull TmfEventsTable createEventsTable(final Composite parent, final int cacheSize) { ITmfTrace trace = fTrace; TmfEventsTable table = TmfTraceTypeUIUtils.getEventTable(trace, parent, cacheSize); if (table != null) { return table; } Iterable<ITmfEventAspect> aspects = getTraceAspects(trace); if (Iterables.isEmpty(aspects)) { return new TmfEventsTable(parent, cacheSize); } return new TmfEventsTable(parent, cacheSize, aspects); }
Source:
private static EventTableLine buildEventTableLine(Map<Long, ITmfEventAspect<?>> aspects, ITmfEvent event, long lineIndex, long lineRank) { List<String> entry = new ArrayList<>(); for (Entry<Long, ITmfEventAspect<?>> aspectEntry : aspects.entrySet()) { Object aspectResolved = aspectEntry.getValue().resolve(event); entry.add(Objects.requireNonNull(aspectResolved == null ? StringUtils.EMPTY : String.valueOf(aspectResolved))); } return new EventTableLine(entry, lineIndex, event.getTimestamp(), lineRank, 0); }

Target:
private static EventTableLine buildEventTableLine(Map<Long, ITmfEventAspect<?>> aspects, ITmfEvent event, long lineIndex, long lineRank) { List<String> entry = new ArrayList<>(aspects.size()); for (Entry<Long, ITmfEventAspect<?>> aspectEntry : aspects.entrySet()) { Object aspectResolved = aspectEntry.getValue().resolve(event); entry.add(aspectResolved == null ? StringUtils.EMPTY : String.valueOf(aspectResolved)); } return new EventTableLine(entry, lineIndex, event.getTimestamp(), lineRank, 0); }
Source:
public void scan(HttpMessage msg, String param, String value) { if (checkWithPayloadsAndResponses(msg, param, errorCausingPayloads, evidenceError)) { checkWithPayloadsAndResponses(msg, param, vendorReturningPayloads, xsltVendors); checkPortScanning(msg, param); } }

Target:
public void scan(HttpMessage msg, String param, String value) { for (XSLTInjectionType check : XSLTInjectionType.values()) { if (tryInjection(msg, param, check)) { return; } } }
Source:
public Map<String, Ref> getRefs(String prefix) throws IOException { List<Ref> refs = reftableDatabase.getRefsByPrefix(prefix); RefList.Builder builder = new RefList.Builder(refs.size()); for (Ref r : refs) { builder.add(r); } return new RefMap(prefix, builder.toRefList(), RefList.emptyList(), RefList.emptyList()); }

Target:
public Map<String, Ref> getRefs(String prefix) throws IOException { List<Ref> refs = reftableDatabase.getRefsByPrefix(prefix); RefList.Builder<Ref> builder = new RefList.Builder<>(refs.size()); for (Ref r : refs) { builder.add(r); } return new RefMap(prefix, builder.toRefList(), RefList.emptyList(), RefList.emptyList()); }
Source:
public final DefaultConstraintMapping createConstraintMapping() { PropertyFilter propertyFilterToUse = null; if ( propertyFilter == null ) { propertyFilterToUse = new DefaultPropertyFilter(); LOG.creatingConstraintMappingPriorToBuildingFactoryWithoutDefinedFilter(); } else { propertyFilterToUse = propertyFilter; } LOG.creatingConstraintMappingPriorToBuildingFactory( propertyFilterToUse.getClass() ); return new DefaultConstraintMapping( propertyFilterToUse ); }

Target:
public final DefaultConstraintMapping createConstraintMapping() { GetterPropertyMatcher getterPropertyMatcherToUse = null; if ( getterPropertyMatcher == null ) { getterPropertyMatcherToUse = new DefaultGetterPropertyMatcher(); LOG.creatingConstraintMappingPriorToBuildingFactoryWithoutDefinedFilter(); } else { getterPropertyMatcherToUse = getterPropertyMatcher; } LOG.creatingConstraintMappingPriorToBuildingFactory( getterPropertyMatcherToUse.getClass() ); return new DefaultConstraintMapping( getterPropertyMatcherToUse ); }
Source:
public static String byteToHexString(byte[] bytes, int start, int end) { if(bytes == null) { throw new IllegalArgumentException("bytes == null"); } else { StringBuilder s = new StringBuilder(); for(int i = start; i < end; ++i) { s.append(String.format("%02x", bytes[i])); } return s.toString(); } }

Target:
public static String byteToHexString(byte[] bytes, int start, int end) { return org.apache.hadoop.util.StringUtils.byteToHexString(bytes, start, end); }
Source:
public void init(StreamGraph graph, Config config) { StreamSpec pageViewStreamSpec = new StreamSpec("page-views", TestRepartitionWindowApp.INPUT_TOPIC, "kafka"); Function<MessageEnvelope<String, String>, String> keyFn = pageView -> (String) pageView.getKey(); MessageStream<MessageEnvelope<String, String>> pageViews = graph.createInStream(pageViewStreamSpec, null, null); pageViews .partitionBy(keyFn) .window(Windows.keyedSessionWindow(keyFn, Duration.ofSeconds(3))) .sink((windowOutput, collector, coordinator) -> { String key = windowOutput.getKey().getKey(); String count = new Integer(windowOutput.getMessage().size()).toString(); LOG.info("Count is " + count + " for key " + key); collector.send(new OutgoingMessageEnvelope(new SystemStream("kafka", TestRepartitionWindowApp.OUTPUT_TOPIC), key, count)); }); }

Target:
public void init(StreamGraph graph, Config config) { MessageStream<String> pageViews = graph.<String, String, String>getInputStream("page-views", (k, v) -> v); Function<String, String> keyFn = pageView -> new PageView(pageView).getUserId(); OutputStream<String, String, WindowPane<String, Collection<String>>> outputStream = graph .getOutputStream(TestRepartitionWindowApp.OUTPUT_TOPIC, m -> m.getKey().getKey(), m -> new Integer(m.getMessage().size()).toString()); pageViews .partitionBy(keyFn) .window(Windows.keyedSessionWindow(keyFn, Duration.ofSeconds(3))) .sendTo(outputStream); }
Source:
protected @NonNull TmfViewer createLeftChildViewer(@Nullable Composite parent) { String analysisId = NonNullUtils.nullToEmptyString(getViewSite().getSecondaryId()); return new AbstractSegmentStoreScatterChartTreeViewer(Objects.requireNonNull(parent)) { @Override protected @Nullable ISegmentStoreProvider getSegmentStoreProvider(ITmfTrace trace) { IAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, IAnalysisModule.class, analysisId); if (module instanceof ISegmentStoreProvider) { return (ISegmentStoreProvider) module; } return null; } }; }

Target:
protected @NonNull TmfViewer createLeftChildViewer(@Nullable Composite parent) { String analysisId = String.valueOf(getViewSite().getSecondaryId()); return new AbstractSegmentStoreScatterChartTreeViewer(Objects.requireNonNull(parent)) { @Override protected @Nullable ISegmentStoreProvider getSegmentStoreProvider(ITmfTrace trace) { IAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, IAnalysisModule.class, analysisId); if (module instanceof ISegmentStoreProvider) { return (ISegmentStoreProvider) module; } return null; } }; }