auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void executePopOps(boolean moveToState) { for (int opNum = mOps.size() - 1; opNum >= 0; opNum--) { final Op op = mOps.get(opNum); Fragment f = op.mFragment; if (f != null) { f.setNextTransition(FragmentManager.reverseTransit(mTransition)); } switch (op.mCmd) { case OP_ADD: f.setNextAnim(op.mPopExitAnim); mManager.setExitAnimationOrder(f, true); mManager.removeFragment(f); break; case OP_REMOVE: f.setNextAnim(op.mPopEnterAnim); mManager.addFragment(f); break; case OP_HIDE: f.setNextAnim(op.mPopEnterAnim); mManager.showFragment(f); break; case OP_SHOW: f.setNextAnim(op.mPopExitAnim); mManager.hideFragment(f); break; case OP_DETACH: f.setNextAnim(op.mPopEnterAnim); mManager.attachFragment(f); break; case OP_ATTACH: f.setNextAnim(op.mPopExitAnim); mManager.detachFragment(f); break; case OP_SET_PRIMARY_NAV: mManager.setPrimaryNavigationFragment(null); break; case OP_UNSET_PRIMARY_NAV: mManager.setPrimaryNavigationFragment(f); break; case OP_SET_MAX_LIFECYCLE: mManager.setMaxLifecycle(f, op.mOldMaxState); break; default: throw new IllegalArgumentException("Unknown cmd: " + op.mCmd); } if (!mReorderingAllowed && op.mCmd != OP_REMOVE && f != null) { mManager.moveFragmentToExpectedState(f); } } if (!mReorderingAllowed && moveToState) { mManager.moveToState(mManager.mCurState, true); } }

Target:
void executePopOps(boolean moveToState) { for (int opNum = mOps.size() - 1; opNum >= 0; opNum--) { final Op op = mOps.get(opNum); Fragment f = op.mFragment; if (f != null) { f.setNextTransition(FragmentManager.reverseTransit(mTransition)); } switch (op.mCmd) { case OP_ADD: f.setNextAnim(op.mPopExitAnim); mManager.setExitAnimationOrder(f, true); mManager.removeFragment(f); break; case OP_REMOVE: f.setNextAnim(op.mPopEnterAnim); mManager.addFragment(f); break; case OP_HIDE: f.setNextAnim(op.mPopEnterAnim); mManager.showFragment(f); break; case OP_SHOW: f.setNextAnim(op.mPopExitAnim); mManager.setExitAnimationOrder(f, true); mManager.hideFragment(f); break; case OP_DETACH: f.setNextAnim(op.mPopEnterAnim); mManager.attachFragment(f); break; case OP_ATTACH: f.setNextAnim(op.mPopExitAnim); mManager.setExitAnimationOrder(f, true); mManager.detachFragment(f); break; case OP_SET_PRIMARY_NAV: mManager.setPrimaryNavigationFragment(null); break; case OP_UNSET_PRIMARY_NAV: mManager.setPrimaryNavigationFragment(f); break; case OP_SET_MAX_LIFECYCLE: mManager.setMaxLifecycle(f, op.mOldMaxState); break; default: throw new IllegalArgumentException("Unknown cmd: " + op.mCmd); } if (!mReorderingAllowed && op.mCmd != OP_REMOVE && f != null) { mManager.moveFragmentToExpectedState(f); } } if (!mReorderingAllowed && moveToState) { mManager.moveToState(mManager.mCurState, true); } }
Source:
public void testNodesWithFlows() { this.m_driver.get(this.getBaseUrl() + "opennms/element/nodeList.htm?flows=true"); assertThat(Iterables.transform(m_driver.findElements(By.xpath(" containsInAnyOrder("TestMachine loc1node2", "TestMachine loc2node2")); }

Target:
public void testNodesWithFlows() { m_driver.get(this.getBaseUrl() + "opennms/element/nodeList.htm?flows=true"); assertThat(Iterables.transform(m_driver.findElements(By.xpath(" containsInAnyOrder("TestMachine loc1node2", "TestMachine loc2node2")); }
Source:
public void updatePluginSettings(PluginSettings newPluginSettings, Username currentUser, LocalizedOperationResult result, String md5) { final String pluginId = newPluginSettings.getPluginId(); if (hasPermission(currentUser, result) && checkPluginLoaded(pluginId, result) && checkPluginSupportsPluginSettings(pluginId, result)) { final String keyToLockOn = keyToLockOn(pluginId); synchronized (keyToLockOn) { final Plugin plugin = pluginDao.findPlugin(pluginId); if (plugin instanceof NullPlugin) { result.notFound(LocalizedMessage.string("RESOURCE_NOT_FOUND", "Plugin Settings", pluginId), HealthStateType.notFound()); return; } final PluginSettings pluginSettingsFromDB = getPluginSettings(pluginId); if (!entityHashingService.md5ForEntity(pluginSettingsFromDB).equals(md5)) { result.stale(LocalizedMessage.string("STALE_RESOURCE_CONFIG", "Plugin Settings", pluginId)); return; } updatePluginSettingsAndNotifyPluginSettingsChangeListeners(result, newPluginSettings); if (result.isSuccessful()) { entityHashingService.removeFromCache(newPluginSettings, pluginId); } } } }

Target:
public void updatePluginSettings(PluginSettings newPluginSettings, Username currentUser, LocalizedOperationResult result, String md5) { final String pluginId = newPluginSettings.getPluginId(); final String keyToLockOn = keyToLockOn(pluginId); synchronized (keyToLockOn) { if (hasPermission(currentUser, result)) { final PluginSettings pluginSettingsFromDB = getPluginSettings(pluginId); if (pluginSettingsFromDB == null) { result.notFound(LocalizedMessage.string("RESOURCE_NOT_FOUND", "Plugin Settings", pluginId), HealthStateType.notFound()); return; } if (!entityHashingService.md5ForEntity(pluginSettingsFromDB).equals(md5)) { result.stale(LocalizedMessage.string("STALE_RESOURCE_CONFIG", "Plugin Settings", pluginId)); return; } updatePluginSettingsAndNotifyPluginSettingsChangeListeners(result, newPluginSettings); if (result.isSuccessful()) { entityHashingService.removeFromCache(newPluginSettings, pluginId); } } } }
Source:
protected void executeCommand() { VdcReturnValueBase result = runInternalAction(VdcActionType.PersistentSetupNetworks, new AddNetworksByLabelParametersBuilder(getContext()).buildParameters(getNic(), getLabel(), getClusterNetworksByLabel()), getContext().clone().withoutCompensationContext().withoutExecutionContext()); if (result.getSucceeded()) { getReturnValue().setActionReturnValue(getLabel()); } else { propagateFailure(result); } setSucceeded(result.getSucceeded()); }

Target:
protected void executeCommand() { VdcReturnValueBase result = runInternalAction(VdcActionType.PersistentSetupNetworks, new AddNetworksByLabelParametersBuilder(getContext()).buildParameters(getNic(), getLabel(), getClusterNetworksByLabel()), cloneOnlyEngineContext()); if (result.getSucceeded()) { getReturnValue().setActionReturnValue(getLabel()); } else { propagateFailure(result); } setSucceeded(result.getSucceeded()); }
Source:
public FirstSuccessfulRouter(Component owner, Publisher<CoreEvent> publisher, List<ProcessorRoute> routes) { this.owner = owner; innerRecorders = IntStream.range(0, routes.size()).mapToObj(x -> new FluxSinkRecorder<CoreEvent>()).collect(Collectors.toList()); upstreamFlux = Flux.from(publisher) .doOnNext(event -> { inflightEvents.getAndIncrement(); innerRecorders.get(0).next(startEvent(event)); }) .doOnComplete(() -> { if (inflightEvents.get() == 0) { completeRouter(); } else { completeDeferred.set(true); } }); for (int i = 0; i < routes.size(); i++) { FluxSinkRecorder<CoreEvent> nextRecorder = i < routes.size() - 1 ? innerRecorders.get(i + 1) : null; innerFluxes.add(createMidFlux(routes.get(i), innerRecorders.get(i), ofNullable(nextRecorder))); } downstreamFlux = Flux.create(downstreamRecorder) .doOnNext(event -> inflightEvents.decrementAndGet()) .map(getScopeResultMapper()); }

Target:
public FirstSuccessfulRouter(Component owner, Publisher<CoreEvent> publisher, List<ProcessorRoute> routes) { this.owner = owner; innerRecorders = routes.stream().map(x -> new FluxSinkRecorder<CoreEvent>()).collect(Collectors.toList()); upstreamFlux = Flux.from(publisher) .doOnNext(event -> { inflightEvents.getAndIncrement(); innerRecorders.get(0).next(startEvent(event)); }) .doOnComplete(() -> { if (inflightEvents.get() == 0) { completeRouter(); } else { completeDeferred.set(true); } }); for (int i = 0; i < routes.size(); i++) { FluxSinkRecorder<CoreEvent> nextRecorder = i < routes.size() - 1 ? innerRecorders.get(i + 1) : null; innerFluxes.add(createMidFlux(routes.get(i), innerRecorders.get(i), ofNullable(nextRecorder))); } downstreamFlux = Flux.create(downstreamRecorder) .doOnNext(event -> inflightEvents.decrementAndGet()) .map(getScopeResultMapper()); }
Source:
void checkRegistryIsAvailable() { if (TRUE.equals(snapshotUseRegistry) && !isNullOrEmpty(registryUrl)) { String registryLink = "http://" + registryUrl; LOG.info("Probing registry '{}'", registryLink); try { HttpJsonResponse response = requestFactory.fromUrl(registryLink).setTimeout(30 * 1000).request(); final int responseCode = response.getResponseCode(); LOG.info("Probe of registry '{}' succeed with HTTP response code '{}'", registryLink, responseCode); } catch (ApiException | IOException ex) { LOG.warn("Docker registry " + registryLink + " is not available, " + "which means that you won't be able to save snapshots of your workspaces." + "\nHow to configure registry?" + "\n\tLocal registry -> <LINK_0>" + "\n\tRemote registry -> set up 'docker.registry.auth.*' properties"); } } }

Target:
private void checkRegistryIsAvailable() throws IOException { if (snapshotUseRegistry && !isNullOrEmpty(machineDockerRegistry)) { String registryUrl = "http://" + machineDockerRegistry; LOG.info("Probing registry '{}'", registryUrl); final HttpURLConnection conn = (HttpURLConnection) new URL(registryUrl).openConnection(); conn.setConnectTimeout(30 * 1000); try { final int responseCode = conn.getResponseCode(); LOG.info("Probe of registry '{}' succeed with HTTP response code '{}'", registryUrl, responseCode); } catch (IOException ioEx) { LOG.warn("Docker registry is not available, " + "which means that you won't be able to save snapshots of your workspaces." + "\nHow to configure registry?" + "\n\tLocal registry -> <LINK_0>" + "\n\tRemote registry -> set up 'docker.registry.auth.*' properties", registryUrl); } finally { conn.disconnect(); } } }
Source:
public void testUpdateMultipleSettingsWithParameters() throws Exception { Map<Symbol, List<Symbol>> settings = new HashMap<>() {{ put(Literal.of("stats.operations_log_size"), ImmutableList.of(new ParameterSymbol(0, DataTypes.LONG))); put(Literal.of("stats.jobs_log_size"), ImmutableList.of(new ParameterSymbol(1, DataTypes.LONG))); }}; Settings expected = Settings.builder() .put("stats.operations_log_size", 10) .put("stats.jobs_log_size", 25) .build(); assertThat( buildSettingsFrom(settings, symbolEvaluator(new RowN(new Object[]{10, 25})), true), is(expected) ); }

Target:
public void testUpdateMultipleSettingsWithParameters() throws Exception { List<Assignment<Symbol>> settings = List.of( new Assignment<>(Literal.of("stats.operations_log_size"), List.of(new ParameterSymbol(0, DataTypes.LONG))), new Assignment<>(Literal.of("stats.jobs_log_size"), List.of(new ParameterSymbol(1, DataTypes.LONG))) ); Settings expected = Settings.builder() .put("stats.operations_log_size", 10) .put("stats.jobs_log_size", 25) .build(); assertThat( buildSettingsFrom(settings, symbolEvaluator(new RowN(new Object[]{10, 25}))), is(expected) ); }
Source:
public void mouseScrolled(MouseEvent e) { if (fDragState != DRAG_NONE || e.count == 0) { return; } boolean horizontalZoom = false; boolean horizontalScroll = false; boolean verticalZoom = false; boolean verticalScroll = false; Point size = getSize(); Rectangle bounds = new Rectangle(0, 0, size.x, size.y); if (bounds.contains(e.x, e.y)) { if ((e.stateMask & SWT.MODIFIER_MASK) == (SWT.SHIFT | SWT.CTRL)) { verticalZoom = true; } else if (e.x < fTimeProvider.getNameSpace()) { verticalScroll = true; } else { if ((e.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL) { horizontalZoom = true; } else if ((e.stateMask & SWT.MODIFIER_MASK) == SWT.SHIFT) { horizontalScroll = true; } else { verticalScroll = true; } } } if (verticalZoom) { fVerticalZoomAlignEntry = getVerticalZoomAlignCursor(e.y); verticalZoom(e.count > 0); if (fVerticalZoomAlignEntry != null) { setElementPosition(fVerticalZoomAlignEntry.getKey(), fVerticalZoomAlignEntry.getValue()); } } else if (horizontalZoom && fTimeProvider.getTime0() != fTimeProvider.getTime1()) { zoom(e.count > 0); } else if (horizontalScroll) { horizontalScroll(e.count > 0); } else if (verticalScroll){ setTopIndex(getTopIndex() - e.count); } }

Target:
public void mouseScrolled(MouseEvent e) { if (fDragState != DRAG_NONE || e.count == 0) { return; } Point size = getSize(); Rectangle bounds = new Rectangle(0, 0, size.x, size.y); if (!bounds.contains(e.x, e.y)) { return; } boolean horizontalZoom = false; boolean horizontalScroll = false; boolean verticalZoom = false; boolean verticalScroll = false; if ((e.stateMask & SWT.MODIFIER_MASK) == (SWT.SHIFT | SWT.CTRL)) { verticalZoom = true; } else if (e.x < fTimeProvider.getNameSpace()) { verticalScroll = true; } else { if ((e.stateMask & SWT.MODIFIER_MASK) == SWT.CTRL) { horizontalZoom = true; } else if ((e.stateMask & SWT.MODIFIER_MASK) == SWT.SHIFT) { horizontalScroll = true; } else { verticalScroll = true; } } if (verticalZoom) { fVerticalZoomAlignEntry = getVerticalZoomAlignCursor(e.y); verticalZoom(e.count > 0); if (fVerticalZoomAlignEntry != null) { setElementPosition(fVerticalZoomAlignEntry.getKey(), fVerticalZoomAlignEntry.getValue()); } } else if (horizontalZoom && fTimeProvider.getTime0() != fTimeProvider.getTime1()) { zoom(e.count > 0); } else if (horizontalScroll) { horizontalScroll(e.count > 0); } else if (verticalScroll){ setTopIndex(getTopIndex() - e.count); } }
Source:
private void initGraphicsData() { ImportUtils.updateGraphicsDevices(getVm().getStaticData(), getVdsGroup() != null ? getVdsGroup().getCompatibilityVersion() : null); }

Target:
private void initGraphicsData() { ImportUtils.updateGraphicsDevices(getVm().getStaticData(), getVdsGroup().getCompatibilityVersion()); }
Source:
public Map<String, String> toConfig() { final Map<String, String> config = new HashMap<>(super.toConfig()); final String systemName = getSystemName(); final String streamId = getStreamId(); final String clientConfigPrefix = String.format(KinesisConfig.CONFIG_STREAM_KINESIS_CLIENT_LIB_CONFIG, systemName, streamId); this.region.ifPresent( val -> config.put(String.format(KinesisConfig.CONFIG_STREAM_REGION, systemName, streamId), val)); this.accessKey.ifPresent( val -> config.put(String.format(KinesisConfig.CONFIG_STREAM_ACCESS_KEY, systemName, streamId), val)); this.secretKey.ifPresent( val -> config.put(String.format(KinesisConfig.CONFIG_STREAM_SECRET_KEY, systemName, streamId), val)); this.kclConfig.forEach((k, v) -> config.put(clientConfigPrefix + k, v)); return config; }

Target:
public Map<String, String> toConfig() { Map<String, String> config = new HashMap<>(super.toConfig()); String systemName = getSystemName(); String streamId = getStreamId(); String clientConfigPrefix = String.format(KinesisConfig.CONFIG_STREAM_KINESIS_CLIENT_LIB_CONFIG, systemName, streamId); this.region.ifPresent( val -> config.put(String.format(KinesisConfig.CONFIG_STREAM_REGION, systemName, streamId), val)); this.accessKey.ifPresent( val -> config.put(String.format(KinesisConfig.CONFIG_STREAM_ACCESS_KEY, systemName, streamId), val)); this.secretKey.ifPresent( val -> config.put(String.format(KinesisConfig.CONFIG_STREAM_SECRET_KEY, systemName, streamId), val)); this.kclConfig.forEach((k, v) -> config.put(clientConfigPrefix + k, v)); return config; }
Source:
Map<Integer, ExposedByteArrayOutputStream> createOutputMap(final CompressionHeader header) throws IOException { final Map<Integer, ExposedByteArrayOutputStream> outputMap = new HashMap<>(); for (final EncodingParams params : header.encodingMap.values()) { if (params.id == EncodingID.EXTERNAL) { try (final ExposedByteArrayOutputStream ebaos = new ExposedByteArrayOutputStream()) { final int externalBlockId = ITF8.readUnsignedITF8(params.params); outputMap.put(externalBlockId, ebaos); } } } return outputMap; }

Target:
Map<Integer, ExposedByteArrayOutputStream> createOutputMap(final CompressionHeader header) { return header.encodingMap.values() .stream() .filter(params -> params.id == EncodingID.EXTERNAL) .collect(Collectors.toMap( params -> ITF8.readUnsignedITF8(params.params), params -> new ExposedByteArrayOutputStream())); }
Source:
public void testSerializeAndDeserializeSession() throws Exception { KieSession ksession = session.getStateful(); File tempFile = createTempFile(name.getMethodName(), ""); ksession.fireAllRules(); OutputStream fos = null; try { fos = new FileOutputStream(tempFile); Marshaller marshaller = KieServices.Factory.get().getMarshallers().newMarshaller(getKbase()); marshaller.marshall(fos, ksession); } finally { if (fos != null) { fos.close(); } } InputStream fis = null; try { fis = new FileInputStream(tempFile); Marshaller marshaller = KieServices.Factory.get().getMarshallers().newMarshaller(getKbase()); marshaller.unmarshall(fis, ksession); } finally { if (fis != null) { fis.close(); } } ksession.insert(new Promotion("Claire", "Scientist")); int firedRules = ksession.fireAllRules(); Assertions.assertThat(firedRules).isEqualTo(1); }

Target:
public void testSerializeAndDeserializeSession() throws Exception { KieSession ksession = session.getStateful(); File tempFile = File.createTempFile(name.getMethodName(), null); ksession.fireAllRules(); try (OutputStream fos = new FileOutputStream(tempFile)) { Marshaller marshaller = getServices().getMarshallers().newMarshaller(getKbase()); marshaller.marshall(fos, ksession); } try (InputStream fis = new FileInputStream(tempFile)) { Marshaller marshaller = getServices().getMarshallers().newMarshaller(getKbase()); marshaller.unmarshall(fis, ksession); } ksession.insert(new Promotion("Claire", "Scientist")); int firedRules = ksession.fireAllRules(); Assertions.assertThat(firedRules).isEqualTo(1); }
Source:
public static synchronized void unregisterAppInfo(String prefix, String id, Metrics metrics) { MBeanServer server = ManagementFactory.getPlatformMBeanServer(); try { id = id == null ? "" : id; ObjectName name = new ObjectName(prefix + ":type=app-info,id=" + Sanitizer.jmxSanitize(id)); if (server.isRegistered(name)) server.unregisterMBean(name); unregisterMetrics(metrics); } catch (JMException e) { log.warn("Error unregistering AppInfo mbean", e); } }

Target:
public static synchronized void unregisterAppInfo(String prefix, String id, Metrics metrics) { MBeanServer server = ManagementFactory.getPlatformMBeanServer(); try { ObjectName name = new ObjectName(prefix + ":type=app-info,id=" + Sanitizer.jmxSanitize(id)); if (server.isRegistered(name)) server.unregisterMBean(name); unregisterMetrics(metrics); } catch (JMException e) { log.warn("Error unregistering AppInfo mbean", e); } }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } RepositoryKey other = (RepositoryKey) obj; if (repository == null) { if (other.repository != null) { return false; } } else if (!repository.equals(other.repository)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } return this.repository == ((RepositoryKey) obj).getRepository(); }
Source:
public Map<String, String> getSystemSessionProperties(SessionConfigurationContext context) { HashMap<String, String> combinedProperties = new HashMap<>(); for (SessionMatchSpec sessionMatchSpec : sessionMatchSpecs) { combinedProperties.putAll(sessionMatchSpec.match(context)); } return ImmutableMap.copyOf(combinedProperties); }

Target:
public Map<String, String> getSystemSessionProperties(SessionConfigurationContext context) { Map<String, String> combinedProperties = new HashMap<>(); for (SessionMatchSpec sessionMatchSpec : sessionMatchSpecs) { combinedProperties.putAll(sessionMatchSpec.match(context)); } return ImmutableMap.copyOf(combinedProperties); }
Source:
public void shouldCheckIndexIsOkOnColumn() { init(); sharedRealm.beginTransaction(); table.addSearchIndex(1); sharedRealm.commitTransaction(); }

Target:
public void shouldCheckIndexIsOkOnColumn() { init(); table.addSearchIndex(1); }
Source:
private List<SearchResult> searchUsingRestApi(String tenant, List<String> queries) { List<SearchResult> results = new ArrayList<>(); Timer.Context multiSearchCtx = searchTimer.time(); int hitsCount = 0; try { queryBatchHistogram.update(queries.size()); String response = elasticsearchRestHelper.fetch( ELASTICSEARCH_INDEX_NAME_READ, ELASTICSEARCH_DOCUMENT_TYPE, tenant, queries.get(0)); List<SearchResult> searchResults = getSearchResults(response); hitsCount = searchResults.size(); results.addAll(searchResults); } catch (JsonProcessingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { multiSearchCtx.stop(); } searchResultsSizeHistogram.update(hitsCount); return dedupResults(results); }

Target:
private List<SearchResult> searchUsingRestApi(String tenant, List<String> queries) { List<SearchResult> results = new ArrayList<>(); Timer.Context multiSearchCtx = searchTimer.time(); int hitsCount; try { queryBatchHistogram.update(queries.size()); String response = elasticsearchRestHelper.fetch( ELASTICSEARCH_INDEX_NAME_READ, ELASTICSEARCH_DOCUMENT_TYPE, tenant, queries); List<SearchResult> searchResults = getSearchResults(response); hitsCount = searchResults.size(); results.addAll(searchResults); } catch (JsonProcessingException e) { log.error("Elasticsearch metrics query failed for tenantId {}. {}", tenant, e.getMessage()); throw new RuntimeException(String.format("searchUsingRestApi failed with message: %s", e.getMessage()), e); } catch (IOException e) { log.error("Elasticsearch metrics query failed for tenantId {}. {}", tenant, e.getMessage()); throw new RuntimeException(String.format("searchUsingRestApi failed with message: %s", e.getMessage()), e); } finally { multiSearchCtx.stop(); } searchResultsSizeHistogram.update(hitsCount); return dedupResults(results); }
Source:
public SearchResults filterResults(SearchResults searchResults) { List<PageTitle> filteredResults = new ArrayList<>(); List<PageTitle> results = searchResults.getPageTitles(); for (int i = 0, count = 0; i < results.size() && count < maxItems; i++) { final PageTitle res = results.get(i); if (!title.equalsIgnoreCase(res.getPrefixedText()) && (!requireThumbnail || res.getThumbUrl() != null) && (!(res.getDescription() != null && (res.getDescription().contains("disambiguation") || res.getDescription().contains("Main page"))))) { filteredResults.add(res); count++; } } return new SearchResults(filteredResults, null, null); }

Target:
public SearchResults filterResults(SearchResults searchResults) { List<PageTitle> filteredResults = new ArrayList<>(); List<PageTitle> results = searchResults.getPageTitles(); for (int i = 0, count = 0; i < results.size() && count < maxItems; i++) { final PageTitle res = results.get(i); if (!title.equalsIgnoreCase(res.getPrefixedText()) && (!requireThumbnail || res.getThumbUrl() != null) && !res.getProperties().has("disambiguation")) { filteredResults.add(res); count++; } } return new SearchResults(filteredResults, null, null); }
Source:
public void destroy() { Process p = null; try { LinuxProcessBuilder lpb = new LinuxProcessBuilder(user, null, scriptBaseFolder); String killProcessTreeScript = new File(scriptBaseFolder, PROCESS_TREE_KILLER_LOCATION).getAbsolutePath(); lpb.directory(new File(System.getProperty("java.io.tmpdir"))); lpb.command(killProcessTreeScript, this.cleanupTimeoutGetter.getCleanupTimeSecondsString()); lpb.environment().put("PROCESS_KILL_TOKEN", this.token); p = lpb.start(); p.waitFor(); if (logger.isDebugEnabled()) { printStdout(p, Level.DEBUG); printStderr(p, Level.DEBUG); logger.debug("token: " + this.token + " exitval:" + p.exitValue()); } } catch (Exception e) { printStderr(p, Level.WARN); logger.warn("Failed to destroy OS process with token: " + this.token, e); } }

Target:
public void destroy() { Process p = null; try { LinuxProcessBuilder lpb = new LinuxProcessBuilder(user, null, scriptBaseFolder); String killProcessTreeScript = new File(scriptBaseFolder, PROCESS_TREE_KILLER_LOCATION).getAbsolutePath(); lpb.directory(new File(System.getProperty("java.io.tmpdir"))); lpb.command(killProcessTreeScript, this.cleanupTimeoutGetter.getCleanupTimeSecondsString()); lpb.environment().put("PROCESS_KILL_TOKEN", this.token); p = lpb.start(); p.waitFor(); if (logger.isDebugEnabled()) { printStdout(p, Level.DEBUG); printStderr(p, Level.DEBUG); logger.debug("token: " + this.token + " exitval:" + p.exitValue()); } } catch (Exception e) { logger.warn("Failed to destroy OS process with token: " + this.token, e); printStdout(p, Level.WARN); printStderr(p, Level.WARN); } }
Source:
public void testWorkPath() throws Exception { List<PID> pids = makePidList(4); when(pathFactory.getAncestorPids(pid)).thenReturn(pids); filter.filter(dip); verify(idb).setRollup(eq(contentObject.getPid().getId())); }

Target:
public void testWorkPath() throws Exception { List<PID> pids = makePidList(4); when(pathFactory.getAncestorPids(pid)).thenReturn(pids); filter.filter(dip); verify(idb).setAncestorPath(listCaptor.capture()); List<String> ancestorPath = listCaptor.getValue(); ancestorPathCheck(ancestorPath, pids); assertEquals(4, ancestorPath.size()); verify(idb).setRollup(eq(contentObject.getPid().getId())); }
Source:
List<JsonObject> findBySort(boolean closed, boolean active, String sort, Integer offset,Integer size) throws DataException { BoolQueryBuilder query = new BoolQueryBuilder(); query.must(getQuerySortHelperStatus(closed)); query.must(getQueryProjectActive(active)); return searcher.findDocuments(query.toString(), sort, offset, size); }

Target:
private List<JsonObject> findBySort(boolean closed, boolean active, String sort, Integer offset, Integer size) throws DataException { BoolQueryBuilder query = new BoolQueryBuilder(); query.must(getQuerySortHelperStatus(closed)); query.must(getQueryProjectActive(active)); return searcher.findDocuments(query.toString(), sort, offset, size); }
Source:
private AbstractHistoryCategory[] sortRevisions(IFileRevision[] revisions, IProgressMonitor monitor) { try { monitor.beginTask(null, 100); DateHistoryCategory[] tempCategories = new DateHistoryCategory[4]; Calendar currentCal = Calendar.getInstance(); tempCategories[0] = new DateHistoryCategory(TeamUIMessages.HistoryPage_Today, currentCal, null); Calendar yesterdayCal = Calendar.getInstance(); yesterdayCal.roll(Calendar.DAY_OF_YEAR, -1); tempCategories[1] = new DateHistoryCategory(TeamUIMessages.HistoryPage_Yesterday, yesterdayCal, null); Calendar monthCal = Calendar.getInstance(); monthCal.set(Calendar.DAY_OF_MONTH, 1); tempCategories[2] = new DateHistoryCategory(TeamUIMessages.HistoryPage_ThisMonth, monthCal, yesterdayCal); tempCategories[3] = new DateHistoryCategory(TeamUIMessages.HistoryPage_Previous, null, monthCal); ArrayList<AbstractHistoryCategory> finalCategories = new ArrayList<AbstractHistoryCategory>(); for (DateHistoryCategory tempCategorie : tempCategories) { tempCategorie.collectFileRevisions(revisions, false); if (tempCategorie.hasRevisions()) { finalCategories.add(tempCategorie); } } if (finalCategories.isEmpty()){ finalCategories.add(getErrorMessage()); } return finalCategories.toArray(new AbstractHistoryCategory[finalCategories.size()]); } finally { monitor.done(); } }

Target:
private AbstractHistoryCategory[] sortRevisions(IFileRevision[] revisions, IProgressMonitor monitor) { try { monitor.beginTask(null, 100); DateHistoryCategory[] tempCategories = new DateHistoryCategory[4]; Calendar currentCal = Calendar.getInstance(); tempCategories[0] = new DateHistoryCategory(TeamUIMessages.HistoryPage_Today, currentCal, null); Calendar yesterdayCal = Calendar.getInstance(); yesterdayCal.roll(Calendar.DAY_OF_YEAR, -1); tempCategories[1] = new DateHistoryCategory(TeamUIMessages.HistoryPage_Yesterday, yesterdayCal, null); Calendar monthCal = Calendar.getInstance(); monthCal.set(Calendar.DAY_OF_MONTH, 1); tempCategories[2] = new DateHistoryCategory(TeamUIMessages.HistoryPage_ThisMonth, monthCal, yesterdayCal); tempCategories[3] = new DateHistoryCategory(TeamUIMessages.HistoryPage_Previous, null, monthCal); ArrayList<AbstractHistoryCategory> finalCategories = new ArrayList<AbstractHistoryCategory>(); for (DateHistoryCategory tempCategory : tempCategories){ tempCategory.collectFileRevisions(revisions, false); if (tempCategory.hasRevisions()){ finalCategories.add(tempCategory); } } if (finalCategories.isEmpty()){ finalCategories.add(getErrorMessage()); } return finalCategories.toArray(new AbstractHistoryCategory[finalCategories.size()]); } finally { monitor.done(); } }
Source:
public static IModelCustom loadModel(String resourceName) throws IllegalArgumentException, ModelFormatException { int i = resourceName.lastIndexOf('.'); int j = resourceName.lastIndexOf(':'); if (i == -1 || j == -1) { FMLLog.severe("The resource name %s is not valid", resourceName); throw new IllegalArgumentException("The resource name is not valid"); } String suffix = resourceName.substring(i + 1); String modID = resourceName.substring(0, j); IModelCustomLoader loader = instances.get(suffix); if (loader == null) { FMLLog.severe("The resource name %s is not supported", resourceName); throw new IllegalArgumentException("The resource name is not supported"); } ResourceLocation resource = new ResourceLocation(modID, resourceName.substring(j + 1)); return loader.loadInstance(resourceName, resource); }

Target:
public static IModelCustom loadModel(String resourceName) throws IllegalArgumentException, ModelFormatException { int i = resourceName.lastIndexOf('.'); int j = resourceName.lastIndexOf(':'); if (i == -1 || j == -1) { FMLLog.severe("The resource name %s is not valid", resourceName); throw new IllegalArgumentException("The resource name is not valid"); } String suffix = resourceName.substring(i + 1); String modID = resourceName.substring(0, j); IModelCustomLoader loader = instances.get(suffix); if (loader == null) { FMLLog.severe("The resource name %s is not supported", resourceName); throw new IllegalArgumentException("The resource name is not supported"); } <<<<<<< HEAD ResourceLocation resLoc = new ResourceLocation(resourceName); return loader.loadInstance(resourceName, resLoc); ======= ResourceLocation resource = new ResourceLocation(modID, resourceName.substring(j + 1)); return loader.loadInstance(resourceName, resource); >>>>>>> master }
Source:
public void invokeCallbackMethods() { initCommandExecutor(); CommandEntity cmdEntity; for (Iterator<Entry<Guid, CommandCallBack>> iterator = cmdCallBackMap.entrySet().iterator(); iterator.hasNext();) { Entry<Guid, CommandCallBack> entry = iterator.next(); Guid cmdId = entry.getKey(); CommandCallBack callBack = entry.getValue(); CommandStatus status = coco.getCommandStatus(cmdId); switch (status) { case FAILED: try { callBack.onFailed(cmdId, coco.getChildCommandIds(cmdId)); } catch (Exception ex) { log.errorFormat("Error invoking onFailed for FAILED command {0}", cmdId.toString()); } coco.updateCallBackNotified(cmdId); iterator.remove(); break; case SUCCEEDED: try { callBack.onSucceeded(cmdId, coco.getChildCommandIds(cmdId)); coco.updateCallBackNotified(cmdId); iterator.remove(); } catch (Exception ex) { log.errorFormat("Error invoking onSucceeded for SUCCEEDED command {0}", cmdId.toString()); coco.updateCommandStatus(cmdId, CommandStatus.FAILED); } break; case ACTIVE: cmdEntity = coco.getCommandEntity(cmdId); if (cmdEntity.isExecuted() && cmdEntity.isAsync()) { try { callBack.doPolling(cmdId, coco.getChildCommandIds(cmdId)); } catch (Exception ex) { coco.updateCommandStatus(cmdId, CommandStatus.FAILED); log.errorFormat("Error invoking doPolling for active command {0}", cmdId.toString()); } } break; default: break; } } }

Target:
public void invokeCallbackMethods() { initCommandExecutor(); CommandEntity cmdEntity; for (Iterator<Entry<Guid, CommandCallBack>> iterator = cmdCallBackMap.entrySet().iterator(); iterator.hasNext();) { Entry<Guid, CommandCallBack> entry = iterator.next(); Guid cmdId = entry.getKey(); CommandCallBack callBack = entry.getValue(); CommandStatus status = coco.getCommandStatus(cmdId); switch (status) { case FAILED: try { callBack.onFailed(cmdId, coco.getChildCommandIds(cmdId)); } catch (Exception ex) { handleError(ex, status, cmdId); } coco.updateCallBackNotified(cmdId); iterator.remove(); break; case SUCCEEDED: try { callBack.onSucceeded(cmdId, coco.getChildCommandIds(cmdId)); coco.updateCallBackNotified(cmdId); iterator.remove(); } catch (Exception ex) { handleError(ex, status, cmdId); } coco.updateCallBackNotified(cmdId); iterator.remove(); break; case ACTIVE: cmdEntity = coco.getCommandEntity(cmdId); if (cmdEntity.isExecuted()) { try { callBack.doPolling(cmdId, coco.getChildCommandIds(cmdId)); } catch (Exception ex) { handleError(ex, status, cmdId); } } break; default: break; } } }
Source:
private String getCookieParam(String param, String cookieString) { if (param.equals(NAME)) { return cookieString.substring(0, cookieString.indexOf('=')); } if (param.equals(VALUE)) { if (cookieString.contains(";")) { return cookieString.substring(cookieString.indexOf('=') + 1, cookieString.indexOf(';')); } else { return cookieString.substring(cookieString.indexOf('=') + 1); } } if(SECURE.equals(param) && cookieString.contains(SECURE)) { return "true"; } if (cookieString.contains(param + '=')) { final int endParam = cookieString.indexOf(';', cookieString.indexOf(param + '=')); final int beginIndex = cookieString.indexOf(param + '=') + param.length() + 1; if (endParam > 0) { return cookieString.substring(beginIndex, endParam); } else { return cookieString.substring(beginIndex); } } throw new CitrusRuntimeException(String.format( "Unable to get cookie argument '%s' from cookie String: %s", param, cookieString)); }

Target:
private String getCookieParam(String param, String cookieString) { if (param.equals(NAME)) { return cookieString.substring(0, cookieString.indexOf('=')); } if (param.equals(VALUE)) { if (cookieString.contains(";")) { return cookieString.substring(cookieString.indexOf('=') + 1, cookieString.indexOf(';')); } else { return cookieString.substring(cookieString.indexOf('=') + 1); } } if(SECURE.equals(param) && cookieString.contains(SECURE)) { return String.valueOf(true); } if (cookieString.contains(param + '=')) { final int endParam = cookieString.indexOf(';', cookieString.indexOf(param + '=')); final int beginIndex = cookieString.indexOf(param + '=') + param.length() + 1; if (endParam > 0) { return cookieString.substring(beginIndex, endParam); } else { return cookieString.substring(beginIndex); } } throw new CitrusRuntimeException(String.format( "Unable to get cookie argument '%s' from cookie String: %s", param, cookieString)); }
Source:
public List<Result> execute(IotasEvent input) { final List<Result> results = splitter.splitEvent(input, splitAction.getOutputStreams()); for (Result result : results) { for (IotasEvent event : result.events) { checkGroupIdPartitionId(event); } } return results; }

Target:
public List<Result> execute(IotasEvent input) { final List<Result> results = splitter.splitEvent(input, getOutputStreams()); for (Result result : results) { for (IotasEvent event : result.events) { checkGroupIdPartitionId(event); } } return results; }
Source:
public void helpBuildingEvent(EventBuilder eventBuilder) { HttpServletRequest servletRequest = SentryServletRequestListener.getServletRequest(); if (servletRequest == null) { return; } HttpServletRequestWrapper servletRequestWrapper = new HttpServletRequestWrapper(servletRequest); addHttpInterface(eventBuilder, servletRequestWrapper); addUserInterface(eventBuilder, servletRequestWrapper); }

Target:
public void helpBuildingEvent(EventBuilder eventBuilder) { HttpServletRequest servletRequest = SentryServletRequestListener.getServletRequest(); if (servletRequest == null) { return; } HttpRequestInterface servletRequestWrapper = new HttpServletRequestWrapper(servletRequest); addHttpInterface(eventBuilder, servletRequestWrapper); addUserInterface(eventBuilder, servletRequestWrapper); }
Source:
private ConfigurableAuthService setUpAuthClient( final Map<String, String> config) { final URL authURL = getURL(config, KBASE_AUTH_URL); final String authAllowInsecure = config.get(INSECURE_AUTH_URL); final URL globusURL = getURL(config, GLOBUS_AUTH_URL); if (authURL == null || globusURL == null) { return null; } System.out.println(UserAndJobStateServer.class.getName() + ": " + INSECURE_AUTH_URL +" = " + (authAllowInsecure == null ? "<not-set> ('false' will be used)" : authAllowInsecure)); final AuthConfig c; try { c = new AuthConfig().withGlobusAuthURL(globusURL) .withKBaseAuthServerURL(authURL) .withAllowInsecureURLs("true".equals(authAllowInsecure)); } catch (URISyntaxException e) { throw new RuntimeException("Neat. I'm suprised this happened", e); } final boolean token = config.get(KBASE_ADMIN_TOKEN) != null; final ConfigurableAuthService auth; try { auth = new ConfigurableAuthService(c); if (token) { c.withToken(auth.validateToken(config.get(KBASE_ADMIN_TOKEN))); } else { c.withRefreshingToken(auth.getRefreshingToken( config.get(KBASE_ADMIN_USER), config.get(KBASE_ADMIN_PWD), TOKEN_REFRESH_INTERVAL_SEC)); } return auth; } catch (AuthException e) { fail("Couldn't log in the KBase administrative user " + (token ? "with a token" : config.get(KBASE_ADMIN_USER)) + ": " + e.getMessage()); } catch (IOException e) { fail("Couldn't connect to authorization service at " + c.getAuthServerURL() + " : " + e.getLocalizedMessage()); } return null; }

Target:
private ConfigurableAuthService setUpAuthClient( final Map<String, String> config) { final URL authURL = getURL(config, KBASE_AUTH_URL); final String authAllowInsecure = config.get(INSECURE_AUTH_URL); final URL globusURL = getURL(config, GLOBUS_AUTH_URL); if (authURL == null || globusURL == null) { return null; } final AuthConfig c; try { c = new AuthConfig().withGlobusAuthURL(globusURL) .withKBaseAuthServerURL(authURL) .withAllowInsecureURLs("true".equals(authAllowInsecure)); } catch (URISyntaxException e) { throw new RuntimeException("Neat. I'm suprised this happened", e); } final boolean token = config.get(KBASE_ADMIN_TOKEN) != null; final ConfigurableAuthService auth; try { auth = new ConfigurableAuthService(c); if (token) { c.withToken(auth.validateToken(config.get(KBASE_ADMIN_TOKEN))); } else { c.withRefreshingToken(auth.getRefreshingToken( config.get(KBASE_ADMIN_USER), config.get(KBASE_ADMIN_PWD), TOKEN_REFRESH_INTERVAL_SEC)); } return auth; } catch (AuthException e) { fail("Couldn't log in the KBase administrative user " + (token ? "with a token" : config.get(KBASE_ADMIN_USER)) + ": " + e.getMessage()); } catch (IOException e) { fail("Couldn't connect to authorization service at " + c.getAuthServerURL() + " : " + e.getLocalizedMessage()); } return null; }
Source:
protected void startMachines() throws InfrastructureException { OpenShiftEnvironment osEnv = getContext().getEnvironment(); List<Service> createdServices = new ArrayList<>(); for (Service service : osEnv.getServices().values()) { createdServices.add(project.services().create(service)); } List<Route> createdRoutes = new ArrayList<>(); for (Route route : osEnv.getRoutes().values()) { createdRoutes.add(project.routes().create(route)); } project.pods().watchContainers(new MachineLogsPublisher()); if (StringUtils.isNotBlank(unrecoverableEvents)) { project.pods().watchContainers(new UnrecoverableEventHanler()); } doStartMachine(new OpenShiftServerResolver(createdServices, createdRoutes)); }

Target:
protected void startMachines() throws InfrastructureException { OpenShiftEnvironment osEnv = getContext().getEnvironment(); List<Service> createdServices = new ArrayList<>(); for (Service service : osEnv.getServices().values()) { createdServices.add(project.services().create(service)); } List<Route> createdRoutes = new ArrayList<>(); for (Route route : osEnv.getRoutes().values()) { createdRoutes.add(project.routes().create(route)); } project.pods().watchContainers(new MachineLogsPublisher()); if (!Strings.isNullOrEmpty(unrecoverableEvents)) { project.pods().watchContainers(new UnrecoverableEventHanler()); } doStartMachine(new OpenShiftServerResolver(createdServices, createdRoutes)); }
Source:
private void addAssetsToView(List<AssetInfo> assetInfos) { if (!reloader.isAssetsLoadingFinished()) { this.showIndexingNotFinished(); reloader.check(assetInfos); } if (assetInfos.isEmpty()) { this.showSearchHitNothing(); } else { this.hideEmptyState(); assetInfos.forEach(asset -> { if (!asset.getFolderItem().getType().equals(FolderItemType.FOLDER)) { AssetItemWidget item = assetItemWidget.get(); final ClientResourceType assetResourceType = getResourceType(asset); final String assetName = getAssetName(asset, assetResourceType); item.init(assetName, getAssetPath(asset), assetResourceType.getDescription(), assetResourceType.getIcon(), getLastModifiedTime(asset), getCreatedTime(asset), detailsCommand((Path) asset.getFolderItem().getItem()), selectCommand((Path) asset.getFolderItem().getItem())); this.view.addAssetItem(elemental2DomUtil.asHTMLElement(item.getElement())); } }); } this.updatedAssetsEventEvent.fire(new UpdatedAssetsEvent(assetInfos)); busyIndicatorView.hideBusyIndicator(); }

Target:
private void addAssetsToView(List<AssetInfo> assetInfos) { if (!reloader.isAssetsLoadingFinished()) { this.showIndexingNotFinished(); reloader.check(assetInfos); } if (assetInfos.isEmpty()) { this.showSearchHitNothing(); } else { this.hideEmptyState(); assetInfos.forEach(asset -> { if (!asset.getFolderItem().getType().equals(FolderItemType.FOLDER)) { AssetItemWidget item = assetItemWidget.get(); final ClientResourceType assetResourceType = getResourceType(asset); final String assetName = getAssetName(asset, assetResourceType); item.init(assetName, getAssetPath(asset), assetResourceType.getDescription(), assetResourceType.getIcon(), getLastModifiedTime(asset), getCreatedTime(asset), detailsCommand((Path) asset.getFolderItem().getItem()), selectCommand((Path) asset.getFolderItem().getItem())); this.view.addAssetItem(item); } }); } this.updatedAssetsEventEvent.fire(new UpdatedAssetsEvent(assetInfos)); busyIndicatorView.hideBusyIndicator(); }
Source:
public static native int getDexOptNeeded(String fileName, String instructionSet, String compilerFilter, String classLoaderContext, boolean newProfile, boolean downgrade) throws FileNotFoundException, IOException; public static native String getDexFileStatus(String fileName, String instructionSet) throws FileNotFoundException; public static native String[] getDexFileOutputPaths(String fileName, String instructionSet) throws FileNotFoundException; public native static boolean isValidCompilerFilter(String filter); public native static boolean isProfileGuidedCompilerFilter(String filter); public native static String getNonProfileGuidedCompilerFilter(String filter); public native static String getSafeModeCompilerFilter(String filter); public long getStaticSizeOfDexFile() { return mCookie == null ? 0 : getStaticSizeOfDexFile(mCookie); }

Target:
public static native int getDexOptNeeded(String fileName, String instructionSet, String compilerFilter, String classLoaderContext, boolean newProfile, boolean downgrade) throws FileNotFoundException, IOException; public static native String getDexFileStatus(String fileName, String instructionSet) throws FileNotFoundException; public static native String[] getDexFileOutputPaths(String fileName, String instructionSet) throws FileNotFoundException; public native static boolean isValidCompilerFilter(String filter); public native static boolean isProfileGuidedCompilerFilter(String filter); public native static String getNonProfileGuidedCompilerFilter(String filter); public native static String getSafeModeCompilerFilter(String filter); public long getStaticSizeOfDexFile() { Object cookie = mCookie; return cookie == null ? 0 : getStaticSizeOfDexFile(cookie); }
Source:
public static HistoricItem historicState(Item item, AbstractInstant timestamp, String serviceId) { PersistenceService service = getService(serviceId); if (service instanceof QueryablePersistenceService) { QueryablePersistenceService qService = (QueryablePersistenceService) service; FilterCriteria filter = new FilterCriteria(); filter.setEndDate(ZonedDateTime.ofInstant(timestamp.toDate().toInstant(), TimeZone.getDefault().toZoneId())); filter.setItemName(item.getName()); filter.setPageSize(1); filter.setOrdering(Ordering.DESCENDING); Iterable<HistoricItem> result = qService.query(filter); if (result.iterator().hasNext()) { return result.iterator().next(); } else { return null; } } else { LoggerFactory.getLogger(PersistenceExtensions.class) .warn("There is no queryable persistence service registered with the id '{}'", serviceId); return null; } }

Target:
public static HistoricItem historicState(Item item, AbstractInstant timestamp, String serviceId) { PersistenceService service = getService(serviceId); if (service instanceof QueryablePersistenceService) { QueryablePersistenceService qService = (QueryablePersistenceService) service; FilterCriteria filter = new FilterCriteria(); filter.setEndDate(ZonedDateTime.ofInstant(timestamp.toDate().toInstant(), timeZoneProvider.getTimeZone())); filter.setItemName(item.getName()); filter.setPageSize(1); filter.setOrdering(Ordering.DESCENDING); Iterable<HistoricItem> result = qService.query(filter); if (result.iterator().hasNext()) { return result.iterator().next(); } else { return null; } } else { LoggerFactory.getLogger(PersistenceExtensions.class) .warn("There is no queryable persistence service registered with the id '{}'", serviceId); return null; } }
Source:
private void verifyNumOfProductThumbVisible(By numOfProductBy) { List<WebElement> thumbElemsList = driver.findElement(numOfProductBy).findElements(productThumbBy); if (numOfProductBy.equals(eCommerceMultipleProductBy)) { Assertion.assertTrue(thumbElemsList.size() > 1, "Expecting more than 1 product thumb image. Found: " + thumbElemsList.size()); } else { Assertion.assertTrue(thumbElemsList.size() == 1, "Expecting more than 1 product thumb image. Found: " + thumbElemsList.size()); } }

Target:
private void verifyNumOfProductThumbVisible(By numOfProductBy) { List<WebElement> thumbElemsList = driver.findElement(numOfProductBy).findElements(productThumbBy); if (numOfProductBy.equals(eCommerceMultipleProductBy)) { Assertion.assertTrue(thumbElemsList.size() > 1, "Expecting more than 1 product thumb image. Found: " + thumbElemsList.size()); } else { Assertion.assertTrue(thumbElemsList.size() == 1, "Expecting only 1 product thumb image. Found: " + thumbElemsList.size()); } }
Source:
public Object getField(ServerConsumer consumer, String fieldName) { ServerSession session = server.getSessionByID(consumer.getSessionID()); if (session == null) { return null; } switch (fieldName) { case "id": return consumer.getSequentialID(); case "session": return consumer.getSessionName(); case "user": return session.getUsername(); case "clientID": return consumer.getConnectionClientID(); case "protocol": return consumer.getConnectionProtocolName(); case "queue": return consumer.getQueueName(); case "queueType": return consumer.getQueueType(); case "filter": return consumer.getFilter() == null ? "" : consumer.getFilter().getFilterString(); case "localAddress": return consumer.getConnectionLocalAddress(); case "remoteAddress": return consumer.getConnectionRemoteAddress(); case "creationTime": return new Date(consumer.getCreationTime()); default: throw new IllegalArgumentException("Unsupported field, " + fieldName); } }

Target:
public Object getField(ServerConsumer consumer, String fieldName) { ServerSession session = server.getSessionByID(consumer.getSessionID()); if (session == null) { return null; } switch (fieldName) { case "id": return consumer.getSequentialID(); case "session": return consumer.getSessionName(); case "user": return session.getUsername(); case "clientID": return consumer.getConnectionClientID(); case "protocol": return consumer.getConnectionProtocolName(); case "queue": return consumer.getQueueName(); case "queueType": return consumer.getQueueType(); case "filter": return consumer.getFilterString(); case "localAddress": return consumer.getConnectionLocalAddress(); case "remoteAddress": return consumer.getConnectionRemoteAddress(); case "creationTime": return new Date(consumer.getCreationTime()); default: throw new IllegalArgumentException("Unsupported field, " + fieldName); } }
Source:
public void emitEvent(Event event) throws QueueException { eventQueue.emitEvent(event); }

Target:
public void emitEvent(Event event) { try { eventQueue.emitEvent(event); } catch (QueueException e) { logger.error("Failed to emit event due to [externalId={}]", event.getEventType(), e.getMessage(), event.getResourceExternalId()); } }
Source:
void onEditProfileClicked() { Flow.get(getView().getContext()).set(new ProfileSettingsScreen()); }

Target:
void onEditProfileClicked() { Flow.get(getView()).set(new ProfileSettingsScreen()); }