auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void checkNodeJoinWithStaticCacheConfig( boolean client, boolean activateBeforeJoin, boolean newCfg ) throws Exception { if (!newCfg) configureCache = true; startGrid(GRID_0); startGrid(GRID_6); IgniteEx client1 = startClientGrid("client1"); if (newCfg) configureCache = true; if (activateBeforeJoin) grid(GRID_0).cluster().state(ClusterState.ACTIVE); if (client && newCfg) { <START> <END> String msg = "Joining node has encrypted caches which are not presented on the cluster, " + "encrypted caches configured on client node cannot be started when such node joins " + "the cluster, these caches can be started manually (dynamically) after node is joined " + "[caches=" + cacheName() + ']'; GridTestUtils.assertThrowsAnyCause(log, () -> startClientGrid(CLIENT), IgniteSpiException.class, msg); return; } IgniteEx node = client ? startClientGrid(CLIENT) : startGrid(GRID_7); if (!activateBeforeJoin) grid(GRID_0).cluster().state(ClusterState.ACTIVE); awaitPartitionMapExchange(); IgniteCache<Object, Object> cache = node.cache(cacheName()); assertNotNull(cache); for (long i = 0; i < 100; i++) cache.put(i, String.valueOf(i)); checkEncryptedCaches(grid(GRID_0), grid(GRID_6)); checkEncryptedCaches(grid(GRID_0), client1); checkData(client1); if (client) { checkEncryptedCaches(grid(GRID_0), grid(CLIENT)); checkData(grid(CLIENT)); return; } checkEncryptedCaches(grid(GRID_7), grid(GRID_0)); }</code><technical_language>Unnecessary line break</technical_language>

Target:
private void checkNodeJoinWithStaticCacheConfig( boolean client, boolean activateBeforeJoin, boolean newCfg ) throws Exception { if (!newCfg) configureCache = true; startGrid(GRID_0); startGrid(GRID_6); IgniteEx client1 = startClientGrid("client1"); if (newCfg) configureCache = true; if (activateBeforeJoin) grid(GRID_0).cluster().state(ClusterState.ACTIVE); if (client && newCfg) { String expErrMsg = "Joining node has encrypted caches which are not presented on the cluster, " + "encrypted caches configured on client node cannot be started when such node joins " + "the cluster, these caches can be started manually (dynamically) after node is joined " + "[caches=" + cacheName() + ']'; GridTestUtils.assertThrowsAnyCause(log, () -> startClientGrid(CLIENT), IgniteSpiException.class, expErrMsg); return; } IgniteEx node = client ? startClientGrid(CLIENT) : startGrid(GRID_7); if (!activateBeforeJoin) grid(GRID_0).cluster().state(ClusterState.ACTIVE); awaitPartitionMapExchange(); IgniteCache<Object, Object> cache = node.cache(cacheName()); assertNotNull(cache); for (long i = 0; i < 100; i++) cache.put(i, String.valueOf(i)); checkEncryptedCaches(grid(GRID_0), grid(GRID_6)); checkEncryptedCaches(grid(GRID_0), client1); checkData(client1); if (client) { checkEncryptedCaches(grid(GRID_0), grid(CLIENT)); checkData(grid(CLIENT)); } else checkEncryptedCaches(grid(GRID_7), grid(GRID_0)); }
Source:
<code>public void configure(BrokerPool pool, Path dataDir, Element config) throws DatabaseConfigurationException { super.configure(pool, dataDir, config); try { checkDatabase(); <START> } catch (ClassNotFoundException | SQLException e) { <END> throw new DatabaseConfigurationException(e.getMessage()); } }</code><technical_language>final</technical_language>

Target:
public void configure(BrokerPool pool, Path dataDir, Element config) throws DatabaseConfigurationException { super.configure(pool, dataDir, config); try { checkDatabase(); } catch (final ClassNotFoundException | SQLException e) { throw new DatabaseConfigurationException(e.getMessage()); } }
Source:
<code>public synchronized void startup() { if (sessionTracker == null) { createSessionTracker(); } startSessionTracker(); setupRequestProcessors(); startRequestThrottler(); registerJMX(); startJvmPauseMonitor(); registerMetrics(); setState(State.RUNNING); requestPathMetricsCollector.start(); <START> localSessionEnabled = sessionTracker instanceof UpgradeableSessionTracker <END> && ((UpgradeableSessionTracker) sessionTracker).isLocalSessionsEnabled(); notifyAll(); }</code><technical_language>this 'instanceof' a 'code smell' adding a isLocalSessionsEnabled method base class (SessionTracker) a default return of 'false'</technical_language>

Target:
public synchronized void startup() { if (sessionTracker == null) { createSessionTracker(); } startSessionTracker(); setupRequestProcessors(); startRequestThrottler(); registerJMX(); startJvmPauseMonitor(); registerMetrics(); setState(State.RUNNING); requestPathMetricsCollector.start(); localSessionEnabled = sessionTracker.isLocalSessionsEnabled(); notifyAll(); }
Source:
<code>private Map<String, String> findConfiguredMetaTags(final Map<String, String> properties) { Map<String, String> filteredMap = new HashMap<>(); properties .entrySet() .stream() <START> .filter(e -> e.getKey().startsWith(MetaTagConfiguration.CONFIG_PREFIX_FOR_TAGS)) .forEach((entry) -> filteredMap.put(entry.getKey().substring(MetaTagConfiguration.CONFIG_PREFIX_FOR_TAGS.length()), entry.getValue())); <END> return filteredMap; }</code><technical_language>suggestion .flatMap((entry) -> StringUtils.truncatePrefix(entry.getKey(), MetaTagConfiguration.CONFIG_PREFIX_FOR_TAGS) .map(Stream::of) .orElseGet(Stream::empty)) .collect(Collectors.toMap((entry) -> entry.getKey(), (entry) -> entry.getValue()));</technical_language>

Target:
private Map<String, String> findConfiguredMetaTags(final Map<String, String> properties) { Map<String, String> filteredMap = new HashMap<>(); return properties .entrySet() .stream() .filter(e -> e.getKey().startsWith(MetaTagConfiguration.CONFIG_PREFIX_FOR_TAGS)) .collect(Collectors.toMap((entry) -> entry.getKey().substring(MetaTagConfiguration.CONFIG_PREFIX_FOR_TAGS.length()), Map.Entry::getValue)); }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view; view = inflater.inflate(R.layout.fragment_course_dashboard, container, false); courseTextName = (TextView) view.findViewById(R.id.course_detail_name); courseTextDetails = (TextView) view.findViewById(R.id.course_detail_extras); headerImageView = (ImageView) view.findViewById(R.id.header_image_view); headerPlayIcon = (ImageView) view.findViewById(R.id.header_play_icon); courseDetailLayout = (LinearLayout) view.findViewById(R.id.dashboard_detail); headerPlayIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { <START> String url = environment.getConfig().getApiHostURL() + courseDetail.media.course_video.uri; <END> Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } }); return view; }</code><technical_language>I want prepend host URL here; I video uri is expected a full video URI, no? a <LINK_0> URL for example</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view; view = inflater.inflate(R.layout.fragment_course_dashboard, container, false); courseTextName = (TextView) view.findViewById(R.id.course_detail_name); courseTextDetails = (TextView) view.findViewById(R.id.course_detail_extras); headerImageView = (ImageView) view.findViewById(R.id.header_image_view); headerPlayIcon = (ImageView) view.findViewById(R.id.header_play_icon); courseDetailLayout = (LinearLayout) view.findViewById(R.id.dashboard_detail); headerPlayIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Uri uri = Uri.parse(courseDetail.media.course_video.uri); Intent intent = new Intent(Intent.ACTION_VIEW, uri); startActivity(intent); } }); return view; }
Source:
<code>public String getDockerHost() { if (isUnixSocketUri(dockerDaemonUri)) { return "localhost"; } else { return getDockerHostIp(); } <START> } <END></code><technical_language>do hate ternary op</technical_language>

Target:
public String getDockerHost() { return isUnixSocketUri(dockerDaemonUri) ? "localhost" : dockerDaemonUri.getHost(); }
Source:
<code>public void setMsqMaxSelectableChoices(int qnNumber, int value) { assertTrue(isMsqMaxSelectableChoicesEnabled(qnNumber)); WebElement inputBox = getMsqMaxSelectableChoicesBox(qnNumber); JavascriptExecutor exec = (JavascriptExecutor) browser.driver; String id = inputBox.getAttribute("id"); <START> exec.executeScript(String.format("$('#%s').val(%d);$('#%s').change();", id, value, id)); <END> }</code><technical_language>Similarly here, exec. necessary</technical_language>

Target:
public void setMsqMaxSelectableChoices(int qnNumber, int value) { assertTrue(isMsqMaxSelectableChoicesEnabled(qnNumber)); WebElement inputBox = getMsqMaxSelectableChoicesBox(qnNumber); String id = inputBox.getAttribute("id"); executeScript(String.format("$('#%s').val(%d);$('#%s').change();", id, value, id)); }
Source:
<code>public void testMetricReporterSetupViaSPI() { <START> Set<Class<? extends MetricReporterFactory>> loadedFactories = StreamSupport <END> .stream(ServiceLoader.load(MetricReporterFactory.class).spliterator(), false) .map(MetricReporterFactory::getClass) .collect(Collectors.toSet()); assertThat(loadedFactories , hasItem(DatadogHttpReporterFactory.class)); }</code><technical_language>I meant this method: public static void testMetricReporterSetupViaSPI(Class<MetricReporterFactory> clazz) { Set<Class<? extends MetricReporterFactory>> loadedFactories = StreamSupport .stream(ServiceLoader.load(MetricReporterFactory.class).iterator(), false) .map(MetricReporterFactory::getClass) .collect(Collectors.toSet()); assertThat(loadedFactories , hasItems(clazz)); } in flink-metrics-core, reporter tests call it</technical_language>

Target:
public void testMetricReporterSetupViaSPI() { MetricReporterTestUtils.testMetricReporterSetupViaSPI(DatadogHttpReporterFactory.class); }
Source:
<code>private void delete() { if (mMessage != null) { mFragmentListener.disableDeleteAction(); LocalMessage messageToDelete = mMessage; mFragmentListener.showNextMessageOrReturn(); <START> mController.deleteMessages(Collections.singletonList(messageToDelete.makeMessageReference()), null); <END> } }</code><technical_language>able mMessageReference here</technical_language>

Target:
private void delete() { if (mMessage != null) { mFragmentListener.disableDeleteAction(); LocalMessage messageToDelete = mMessage; mFragmentListener.showNextMessageOrReturn(); mController.deleteMessage(mMessageReference, null); } }
Source:
<code>protected void setSchema(final String schema) throws DatabaseEngineException { <START> final String findSchemaQuery = "SELECT count(*) FROM syscat.schemata WHERE SCHEMANAME = '" + schema + "'"; <END> final boolean schemaExists; try (final Statement stmt = conn.createStatement(); final ResultSet resultSet = stmt.executeQuery(findSchemaQuery)) { schemaExists = resultSet.next() && resultSet.getInt(1) == 1; stmt.execute("SET CURRENT SCHEMA " + quotize(schema)); } catch (Exception e) { throw new DatabaseEngineException(String.format("Could not set current schema to '%s'", schema), e); } if (!schemaExists) { throw new DatabaseEngineException(String.format("Schema '%s' doesn't exist", schema)); } }</code><technical_language>a prepared statement here? java PreparedStatement preparedStatement = conn.prepareStatement("SELECT count(*) syscat.schemata SCHEMANAME = '?'"); preparedStatement.setString(1, schema); Actually, should've this beginning</technical_language>

Target:
protected void setSchema(final String schema) throws DatabaseEngineException { final boolean schemaExists; try (final PreparedStatement ps = conn.prepareStatement("SELECT count(*) FROM syscat.schemata WHERE SCHEMANAME = ?")) { ps.setString(1, schema); try (final ResultSet resultSet = ps.executeQuery()) { schemaExists = resultSet.next() && resultSet.getInt(1) == 1; } } catch (final Exception e) { throw new DatabaseEngineException(String.format("Could not set current schema to '%s'", schema), e); } if (!schemaExists) { throw new DatabaseEngineException(String.format("Could not set current schema to non existing '%s'", schema)); } try (final PreparedStatement ps = conn.prepareStatement("SET CURRENT SCHEMA ?")) { ps.setString(1, schema); ps.execute(); } catch (final Exception e) { throw new DatabaseEngineException(String.format("Could not set current schema to '%s'", schema), e); } }
Source:
<code>private List<VM> getVmsDiskPluggedTo() { if (vmsDiskPluggedTo == null) { vmsDiskPluggedTo = getVmDAO().getForDisk(getImage().getId()).get(Boolean.TRUE); if (vmsDiskPluggedTo == null) { <START> vmsDiskPluggedTo = new ArrayList<VM>(); <END> } } return vmsDiskPluggedTo; }</code><technical_language>please change Collections.emptyList</technical_language>

Target:
private List<VM> getVmsDiskPluggedTo() { if (vmsDiskPluggedTo == null) { vmsDiskPluggedTo = getVmDAO().getForDisk(getImage().getId()).get(Boolean.TRUE); if (vmsDiskPluggedTo == null) { vmsDiskPluggedTo = Collections.emptyList(); } } return vmsDiskPluggedTo; }
Source:
<code>public MacrosInput macros() { MacrosInput macros = emptyMacrosInput(); <START> macros.put("NAME", this.getOpiTitle()); <END> macros.put("P", Instrument.getInstance().currentInstrument().pvPrefix()); return macros; }</code><technical_language>Nitpick: need this</technical_language>

Target:
public MacrosInput macros() { MacrosInput macros = emptyMacrosInput(); macros.put("NAME", getOpiTitle()); macros.put("P", Instrument.getInstance().currentInstrument().pvPrefix()); return macros; }
Source:
<code><START> public void registerMetric(String name, IMetric metric, int timeBucketSizeInSecs) { <END> _registeredMetrics.add(new MetricHolder(name, metric, timeBucketSizeInSecs)); }</code><technical_language>add a convenience method takes in IReducer wraps in ReducedMetric</technical_language>

Target:
public IMetric registerMetric(String name, IMetric metric, int timeBucketSizeInSecs) { if((Boolean)_openOrPrepareWasCalled.deref() == true) { throw new RuntimeException("TopologyContext.registerMetric can only be called from within overridden " + "IBolt::prepare() or ISpout::open() method."); } Map m1 = _registeredMetrics; if(!m1.containsKey(timeBucketSizeInSecs)) { m1.put(timeBucketSizeInSecs, new HashMap()); } Map m2 = (Map)m1.get(timeBucketSizeInSecs); if(!m2.containsKey(_taskId)) { m2.put(_taskId, new HashMap()); } Map m3 = (Map)m2.get(_taskId); if(m3.containsKey(name)) { throw new RuntimeException("The same metric name `" + name + "` was registered twice." ); } else { m3.put(name, metric); } return metric; }
Source:
<code>public void testSystemTableDoesNotSplit() throws Exception { HBaseTestingUtility testUtil = getUtility(); for (int i=0; i<10; i++) { createTable("schema"+i+".table_"+i); } TableName systemCatalog = TableName.valueOf("SYSTEM.CATALOG"); RegionLocator rl = testUtil.getConnection().getRegionLocator(systemCatalog); <START> assertEquals(rl.getAllRegionLocations().size(), 1); <END> try { testUtil.getHBaseAdmin().split(systemCatalog); testUtil.getHBaseAdmin().disableTable(systemCatalog); testUtil.getHBaseAdmin().enableTable(systemCatalog); } catch (DoNotRetryIOException e) { assert (e.getMessage().contains("NOT splittable")); } rl = testUtil.getConnection().getRegionLocator(systemCatalog); assertEquals(1, rl.getAllRegionLocations().size()); }</code><technical_language>nit: expected argument</technical_language>

Target:
public void testSystemTableDoesNotSplit() throws Exception { HBaseTestingUtility testUtil = getUtility(); for (int i=0; i<10; i++) { createTableAndTenantViews("schema"+i+".table_"+i); } TableName systemCatalog = TableName.valueOf( PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME); RegionLocator rl = testUtil.getConnection() .getRegionLocator(systemCatalog); assertEquals(1, rl.getAllRegionLocations().size()); try { testUtil.getHBaseAdmin().split(systemCatalog); testUtil.getHBaseAdmin().disableTable(systemCatalog); testUtil.getHBaseAdmin().enableTable(systemCatalog); } catch (DoNotRetryIOException e) { assertTrue(e.getMessage().contains("NOT splittable")); } rl = testUtil.getConnection().getRegionLocator(systemCatalog); assertEquals(1, rl.getAllRegionLocations().size()); }
Source:
<code>protected void updateOvfForTemplatesOfStoragePool(Guid poolId) { <START> List<Guid> templateIdsForUpdate = getVmAndTemplatesGenerationsDao(). <END> getVmTemplatesIdsForOvfUpdate(poolId); int i = 0; while (i < templateIdsForUpdate.size()) { int size = Math.min(templateIdsForUpdate.size() - i, ITEMS_COUNT_PER_UPDATE); List<Guid> idsToProcess = templateIdsForUpdate.subList(i, i + size); i += size; Map<Guid, KeyValuePairCompat<String, List<Guid>>> vmsAndTemplateMetadata = populateTemplatesMetadataForOvfUpdate(idsToProcess); if (!vmsAndTemplateMetadata.isEmpty()) { performOvfUpdate(poolId, vmsAndTemplateMetadata); } } }</code><technical_language>move getVmAndTemplatesGenerationsDao next line</technical_language>

Target:
protected void updateOvfForTemplatesOfStoragePool(Guid poolId) { List<Guid> templateIdsForUpdate = getVmAndTemplatesGenerationsDao().getVmTemplatesIdsForOvfUpdate(poolId); int i = 0; while (i < templateIdsForUpdate.size()) { int size = Math.min(templateIdsForUpdate.size() - i, itemsCountPerUpdate); List<Guid> idsToProcess = templateIdsForUpdate.subList(i, i + size); i += size; Map<Guid, KeyValuePairCompat<String, List<Guid>>> vmsAndTemplateMetadata = populateTemplatesMetadataForOvfUpdate(idsToProcess); if (!vmsAndTemplateMetadata.isEmpty()) { performOvfUpdate(poolId, vmsAndTemplateMetadata); } } }
Source:
<code>public Boolean visitLiteral(LiteralTree reference, Tree tree) { Optional<LiteralTree> other = checkTypeAndCast(reference, tree); return other.isPresent() && (reference.getValue() == null ? other.get().getValue() == null <START> : reference.getValue().equals(other.get().getValue())); <END> }</code><technical_language>Objects.equal()</technical_language>

Target:
public Boolean visitLiteral(LiteralTree reference, Tree tree) { Optional<LiteralTree> other = checkTypeAndCast(reference, tree); return other.isPresent() && Objects.equal(reference.getValue(), other.get().getValue()); }
Source:
<code>ConfiguredRolesAllowedPastLoginFilter(String[] rolesAllowed) { this.denyAll = false; <START> this.rolesAllowed = (rolesAllowed != null) ? rolesAllowed : new String[] {}; <END> }</code><technical_language>if rolesAllowed is null, denyAll effectively true</technical_language>

Target:
ConfiguredRolesAllowedPastLoginFilter(String[] rolesAllowed) { this.rolesAllowed = (rolesAllowed != null) ? rolesAllowed : null; }
Source:
<code>public void testCrossCacheTransactionInAnotherThreadContinued() throws Exception { withAllIsolationsAndConcurrencies(new IgniteClosure<Object, Void>() { @Override public Void apply(Object o) { <START> try { <END> crossCacheTransactionInAnotherThreadContinued(); } catch (Exception ignore) { } return null; } }); }</code><technical_language>rename "ignore" "ignired" replace "// igniore." "// No-op."</technical_language>

Target:
public void testCrossCacheTransactionInAnotherThreadContinued() throws Exception { runWithAllIsolations(new IgniteCallable<Void>() { @Override public Void call() throws Exception { crossCacheTransactionInAnotherThreadContinued(); return null; } }); }
Source:
<code>public void testFindTaskWithIncompatibleTypeFilter() throws Exception { assertClientException( () -> searchServicesClient.findHumanTasksWithFilters(createQueryFilterEqualsTo(TaskField.NAME, 1), 0, 100), <START> 500, <END> "Can't lookup on specified data set: getTasksWithFilters"); }</code><technical_language>This is more a client's problem - 400 (bad request) more in opinion</technical_language>

Target:
public void testFindTaskWithIncompatibleTypeFilter() throws Exception { assertClientException( () -> searchServicesClient.findHumanTasksWithFilters(createQueryFilterEqualsTo(TaskField.NAME, 1), 0, 100), 400, "Bad request"); }
Source:
<code>public void sendAndReceive() { this.input.send(new GenericMessage<String>("foo")); Message<?> message = this.output.receive(100); assertNotNull(message); assertEquals("foo: 1", message.getPayload()); assertEquals(1, count); assertTrue(this.applicationContext.containsBean("annotatedEndpoint.process.serviceActivator")); assertTrue(this.applicationContext.containsBean("annotatedEndpoint2.process.serviceActivator")); <START> assertTrue(this.applicationContext.containsBean("annotatedEndpoint3.process.serviceActivator")); <END> }</code><technical_language>test full. prove async is applied. test pass async = "true". Please, develop test-case reflect expectations</technical_language>

Target:
public void sendAndReceive() { this.input.send(new GenericMessage<String>("foo")); Message<?> message = this.output.receive(100); assertNotNull(message); assertEquals("foo: 1", message.getPayload()); assertEquals(1, count); assertTrue(this.applicationContext.containsBean("annotatedEndpoint.process.serviceActivator")); assertTrue(this.applicationContext.containsBean("annotatedEndpoint2.process.serviceActivator")); }
Source:
<code><START> public Builder(Title title) { <END> this.title = title.title.orElse(null); this.subtitle = title.subtitle.orElse(null); this.fadeIn = title.fadeIn.orElse(null); this.stay = title.stay.orElse(null); this.fadeOut = title.fadeOut.orElse(null); this.clear = title.clear; this.reset = title.reset; }</code><technical_language>constructors public? devs toBuilder() static builder() methods</technical_language>

Target:
private Builder(Title title) { this.title = title.title.orElse(null); this.subtitle = title.subtitle.orElse(null); this.fadeIn = title.fadeIn.orElse(null); this.stay = title.stay.orElse(null); this.fadeOut = title.fadeOut.orElse(null); this.clear = title.clear; this.reset = title.reset; }
Source:
<code>protected void startNodeImplWithRetries(final InetAddress host, final int nbNodes, int retries) throws RMException { final List<String> depNodeURLs = new ArrayList<>(nbNodes); try { startNodeImpl(host, nbNodes, depNodeURLs); } catch (Exception e) { logger.warn("Failed nodes deployment in host : " + host + ", retries left : " + retries); <START> if (isInfiniteRetries(retries) || retries > 1) { <END> removeNodes(depNodeURLs); waitPeriodBeforeRetry(); startNodeImplWithRetries(host, nbNodes, getRetriesLeft(retries)); } else { logger.error("Tries threshold reached for host " + host + ". This host is not part of the deployment process anymore."); throw e; } } }</code><technical_language>0</technical_language>

Target:
protected void startNodeImplWithRetries(final InetAddress host, final int nbNodes, int retries) throws RMException { while (true) { final List<String> depNodeURLs = new ArrayList<>(nbNodes); try { startNodeImpl(host, nbNodes, depNodeURLs); return; } catch (Exception e) { logger.warn("Failed nodes deployment in host : " + host + ", retries left : " + retries); if (isInfiniteRetries(retries) || retries > 0) { removeNodes(depNodeURLs); waitPeriodBeforeRetry(); retries = getRetriesLeft(retries); } else { logger.error("Tries threshold reached for host " + host + ". This host is not part of the deployment process anymore."); throw e; } } } }
Source:
<code>public void test() throws IOException { JsonObject properties = super.generateConfigProperties(); properties.addProperty(DISCUSSIONS_ENABLED, isDiscussionsEnabled); <START> config = new org.edx.mobile.util.Config(properties); <END> FragmentManager fragmentManager = Mockito.mock(FragmentManager.class); EnrolledCoursesResponse courseData = Mockito.mock(EnrolledCoursesResponse.class); CourseUnitFragment.HasComponent hasComponent = Mockito.mock(CourseUnitFragment.HasComponent.class); CourseUnitPagerAdapter adapter = new CourseUnitPagerAdapter(fragmentManager, config, Collections.singletonList(input), courseData, hasComponent); assertThat(adapter.getItem(0)).isInstanceOf(expected); }</code><technical_language>This done while overriding generateConfigProperties() method itself, test method. passing config directly, work for now, ensure inject correct configs in case switch injection later</technical_language>

Target:
public void test() throws IOException { config = new org.edx.mobile.util.Config(generateConfigProperties()); FragmentManager fragmentManager = Mockito.mock(FragmentManager.class); EnrolledCoursesResponse courseData = Mockito.mock(EnrolledCoursesResponse.class); CourseUnitFragment.HasComponent hasComponent = Mockito.mock(CourseUnitFragment.HasComponent.class); CourseUnitPagerAdapter adapter = new CourseUnitPagerAdapter(fragmentManager, config, Collections.singletonList(paramCourseComponent), courseData, hasComponent); assertThat(adapter.getItem(0)).isInstanceOf(expectedFragmentClass); }
Source:
<code>public <B> PriorityQueue<K, B> map(F<A, B> f) { return priorityQueue(equal, ftree.map(p2 -> p2.map2(a -> f.f(a)), FingerTree.measured(ftree.measured().monoid(), (P2<K, B> p2) -> p2._1())) <START> ); <END> }</code><technical_language>java return priorityQueue(equal, ftree.map(P2.map2_(f), FingerTree.measured(ftree.measured().monoid(), P2.__1())) );</technical_language>

Target:
public <B> PriorityQueue<K, B> map(F<A, B> f) { return priorityQueue(equal, ftree.map(P2.map2_(f), FingerTree.measured(ftree.measured().monoid(), P2.__1()) ) ); }
Source:
<code>synchronized public void close() { <START> if (socket != null) { <END> try { socket.close(); } catch (IOException e) { log.warn("Error while closing tcp stream", e); } } }</code><technical_language>Add log.info "connecting ATSD host:port"</technical_language>

Target:
synchronized public void close() { closeWriter(); closeSocket(); }
Source:
<code>public int hashCode() { <START> if (hashCode == Utils.NO_HASHCODE) { <END> int accum = 1; accum = accum * Utils.HASH_PRIME + data.hashCode(); hashCode = accum == 0 ? 1 : accum; } return hashCode; }</code><technical_language>here, racey single check</technical_language>

Target:
public int hashCode() { int h = hashCode; if (h == Utils.NO_HASHCODE) { h = 1; h = h * Utils.HASH_PRIME + data.hashCode(); hashCode = h == 0 ? 1 : h; } return h; }
Source:
<code>private void existsEntity() { TableServiceAsyncClient tableServiceAsyncClient = new TableServiceClientBuilder() .connectionString("connectionString") .buildAsyncClient(); TableAsyncClient tableAsyncClient = tableServiceAsyncClient.getTableAsyncClient("OfficeSupplies"); tableAsyncClient.queryEntitiesWithPartitionAndRowKey("crayolaMarkers", "markers") <START> .subscribe(tableEntity -> { logger.info("Table Entity exists: " + tableEntity); <END> }, error -> { logger.error("There was an error querying the table. Error: " + error); }); }</code><technical_language>This returns a paged collection. So, check tableEntity find out if testing for existence is in returned collection</technical_language>

Target:
private void existsEntity() { TableServiceAsyncClient tableServiceAsyncClient = new TableServiceClientBuilder() .connectionString("connectionString") .buildAsyncClient(); TableAsyncClient tableAsyncClient = tableServiceAsyncClient.getTableAsyncClient("OfficeSupplies"); tableAsyncClient.get("crayolaMarkers", "markers") .subscribe(tableEntity -> { System.out.println("Table Entity exists: " + tableEntity); }, error -> { System.err.println("There was an error getting the entity. Error: " + error); }); }
Source:
<code>private static void encodeV2(HAProxyMessage msg, ByteBuf out) { out.writeBytes(BINARY_PREFIX); out.writeByte(V2_VERSION_BITMASK | msg.command().byteValue()); out.writeByte(msg.proxiedProtocol().byteValue()); if (msg.proxiedProtocol().addressFamily() == AddressFamily.AF_IPv4 || <START> msg.proxiedProtocol().addressFamily() == AddressFamily.AF_IPv6) { <END> byte[] sourceAddress = NetUtil.createByteArrayFromIpAddressString(msg.sourceAddress()); byte[] destinationAddress = NetUtil.createByteArrayFromIpAddressString(msg.destinationAddress()); out.writeShort(sourceAddress.length + destinationAddress.length + 4 + msg.tlvNumBytes()); out.writeBytes(sourceAddress); out.writeBytes(destinationAddress); out.writeShort(msg.sourcePort()); out.writeShort(msg.destinationPort()); encodeTlvs(msg.tlvs(), out); } else if (msg.proxiedProtocol().addressFamily() == AddressFamily.AF_UNIX) { out.writeShort(216 + msg.tlvNumBytes()); byte[] srcAddressBytes = msg.sourceAddress().getBytes(CharsetUtil.US_ASCII); out.writeBytes(srcAddressBytes); out.writeBytes(new byte[108 - srcAddressBytes.length]); byte[] dstAddressBytes = msg.destinationAddress().getBytes(CharsetUtil.US_ASCII); out.writeBytes(dstAddressBytes); out.writeBytes(new byte[108 - dstAddressBytes.length]); encodeTlvs(msg.tlvs(), out); } else if (msg.proxiedProtocol().addressFamily() == AddressFamily.AF_UNSPEC) { out.writeShort(0); } }</code><technical_language>consider a switch replacement for if ... else if ... else</technical_language>

Target:
private static void encodeV2(HAProxyMessage msg, ByteBuf out) { out.writeBytes(BINARY_PREFIX); out.writeByte(V2_VERSION_BITMASK | msg.command().byteValue()); out.writeByte(msg.proxiedProtocol().byteValue()); switch (msg.proxiedProtocol().addressFamily()) { case AF_IPv4: case AF_IPv6: byte[] srcAddrBytes = NetUtil.createByteArrayFromIpAddressString(msg.sourceAddress()); byte[] dstAddrBytes = NetUtil.createByteArrayFromIpAddressString(msg.destinationAddress()); out.writeShort(srcAddrBytes.length + dstAddrBytes.length + 4 + msg.tlvNumBytes()); out.writeBytes(srcAddrBytes); out.writeBytes(dstAddrBytes); out.writeShort(msg.sourcePort()); out.writeShort(msg.destinationPort()); encodeTlvs(msg.tlvs(), out); break; case AF_UNIX: out.writeShort(TOTAL_UNIX_ADDRESS_BYTES_LENGTH + msg.tlvNumBytes()); int srcAddrBytesWritten = out.writeCharSequence(msg.sourceAddress(), CharsetUtil.US_ASCII); out.writeZero(UNIX_ADDRESS_BYTES_LENGTH - srcAddrBytesWritten); int dstAddrBytesWritten = out.writeCharSequence(msg.destinationAddress(), CharsetUtil.US_ASCII); out.writeZero(UNIX_ADDRESS_BYTES_LENGTH - dstAddrBytesWritten); encodeTlvs(msg.tlvs(), out); break; case AF_UNSPEC: out.writeShort(0); break; default: throw new HAProxyProtocolException("unexpected addrFamily"); } }
Source:
<code><START> default String getPlatformName() { <END> Object platformName = ofNullable(getSessionDetail("platformName")) .orElseGet(() -> getSessionDetail("platform")); return ofNullable(platformName).map(Object::toString).orElse(null); }</code><technical_language>mark Nullable annotation</technical_language>

Target:
default @Nullable String getPlatformName() { Object platformName = ofNullable(getSessionDetail("platformName")) .orElseGet(() -> getSessionDetail("platform")); return ofNullable(platformName).map(String::valueOf).orElse(null); }
Source:
<code>public void onPostMessage(@NonNull WebView view, @NonNull InvocationHandler message, @NonNull Uri sourceOrigin, boolean isMainFrame, @NonNull InvocationHandler replyProxy) { mWebMessageListener.onPostMessage(view, <START> WebMessageAdapter.webMessageCompatFromBoundaryInterface( BoundaryInterfaceReflectionUtil.castToSuppLibClass( WebMessageBoundaryInterface.class, message)), sourceOrigin, isMainFrame, JsReplyProxyImpl.forInvocationHandler(replyProxy)); <END> }</code><technical_language>nit: read if rewrite this as: WebMessageCompat webMessage = WebMessageAdapter.webMessageCompatFromBoundaryInterface( BoundaryInterfaceReflectionUtil.castToSuppLibClass( WebMessageBoundaryInterface.class, message)); JsReplyProxy jsReplyProxy = JsReplyProxyImpl.forInvocationHandler(replyProxy); mWebMessageListener.onPostMessage(view, message, sourceOrigin, isMainFrame, jsReplyProxy);</technical_language>

Target:
public void onPostMessage(@NonNull WebView view, @NonNull InvocationHandler message, @NonNull Uri sourceOrigin, boolean isMainFrame, @NonNull InvocationHandler replyProxy) { WebMessageCompat webMessage = WebMessageAdapter.webMessageCompatFromBoundaryInterface( BoundaryInterfaceReflectionUtil.castToSuppLibClass( WebMessageBoundaryInterface.class, message)); JsReplyProxy jsReplyProxy = JsReplyProxyImpl.forInvocationHandler(replyProxy); mWebMessageListener.onPostMessage( view, webMessage, sourceOrigin, isMainFrame, jsReplyProxy); }
Source:
<code>private void sendErrorEmailForGenericException( Exception genericException, String incomingFileName, PaymentFileLoad paymentFile) { PaymentFileLoad paymentFileForEmail; try { paymentFileForEmail = getCustomerProfileFromUnparsableFile(incomingFileName, paymentFile); } catch (RuntimeException e) { <START> paymentFileForEmail = paymentFile; <END> } MessageMap errorMap = new MessageMap(); errorMap.putError(KFSConstants.GLOBAL_ERRORS, KFSKeyConstants.ERROR_BATCH_UPLOAD_PARSING, "Error reading XML file: " + genericException.getMessage()); paymentFileEmailService.sendErrorEmail(paymentFileForEmail, errorMap); }</code><technical_language>log this exception</technical_language>

Target:
private void sendErrorEmailForGenericException( Exception genericException, String incomingFileName, PaymentFileLoad paymentFile) { PaymentFileLoad paymentFileForEmail; try { paymentFileForEmail = getCustomerProfileFromUnparsableFile(incomingFileName, paymentFile); } catch (RuntimeException e) { LOG.error("sendErrorEmailForGenericException: Could not read file contents as plain text", e); paymentFileForEmail = paymentFile; } MessageMap errorMap = new MessageMap(); errorMap.putError(KFSConstants.GLOBAL_ERRORS, KFSKeyConstants.ERROR_BATCH_UPLOAD_PARSING, "Error reading XML file: " + genericException.getMessage()); paymentFileEmailService.sendErrorEmail(paymentFileForEmail, errorMap); }
Source:
<code>public void selectingARating_ShouldChangeRelevanceOfRelatedField() throws Exception { jumpToGroupWithText("Rating"); onView(withText(startsWith("Source13"))).perform(click()); <START> for (int i = 1; i <= 10; i++) { <END> onView(withText("Target13")).check(doesNotExist()); if (i < 9) { onView(allOf(withId(R.id.rating_bar1), isDisplayed())).perform(setRating((float) i)); } else { onView(allOf(withId(R.id.rating_bar2), isDisplayed())).perform(setRating((float) (i - 8))); } onView(withText("Target13")).check(matches(isDisplayed())); onView(withText("Source13")).perform(longClick()); onView(withText(R.string.clear_answer)).perform(click()); onView(withText(R.string.discard_answer)).perform(click()); } }</code><technical_language>previous version this test loops. goal of test check setting a rating updates relevance of another question. In head test do this once: check "Target13" question exist, set a (any) rating, check does, remove rating, check "Target13". @lognaturel of reason checking here</technical_language>

Target:
public void selectingARating_ShouldChangeRelevanceOfRelatedField() throws Exception { jumpToGroupWithText("Rating"); onView(withText(startsWith("Source13"))).perform(click()); onView(withText("Target13")).check(doesNotExist()); onView(allOf(withId(R.id.rating_bar1), isDisplayed())).perform(setRating(3.0f)); onView(withText("Target13")).check(matches(isDisplayed())); onView(withText("Source13")).perform(longClick()); onView(withText(R.string.clear_answer)).perform(click()); onView(withText(R.string.discard_answer)).perform(click()); onView(withText("Target13")).check(doesNotExist()); }
Source:
<code>private void trackLiftedVariantContig(Map<String, Long> map, String contig) { Long val = map.get(contig); if (val == null){ val = 0L; } val++; <START> map.put(contig, val); <END> }</code><technical_language>get rid of lines 439-441 this map.put(contig, ++val);</technical_language>

Target:
private void trackLiftedVariantContig(Map<String, Long> map, String contig) { Long val = map.get(contig); if (val == null) { val = 0L; } map.put(contig, ++val); }
Source:
<code>protected void verifyFindsCar(Cache cache, int expectedCount, String carMake) { QueryParser queryParser = createQueryParser("make"); try { Query luceneQuery = queryParser.parse(carMake); CacheQuery cacheQuery = Search.getSearchManager(cache).getClusteredQuery(luceneQuery, Car.class); Assert.assertEquals(expectedCount, cacheQuery.getResultSize()); } catch (ParseException ex) { <START> ex.printStackTrace(); <END> Assert.fail("Failed due to: " + ex.getMessage()); } }</code><technical_language>I try handle this exception</technical_language>

Target:
protected void verifyFindsCar(Cache cache, int expectedCount, String carMake) { CacheQuery cacheQuery = Search.getSearchManager(cache) .getClusteredQuery(new TermQuery(new Term("make", carMake))); assertEquals(expectedCount, cacheQuery.getResultSize()); }
Source:
<code>private boolean validateExternalVnicProfileMapping() { <START> drMappingHelper.mapVnicProfiles(vmTemplateFromConfiguration.getInterfaces(), getParameters().getExternalVnicProfileMappings()); <END> final ValidationResult validationResult = externalVnicProfileMappingValidator.validateExternalVnicProfileMapping( getParameters().getExternalVnicProfileMappings(), getParameters().getClusterId()); return validate(validationResult); }</code><technical_language>mapping is performed validation</technical_language>

Target:
private boolean validateExternalVnicProfileMapping() { final ValidationResult validationResult = externalVnicProfileMappingValidator.validateExternalVnicProfileMapping( getParameters().getExternalVnicProfileMappings(), getParameters().getClusterId()); return validate(validationResult); }
Source:
<code>public ExampleScript[] examples() throws ConfigCompileException { return new ExampleScript[]{ <START> new ExampleScript("Getting values", "store_value('x.top.a',true)\nstore_value('x.top.b',false)\nget_values('x')"), <END> }; }</code><technical_language>need msg() get_value(), show up</technical_language>

Target:
public ExampleScript[] examples() throws ConfigCompileException { return new ExampleScript[]{ new ExampleScript("Getting values", "store_value('x.top.a',true)\nstore_value('x.top.b',false)\nmsg(get_values('x'))"), }; }
Source:
<code>public void testVisibilityForAdminInOtherDomainInPublisher() throws APIManagerIntegrationTestException, ApiException { <START> APIListDTO getAllApisResponse = restAPIPublisherOtherDomainAdmin.getAllAPIs("carbon.super"); <END> assertFalse(APIMTestCaseUtils.isAPIAvailable(apiIdentifier, getAllApisResponse), "API is visible to admin in other domain in API Publisher. When Visibility is private. " + getAPIIdentifierString(apiIdentifier)); }</code><technical_language>constant</technical_language>

Target:
public void testVisibilityForAdminInOtherDomainInPublisher() throws APIManagerIntegrationTestException, ApiException { APIListDTO getAllApisResponse = restAPIPublisherOtherDomainAdmin .getAllAPIs(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); assertFalse(APIMTestCaseUtils.isAPIAvailable(apiIdentifier, getAllApisResponse), "API is visible to admin in other domain in API Publisher. When Visibility is private. " + getAPIIdentifierString(apiIdentifier)); }
Source:
<code>public List<DFUDataColumnInfo> getFileDataColumns(String logicalname, String clustername) throws Exception { WsDfuServiceSoapProxy proxy = getSoapProxy(); DFUGetDataColumnsRequest req = new DFUGetDataColumnsRequest(); List<DFUDataColumnInfo> cols = new ArrayList<DFUDataColumnInfo>(); req.setOpenLogicalName(logicalname); if (clustername != null) { req.setCluster(clustername); } try { DFUGetDataColumnsResponse resp = proxy.DFUGetDataColumns(req); if (resp == null) { return cols; } this.handleException(resp.getExceptions()); for (Method m : resp.getClass().getMethods()) { if (m.getName().startsWith("getDFUDataKeyedColumns") && m.getParameterTypes().length == 0) { final Object r = m.invoke(resp); DFUDataColumn[] thesecols = (DFUDataColumn[]) r; if (r != null) { <START> for (DFUDataColumn col:Arrays.asList(thesecols)) { <END> cols.add(new DFUDataColumnInfo(col)); } } } if (m.getName().startsWith("getDFUDataNonKeyedColumns") && m.getParameterTypes().length == 0) { final Object r = m.invoke(resp); DFUDataColumn[] thesecols = (DFUDataColumn[]) r; if (r != null) { for (DFUDataColumn col:Arrays.asList(thesecols)) { cols.add(new DFUDataColumnInfo(col)); } } } } } catch (ArrayOfEspException e) { if (e != null && verbose) { for (EspException espexception : e.getException()) { Utils.println(System.out, "Error retrieving field names for file: " + espexception.getSource() + espexception.getMessage(), false, true); } } throw e; } return cols; }</code><technical_language>line 409 if (thesecols != null)</technical_language>

Target:
public List<DFUDataColumnInfo> getFileDataColumns(String logicalname, String clustername) throws Exception { WsDfuServiceSoapProxy proxy = getSoapProxy(); DFUGetDataColumnsRequest req = new DFUGetDataColumnsRequest(); List<DFUDataColumnInfo> cols = new ArrayList<DFUDataColumnInfo>(); req.setOpenLogicalName(logicalname); if (clustername != null) { req.setCluster(clustername); } try { DFUGetDataColumnsResponse resp = proxy.DFUGetDataColumns(req); if (resp == null) { return cols; } this.handleException(resp.getExceptions()); for (Method m : resp.getClass().getMethods()) { if (m.getName().startsWith("getDFUDataKeyedColumns") && m.getParameterTypes().length == 0) { final Object r = m.invoke(resp); if (r != null) { DFUDataColumn[] thesecols = (DFUDataColumn[]) r; for (DFUDataColumn col : Arrays.asList(thesecols)) { cols.add(new DFUDataColumnInfo(col)); } } } if (m.getName().startsWith("getDFUDataNonKeyedColumns") && m.getParameterTypes().length == 0) { final Object r = m.invoke(resp); if (r != null) { DFUDataColumn[] thesecols = (DFUDataColumn[]) r; for (DFUDataColumn col : Arrays.asList(thesecols)) { cols.add(new DFUDataColumnInfo(col)); } } } } } catch (ArrayOfEspException e) { if (e != null && verbose) { for (EspException espexception : e.getException()) { Utils.println(System.out, "Error retrieving field names for file: " + espexception.getSource() + espexception.getMessage(), false, true); } } throw e; } return cols; }
Source:
<code>private Map<Integer, String> getRemovableTimestampedSnapshots(Metadata metadata, int numberToKeep, Date keepDate) { Map<Integer, SnapshotVersionDecomposition> snapshots = new HashMap<>(); Map<Integer, String> mapToRemove = new HashMap<>(); metadata.getVersioning() .getSnapshotVersions() .forEach(e -> { if ("jar".equals(e.getExtension())) { SnapshotVersionDecomposition snapshotVersion = SnapshotVersionDecomposition.of(e.getVersion()); if (SnapshotVersionDecomposition.INVALID.equals(snapshotVersion)) { logger.warn("Received invalid snapshot version {}", snapshotVersion); return; } snapshots.put(snapshotVersion.getBuildNumber(), snapshotVersion); } }); if (numberToKeep != 0 && snapshots.size() > numberToKeep) { snapshots.forEach((k, v) -> { if (mapToRemove.size() < snapshots.size() - numberToKeep) { mapToRemove.put(k, v.getVersion()); } }); } else if (numberToKeep == 0 && keepDate != null) { snapshots.forEach((k, v) -> { try { DateFormat formatter = new SimpleDateFormat(TIMESTAMP_FORMAT); Calendar calendar = Calendar.getInstance(); String currentDate = formatter.format(calendar.getTime()); <START> if (keepDate.compareTo(formatter.parse(currentDate)) < 0) <END> { mapToRemove.put(k, v.getVersion()); } } catch (ParseException e) { logger.error(e.getMessage(), e); } }); } return mapToRemove; }</code><technical_language>condition be: if (keepDate.after(snapshotVersionDate))</technical_language>

Target:
private Map<Integer, String> getRemovableTimestampedSnapshots(Metadata metadata, int numberToKeep, Date keepDate) { Map<Integer, SnapshotVersionDecomposition> snapshots = new HashMap<>(); Map<Integer, String> mapToRemove = new HashMap<>(); metadata.getVersioning() .getSnapshotVersions() .forEach(e -> { if ("jar".equals(e.getExtension())) { SnapshotVersionDecomposition snapshotVersion = SnapshotVersionDecomposition.of(e.getVersion()); if (SnapshotVersionDecomposition.INVALID.equals(snapshotVersion)) { logger.warn("Received invalid snapshot version {}", snapshotVersion); return; } snapshots.put(snapshotVersion.getBuildNumber(), snapshotVersion); } }); if (numberToKeep != 0 && snapshots.size() > numberToKeep) { snapshots.forEach((k, v) -> { if (mapToRemove.size() < snapshots.size() - numberToKeep) { mapToRemove.put(k, v.getVersion()); } }); } else if (numberToKeep == 0 && keepDate != null) { snapshots.forEach((k, v) -> { try { DateFormat formatter = new SimpleDateFormat(TIMESTAMP_FORMAT); Date snapshotVersionDate = formatter.parse(v.getTimestamp()); if (keepDate.after(snapshotVersionDate)) { mapToRemove.put(k, v.getVersion()); } } catch (ParseException e) { logger.error(e.getMessage(), e); } }); } return mapToRemove; }
Source:
<code>protected void doStop() throws Exception { <START> if (zendesk != null) { <END> zendesk.close(); zendesk = null; } }</code><technical_language>super.doStop is missing. I if zendesk is closable close IOHelper.close instead</technical_language>

Target:
protected void doStop() throws Exception { IOHelper.close(zendesk); super.doStop(); }
Source:
<code>public DownloadMigrator build() { ServiceConnection serviceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder binder) { <START> if (!(binder instanceof LiteDownloadMigrationService.MigrationDownloadServiceBinder)) { <END> return; } DownloadMigrationService migrationService = ((LiteDownloadMigrationService.MigrationDownloadServiceBinder) binder).getService(); downloadMigrator.initialise(migrationService); } @Override public void onServiceDisconnected(ComponentName name) { } }; Intent serviceIntent = new Intent(applicationContext, LiteDownloadMigrationService.class); applicationContext.bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { notificationChannelProvider.registerNotificationChannel(applicationContext); } NotificationManagerCompat notificationManager = NotificationManagerCompat.from(applicationContext); ServiceNotificationDispatcher<MigrationStatus> notificationDispatcher = new ServiceNotificationDispatcher<>( LOCK, notificationCreator, notificationManager ); downloadMigrator = new LiteDownloadMigrator(applicationContext, LOCK, EXECUTOR, handler, migrationCallback, notificationDispatcher); return downloadMigrator; }</code><technical_language>Negative check early return</technical_language>

Target:
public DownloadMigrator build() { ServiceConnection serviceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder binder) { if (binder instanceof LiteDownloadMigrationService.MigrationDownloadServiceBinder) { DownloadMigrationService migrationService = ((LiteDownloadMigrationService.MigrationDownloadServiceBinder) binder).getService(); downloadMigrator.initialise(migrationService); } } @Override public void onServiceDisconnected(ComponentName name) { } }; Intent serviceIntent = new Intent(applicationContext, LiteDownloadMigrationService.class); applicationContext.bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { notificationChannelProvider.registerNotificationChannel(applicationContext); } NotificationManagerCompat notificationManager = NotificationManagerCompat.from(applicationContext); ServiceNotificationDispatcher<MigrationStatus> notificationDispatcher = new ServiceNotificationDispatcher<>( LOCK, notificationCreator, notificationManager ); downloadMigrator = new LiteDownloadMigrator(applicationContext, LOCK, EXECUTOR, handler, migrationCallback, notificationDispatcher); return downloadMigrator; }
Source:
<code>private void initialiseRegistry() { IConfigurationElement[] extensions = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID); for (IConfigurationElement configuration : extensions) { try { Object classAttribute = configuration.createExecutableExtension("class"); if <START> (classAttribute instanceof IRefactorParticipant) { <END> IRefactorParticipant refactorParticipant = (IRefactorParticipant) classAttribute; String nameParticitpant = configuration.getAttribute("name"); String participantId = configuration.getAttribute("id"); refactorParticipantsList.add(refactorParticipant); } } catch (CoreException e) { Activator.log.error("Failed to retrieve Refactor Participant extension point", e); } } }</code><technical_language>log error warning if IRefactorParticipant ..</technical_language>

Target:
private void initialiseRegistry() { IConfigurationElement[] extensions = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID); for (IConfigurationElement configuration : extensions) { try { Object classAttribute = configuration.createExecutableExtension("class"); if (classAttribute instanceof IRefactorParticipant) { IRefactorParticipant refactorParticipant = (IRefactorParticipant) classAttribute; String nameParticitpant = configuration.getAttribute("name"); String participantId = configuration.getAttribute("id"); refactorParticipantsList.add(refactorParticipant); } else { Activator.log.warn("The class " + classAttribute.getClass().getName() + " is not an instance of IRefactorParticipant"); } } catch (CoreException e) { Activator.log.error("Failed to retrieve Refactor Participant extension point", e); } } }