auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
@Override public <K, V> IgniteModel<I, List<O>> update(IgniteModel<I, List<O>> mdl, DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, L> lbExtractor) { ModelsParallelComposition<I, O> typedMdl = (ModelsParallelComposition<I, O>)mdl; assert typedMdl.submodels().size() == trainers.size(); List<IgniteModel<I, O>> mdls = new ArrayList<>(); for (int i = 0; i < trainers.size(); i++) mdls.add(trainers.get(i).update(typedMdl.submodels().get(i), datasetBuilder, featureExtractor, lbExtractor)); return new ModelsParallelComposition<>(mdls); }

Target:
@Override public <K, V> IgniteModel<I, List<O>> update(IgniteModel<I, List<O>> mdl, DatasetBuilder<K, V> datasetBuilder, IgniteBiFunction<K, V, Vector> featureExtractor, IgniteBiFunction<K, V, L> lbExtractor) { ModelsParallelComposition<I, O> typedMdl = (ModelsParallelComposition<I, O>)mdl; assert typedMdl.submodels().size() == trainers.size(); List<IgniteSupplier<IgniteModel<I, O>>> tasks = new ArrayList<>(); for (int i = 0; i < trainers.size(); i++) { int j = i; tasks.add(() -> trainers.get(j).update(typedMdl.submodels().get(j), datasetBuilder, featureExtractor, lbExtractor)); } List<IgniteModel<I, O>> mdls = environment.parallelismStrategy().submit(tasks).stream() .map(Promise::unsafeGet) .collect(Collectors.toList()); return new ModelsParallelComposition<>(mdls); }
Source:
public void acceptDraftDataFilteredByVariable( final Integer datasetId, final ObservationUnitsSearchDTO searchDTO, final int studyId) { final String variableId = searchDTO.getFilter().getVariableId().toString(); final List<Phenotype> phenotypes = new ArrayList<>(); this.fillSearchDTO(studyId, datasetId, searchDTO); final List<ObservationUnitRow> observationUnitsByVariable = this.daoFactory.getObservationUnitsSearchDAO().getObservationUnitsByVariable(searchDTO); if (!observationUnitsByVariable.isEmpty()) { for (final ObservationUnitRow observationUnitRow : observationUnitsByVariable) { final ObservationUnitData observationUnitData = observationUnitRow.getVariables().get( variableId); Phenotype phenotype = null; if (observationUnitData != null) { phenotype = this.daoFactory.getPhenotypeDAO().getById(observationUnitData.getObservationId()); } if (phenotype != null) { phenotypes.add(phenotype); if (StringUtils.isEmpty(phenotype.getDraftValue())) { this.deletePhenotype(phenotype.getPhenotypeId()); } else { this.updatePhenotype(phenotype, phenotype.getDraftCValueId(), phenotype.getDraftValue(), null, null, false); } } } } final List<Phenotype> allPhenotypes = this.daoFactory.getPhenotypeDAO().getPhenotypes(datasetId); this.reorganizePhenotypesStatus(studyId, datasetId, phenotypes, allPhenotypes); }

Target:
public void acceptDraftDataFilteredByVariable( final Integer datasetId, final ObservationUnitsSearchDTO searchDTO, final int studyId) { final String variableId = searchDTO.getFilter().getVariableId().toString(); final List<Phenotype> phenotypes = new ArrayList<>(); this.fillSearchDTO(studyId, datasetId, searchDTO); final List<ObservationUnitRow> observationUnitsByVariable = this.daoFactory.getObservationUnitsSearchDAO().getObservationUnitsByVariable(searchDTO); if (!observationUnitsByVariable.isEmpty()) { for (final ObservationUnitRow observationUnitRow : observationUnitsByVariable) { final ObservationUnitData observationUnitData = observationUnitRow.getVariables().get( variableId); Phenotype phenotype = null; if (observationUnitData != null) { phenotype = this.daoFactory.getPhenotypeDAO().getById(observationUnitData.getObservationId()); } if (phenotype != null) { phenotypes.add(phenotype); if (StringUtils.isEmpty(phenotype.getDraftValue())) { this.deletePhenotype(phenotype.getPhenotypeId()); } else { this.updatePhenotype(phenotype, phenotype.getDraftCValueId(), phenotype.getDraftValue(), null, null, false); } } } } this.reorganizePhenotypesStatus(studyId, phenotypes); }
Source:
public static List<NameValuePair> buildParameters(ArticleSearchQuery asq) { UrlParamBuilder params = UrlParamBuilder.params(); params.add("wt", "json"); if (asq.isPartialSearch()) { params.add("qf", "doc_partial_body"); params.add("fl", "*"); params.add("fq", "doc_type:partial"); } else { params.add("fq", "doc_type:full"); } params.add("fq", "!article_type_facet:\"Issue Image\""); if (asq.getStart() > 0) { params.add("start", Integer.toString(asq.getStart())); } params.add("rows", Integer.toString(asq.getRows())); params.add("hl", "false"); String queryString = asq.getQuery(); params.add("q", queryString); if (asq.isSimple()) { params.add("defType", "dismax"); } if (asq.getFacetFields().size() > 0) { params.add("facet", "true"); for (String field: asq.getFacetFields()) { params.add("facet.field", field); } params.add("facet.mincount", Integer.toString(asq.getFacetMinCount())); params.add("facet.limit", Integer.toString(asq.getFacetLimit())); params.add("facet.threads", Integer.toString(-1)); params.add("json.nl", "map"); } else { params.add("facet", "false"); } List<String> fields = asq.getFields().orElse(ArticleSearchQuery.ARTICLE_FIELDS); params.add("fl", Joiner.on(",").join(fields)); asq.getCursor().ifPresent(cursor -> params.add("cursorMark", cursor)); setQueryFilters(asq, params); if (asq.getStatsField().isPresent()) { params.add("stats", "true"); params.add("stats.field", asq.getStatsField().get()); } return params.build(); }

Target:
public static List<NameValuePair> buildParameters(ArticleSearchQuery asq) { UrlParamBuilder params = UrlParamBuilder.params(); params.add("wt", "json"); if (asq.isPartialSearch()) { params.add("qf", "doc_partial_body"); params.add("fl", "*"); params.add("fq", "doc_type:partial"); } else { params.add("fq", "doc_type:full"); } params.add("fq", "!article_type_facet:\"Issue Image\""); if (asq.getStart() > 0) { params.add("start", Integer.toString(asq.getStart())); } params.add("rows", Integer.toString(asq.getRows())); params.add("hl", "false"); String queryString = asq.getQuery(); params.add("q", queryString); if (asq.isSimple()) { params.add("defType", "dismax"); } if (asq.getFacetFields().size() > 0) { params.add("facet", "true"); for (String field: asq.getFacetFields()) { params.add("facet.field", field); } params.add("facet.mincount", Integer.toString(asq.getFacetMinCount())); params.add("facet.limit", Integer.toString(asq.getFacetLimit())); params.add("facet.threads", Integer.toString(THREAD_PER_FACET)); params.add("json.nl", "map"); } else { params.add("facet", "false"); } List<String> fields = asq.getFields().orElse(ArticleSearchQuery.ARTICLE_FIELDS); params.add("fl", Joiner.on(",").join(fields)); asq.getCursor().ifPresent(cursor -> params.add("cursorMark", cursor)); setQueryFilters(asq, params); if (asq.getStatsField().isPresent()) { params.add("stats", "true"); params.add("stats.field", asq.getStatsField().get()); } return params.build(); }
Source:
public void should_create_error_message_for_ignoring_case_with_multiple_findings() { ErrorMessageFactory factory = ShouldNotContainCharSequence.shouldNotContainIgnoringCase("Yoda", Arrays.array("OD", "da", "Luke"), Sets.newSet("OD", "da")); String message = factory.create(new TextDescription("Test"), new StandardRepresentation()); then(message).isEqualTo(format("[Test] %n" + "Expecting:%n" + " <\"Yoda\">%n" + "not to contain (ignoring case):%n" + " <[\"OD\", \"da\", \"Luke\"]>%n" + "but found:%n" + " <[\"OD\", \"da\"]>%n")); }

Target:
public void should_create_error_message_for_ignoring_case_with_multiple_findings() { ErrorMessageFactory factory = shouldNotContainIgnoringCase("Yoda", array("OD", "da", "Luke"), newSet("OD", "da")); String message = factory.create(new TextDescription("Test"), new StandardRepresentation()); then(message).isEqualTo(format("[Test] %n" + "Expecting:%n" + " <\"Yoda\">%n" + "not to contain (ignoring case):%n" + " <[\"OD\", \"da\", \"Luke\"]>%n" + "but found:%n" + " <[\"OD\", \"da\"]>%n")); }
Source:
IndexedTableJoinMatcher( final IndexedTable table, final ColumnSelectorFactory leftSelectorFactory, final JoinConditionAnalysis condition, final boolean remainderNeeded ) { this.table = table; this.currentRow = -1; if (condition.isAlwaysTrue()) { this.conditionMatchers = Collections.singletonList(() -> IntIterators.fromTo(0, table.numRows())); } else if (condition.isAlwaysFalse()) { this.conditionMatchers = Collections.singletonList(() -> IntIterators.EMPTY_ITERATOR); } else if (condition.getNonEquiConditions().isEmpty()) { this.conditionMatchers = condition.getEquiConditions() .stream() .map(eq -> makeConditionMatcher(table, leftSelectorFactory, eq)) .collect(Collectors.toCollection(ArrayList::new)); } else { throw new IAE( "Cannot build hash-join matcher on non-equi-join condition: %s", condition.getOriginalExpression() ); } this.currentMatchedRows = new IntIterator[conditionMatchers.size()]; this.selectorFactory = new IndexedTableColumnSelectorFactory(table, () -> currentRow); if (remainderNeeded) { this.matchedRows = new IntRBTreeSet(); } else { this.matchedRows = null; } }

Target:
IndexedTableJoinMatcher( final IndexedTable table, final ColumnSelectorFactory leftSelectorFactory, final JoinConditionAnalysis condition, final boolean remainderNeeded ) { this.table = table; this.currentRow = UNINITIALIZED_CURRENT_ROW; if (condition.isAlwaysTrue()) { this.conditionMatchers = Collections.singletonList(() -> IntIterators.fromTo(0, table.numRows())); } else if (condition.isAlwaysFalse()) { this.conditionMatchers = Collections.singletonList(() -> IntIterators.EMPTY_ITERATOR); } else if (condition.getNonEquiConditions().isEmpty()) { this.conditionMatchers = condition.getEquiConditions() .stream() .map(eq -> makeConditionMatcher(table, leftSelectorFactory, eq)) .collect(Collectors.toCollection(ArrayList::new)); } else { throw new IAE( "Cannot build hash-join matcher on non-equi-join condition: %s", condition.getOriginalExpression() ); } this.currentMatchedRows = new IntIterator[conditionMatchers.size()]; this.selectorFactory = new IndexedTableColumnSelectorFactory(table, () -> currentRow); if (remainderNeeded) { this.matchedRows = new IntRBTreeSet(); } else { this.matchedRows = null; } }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Integer.valueOf(maxBatchSize).hashCode(); return result; }

Target:
public int hashCode() { return 31 * super.hashCode() + maxBatchSize; }
Source:
private void generateRequires(StringBuilder buffer) { for (Map.Entry<String, String> entry : model.getDependencies() .entrySet()) { buffer.append("BuildRequires: mvn(" + entry.getKey() + ":" + entry.getValue() + ")\n"); } buffer.append("BuildRequires: maven-local\n"); for (Map.Entry<String, String> entry : model.getDependencies() .entrySet()) { buffer.append("Requires: mvn(" + entry.getKey() + ":" + entry.getValue() + ")\n"); } }

Target:
private void generateRequires(StringBuilder buffer) { buffer.append("BuildRequires: maven-local\n"); }
Source:
public List<DataPoint> getValues() { return _values; }

Target:
public ImmutableList<DataPoint> getValues() { return _values; }
Source:
public void readFields(DataInput dataInput) throws IOException { long numObjects = dataInput.readLong(); totalBytes = dataInput.readLong(); fileMetaDataList = new ArrayList<>(); for (long i = 0; i < numObjects; i++) { AbstractFileMetadata metadata = readFileMetaData(dataInput); fileMetaDataList.add(metadata); totalBytes += metadata.getFileSize(); } }

Target:
public void readFields(DataInput dataInput) throws IOException { totalBytes = dataInput.readLong(); long numObjects = dataInput.readLong(); fileMetaDataList = new ArrayList<>(); for (long i = 0; i < numObjects; i++) { AbstractFileMetadata metadata = readFileMetaData(dataInput); fileMetaDataList.add(metadata); } }
Source:
public static boolean publishHTMLPage(IHTMLPage htmlPage, List relatedNotPublished, User user, boolean respectFrontendRoles ) throws WebAssetException, DotSecurityException, DotDataException { Logger.debug(PublishFactory.class, "*****I'm an HTML Page -- Publishing"); ContentletAPI contentletAPI = APILocator.getContentletAPI(); for ( Object asset : relatedNotPublished ) { if ( asset instanceof Contentlet ) { Logger.debug( PublishFactory.class, "*****I'm an HTML Page -- Publishing my Contentlet Child=" + ((Contentlet) asset).getInode() ); try { Contentlet contentlet = (Contentlet) asset; WorkflowStep step = null; List<WorkflowStep> steps = APILocator.getWorkflowAPI().findStepsByContentlet(contentlet); if( null != steps && !steps.isEmpty() && steps.size() == 1) { step = steps.get(0); } if (null != step && !APILocator.getWorkflowAPI().findScheme(step.getSchemeId()).isMandatory() ) { contentletAPI.publish( (Contentlet) asset, user, false ); ContentletServices.invalidateLive(contentlet); } } catch ( DotSecurityException e ) { Logger.debug( PublishFactory.class, "publish html page: User has no permission to publish the content inode = " + ((Contentlet) asset).getInode() + " in the page, skipping it." ); } } else if ( asset instanceof Template ) { Logger.debug( PublishFactory.class, "*****I'm an HTML Page -- Publishing Template =" + ((Template) asset).getInode() ); publishAsset( (Template) asset, user, respectFrontendRoles, false ); } } PageServices.invalidateAll(htmlPage); if ( htmlPage instanceof HTMLPageAsset ) { APILocator.getContentletAPI().publish( (HTMLPageAsset) htmlPage, user, false ); } return true; }

Target:
public static boolean publishHTMLPage(IHTMLPage htmlPage, List relatedNotPublished, User user, boolean respectFrontendRoles ) throws WebAssetException, DotSecurityException, DotDataException { Logger.debug(PublishFactory.class, "*****I'm an HTML Page -- Publishing"); ContentletAPI contentletAPI = APILocator.getContentletAPI(); for ( Object asset : relatedNotPublished ) { if ( asset instanceof Contentlet ) { Logger.debug( PublishFactory.class, "*****I'm an HTML Page -- Publishing my Contentlet Child=" + ((Contentlet) asset).getInode() ); try { Contentlet contentlet = (Contentlet) asset; WorkflowStep step = APILocator.getWorkflowAPI().findStepByContentlet(contentlet); if (null != step && !APILocator.getWorkflowAPI().findScheme(step.getSchemeId()).isMandatory() ) { contentletAPI.publish( (Contentlet) asset, user, false ); ContentletServices.invalidateLive(contentlet); } } catch ( DotSecurityException e ) { Logger.debug( PublishFactory.class, "publish html page: User has no permission to publish the content inode = " + ((Contentlet) asset).getInode() + " in the page, skipping it." ); } } else if ( asset instanceof Template ) { Logger.debug( PublishFactory.class, "*****I'm an HTML Page -- Publishing Template =" + ((Template) asset).getInode() ); publishAsset( (Template) asset, user, respectFrontendRoles, false ); } } PageServices.invalidateAll(htmlPage); if ( htmlPage instanceof HTMLPageAsset ) { APILocator.getContentletAPI().publish( (HTMLPageAsset) htmlPage, user, false ); } return true; }
Source:
protected Set<String> getGroupsForUser(IPerson person) { final IGroupMember member = GroupService.getGroupMember(person.getEntityIdentifier()); final Set<String> groupKeys = new LinkedHashSet<String>(); for (final Iterator<IEntityGroup> groupItr = member.getAncestorGroups().iterator(); groupItr.hasNext();) { final IGroupMember group = groupItr.next(); final String groupKey = group.getKey(); if (IncludeExcludeUtils.included(groupKey, this.groupIncludes, this.groupExcludes)) { groupKeys.add(groupKey); } } return groupKeys; }

Target:
protected Set<String> getGroupsForUser(IPerson person) { final IGroupMember member = GroupService.getGroupMember(person.getEntityIdentifier()); final Set<String> groupKeys = new LinkedHashSet<>(); for (IGroupMember group : member.getAncestorGroups()) { final String groupKey = group.getKey(); if (IncludeExcludeUtils.included(groupKey, this.groupIncludes, this.groupExcludes)) { groupKeys.add(groupKey); } } return groupKeys; }
Source:
private void configureSaxonExtensions(net.sf.saxon.TransformerFactoryImpl tfi) { net.sf.saxon.Configuration conf = tfi.getConfiguration(); for (ExtensionFunctionDefinition def : ServiceLoader.load(ExtensionFunctionDefinition.class)) { try { conf.registerExtensionFunction(def.getClass().newInstance()); } catch (InstantiationException e) { throw new RuntimeException("Failed to register " + def.getFunctionQName().getDisplayName() + ". Cannot create instance of " + def.getClass().getName() + ": " + e.getMessage(), e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } }

Target:
private void configureSaxonExtensions(net.sf.saxon.TransformerFactoryImpl tfi) { final net.sf.saxon.Configuration conf = tfi.getConfiguration(); for (ExtensionFunctionDefinition def : ServiceLoader.load(ExtensionFunctionDefinition.class)) { try { conf.registerExtensionFunction(def.getClass().newInstance()); } catch (InstantiationException e) { throw new RuntimeException("Failed to register " + def.getFunctionQName().getDisplayName() + ". Cannot create instance of " + def.getClass().getName() + ": " + e.getMessage(), e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } }
Source:
public void toTop() { recordA.recordIndex = -1; }

Target:
public void toTop() { recordA.reset(); }
Source:
private boolean next0() { do { if (readNextFileFromDisk) { foundMetadataFile = false; final long pname = ff.findName(findFileStruct); if (hasNextFile) { nativeLPSZ.of(pname); if ( ff.findType(findFileStruct) == Files.DT_DIR && !Chars.equals(nativeLPSZ, '.') && !Chars.equals(nativeLPSZ, "..") ) { path.trimTo(plimit); path.concat(pname); if (ff.exists(path.concat(TableUtils.META_FILE_NAME).$())) { foundMetadataFile = true; metaMem.of(ff, path, ff.getPageSize(), ff.length(path)); columnCount = metaMem.getInt(TableUtils.META_OFFSET_COUNT); tableId = metaMem.getInt(TableUtils.META_OFFSET_TABLE_ID); } } hasNextFile = ff.findNext(findFileStruct) > 0; } } if (foundMetadataFile) { long offset = TableUtils.getColumnNameOffset(columnCount); for (int i = 0; i < columnCount; i++) { CharSequence name = metaMem.getStr(offset); if (columnIndex == i) { diskReadingRecord.name = name; diskReadingRecord.columnNumber = (short) (i + 1); diskReadingRecord.tableId = tableId; columnIndex++; if (columnIndex == columnCount) { readNextFileFromDisk = true; columnIndex = 0; } else { readNextFileFromDisk = false; } return true; } offset += ReadOnlyMemory.getStorageLength(name); } } } while (hasNextFile); ff.findClose(findFileStruct); findFileStruct = 0; hasNextFile = true; foundMetadataFile = false; return false; }

Target:
private boolean next0() { do { if (readNextFileFromDisk) { foundMetadataFile = false; final long pname = ff.findName(findFileStruct); if (hasNextFile) { nativeLPSZ.of(pname); if ( ff.findType(findFileStruct) == Files.DT_DIR && Chars.notDots(nativeLPSZ) ) { path.trimTo(plimit); path.concat(pname); if (ff.exists(path.concat(TableUtils.META_FILE_NAME).$())) { foundMetadataFile = true; metaMem.of(ff, path, ff.getPageSize(), ff.length(path)); columnCount = metaMem.getInt(TableUtils.META_OFFSET_COUNT); tableId = metaMem.getInt(TableUtils.META_OFFSET_TABLE_ID); } } hasNextFile = ff.findNext(findFileStruct) > 0; } } if (foundMetadataFile) { long offset = TableUtils.getColumnNameOffset(columnCount); for (int i = 0; i < columnCount; i++) { CharSequence name = metaMem.getStr(offset); if (columnIndex == i) { diskReadingRecord.name = name; diskReadingRecord.columnNumber = (short) (i + 1); diskReadingRecord.tableId = tableId; columnIndex++; if (columnIndex == columnCount) { readNextFileFromDisk = true; columnIndex = 0; } else { readNextFileFromDisk = false; } return true; } offset += ReadOnlyMemory.getStorageLength(name); } } } while (hasNextFile); ff.findClose(findFileStruct); findFileStruct = 0; hasNextFile = true; foundMetadataFile = false; return false; }
Source:
public void getPrograms_shouldTestGetPrograms() { List<Program> programs = pws.getPrograms("MAL"); List<Program> programs1 = pws.getPrograms("PR"); assertEquals(programs.size(), 1); assertEquals(programs1.size(), 3); }

Target:
public void getPrograms_shouldTestGetPrograms() { List<Program> malPrograms = pws.getPrograms("MAL"); List<Program> prPrograms = pws.getPrograms("PR"); assertEquals(malPrograms.size(), 1); assertEquals(prPrograms.size(), 3); }
Source:
public void factoryWithDirectUrlWithRootFolder() throws Exception { String expectedMessInTheEventsPanel = "Project " + EXPECTED_PROJECT + " imported"; List<String> expectedItemsAfterClonning = Arrays.asList( "CHANGELOG.md", "Dockerfile", "LICENSE", "README.md", "favicon.ico", "index.html", "karma-test-shim.js", "karma.conf.js", "package.json", "protractor.config.js", "styles.css", "systemjs.config.js", "tsconfig.json", "tslint.json", "typings.json", "wallaby.js"); try { testFactoryWithRootFolder.authenticateAndOpen(); } catch (TimeoutException ex) { fail("Known issue <LINK_0>"); } projectExplorer.waitProjectExplorer(); projectExplorer.waitItem(EXPECTED_PROJECT); notificationsPopupPanel.waitProgressPopupPanelClose(); events.clickEventLogBtn(); try { events.waitExpectedMessage(expectedMessInTheEventsPanel); } catch (TimeoutException ex) { fail("Known issue <LINK_1>"); } projectExplorer.openItemByPath(EXPECTED_PROJECT); String currentWsId = workspaceServiceClient .getByName(seleniumWebDriver.getWorkspaceNameFromBrowserUrl(), testUser.getName()) .getId(); List<String> visibleItems = projectExplorer.getNamesOfAllOpenItems(); assertTrue(visibleItems.containsAll(expectedItemsAfterClonning)); String currentTypeOfProject = projectServiceClient.getFirstProject(currentWsId).getType(); assertTrue(currentTypeOfProject.equals("blank")); }

Target:
public void factoryWithDirectUrlWithRootFolder() throws Exception { String expectedMessInTheEventsPanel = "Project " + EXPECTED_PROJECT + " imported"; List<String> expectedItemsAfterClonning = Arrays.asList( "CHANGELOG.md", "Dockerfile", "LICENSE", "README.md", "favicon.ico", "index.html", "karma-test-shim.js", "karma.conf.js", "package.json", "protractor.config.js", "styles.css", "systemjs.config.js", "tsconfig.json", "tslint.json", "typings.json", "wallaby.js"); try { testFactoryWithRootFolder.authenticateAndOpen(); } catch (TimeoutException ex) { fail("Known issue <LINK_0>", ex); } projectExplorer.waitProjectExplorer(); projectExplorer.waitItem(EXPECTED_PROJECT); notificationsPopupPanel.waitProgressPopupPanelClose(); events.clickEventLogBtn(); try { events.waitExpectedMessage(expectedMessInTheEventsPanel); } catch (TimeoutException ex) { fail("Known issue <LINK_1>"); } projectExplorer.openItemByPath(EXPECTED_PROJECT); String currentWsId = workspaceServiceClient .getByName(seleniumWebDriver.getWorkspaceNameFromBrowserUrl(), testUser.getName()) .getId(); List<String> visibleItems = projectExplorer.getNamesOfAllOpenItems(); assertTrue(visibleItems.containsAll(expectedItemsAfterClonning)); String currentTypeOfProject = projectServiceClient.getFirstProject(currentWsId).getType(); assertTrue(currentTypeOfProject.equals("blank")); }
Source:
void flush() { Producer<K, V> producer; try { _producerLock.lock(); producer = _kafkaProducer; } finally { _producerLock.unlock(); } if (producer != null) { try { producer.flush(_producerFlushTimeoutMs, TimeUnit.MILLISECONDS); } catch (InterruptException | TimeoutException | IllegalStateException e) { try { _producerLock.lock(); if (producer == _kafkaProducer) { _log.warn("Kafka producer flush may be interrupted/timed out, closing producer {}.", producer); shutdownProducer(); } else { _log.warn("Kafka producer flush may be interrupted/timed out, producer already closed.", producer); } throw e; } finally { _producerLock.unlock(); } } } }

Target:
void flush() { Producer<K, V> producer; try { _producerLock.lock(); producer = _kafkaProducer; } finally { _producerLock.unlock(); } if (producer != null) { try { producer.flush(_producerFlushTimeoutMs, TimeUnit.MILLISECONDS); } catch (Exception e) { try { _producerLock.lock(); if (producer == _kafkaProducer) { _log.warn("Kafka producer flush may be interrupted/timed out, closing producer {}.", producer); shutdownProducer(); } else { _log.warn("Kafka producer flush may be interrupted/timed out, producer already closed.", producer); } throw e; } finally { _producerLock.unlock(); } } } }
Source:
public List<JdbcColumnHandle> getColumns(JdbcTableHandle tableHandle) { try (Connection connection = driver.connect(connectionUrl, connectionProperties)) { try (ResultSet resultSet = getColumns(tableHandle, connection.getMetaData())) { List<JdbcColumnHandle> columns = new ArrayList<>(); boolean found = false; while (resultSet.next()) { found = true; Type columnType = toPrestoType( resultSet.getInt("DATA_TYPE"), resultSet.getInt("COLUMN_SIZE"), resultSet.getInt("DECIMAL_DIGITS")); if (columnType != null) { String columnName = resultSet.getString("COLUMN_NAME"); columns.add(new JdbcColumnHandle(connectorId, columnName, columnType)); } } if (!found) { throw new TableNotFoundException(tableHandle.getSchemaTableName()); } return ImmutableList.copyOf(columns); } } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } }

Target:
public List<JdbcColumnHandle> getColumns(JdbcTableHandle tableHandle) { try (Connection connection = driver.connect(connectionUrl, connectionProperties)) { try (ResultSet resultSet = getColumns(tableHandle, connection.getMetaData())) { List<JdbcColumnHandle> columns = new ArrayList<>(); while (resultSet.next()) { Type columnType = toPrestoType( resultSet.getInt("DATA_TYPE"), resultSet.getInt("COLUMN_SIZE"), resultSet.getInt("DECIMAL_DIGITS")); if (columnType != null) { String columnName = resultSet.getString("COLUMN_NAME"); columns.add(new JdbcColumnHandle(connectorId, columnName, columnType)); } } if (columns.isEmpty()) { throw new TableNotFoundException(tableHandle.getSchemaTableName()); } return ImmutableList.copyOf(columns); } } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } }
Source:
public HttpMessage buildMessage(String body) throws HttpMalformedHeaderException { HttpMessage msg = new HttpMessage(); msg.setRequestHeader("GET <LINK_0> HTTP/1.1"); msg.setResponseBody(body); return msg; }

Target:
private static HttpMessage buildMessage(String body) throws HttpMalformedHeaderException { HttpMessage msg = new HttpMessage(); msg.setRequestHeader("GET <LINK_0> HTTP/1.1"); msg.setResponseBody(body); return msg; }
Source:
public void logsMessage() throws IOException { new TkSlf4j(new TkEmpty()).act(new RqFake()); }

Target:
public void logsMessage() throws IOException { new TkSlf4j(new TkText("test")).act(new RqFake()); }
Source:
static ExportMode getExportFeatureMode(FeaturesType features) throws SetupException { if (features == null) { return ExportMode.BASIC; } for (FeatureType feature : features.getFeature()) { if (feature.getName().equalsIgnoreCase(EXPORT_FEATURE)) { String mode = feature.getOption(); for (ExportMode modeEnum : ExportMode.values()) { if (mode.equalsIgnoreCase(modeEnum.toString())) { if (!VoltDB.instance().getConfig().m_isEnterprise && modeEnum == ExportMode.ADVANCED) { throw new SetupException("Cannot use ADVANCED export mode in community edition"); } return modeEnum; } } throw new SetupException("Unknown export feature mode: " + mode); } } return ExportMode.BASIC; }

Target:
static ExportMode getExportFeatureMode(FeaturesType features) throws SetupException { if (features == null) { return ExportMode.BASIC; } for (FeatureType feature : features.getFeature()) { if (feature.getName().equalsIgnoreCase(EXPORT_FEATURE)) { String mode = feature.getOption(); for (ExportMode modeEnum : ExportMode.values()) { if (mode.equalsIgnoreCase(modeEnum.name())) { if (!VoltDB.instance().getConfig().m_isEnterprise && modeEnum == ExportMode.ADVANCED) { throw new SetupException("Cannot use ADVANCED export mode in community edition"); } return modeEnum; } } throw new SetupException("Unknown export feature mode: " + mode); } } return ExportMode.BASIC; }
Source:
public long scanAndAggregate( TopNQuery query, Selector selector, Cursor cursor, Aggregator[][] rowSelector ) { initAggregateStore(); long processedRows = 0; while (!cursor.isDone()) { if (hasNulls && selector.isNull()) { if (nullValueAggregates == null) { nullValueAggregates = BaseTopNAlgorithm.makeAggregators(cursor, query.getAggregatorSpecs()); } for (Aggregator aggregator : nullValueAggregates) { aggregator.aggregate(); } } else { Aggregator[] valueAggregates = getValueAggregators(query, selector, cursor); for (Aggregator aggregator : valueAggregates) { aggregator.aggregate(); } } cursor.advance(); processedRows++; } return processedRows; }

Target:
public long scanAndAggregate( TopNQuery query, Selector selector, Cursor cursor, Aggregator[][] rowSelector ) { long processedRows = 0; while (!cursor.isDone()) { if (hasNulls && selector.isNull()) { if (nullValueAggregates == null) { nullValueAggregates = BaseTopNAlgorithm.makeAggregators(cursor, query.getAggregatorSpecs()); } for (Aggregator aggregator : nullValueAggregates) { aggregator.aggregate(); } } else { Aggregator[] valueAggregates = getValueAggregators(query, selector, cursor); for (Aggregator aggregator : valueAggregates) { aggregator.aggregate(); } } cursor.advance(); processedRows++; } return processedRows; }
Source:
public String[] getCallStackPath() { return new String[] { CallStackStateProvider.CALL_STACK }; }

Target:
public String[] getCallStackPath() { return CALL_STACK_PATH; }
Source:
private int randInt() { Random rand = new Random(); int min = 1; int max = 200; int res = rand.nextInt((max - min) + 1) + min; System.out.println(res); return res; }

Target:
private int randInt() { Random rand = new Random(); int min = 1; int max = 200; int res = rand.nextInt((max - min) + 1) + min; return res; }
Source:
public void changeMessageCommitFormatSimple() throws Exception { Change c = newChange(); ChangeUpdate update = newUpdate(c, changeOwner); update.setChangeMessage("Just a little code change.\nHow about a new line"); update.commit(); assertEquals("refs/changes/01/1/meta", update.getRefName()); RevWalk walk = new RevWalk(repo); try { RevCommit commit = walk.parseCommit(update.getRevision()); walk.parseBody(commit); assertEquals("Update patch set 1\n" + "\n" + "Just a little code change.\nHow about a new line\n" + "\n" + "Patch-set: 1\n", commit.getFullMessage()); } finally { walk.release(); } }

Target:
public void changeMessageCommitFormatSimple() throws Exception { Change c = newChange(); ChangeUpdate update = newUpdate(c, changeOwner); update.setChangeMessage("Just a little code change.\n" + "How about a new line"); update.commit(); assertEquals("refs/changes/01/1/meta", update.getRefName()); RevWalk walk = new RevWalk(repo); try { RevCommit commit = walk.parseCommit(update.getRevision()); walk.parseBody(commit); assertEquals("Update patch set 1\n" + "\n" + "Just a little code change.\n" + "How about a new line\n" + "\n" + "Patch-set: 1\n", commit.getFullMessage()); } finally { walk.release(); } }
Source:
public void testSshWithoutKnownHostsWithProviderAsk() throws Exception { File copiedHosts = new File(knownHosts.getParentFile(), "copiedKnownHosts"); assertTrue("Failed to rename known_hosts", knownHosts.renameTo(copiedHosts)); TestCredentialsProvider provider = new TestCredentialsProvider(); cloneWith("ssh://localhost/doesntmatter", defaultCloneDir, provider, "Host localhost", "HostName localhost", "Port " + testPort, "User " + TEST_USER, "IdentityFile " + privateKey1.getAbsolutePath()); Map<URIish, List<CredentialItem>> messages = provider.getLog(); assertFalse("Expected user iteraction", messages.isEmpty()); if (getSessionFactory() instanceof JschConfigSessionFactory) { assertEquals("Expected to be asked about the key", 1, messages.size()); return; } assertEquals( "Expected to be asked about the key, and the file creation", 2, messages.size()); assertTrue("~/.ssh/known_hosts should exist now", knownHosts.exists()); File clonedAgain = new File(getTemporaryDirectory(), "cloned2"); cloneWith("ssh://localhost/doesntmatter", clonedAgain, provider, "Host localhost", "HostName localhost", "Port " + testPort, "User " + TEST_USER, "IdentityFile " + privateKey1.getAbsolutePath()); }

Target:
public void testSshWithoutKnownHostsWithProviderAsk() throws Exception { File copiedHosts = new File(knownHosts.getParentFile(), "copiedKnownHosts"); assertTrue("Failed to rename known_hosts", knownHosts.renameTo(copiedHosts)); TestCredentialsProvider provider = new TestCredentialsProvider(); cloneWith("ssh://localhost/doesntmatter", defaultCloneDir, provider, "Host localhost", "HostName localhost", "Port " + testPort, "User " + TEST_USER, "IdentityFile " + privateKey1.getAbsolutePath()); Map<URIish, List<CredentialItem>> messages = provider.getLog(); assertFalse("Expected user interaction", messages.isEmpty()); if (getSessionFactory() instanceof JschConfigSessionFactory) { assertEquals("Expected to be asked about the key", 1, messages.size()); return; } assertEquals( "Expected to be asked about the key, and the file creation", 2, messages.size()); assertTrue("~/.ssh/known_hosts should exist now", knownHosts.exists()); File clonedAgain = new File(getTemporaryDirectory(), "cloned2"); cloneWith("ssh://localhost/doesntmatter", clonedAgain, provider, "Host localhost", "HostName localhost", "Port " + testPort, "User " + TEST_USER, "IdentityFile " + privateKey1.getAbsolutePath()); }
Source:
private static Symbol copySymbol(String symbolName, Symbol symbol, Map<String, Symbol> globalSymbolsByFQN) { if (symbol.kind() == Symbol.Kind.FUNCTION) { return new FunctionSymbolImpl(symbolName, (FunctionSymbol) symbol); } else if (symbol.kind() == Symbol.Kind.CLASS) { ClassSymbolImpl classSymbol = new ClassSymbolImpl(symbolName, symbol.fullyQualifiedName()); for (Symbol originalSymbol : ((ClassSymbol) symbol).superClasses()) { Symbol globalSymbol = globalSymbolsByFQN.get(originalSymbol.fullyQualifiedName()); if (globalSymbol != null && globalSymbol.kind() == Symbol.Kind.CLASS) { classSymbol.addSuperClass(globalSymbol); } else { classSymbol.addSuperClass(originalSymbol); } } classSymbol.setHasUnresolvedTypeHierarchy(classSymbol.superClasses().stream().anyMatch( s -> s.kind() != Symbol.Kind.CLASS && !BuiltinSymbols.all().contains(s.fullyQualifiedName()))); return classSymbol; } return new SymbolImpl(symbolName, symbol.fullyQualifiedName()); }

Target:
private static Symbol copySymbol(String symbolName, Symbol symbol, Map<String, Symbol> globalSymbolsByFQN) { if (symbol.kind() == Symbol.Kind.FUNCTION) { return new FunctionSymbolImpl(symbolName, (FunctionSymbol) symbol); } else if (symbol.kind() == Symbol.Kind.CLASS) { ClassSymbolImpl classSymbol = new ClassSymbolImpl(symbolName, symbol.fullyQualifiedName()); for (Symbol originalSymbol : ((ClassSymbol) symbol).superClasses()) { Symbol globalSymbol = globalSymbolsByFQN.get(originalSymbol.fullyQualifiedName()); if (globalSymbol != null && globalSymbol.kind() == Symbol.Kind.CLASS) { classSymbol.addSuperClass(copySymbol(globalSymbol.name(), globalSymbol, globalSymbolsByFQN)); } else { classSymbol.addSuperClass(originalSymbol); } } classSymbol.setHasUnresolvedTypeHierarchy(classSymbol.superClasses().stream().anyMatch(s -> s.kind() != Symbol.Kind.CLASS)); return classSymbol; } return new SymbolImpl(symbolName, symbol.fullyQualifiedName()); }
Source:
public void dispose() { getTableViewer().getTable().dispose(); super.dispose(); }

Target:
public void dispose() { super.dispose(); }
Source:
public static DiscoveryStrategy create(ResourceLoader resourceLoader, Bootstrap bootstrap, Set<Class<? extends Annotation>> initialBeanDefiningAnnotations) { if (Reflections.isClassLoadable(resourceLoader, JANDEX_INDEX_CLASS_NAME)) { CommonLogger.LOG.usingJandex(); try { return Reflections.cast(SecurityActions.getConstructor(Reflections.classForName(resourceLoader, JANDEX_DISCOVERY_STRATEGY_CLASS_NAME), ResourceLoader.class, Bootstrap.class, Set.class).newInstance(resourceLoader, bootstrap, initialBeanDefiningAnnotations)); } catch (Exception e) { throw CommonLogger.LOG.unableToInstantiate(JANDEX_DISCOVERY_STRATEGY_CLASS_NAME, Arrays.toString(new Object[] { resourceLoader, bootstrap, initialBeanDefiningAnnotations }), e); } } return new ReflectionDiscoveryStrategy(resourceLoader, bootstrap, initialBeanDefiningAnnotations); }

Target:
public static DiscoveryStrategy create(ResourceLoader resourceLoader, Bootstrap bootstrap, Set<Class<? extends Annotation>> initialBeanDefiningAnnotations) { if (Reflections.isClassLoadable(resourceLoader, JANDEX_INDEX_CLASS_NAME)) { CommonLogger.LOG.usingJandex(); try { return cast(classForName(resourceLoader, JANDEX_DISCOVERY_STRATEGY_CLASS_NAME).getConstructor(ResourceLoader.class, Bootstrap.class, Set.class) .newInstance(resourceLoader, bootstrap, initialBeanDefiningAnnotations)); } catch (Exception e) { throw CommonLogger.LOG.unableToInstantiate(JANDEX_DISCOVERY_STRATEGY_CLASS_NAME, Arrays.toString(new Object[] { resourceLoader, bootstrap, initialBeanDefiningAnnotations }), e); } } return new ReflectionDiscoveryStrategy(resourceLoader, bootstrap, initialBeanDefiningAnnotations); }
Source:
public void handleMessage(Message msg) { Dispatcher outerThis = dispatcherRef.get(); if (outerThis == null) { return; } switch (msg.what) { case REQUEST_SUBMIT : { Action action = (Action) msg.obj; outerThis.performSubmit(action); break; } case REQUEST_CANCEL : { Action action = (Action) msg.obj; outerThis.performCancel(action); break; } case HUNTER_COMPLETE : { BitmapHunter hunter = (BitmapHunter) msg.obj; outerThis.performComplete(hunter); break; } case HUNTER_RETRY : { BitmapHunter hunter = (BitmapHunter) msg.obj; outerThis.performRetry(hunter); break; } case HUNTER_DECODE_FAILED : { BitmapHunter hunter = (BitmapHunter) msg.obj; outerThis.performError(hunter); break; } case HUNTER_DELAY_NEXT_BATCH : { outerThis.performBatchComplete(); break; } case NETWORK_STATE_CHANGE : { NetworkInfo info = (NetworkInfo) msg.obj; outerThis.performNetworkStateChange(info); break; } case AIRPLANE_MODE_CHANGE : { outerThis.performAirplaneModeChange(msg.arg1 == AIRPLANE_MODE_ON); break; } default : throw new AssertionError("Unknown handler message received: " + msg.what); } }

Target:
public void handleMessage(Message msg) { Dispatcher dispatcher = dispatcherRef.get(); if (dispatcher == null) { return; } switch (msg.what) { case REQUEST_SUBMIT: { Action action = (Action) msg.obj; dispatcher.performSubmit(action); break; } case REQUEST_CANCEL: { Action action = (Action) msg.obj; dispatcher.performCancel(action); break; } case HUNTER_COMPLETE: { BitmapHunter hunter = (BitmapHunter) msg.obj; dispatcher.performComplete(hunter); break; } case HUNTER_RETRY: { BitmapHunter hunter = (BitmapHunter) msg.obj; dispatcher.performRetry(hunter); break; } case HUNTER_DECODE_FAILED: { BitmapHunter hunter = (BitmapHunter) msg.obj; dispatcher.performError(hunter); break; } case HUNTER_DELAY_NEXT_BATCH: { dispatcher.performBatchComplete(); break; } case NETWORK_STATE_CHANGE: { NetworkInfo info = (NetworkInfo) msg.obj; dispatcher.performNetworkStateChange(info); break; } case AIRPLANE_MODE_CHANGE: { dispatcher.performAirplaneModeChange(msg.arg1 == AIRPLANE_MODE_ON); break; } default: throw new AssertionError("Unknown handler message received: " + msg.what); } }
Source:
public void dropToSelection(Object data) { String filePath = ""; if (data instanceof String[]) { filePath = ((String[]) data)[0]; } if (filePath != null) { parseFile(filePath, "-1"); } else { showMessage(viewer.getControl().getShell(), SWT.ERROR, "Error", "Not an Excel or Word file."); } viewer.refresh(); }

Target:
public void dropToSelection(Object data) { String filePath = ""; if (data instanceof String[]) { filePath = ((String[]) data)[0]; } if (filePath != null) { parseFile(filePath, OBJECT_ID_NOT_SPECIFIED); } else { showMessage(viewer.getControl().getShell(), SWT.ERROR, "Error", "Not an Excel or Word file."); } viewer.refresh(); }
Source:
private void setupFilters() { addFilter(ContextClasssLoaderFilter.class); addFilter(DiagnosticThreadNameFilter.class); addFilter(CharacterEncodingFilter.class); addFilter(CompressionFilter.class); addFilter(HudsonFilter.class); addFilter(CrumbFilter.class); addFilter(PluginServletFilter.class); }

Target:
private void setupFilters() { addFilter(ContextClassLoaderFilter.class); addFilter(DiagnosticThreadNameFilter.class); addFilter(CharacterEncodingFilter.class); addFilter(CompressionFilter.class); addFilter(HudsonFilter.class); addFilter(CrumbFilter.class); addFilter(PluginServletFilter.class); }
Source:
public void whenTryToLockShouldWork() throws DotSecurityException, DotDataException { final Role role = new RoleDataGen().nextPersisted(); final User user = new UserDataGen().roles(role).nextPersisted(); final ContentType contentType = new ContentTypeDataGen().nextPersisted(); final Contentlet contentlet = new ContentletDataGen(contentType.id()).next(); final ESContentletAPIImpl esContentletAPI = new ESContentletAPIImpl(); final Contentlet contentletSaved = esContentletAPI.checkin(contentlet, APILocator.systemUser(), false); addPermission(role, contentType, PermissionLevel.WRITE); addPermission(role, contentletSaved, PermissionLevel.WRITE); esContentletAPI.lock(contentletSaved, user, false); }

Target:
public void whenTryToLockShouldWork() throws DotSecurityException, DotDataException { final Role role = new RoleDataGen().nextPersisted(); final User user = new UserDataGen().roles(role).nextPersisted(); final ContentType contentType = new ContentTypeDataGen().nextPersisted(); final Contentlet contentlet = new ContentletDataGen(contentType.id()).next(); final ESContentletAPIImpl esContentletAPI = new ESContentletAPIImpl(); final Contentlet contentletSaved = esContentletAPI.checkin(contentlet, APILocator.systemUser(), false); addPermission(role, contentType, PermissionLevel.WRITE); addPermission(role, contentletSaved, PermissionLevel.WRITE); esContentletAPI.lock(contentletSaved, user, false); checkLock(user, contentletSaved); }
Source:
public List<CaptureConfig> onRepeating() { return new ArrayList<>(); }

Target:
public CaptureConfig onRepeating() { return null; }
Source:
public void execute(SensorContext context) { Optional<RuleKey> parsingErrorKey = getParsingErrorKey(); for (InputFile inputFile : fileSystem.inputFiles(mainFilesPredicate)) { XmlFile xmlFile = new XmlFile(inputFile, fileSystem); try { NewXmlFile newXmlFile = NewXmlFile.create(inputFile); LineCounter.analyse(context, fileLinesContextFactory, newXmlFile); runChecks(context, xmlFile); } catch (ParseException e) { processParseException(e, context, inputFile, parsingErrorKey); } catch (Exception e) { processException(e, context, inputFile); } } }

Target:
public void execute(SensorContext context) { Optional<RuleKey> parsingErrorKey = getParsingErrorKey(); for (InputFile inputFile : fileSystem.inputFiles(mainFilesPredicate)) { XmlFile xmlFile = new XmlFile(inputFile, fileSystem); try { NewXmlFile newXmlFile = NewXmlFile.create(inputFile); LineCounter.analyse(context, fileLinesContextFactory, newXmlFile); runChecks(context, xmlFile, newXmlFile); } catch (ParseException e) { processParseException(e, context, inputFile, parsingErrorKey); } catch (Exception e) { processException(e, context, inputFile); } } }
Source:
public void saveValuesText(String answer) { ValueDB valueDB = getValueBySession(); if (valueDB != null) { valueDB.setValue(answer); } SurveyDB surveyDB = (SurveyFragmentStrategy.getSessionSurveyByQuestion(this)); SurveyFragmentStrategy.saveValuesText(valueDB, answer, this, surveyDB); }

Target:
public void saveValuesText(String answer) { ValueDB valueDB = getValueBySession(); SurveyDB surveyDB = (SurveyFragmentStrategy.getSessionSurveyByQuestion(this)); SurveyFragmentStrategy.saveValuesText(valueDB, answer, this, surveyDB); }
Source:
public void addEditCentralRepoComment() { CentralRepoCommentDialog centralRepoCommentDialog = new CentralRepoCommentDialog(correlationAttribute); centralRepoCommentDialog.display(); if (centralRepoCommentDialog.isCommentUpdated()) { EamDb dbManager; try { dbManager = EamDb.getInstance(); if (addToDatabase) { dbManager.addArtifact(correlationAttribute); } else { dbManager.updateAttributeInstanceComment(correlationAttribute); } } catch (EamDbException ex) { logger.log(Level.SEVERE, "Error connecting to Central Repository database.", ex); } } }

Target:
public void addEditCentralRepoComment() { CentralRepoCommentDialog centralRepoCommentDialog = new CentralRepoCommentDialog(correlationAttribute, title); centralRepoCommentDialog.display(); if (centralRepoCommentDialog.isCommentUpdated()) { EamDb dbManager; try { dbManager = EamDb.getInstance(); if (addToDatabase) { dbManager.addArtifact(correlationAttribute); } else { dbManager.updateAttributeInstanceComment(correlationAttribute); } } catch (EamDbException ex) { logger.log(Level.SEVERE, "Error connecting to Central Repository database.", ex); } } }
Source:
private ReaderPostAdapter getPostAdapter() { if (mPostAdapter == null) { AppLog.d(T.READER, "reader post list > creating post adapter"); Context context = WPActivityUtils.getThemedContext(getActivity()); mPostAdapter = new ReaderPostAdapter( context, getPostListType(), mImageManager, mIsTopLevel, this ); mPostAdapter.setOnFollowListener(this); mPostAdapter.setOnPostSelectedListener(this); mPostAdapter.setOnPostPopupListener(this); mPostAdapter.setOnDataLoadedListener(mDataLoadedListener); mPostAdapter.setOnDataRequestedListener(mDataRequestedListener); mPostAdapter.setOnPostBookmarkedListener(mOnPostBookmarkedListener); mPostAdapter.setOnNewsCardListener(mNewsCardListener); if (getActivity() instanceof ReaderSiteHeaderView.OnBlogInfoLoadedListener) { mPostAdapter.setOnBlogInfoLoadedListener((ReaderSiteHeaderView.OnBlogInfoLoadedListener) getActivity()); } mViewModel.getNewsDataSource().removeObserver(mNewsItemObserver); if (getPostListType().isTagType()) { mPostAdapter.setCurrentTag(getCurrentTag()); mViewModel.getNewsDataSource().observe((FragmentActivity) getActivity(), mNewsItemObserver); } else if (getPostListType() == ReaderPostListType.BLOG_PREVIEW) { mPostAdapter.setCurrentBlogAndFeed(mCurrentBlogId, mCurrentFeedId); } else if (getPostListType() == ReaderPostListType.SEARCH_RESULTS) { ReaderTag searchTag = ReaderUtils.getTagForSearchQuery(mCurrentSearchQuery); mPostAdapter.setCurrentTag(searchTag); } } return mPostAdapter; }

Target:
private ReaderPostAdapter getPostAdapter() { if (mPostAdapter == null) { AppLog.d(T.READER, "reader post list > creating post adapter"); Context context = WPActivityUtils.getThemedContext(getActivity()); mPostAdapter = new ReaderPostAdapter( context, getPostListType(), mImageManager, mIsTopLevel ); mPostAdapter.setOnFollowListener(this); mPostAdapter.setReblogActionListener(this); mPostAdapter.setOnPostSelectedListener(this); mPostAdapter.setOnPostPopupListener(this); mPostAdapter.setOnDataLoadedListener(mDataLoadedListener); mPostAdapter.setOnDataRequestedListener(mDataRequestedListener); mPostAdapter.setOnPostBookmarkedListener(mOnPostBookmarkedListener); mPostAdapter.setOnNewsCardListener(mNewsCardListener); if (getActivity() instanceof ReaderSiteHeaderView.OnBlogInfoLoadedListener) { mPostAdapter.setOnBlogInfoLoadedListener((ReaderSiteHeaderView.OnBlogInfoLoadedListener) getActivity()); } mViewModel.getNewsDataSource().removeObserver(mNewsItemObserver); if (getPostListType().isTagType()) { mPostAdapter.setCurrentTag(getCurrentTag()); mViewModel.getNewsDataSource().observe((FragmentActivity) getActivity(), mNewsItemObserver); } else if (getPostListType() == ReaderPostListType.BLOG_PREVIEW) { mPostAdapter.setCurrentBlogAndFeed(mCurrentBlogId, mCurrentFeedId); } else if (getPostListType() == ReaderPostListType.SEARCH_RESULTS) { ReaderTag searchTag = ReaderUtils.getTagForSearchQuery(mCurrentSearchQuery); mPostAdapter.setCurrentTag(searchTag); } } return mPostAdapter; }