auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testCompressedFrame() { EmbeddedChannel encoderChannel = new EmbeddedChannel( ZlibCodecFactory.newZlibEncoder(ZlibWrapper.NONE, 9, 15, 8)); EmbeddedChannel decoderChannel = new EmbeddedChannel(new PerMessageDeflateDecoder(false, NEVER_SKIP)); byte[] payload = new byte[300]; random.nextBytes(payload); encoderChannel.writeOutbound(Unpooled.wrappedBuffer(payload)); ByteBuf compressedPayload = encoderChannel.readOutbound(); BinaryWebSocketFrame compressedFrame = new BinaryWebSocketFrame(true, WebSocketExtension.RSV1 | WebSocketExtension.RSV3, compressedPayload.slice(0, compressedPayload.readableBytes() - 4)); decoderChannel.writeInbound(compressedFrame); BinaryWebSocketFrame uncompressedFrame = decoderChannel.readInbound(); assertNotNull(uncompressedFrame); assertNotNull(uncompressedFrame.content()); assertEquals(WebSocketExtension.RSV3, uncompressedFrame.rsv()); assertEquals(300, uncompressedFrame.content().readableBytes()); byte[] finalPayload = new byte[300]; uncompressedFrame.content().readBytes(finalPayload); assertArrayEquals(finalPayload, payload); uncompressedFrame.release(); }

Target:
public void testCompressedFrame() { EmbeddedChannel encoderChannel = new EmbeddedChannel( ZlibCodecFactory.newZlibEncoder(ZlibWrapper.NONE, 9, 15, 8)); EmbeddedChannel decoderChannel = new EmbeddedChannel(new PerMessageDeflateDecoder(false)); byte[] payload = new byte[300]; random.nextBytes(payload); assertTrue(encoderChannel.writeOutbound(Unpooled.wrappedBuffer(payload))); ByteBuf compressedPayload = encoderChannel.readOutbound(); BinaryWebSocketFrame compressedFrame = new BinaryWebSocketFrame(true, WebSocketExtension.RSV1 | WebSocketExtension.RSV3, compressedPayload.slice(0, compressedPayload.readableBytes() - 4)); assertTrue(decoderChannel.writeInbound(compressedFrame)); BinaryWebSocketFrame uncompressedFrame = decoderChannel.readInbound(); assertNotNull(uncompressedFrame); assertNotNull(uncompressedFrame.content()); assertEquals(WebSocketExtension.RSV3, uncompressedFrame.rsv()); assertEquals(300, uncompressedFrame.content().readableBytes()); byte[] finalPayload = new byte[300]; uncompressedFrame.content().readBytes(finalPayload); assertArrayEquals(finalPayload, payload); uncompressedFrame.release(); }
Source:
private ErlangFile getErlangFile(@NotNull VirtualFile virtualFile) { PsiFile psiFile = myPsiManager.findFile(virtualFile); if (psiFile instanceof ErlangFile) { return (ErlangFile) psiFile; } return null; }

Target:
private ErlangFile getErlangFile(@NotNull VirtualFile virtualFile) { PsiFile psiFile = myPsiManager.findFile(virtualFile); ErlangFile erlangFile = ObjectUtils.tryCast(psiFile, ErlangFile.class); assert erlangFile != null; return erlangFile; }
Source:
public synchronized Integer getAvailable() { Integer quark = fAvailableQuarks.poll(); if (quark == null) { quark = fSs.getQuarkRelativeAndAdd(fBaseQuark, String.valueOf(fCount)); fCount++; } fInUseQuarks.add(quark); return quark; }

Target:
public synchronized int getAvailable() { Integer quark = fAvailableQuarks.poll(); if (quark == null) { quark = fSs.getQuarkRelativeAndAdd(fBaseQuark, String.valueOf(fCount)); fCount++; } fQuarksInUse.add(quark); return quark; }
Source:
protected List<ConfigIssue> init() { List<ConfigIssue> issues = gcsOriginConfig.init(getContext(), super.init()); storage = StorageOptions.getDefaultInstance().getService(); minMaxPriorityQueue = MinMaxPriorityQueue.orderedBy((Blob o1, Blob o2) -> { int result = o1.getUpdateTime().compareTo(o2.getUpdateTime()); if(result != 0) { return result; } return o1.getName().compareTo(o2.getName()); }).maximumSize(10000).create(); return issues; }

Target:
protected List<ConfigIssue> init() { List<ConfigIssue> issues = gcsOriginConfig.init(getContext(), super.init()); minMaxPriorityQueue = MinMaxPriorityQueue.orderedBy((Blob o1, Blob o2) -> { int result = o1.getUpdateTime().compareTo(o2.getUpdateTime()); if(result != 0) { return result; } return o1.getName().compareTo(o2.getName()); }).maximumSize(gcsOriginConfig.maxResultQueueSize).create(); antPathMatcher = new AntPathMatcher(); gcsOriginConfig.prefixPattern = gcsOriginConfig.commonPrefix + gcsOriginConfig.prefixPattern; gcsOriginConfig.credentials.getCredentialsProvider(getContext(), issues).ifPresent(p -> credentialsProvider = p); try { storage = StorageOptions.newBuilder().setCredentials(credentialsProvider.getCredentials()).build().getService(); } catch (IOException e) { getContext().reportError(Errors.GCS_01, e); } return issues; }
Source:
private static void accessLocation() { sConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { } @Override public void onServiceDisconnected(ComponentName name) { } }; Intent testAppService = new Intent(); testAppService.setComponent(new ComponentName(TEST_APP_PKG, TEST_APP_SERVICE)); sContext.bindService(testAppService, sConnection, BIND_AUTO_CREATE); }

Target:
private void accessLocation() { mConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { } @Override public void onServiceDisconnected(ComponentName name) { } }; Intent testAppService = new Intent(); testAppService.setComponent(new ComponentName(TEST_APP_PKG, TEST_APP_SERVICE)); sContext.bindService(testAppService, mConnection, BIND_AUTO_CREATE); }
Source:
private boolean isConditionColumnWithSpecialOperator( final BaseColumn baseColumn ) { final ArrayList specialOperators = new ArrayList(); specialOperators.add( "== null" ); specialOperators.add( "!= null" ); return baseColumn instanceof ConditionCol52 && specialOperators.contains( ( (ConditionCol52) baseColumn ).getOperator() ); }

Target:
private boolean isConditionColumnWithSpecialOperator( final BaseColumn baseColumn ) { return baseColumn instanceof ConditionCol52 && NullEqualityOperator.contains( ( (ConditionCol52) baseColumn ).getOperator() ) ; }
Source:
public void shouldNotBeOverdueWhenDueTomorrow() throws Exception { Configuration config = new Configuration(); config.setValue("40"); config.setReferencePoint("end"); config.setAction("add"); Appraisal appraisal = new Appraisal(); DateTime endDate = new DateTime(); appraisal.setEndDate(endDate.plusDays(-39).toDate()); assert !EvalsUtil.isOverdue(appraisal, config); assert EvalsUtil.isDue(appraisal, config) > 0; }

Target:
public void shouldNotBeOverdueWhenDueTomorrow() throws Exception { Configuration config = new Configuration(); config.setValue("40"); config.setReferencePoint("end"); config.setAction("add"); Appraisal appraisal = new Appraisal(); DateTime endDate = new DateTime(); appraisal.setEndDate(endDate.plusDays(-39).toDate()); assert !EvalsUtil.isOverdue(appraisal, config); assert EvalsUtil.isDue(appraisal, config) == 1; }
Source:
private void clusterSelectedItemChanged() { AsyncDataProvider.getInstance().getGlusterSnapshotConfig(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { VdcQueryReturnValue vdcValue = (VdcQueryReturnValue) returnValue; Pair<List<GlusterVolumeSnapshotConfig>, List<GlusterVolumeSnapshotConfig>> configs = (Pair<List<GlusterVolumeSnapshotConfig>, List<GlusterVolumeSnapshotConfig>>) vdcValue.getReturnValue(); if (configs != null) { List<GlusterVolumeSnapshotConfig> clusterConfigOptions = configs.getFirst(); Collections.sort(clusterConfigOptions, new Linq.GlusterVolumeSnapshotConfigComparator()); setModelItems(getClusterConfigOptions(), clusterConfigOptions, existingClusterConfigs); } else { getClusterConfigOptions().setItems(null); } } private void setModelItems(ListModel<EntityModel<GlusterVolumeSnapshotConfig>> listModel, List<GlusterVolumeSnapshotConfig> cfgs, Map<String, String> fetchedCfgsBackup) { List<EntityModel<GlusterVolumeSnapshotConfig>> coll = new ArrayList<EntityModel<GlusterVolumeSnapshotConfig>>(); for (GlusterVolumeSnapshotConfig cfg : cfgs) { EntityModel<GlusterVolumeSnapshotConfig> cfgModel = new EntityModel<GlusterVolumeSnapshotConfig>(); cfgModel.setEntity(cfg); fetchedCfgsBackup.put(cfg.getParamName(), cfg.getParamValue()); coll.add(cfgModel); } listModel.setItems(coll); } }), getClusters().getSelectedItem().getId(), null); }

Target:
private void clusterSelectedItemChanged() { VDSGroup selectedCluster = getClusters().getSelectedItem(); if (selectedCluster == null) { return; } AsyncDataProvider.getInstance().getGlusterSnapshotConfig(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { VdcQueryReturnValue vdcValue = (VdcQueryReturnValue) returnValue; Pair<List<GlusterVolumeSnapshotConfig>, List<GlusterVolumeSnapshotConfig>> configs = (Pair<List<GlusterVolumeSnapshotConfig>, List<GlusterVolumeSnapshotConfig>>) vdcValue.getReturnValue(); if (configs != null) { List<GlusterVolumeSnapshotConfig> clusterConfigOptions = configs.getFirst(); Collections.sort(clusterConfigOptions, new Linq.GlusterVolumeSnapshotConfigComparator()); setModelItems(getClusterConfigOptions(), clusterConfigOptions, existingClusterConfigs); } else { getClusterConfigOptions().setItems(null); } } private void setModelItems(ListModel<EntityModel<GlusterVolumeSnapshotConfig>> listModel, List<GlusterVolumeSnapshotConfig> cfgs, Map<String, String> fetchedCfgsBackup) { List<EntityModel<GlusterVolumeSnapshotConfig>> coll = new ArrayList<EntityModel<GlusterVolumeSnapshotConfig>>(); for (GlusterVolumeSnapshotConfig cfg : cfgs) { EntityModel<GlusterVolumeSnapshotConfig> cfgModel = new EntityModel<GlusterVolumeSnapshotConfig>(); cfgModel.setEntity(cfg); fetchedCfgsBackup.put(cfg.getParamName(), cfg.getParamValue()); coll.add(cfgModel); } listModel.setItems(coll); } }), selectedCluster.getId(), null); }
Source:
public void testCreateNodeWithCustomHardware() throws Exception { Template template = buildTemplate(templateBuilder() .hardwareId("automatic:cores=2;ram=2048;disk=10")); try { NodeMetadata node = getOnlyElement(client.createNodesInGroup(group + "custom", 1, template)); assertThat(node.getHardware().getRam()).isEqualTo(2048); assertThat(node.getHardware().getProcessors().get(0).getCores()).isEqualTo(2); assertThat(node.getHardware().getVolumes().get(0).getSize()).isEqualTo(10); } finally { client.destroyNodesMatching(inGroup(group + "custom")); } }

Target:
public void testCreateNodeWithCustomHardware() throws Exception { Template template = buildTemplate(templateBuilder() .hardwareId("automatic:cores=2;ram=2048;disk=10")); try { NodeMetadata node = getOnlyElement(client.createNodesInGroup(group + "custom", 1, template)); assertThat(node.getHardware().getRam()).isEqualTo(2048); assertThat(node.getHardware().getProcessors().get(0).getCores()).isEqualTo(2); assertThat(node.getHardware().getVolumes().get(0).getSize()).isEqualTo(10); assertThat(node.getHardware().getId()).isEqualTo("automatic:cores=2;ram=2048;disk=10"); } finally { client.destroyNodesMatching(inGroup(group + "custom")); } }
Source:
public B findGitDir(File current) { if (getGitDir() == null) { FS tryFS = safeFS(); while (current != null) { File dir = new File(current, DOT_GIT); if (FileKey.isGitRepository(dir, tryFS)) { setGitDir(dir); break; } else if (dir.isFile()) try { setGitDir(getSymRef(current, dir, tryFS)); break; } catch (IOException ignored) { } else if (FileKey.isGitRepository(current, tryFS)) { setGitDir(current); break; } current = current.getParentFile(); if (current != null && ceilingDirectories != null && ceilingDirectories.contains(current)) break; } } return self(); }

Target:
public B findGitDir(File current) { if (getGitDir() == null) { FS tryFS = safeFS(); while (current != null) { File dir = new File(current, DOT_GIT); if (FileKey.isGitRepository(dir, tryFS)) { setGitDir(dir); break; } else if (dir.isFile()) { try { setGitDir(getSymRef(current, dir, tryFS)); break; } catch (IOException ignored) { } } else if (FileKey.isGitRepository(current, tryFS)) { setGitDir(current); break; } current = current.getParentFile(); if (current != null && ceilingDirectories != null && ceilingDirectories.contains(current)) break; } } return self(); }
Source:
public void start() { System.out.println("ServerSideSession Start"); instruments.startSession(getSessionId(), application, device, capabilities); final int sessionTimeoutMillis = options.getSessionTimeoutMillis(); stopSessionTimer.schedule(new TimerTask() { @Override public void run() { log.warning("forcing stop session that has been running for " + sessionTimeoutMillis / 1000 + " seconds"); hardForceStop(); } }, sessionTimeoutMillis); URL url = null; try { url = new URL("http://localhost:" + driver.getHostInfo().getPort() + "/wd/hub"); } catch (Exception e) { e.printStackTrace(); } nativeDriver = new ServerSideNativeDriver(url, new SessionId(instruments.getSessionId())); if ("Safari".equals(capabilities.getBundleName())) { setMode(WorkingMode.Web); getRemoteWebDriver().get("about:blank"); } }

Target:
public void start() { instruments.startSession(getSessionId(), application, device, capabilities); final int sessionTimeoutMillis = options.getSessionTimeoutMillis(); stopSessionTimer.schedule(new TimerTask() { @Override public void run() { log.warning("forcing stop session that has been running for " + sessionTimeoutMillis / 1000 + " seconds"); hardForceStop(); } }, sessionTimeoutMillis); URL url = null; try { url = new URL("http://localhost:" + driver.getHostInfo().getPort() + "/wd/hub"); } catch (Exception e) { e.printStackTrace(); } nativeDriver = new ServerSideNativeDriver(url, new SessionId(instruments.getSessionId())); if ("Safari".equals(capabilities.getBundleName())) { setMode(WorkingMode.Web); getRemoteWebDriver().get("about:blank"); } }
Source:
private void changeStatus(DestroyVmVDSCommandParameters parameters, VM curVm) { if (curVm.getRunOnVds() != null || curVm.getStatus() != VMStatus.MigratingTo) { ResourceManager.getInstance().InternalSetVmStatus(curVm, parameters.getGracefully() ? VMStatus.PoweringDown : VMStatus.Down); } }

Target:
private void changeStatus(DestroyVmVDSCommandParameters parameters, VM curVm) { if (getVdsId().equals(curVm.getRunOnVds())) { ResourceManager.getInstance().InternalSetVmStatus(curVm, parameters.getGracefully() ? VMStatus.PoweringDown : VMStatus.Down); } }
Source:
private Set<IPath> getAllPaths() { Set<IPath> paths = new HashSet<IPath>(); TableItem[] items = fileTableViewer.getTable().getItems(); for (TableItem item : items) { Object element = item.getData(); IResource source; if (element instanceof IResource) { source = (IResource) element; } else if (element instanceof IAdaptable) { source = (IResource) ((IAdaptable) element).getAdapter(IResource.class); } else { RDTSyncUIPlugin.getDefault().logErrorMessage(Messages.SyncMenuOperation_6); continue; } paths.add(source.getProjectRelativePath()); } return paths; }

Target:
private Set<IPath> getAllPaths() { Set<IPath> paths = new HashSet<IPath>(); TableItem[] items = fileTableViewer.getTable().getItems(); for (TableItem item : items) { Object element = item.getData(); IResource source; if (element instanceof IResource) { source = (IResource) element; } else if (element instanceof IAdaptable) { source = (IResource) ((IAdaptable) element).getAdapter(IResource.class); } else { RDTSyncUIPlugin.getDefault().logErrorMessage( Messages.SyncMergeFileTableViewer_Selected_element_not_adaptable); continue; } paths.add(source.getProjectRelativePath()); } return paths; }
Source:
public AzureKeyVaultKeyWrapMetadata(URL masterKeyUri) { super(AzureKeyVaultKeyWrapMetadata.TYPE_CONSTANT, masterKeyUri.toString(), "RSA-OAEP-256"); }

Target:
public AzureKeyVaultKeyWrapMetadata(URL masterKeyUri) { super(AzureKeyVaultKeyWrapMetadata.TYPE_CONSTANT, masterKeyUri.toString(), ALGO); }
Source:
private void examinedEnoughCellsIs(boolean expected) { CellsToSweepPartitioningIterator.ExaminedCellLimit limit = new CellsToSweepPartitioningIterator.ExaminedCellLimit(startingRow.getBytes(), maxCellsToExamine); assertThat(limit.examinedEnoughCells(cellsExamined, cell()), Matchers.is(expected)); }

Target:
private void examinedEnoughCellsIs(boolean expected) { CellsToSweepPartitioningIterator.ExaminedCellLimit limit = new CellsToSweepPartitioningIterator.ExaminedCellLimit(startingRow.getBytes(), maxCellsToExamine); assertThat(limit.examinedEnoughCells(cellsExamined, cell()), is(expected)); }
Source:
public void testNewInstanceMethod() { MyStreamCodec codec = new MyStreamCodec(); DefaultStatefulStreamCodec newCodec = codec.newInstance(); Assert.assertEquals("The class type is correct", newCodec.getClass(), codec.getClass()); }

Target:
public void testNewInstanceMethod() { NoNewInstanceStatefulStreamCodec codec = new NoNewInstanceStatefulStreamCodec(); DefaultStatefulStreamCodec newCodec = codec.newInstance(); Assert.assertNotEquals("Codec and newCodec are not same ", codec, newCodec); Assert.assertEquals("Class of codec and newCodec is same ", newCodec.getClass(), codec.getClass()); }
Source:
public boolean vdsUpEvent(final VDS vds) { HostStoragePoolParametersBase params = new HostStoragePoolParametersBase(vds); boolean isSucceeded = backend.runInternalAction(VdcActionType.InitVdsOnUp, params).getSucceeded(); if (isSucceeded) { ThreadPoolUtil.execute(new Runnable() { @Override public void run() { try { List<VmStatic> vmsToMigrate = DbFacade.getInstance().getVmStaticDao().getAllWithFailbackByVds(vds.getId()); if (!vmsToMigrate.isEmpty()) { CommandContext ctx = new CommandContext(new EngineContext()); ctx.getExecutionContext().setMonitored(true); backend.runInternalMultipleActions(VdcActionType.MigrateVmToServer, new ArrayList<>(createMigrateVmToServerParametersList(vmsToMigrate, vds)), ctx); } } catch (RuntimeException e) { log.error("Failed to initialize Vds on up: {}", e.getMessage()); log.error("Exception", e); } } }); } if (isSucceeded && vds.getVdsGroupSupportsGlusterService()) { isSucceeded = resourceManagerProvider.get().runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "restart")).getSucceeded(); } return isSucceeded; }

Target:
public boolean vdsUpEvent(final VDS vds) { HostStoragePoolParametersBase params = new HostStoragePoolParametersBase(vds); boolean isSucceeded = backend.runInternalAction(VdcActionType.InitVdsOnUp, params).getSucceeded(); if (isSucceeded) { ThreadPoolUtil.execute(new Runnable() { @Override public void run() { try { List<VmStatic> vmsToMigrate = DbFacade.getInstance().getVmStaticDao().getAllWithFailbackByVds(vds.getId()); if (!vmsToMigrate.isEmpty()) { CommandContext ctx = new CommandContext(new EngineContext()); ctx.getExecutionContext().setMonitored(true); backend.runInternalMultipleActions(VdcActionType.MigrateVmToServer, new ArrayList<>(createMigrateVmToServerParametersList(vmsToMigrate, vds)), ctx); } } catch (RuntimeException e) { log.error("Failed to initialize Vds on up: {}", e.getMessage()); log.error("Exception", e); } } }); } return isSucceeded; }
Source:
private Set<String> collectAllLiterals(Map<String, Node> elements) { Set<String> literalTypes = new HashSet(); for (Node n : elements.values()) { if (n.isString()) { literalTypes.add(n.getString()); } } return literalTypes; }

Target:
private Set<String> collectAllLiterals(Map<String, Node> elements) { Set<String> literalInitializers = new HashSet(); for (Node n : elements.values()) { if (n.isString()) { literalInitializers.add(n.getString()); } } return literalInitializers; }
Source:
private void loadMetricConfigResources(AppConfig config, LinkedList<Configuration> configurationList) { List<String> resourceConfigList = config.getMetricConfigResources(); if (resourceConfigList != null) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); for (String resourceName : resourceConfigList) { LOGGER.info("Reading metric config resource " + resourceName); InputStream inputStream = classLoader.getResourceAsStream(resourceName); if (inputStream == null) { LOGGER.warn("Cannot find metric config resource" + resourceName); } else { try { LinkedHashMap<String, ArrayList<LinkedHashMap<String, Object>>> topYaml = (LinkedHashMap<String, ArrayList<LinkedHashMap<String, Object>>>) YAML.get().load(inputStream); ArrayList<LinkedHashMap<String, Object>> jmxConf = topYaml.get("jmx_metrics"); if(jmxConf != null) { for (LinkedHashMap<String, Object> conf : jmxConf) { configurationList.add(new Configuration(conf)); } } else { LOGGER.warn("jmx_metrics block not found in resource " + resourceName); } } catch (Exception e) { LOGGER.warn("Cannot parse yaml resource " + resourceName, e); } finally { try { inputStream.close(); } catch (IOException e) { } } } } } }

Target:
static void loadMetricConfigResources(AppConfig config, LinkedList<Configuration> configurationList) { List<String> resourceConfigList = config.getMetricConfigResources(); if (resourceConfigList != null) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); for (String resourceName : resourceConfigList) { LOGGER.info("Reading metric config resource " + resourceName); InputStream inputStream = classLoader.getResourceAsStream(resourceName); if (inputStream == null) { LOGGER.warn("Cannot find metric config resource" + resourceName); } else { try { LinkedHashMap<String, ArrayList<LinkedHashMap<String, Object>>> topYaml = (LinkedHashMap<String, ArrayList<LinkedHashMap<String, Object>>>) YAML.get().load(inputStream); ArrayList<LinkedHashMap<String, Object>> jmxConf = topYaml.get("jmx_metrics"); if(jmxConf != null) { for (LinkedHashMap<String, Object> conf : jmxConf) { configurationList.add(new Configuration(conf)); } } else { LOGGER.warn("jmx_metrics block not found in resource " + resourceName); } } catch (Exception e) { LOGGER.warn("Cannot parse yaml resource " + resourceName, e); } finally { try { inputStream.close(); } catch (IOException e) { } } } } } }
Source:
public void execute(Object o) { if (search == null) { search = elasticsearchClientManager.getClient() .prepareSearch(indexes.toArray(new String[0])) .setSearchType(SearchType.SCAN) .setSize(Objects.firstNonNull(batchSize, DEFAULT_BATCH_SIZE).intValue()) .setScroll(Objects.firstNonNull(scrollTimeout, DEFAULT_SCROLL_TIMEOUT)); String searchJson; if( config.getSearch() != null ) { LOGGER.debug("Have config in Reader: " + config.getSearch().toString()); try { searchJson = mapper.writeValueAsString(config.getSearch()); LOGGER.debug("Setting source: " + searchJson); search = search.setExtraSource(searchJson); } catch (JsonProcessingException e) { LOGGER.warn("Could not apply _search supplied by config"); e.printStackTrace(); } LOGGER.debug("Search Source is now " + search.toString()); } if (this.queryBuilder != null) search = search.setQuery(this.queryBuilder); if (this.types != null && this.types.size() > 0) search = search.setTypes(types.toArray(new String[0])); Integer clauses = 0; if (this.withfields != null || this.withoutfields != null) { if (this.withfields != null) clauses += this.withfields.length; if (this.withoutfields != null) clauses += this.withoutfields.length; } List<FilterBuilder> filterList = buildFilterList(); FilterBuilder allFilters = andFilters(filterList); if (clauses > 0) { search = search.setPostFilter(allFilters); } if (this.random) search = search.addSort(SortBuilders.scriptSort("random()", "number")); } if (scrollResp == null) { scrollResp = search.execute().actionGet(); LOGGER.trace(search.toString()); } }

Target:
public void execute(Object o) { if (search == null) { search = elasticsearchClientManager.getClient() .prepareSearch(indexes.toArray(new String[0])) .setSearchType(SearchType.SCAN) .setSize(Objects.firstNonNull(batchSize, DEFAULT_BATCH_SIZE).intValue()) .setScroll(Objects.firstNonNull(scrollTimeout, DEFAULT_SCROLL_TIMEOUT)); String searchJson; if( config.getSearch() != null ) { LOGGER.debug("Have config in Reader: " + config.getSearch().toString()); try { searchJson = mapper.writeValueAsString(config.getSearch()); LOGGER.debug("Setting source: " + searchJson); search = search.setExtraSource(searchJson); } catch (JsonProcessingException e) { LOGGER.warn("Could not apply _search supplied by config", e.getMessage()); } LOGGER.debug("Search Source is now " + search.toString()); } if (this.queryBuilder != null) search = search.setQuery(this.queryBuilder); if (this.types != null && this.types.size() > 0) search = search.setTypes(types.toArray(new String[0])); Integer clauses = 0; if (this.withfields != null || this.withoutfields != null) { if (this.withfields != null) clauses += this.withfields.length; if (this.withoutfields != null) clauses += this.withoutfields.length; } List<FilterBuilder> filterList = buildFilterList(); FilterBuilder allFilters = andFilters(filterList); if (clauses > 0) { search = search.setPostFilter(allFilters); } if (this.random) search = search.addSort(SortBuilders.scriptSort("random()", "number")); } if (scrollResp == null) { scrollResp = search.execute().actionGet(); LOGGER.trace(search.toString()); } }
Source:
private <E> FileAppender<E> newAppender(Path temp) { Format format = descriptor.getFormat(); if (Formats.PARQUET.equals(format)) { if (DescriptorUtil.isDisabled( FileSystemProperties.NON_DURABLE_PARQUET_PROP, descriptor)) { return (FileAppender<E>) new DurableParquetAppender( fs, temp, descriptor.getSchema(), conf, descriptor.getCompressionType()); } else { return (FileAppender<E>) new ParquetAppender( fs, temp, descriptor.getSchema(), conf, descriptor.getCompressionType()); } } else if (Formats.AVRO.equals(format)) { return new AvroAppender<E>(fs, temp, descriptor.getSchema(), descriptor.getCompressionType()); } else if (Formats.CSV.equals(format) && DescriptorUtil.isEnabled(FileSystemProperties.ALLOW_CSV_PROP, descriptor)) { return new CSVAppender<E>(fs, temp, descriptor); } else { this.state = ReaderWriterState.ERROR; throw new DatasetWriterException("Unknown format " + descriptor); } }

Target:
<E> FileAppender<E> newAppender(Path temp) { Format format = descriptor.getFormat(); if (Formats.PARQUET.equals(format)) { if (DescriptorUtil.isDisabled( FileSystemProperties.NON_DURABLE_PARQUET_PROP, descriptor)) { return (FileAppender<E>) new DurableParquetAppender( fs, temp, descriptor.getSchema(), conf, descriptor.getCompressionType()); } else { return (FileAppender<E>) new ParquetAppender( fs, temp, descriptor.getSchema(), conf, descriptor.getCompressionType()); } } else if (Formats.AVRO.equals(format)) { return new AvroAppender<E>(fs, temp, descriptor.getSchema(), descriptor.getCompressionType()); } else if (Formats.CSV.equals(format) && DescriptorUtil.isEnabled(FileSystemProperties.ALLOW_CSV_PROP, descriptor)) { return new CSVAppender<E>(fs, temp, descriptor); } else { this.state = ReaderWriterState.ERROR; throw new DatasetWriterException("Unknown format " + descriptor); } }
Source:
public Optional<? extends ActivePagination> getValue(final Parameter.Key<? super ActivePagination> parameterKey, final ArgumentReader.Mutable reader, final CommandContext.Builder context) throws ArgumentParseException { final Audience source = context.getCause().first(Audience.class) .orElseThrow(() -> reader.createException(TextComponent.of("No usable source found"))); final SourcePaginations paginations = SpongePaginationService.this.getPaginationState(source, false); if (paginations == null) { final String name = source instanceof Nameable ? ((Nameable) source).getName() : source.toString(); throw reader.createException(TextComponent.of(String.format("Source %s has no paginations!", name))); } final UUID id; final ArgumentReader.Immutable state = reader.getImmutable(); try { id = UUID.fromString(reader.parseString()); } catch (final IllegalArgumentException ex) { if (paginations.getLastUuid() != null) { reader.setState(state); return Optional.ofNullable(paginations.get(paginations.getLastUuid())); } throw reader.createException(TextComponent.of("Input was not a valid UUID!")); } final ActivePagination pagination = paginations.get(id); if (pagination == null) { throw reader.createException(TextComponent.of("No pagination registered for id " + id)); } return Optional.ofNullable(paginations.get(id)); }

Target:
public Optional<? extends ActivePagination> getValue(final Parameter.Key<? super ActivePagination> parameterKey, final ArgumentReader.Mutable reader, final CommandContext.Builder context) throws ArgumentParseException { final Audience source = context.getCause().getAudience(); final SourcePaginations paginations = SpongePaginationService.this.getPaginationState(source, false); if (paginations == null) { final String name = source instanceof Nameable ? ((Nameable) source).getName() : source.toString(); throw reader.createException(TextComponent.of(String.format("Source %s has no paginations!", name))); } final UUID id; final ArgumentReader.Immutable state = reader.getImmutable(); try { id = UUID.fromString(reader.parseString()); } catch (final IllegalArgumentException ex) { if (paginations.getLastUuid() != null) { reader.setState(state); return Optional.ofNullable(paginations.get(paginations.getLastUuid())); } throw reader.createException(TextComponent.of("Input was not a valid UUID!")); } final ActivePagination pagination = paginations.get(id); if (pagination == null) { throw reader.createException(TextComponent.of("No pagination registered for id " + id)); } return Optional.ofNullable(paginations.get(id)); }
Source:
public List<? extends ToolInstaller> getDefaultInstallers() { try { Class<? extends ToolInstaller> jdkInstallerClass = Jenkins.getInstance().getPluginManager() .uberClassLoader.loadClass("hudson.tools.JDKInstaller").asSubclass(ToolInstaller.class); Constructor<? extends ToolInstaller> constructor = jdkInstallerClass.getConstructor(String.class, boolean.class); return Collections.singletonList(constructor.newInstance(null, false)); } catch (ClassNotFoundException e) { return Collections.emptyList(); } catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) { LOGGER.log(Level.WARNING, "Unable to get default installer", e); return Collections.emptyList(); } }

Target:
public List<? extends ToolInstaller> getDefaultInstallers() { try { Class<? extends ToolInstaller> jdkInstallerClass = Jenkins.getInstance().getPluginManager() .uberClassLoader.loadClass("hudson.tools.JDKInstaller").asSubclass(ToolInstaller.class); Constructor<? extends ToolInstaller> constructor = jdkInstallerClass.getConstructor(String.class, boolean.class); return Collections.singletonList(constructor.newInstance(null, false)); } catch (ClassNotFoundException e) { return Collections.emptyList(); } catch (Exception e) { LOGGER.log(Level.WARNING, "Unable to get default installer", e); return Collections.emptyList(); } }
Source:
private void testCancelNewOrEditQuestion() { ______TS("Testing cancelling adding or editing questions"); feedbackEditPage.selectNewQuestionType("Multiple-choice (single answer) question"); feedbackEditPage.clickNewQuestionButton(); ______TS("MCQ: click and cancel 'cancel new question'"); feedbackEditPage.clickAndCancel(feedbackEditPage.getCancelQuestionLink(-1)); assertTrue(feedbackEditPage.verifyNewMcqQuestionFormIsDisplayed()); ______TS("MCQ: click and confirm 'cancel new question'"); feedbackEditPage.clickAndConfirm(feedbackEditPage.getCancelQuestionLink(-1)); assertFalse(feedbackEditPage.verifyNewMcqQuestionFormIsDisplayed()); ______TS("MCQ: click and cancel 'editing question'"); feedbackEditPage.selectNewQuestionType("Multiple-choice (single answer) question"); feedbackEditPage.clickNewQuestionButton(); feedbackEditPage.fillQuestionBox("mcq qn"); feedbackEditPage.fillMcqOption(0, "Choice 1"); feedbackEditPage.fillMcqOption(1, "Choice 2"); feedbackEditPage.clickAddQuestionButton(); assertEquals(true, feedbackEditPage.clickEditQuestionButton(1)); feedbackEditPage.clickAndCancel(feedbackEditPage.getCancelQuestionLink(1)); assertTrue(feedbackEditPage.checkCancelEditQuestionButtonVisibility(1)); ______TS("MCQ: click and confirm 'editing question'"); feedbackEditPage.clickAndConfirm(feedbackEditPage.getCancelQuestionLink(1)); assertFalse(feedbackEditPage.checkCancelEditQuestionButtonVisibility(1)); feedbackEditPage.clickAndConfirm(feedbackEditPage.getDeleteQuestionLink(1)); }

Target:
private void testCancelNewOrEditQuestion() { ______TS("Testing cancelling adding or editing questions"); feedbackEditPage.selectNewQuestionType("Multiple-choice (single answer) question"); feedbackEditPage.clickNewQuestionButton(); ______TS("MCQ: click and cancel 'cancel new question'"); feedbackEditPage.clickAndCancel(feedbackEditPage.getCancelQuestionLink(-1)); assertTrue(feedbackEditPage.verifyNewMcqQuestionFormIsDisplayed()); ______TS("MCQ: click and confirm 'cancel new question'"); feedbackEditPage.clickAndConfirm(feedbackEditPage.getCancelQuestionLink(-1)); assertFalse(feedbackEditPage.verifyNewMcqQuestionFormIsDisplayed()); ______TS("MCQ: click and cancel 'editing question'"); feedbackEditPage.selectNewQuestionType("Multiple-choice (single answer) question"); feedbackEditPage.clickNewQuestionButton(); feedbackEditPage.fillQuestionBox("mcq qn"); feedbackEditPage.fillMcqOption(0, "Choice 1"); feedbackEditPage.fillMcqOption(1, "Choice 2"); feedbackEditPage.clickAddQuestionButton(); assertTrue(feedbackEditPage.clickEditQuestionButton(1)); feedbackEditPage.clickAndCancel(feedbackEditPage.getCancelQuestionLink(1)); assertTrue(feedbackEditPage.checkCancelEditQuestionButtonVisibility(1)); ______TS("MCQ: click and confirm 'editing question'"); feedbackEditPage.clickAndConfirm(feedbackEditPage.getCancelQuestionLink(1)); assertFalse(feedbackEditPage.checkCancelEditQuestionButtonVisibility(1)); feedbackEditPage.clickAndConfirm(feedbackEditPage.getDeleteQuestionLink(1)); }
Source:
Type leastUpperBound(List<Type> typeAlternatives) { return types.leastUpperBound(typeAlternatives.toArray(new Type[typeAlternatives.size()])); }

Target:
Type leastUpperBound(List<Type> typeAlternatives) { return types.leastUpperBound(typeAlternatives); }
Source:
private boolean isRegisterHealthIndicator(CircuitBreaker circuitBreaker) { return circuitBreakerProperties.findCircuitBreakerProperties(circuitBreaker.getName()) .map(InstanceProperties::getRegisterHealthIndicator) .orElse(true); }

Target:
private boolean isRegisterHealthIndicator(CircuitBreaker circuitBreaker) { return circuitBreakerProperties.findCircuitBreakerProperties(circuitBreaker.getName()) .map(InstanceProperties::getRegisterHealthIndicator) .orElse(false); }
Source:
protected ScriptEngine getScriptEngine() throws ScriptException { String lang = getScriptLanguage(); if (lang.isEmpty()) { lang = defaultScriptLanguage; log.warn("Script language has not been chosen on the UI, the script will be interpreted as a groovy script"); } ScriptEngine scriptEngine = getInstance().getEngineByName(lang); if (scriptEngine == null) { throw new ScriptException("Cannot find engine named: '"+lang+"', ensure you set language field in JSR223 Test Element: "+getName()); } return scriptEngine; }

Target:
protected ScriptEngine getScriptEngine() throws ScriptException { String lang = getScriptLanguage(); if (StringUtils.isEmpty(lang)) { lang = DEFAULT_SCRIPT_LANGUAGE; setScriptLanguage(lang); } ScriptEngine scriptEngine = getInstance().getEngineByName(lang); if (scriptEngine == null) { throw new ScriptException("Cannot find engine named: '"+lang+"', ensure you set language field in JSR223 Test Element: "+getName()); } return scriptEngine; }
Source:
void configureDataSource(Resource dbprops, Resource monitoringDir) throws Exception { Properties db = new Properties(); if (dbprops == null) { dbprops = monitoringDir.get("db.properties"); InputStream in = getClass().getResourceAsStream("db.properties"); IOUtils.copy(in, dbprops.out()); db.load(getClass().getResourceAsStream("db.properties")); } else { InputStream in = dbprops.in(); db.load(in); in.close(); } logDbProperties(db); setDriverClassName(db.getProperty("driver")); setUrl(getURL(db)); if (db.containsKey("username")) { setUsername(db.getProperty("username")); } if (db.containsKey("password")) { setPassword(db.getProperty("password")); } setDefaultAutoCommit(Boolean.valueOf(db.getProperty("defaultAutoCommit", "true"))); setMinIdle(1); setMaxActive(4); super.getConnection(); }

Target:
void configureDataSource(Resource dbprops, Resource monitoringDir) throws Exception { Properties db = new Properties(); if (dbprops == null) { dbprops = monitoringDir.get("db.properties"); InputStream in = getClass().getResourceAsStream("db.properties"); IOUtils.copy(in, dbprops.out()); db.load(getClass().getResourceAsStream("db.properties")); } else { try (InputStream in = dbprops.in()) { db.load(in); } } logDbProperties(db); setDriverClassName(db.getProperty("driver")); setUrl(getURL(db)); if (db.containsKey("username")) { setUsername(db.getProperty("username")); } if (db.containsKey("password")) { setPassword(db.getProperty("password")); } setDefaultAutoCommit(Boolean.valueOf(db.getProperty("defaultAutoCommit", "true"))); setMinIdle(1); setMaxActive(4); super.getConnection(); }
Source:
private boolean permitCmAndStackUpgrade(Image currentImage, Image image, String versionKey, String buildNumberKey) { String currentVersion = currentImage.getPackageVersions().get(versionKey); String newVersion = image.getPackageVersions().get(versionKey); return upgradePermissionProvider.permitCmAndStackUpgrade(currentVersion, newVersion) || (currentVersion.equals(newVersion) && componentBuildNumberComparator.compare(currentImage, image, buildNumberKey)); }

Target:
private boolean permitCmAndStackUpgrade(Image currentImage, Image image, String versionKey, String buildNumberKey) { return upgradePermissionProvider.permitCmAndStackUpgrade(currentImage, image, versionKey, buildNumberKey); }
Source:
private void cleanupInvalidRegistrationIDsForVariant(String variantID, MulticastResult multicastResult, List<String> registrationIDs) { final List<Result> results = multicastResult.getResults(); final Set<String> inactiveTokens = new HashSet<String>(); for (int i = 0; i < results.size(); i++) { final Result result = results.get(i); final String errorCodeName = result.getErrorCodeName(); if (Constants.ERROR_INVALID_REGISTRATION.equals(errorCodeName) || Constants.ERROR_NOT_REGISTERED.equals(errorCodeName)) { inactiveTokens.add(registrationIDs.get(i)); } } logger.fine("Deleting '" + inactiveTokens.size() + "' invalid Android installations"); clientInstallationService.removeInstallationsForVariantByDeviceTokens(variantID, inactiveTokens); }

Target:
private void cleanupInvalidRegistrationIDsForVariant(String variantID, MulticastResult multicastResult, List<String> registrationIDs) { final List<Result> results = multicastResult.getResults(); final Set<String> inactiveTokens = new HashSet<String>(); for (int i = 0; i < results.size(); i++) { final Result result = results.get(i); final String errorCodeName = result.getErrorCodeName(); if (GCM_ERROR_CODES.contains(errorCodeName)) { inactiveTokens.add(registrationIDs.get(i)); } } logger.fine("Deleting '" + inactiveTokens.size() + "' invalid Android installations"); clientInstallationService.removeInstallationsForVariantByDeviceTokens(variantID, inactiveTokens); }
Source:
public long writeTo(WritableByteChannel channel) throws IOException { long totalWritten = 0; if (bufferToSend == null) { bufferToSend = ByteBuffer.allocate(Math.max((int)sizeInBytes(), MAX_WRITE_BUFFER_SIZE)); writeHeader(); bufferToSend.put(blobId.toBytes()); BlobPropertiesSerDe.putBlobPropertiesToBuffer(bufferToSend, properties); bufferToSend.putInt(usermetadata.capacity()); bufferToSend.put(usermetadata); bufferToSend.flip(); } while (sentBytes < sizeInBytes()) { if (bufferToSend.remaining() > 0) { int toWrite = bufferToSend.remaining(); int written = channel.write(bufferToSend); totalWritten += written; sentBytes += written; if (toWrite != written || sentBytes == sizeInBytes()) { break; } } logger.trace("sent Bytes from Put Request {}", sentBytes); bufferToSend.clear(); int dataRead = data.read(bufferToSend.array(), 0, (int) Math.min(bufferToSend.capacity(), (sizeInBytes() - sentBytes))); bufferToSend.limit(dataRead); } return totalWritten; }

Target:
public long writeTo(WritableByteChannel channel) throws IOException { long totalWritten = 0; if (bufferToSend == null) { int bufferSize = sizeInBytes() < MAX_WRITE_BUFFER_SIZE ? (int) sizeInBytes() : (Math.max(MAX_WRITE_BUFFER_SIZE, sizeExcludingData())); bufferToSend = ByteBuffer.allocate(bufferSize); writeHeader(); bufferToSend.put(blobId.toBytes()); BlobPropertiesSerDe.putBlobPropertiesToBuffer(bufferToSend, properties); bufferToSend.putInt(usermetadata.capacity()); bufferToSend.put(usermetadata); bufferToSend.flip(); } while (sentBytes < sizeInBytes()) { if (bufferToSend.remaining() > 0) { int toWrite = bufferToSend.remaining(); int written = channel.write(bufferToSend); totalWritten += written; sentBytes += written; if (toWrite != written || sentBytes == sizeInBytes()) { break; } } logger.trace("sent Bytes from Put Request {}", sentBytes); bufferToSend.clear(); int dataRead = data.read(bufferToSend.array(), 0, (int) Math.min(bufferToSend.capacity(), (sizeInBytes() - sentBytes))); bufferToSend.limit(dataRead); } return totalWritten; }
Source:
public void testWritingSeveralRawTaggedFields() { List<RawTaggedField> tags = Arrays.asList(new RawTaggedField[] { new RawTaggedField(2, new byte[] {0x1, 0x2, 0x3}), new RawTaggedField(5, new byte[] {0x4, 0x5}) }); RawTaggedFieldWriter writer = RawTaggedFieldWriter.forFields(tags); assertEquals(2, writer.numFields()); byte[] arr = new byte[9]; ByteBufferAccessor accessor = new ByteBufferAccessor(ByteBuffer.wrap(arr)); writer.writeRawTags(accessor, 1); assertArrayEquals(new byte[] {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, arr); writer.writeRawTags(accessor, 3); assertArrayEquals(new byte[] {0x2, 0x3, 0x1, 0x2, 0x3, 0x0, 0x0, 0x0, 0x0}, arr); writer.writeRawTags(accessor, 7); assertArrayEquals(new byte[] {0x2, 0x3, 0x1, 0x2, 0x3, 0x5, 0x2, 0x4, 0x5}, arr); writer.writeRawTags(accessor, Integer.MAX_VALUE); assertArrayEquals(new byte[] {0x2, 0x3, 0x1, 0x2, 0x3, 0x5, 0x2, 0x4, 0x5}, arr); }

Target:
public void testWritingSeveralRawTaggedFields() { List<RawTaggedField> tags = Arrays.asList( new RawTaggedField(2, new byte[] {0x1, 0x2, 0x3}), new RawTaggedField(5, new byte[] {0x4, 0x5}) ); RawTaggedFieldWriter writer = RawTaggedFieldWriter.forFields(tags); assertEquals(2, writer.numFields()); byte[] arr = new byte[9]; ByteBufferAccessor accessor = new ByteBufferAccessor(ByteBuffer.wrap(arr)); writer.writeRawTags(accessor, 1); assertArrayEquals(new byte[] {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, arr); writer.writeRawTags(accessor, 3); assertArrayEquals(new byte[] {0x2, 0x3, 0x1, 0x2, 0x3, 0x0, 0x0, 0x0, 0x0}, arr); writer.writeRawTags(accessor, 7); assertArrayEquals(new byte[] {0x2, 0x3, 0x1, 0x2, 0x3, 0x5, 0x2, 0x4, 0x5}, arr); writer.writeRawTags(accessor, Integer.MAX_VALUE); assertArrayEquals(new byte[] {0x2, 0x3, 0x1, 0x2, 0x3, 0x5, 0x2, 0x4, 0x5}, arr); }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { AbstractTextEditor textEditor = getActiveTextEditor(); if (textEditor == null) { return null; } FontRegistry fontRegistry = textEditor.getSite().getWorkbenchWindow().getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry(); FontData[] initialFontData = fontRegistry.getFontData(JFaceResources.TEXT_FONT); int destFontSize = initialFontData[0].getHeight() + this.fontDiff; if (destFontSize <= 0) { return null; } FontDescriptor newFontDescriptor = FontDescriptor.createFrom(initialFontData).setHeight(destFontSize); fontRegistry.put(JFaceResources.TEXT_FONT, newFontDescriptor.getFontData()); PrefUtil.getInternalPreferenceStore().setValue(JFaceResources.TEXT_FONT, PreferenceConverter.getStoredRepresentation(newFontDescriptor.getFontData())); PrefUtil.savePrefs(); IEventBroker eventBroker = (IEventBroker) textEditor.getSite().getWorkbenchWindow().getWorkbench().getService(IEventBroker.class); eventBroker.send(WorkbenchThemeManager.Events.THEME_REGISTRY_MODIFIED, null); return newFontDescriptor; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { AbstractTextEditor textEditor = getActiveTextEditor(); if (textEditor == null) { return null; } FontRegistry fontRegistry = textEditor.getSite().getWorkbenchWindow().getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry(); FontData[] initialFontData = fontRegistry.getFontData(JFaceResources.TEXT_FONT); int destFontSize = initialFontData[0].getHeight() + this.fontDiff; if (destFontSize <= 0) { return null; } FontDescriptor newFontDescriptor = FontDescriptor.createFrom(initialFontData).setHeight(destFontSize); fontRegistry.put(JFaceResources.TEXT_FONT, newFontDescriptor.getFontData()); PlatformUI.getPreferenceStore().setValue(JFaceResources.TEXT_FONT, PreferenceConverter.getStoredRepresentation(newFontDescriptor.getFontData())); return newFontDescriptor; }
Source:
public void testExecute() throws Exception { final ReportExecutionContext context = new ReportExecutionContext(CLOCK, _injector, _environment, _config); context.execute(EXAMPLE_REPORT, T1).toCompletableFuture().get(); Mockito.verify(_emailSender).send( ALICE, ImmutableMap.of(HTML, mockRendered(EXAMPLE_REPORT, HTML, TIME_RANGE)), Duration.ofSeconds(10) ); Mockito.verify(_emailSender).send( BOB, ImmutableMap.of(HTML, mockRendered(EXAMPLE_REPORT, HTML, TIME_RANGE), PDF, mockRendered(EXAMPLE_REPORT, PDF, TIME_RANGE)), Duration.ofSeconds(10) ); }

Target:
public void testExecute() throws Exception { final ReportExecutionContext context = new ReportExecutionContext(CLOCK, _injector, _environment, _config); context.execute(EXAMPLE_REPORT, T1).toCompletableFuture().get(); Mockito.verify(_emailSender).send( ALICE, ImmutableMap.of(HTML, mockRendered(EXAMPLE_REPORT, HTML, TIME_RANGE)), SEND_TIMEOUT ); Mockito.verify(_emailSender).send( BOB, ImmutableMap.of(HTML, mockRendered(EXAMPLE_REPORT, HTML, TIME_RANGE), PDF, mockRendered(EXAMPLE_REPORT, PDF, TIME_RANGE)), SEND_TIMEOUT ); }
Source:
private void updateSLinks(ITmfEvent event) { String sId = event.getContent().getFieldValue(String.class, ITraceEventConstants.ID); if (sId == null) { Object resolve = fIdAspect.resolve(event); if (resolve == null) { resolve = Integer.valueOf(0); } sId = String.valueOf(resolve); } HostThread src = fSrcHost.remove(sId); int tid = (int) getThreadId(event); ITmfStateSystemBuilder ssb = getStateSystemBuilder(); if (ssb == null) { return; } long ts = event.getTimestamp().toNanos(); long startTime = fScopeEndTimes.getOrDefault(sId, ts - 1); HostThread currHostThread = new HostThread(event.getTrace().getHostId(), tid); if (src != null) { int edgeQuark = getAvailableEdgeQuark(ssb, startTime); Object edgeStateValue = new EdgeStateValue(fIdCache.computeIfAbsent(sId, FUNCTION), src, currHostThread); ssb.modifyAttribute(startTime, edgeStateValue, edgeQuark); ssb.modifyAttribute(ts + 1, (Object) null, edgeQuark); } fSrcHost.put(sId, currHostThread); }

Target:
private void updateSLinks(ITmfEvent event) { String sId = event.getContent().getFieldValue(String.class, ITraceEventConstants.ID); if (sId == null) { Object resolve = fIdAspect.resolve(event); if (resolve == null) { resolve = Integer.valueOf(0); } sId = String.valueOf(resolve); } HostThread src = fSrcHost.remove(sId); int tid = (int) getThreadId(event); ITmfStateSystemBuilder ssb = getStateSystemBuilder(); if (ssb == null) { return; } long ts = event.getTimestamp().toNanos(); long startTime = fScopeEndTimes.getOrDefault(sId, ts); HostThread currHostThread = new HostThread(event.getTrace().getHostId(), tid); if (src != null) { int edgeQuark = getAvailableEdgeQuark(ssb, startTime); Object edgeStateValue = new EdgeStateValue(fIdCache.computeIfAbsent(sId, FUNCTION), src, currHostThread); ssb.modifyAttribute(startTime, edgeStateValue, edgeQuark); ssb.modifyAttribute(ts + 1, (Object) null, edgeQuark); } fScopeEndTimes.put(sId, ts + 1); fSrcHost.put(sId, currHostThread); }
Source:
private void setLineSeriesColor() { Iterator<Color> colorsIt; colorsIt = Iterators.cycle(COLORS); for (ISeries series : getChart().getSeriesSet().getSeries()) { ((ILineSeries) series).setSymbolColor((colorsIt.next())); Color[] colors = new Color[series.getXSeries().length]; Color color = checkNotNull(((ILineSeries) series).getSymbolColor()); Arrays.setAll(colors, i -> color); ((ILineSeries) series).setSymbolColors(colors); } }

Target:
private void setLineSeriesColor() { Iterator<Color> colorsIt = Iterators.cycle(COLORS); for (ISeries series : getChart().getSeriesSet().getSeries()) { ILineSeries lineSeries = (ILineSeries) series; Color color = colorsIt.next(); lineSeries.setSymbolColor(color); Color[] colors = new Color[lineSeries.getXSeries().length]; Arrays.fill(colors, color); lineSeries.setSymbolColors(colors); } }