auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_snapshot_share); cameraFab = findViewById(R.id.camera_share_snapshot_image_fab); cameraFab.setImageResource(R.drawable.ic_camera); hasStartedSnapshotGeneration = false; mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap mapboxMap) { mapboxMap.setStyle(Style.SATELLITE_STREETS, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { SnapshotShareActivity.this.mapboxMap = mapboxMap; cameraFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!hasStartedSnapshotGeneration) { hasStartedSnapshotGeneration = true; Toast.makeText(SnapshotShareActivity.this, R.string.loading_snapshot_image, Toast.LENGTH_LONG).show(); startSnapShot( mapboxMap.getProjection().getVisibleRegion().latLngBounds, mapView.getMeasuredHeight(), mapView.getMeasuredWidth()); } } }); } }); StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build()); } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_snapshot_share); cameraFab = findViewById(R.id.camera_share_snapshot_image_fab); cameraFab.setImageResource(R.drawable.ic_camera); hasStartedSnapshotGeneration = false; mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap mapboxMap) { SnapshotShareActivity.this.mapboxMap = mapboxMap; mapboxMap.setStyle(Style.SATELLITE_STREETS, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { cameraFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!hasStartedSnapshotGeneration) { hasStartedSnapshotGeneration = true; Toast.makeText(SnapshotShareActivity.this, R.string.loading_snapshot_image, Toast.LENGTH_LONG).show(); startSnapShot( mapboxMap.getProjection().getVisibleRegion().latLngBounds, mapView.getMeasuredHeight(), mapView.getMeasuredWidth()); } } }); } }); StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build()); } }); }
Source:
protected boolean doStatusCheck(ClouderaManagerPollerObject pollerObject, CommandsResourceApi commandsResourceApi) throws ApiException { ApiClient apiClient = pollerObject.getApiClient(); Stack stack = pollerObject.getStack(); ApiParcelList parcels = getClouderaManagerParcels(apiClient, stack.getName()); List<ApiParcel> existedParcels = getExistedParcels(parcelVersion, parcels); if (existedParcels.isEmpty()) { LOGGER.debug("Parcels are deleted succesfully."); return true; } else { LOGGER.debug("Some parcels are not yet deleted: [{}].", getJoinedParcelStages(existedParcels)); return false; } }

Target:
protected boolean doStatusCheck(ClouderaManagerPollerObject pollerObject, CommandsResourceApi commandsResourceApi) throws ApiException { ApiClient apiClient = pollerObject.getApiClient(); Stack stack = pollerObject.getStack(); ApiParcelList parcels = getClouderaManagerParcels(apiClient, stack.getName()); List<ApiParcel> existedParcels = collectExistingParcels(parcels); if (existedParcels.isEmpty()) { LOGGER.debug("Parcels are deleted succesfully."); return true; } else { LOGGER.debug("Some parcels are not yet deleted: [{}].", getJoinedParcelStages(existedParcels)); return false; } }
Source:
public void testMultipleContainersAtTheSameTimeShouldNotThrowException() throws Exception { List<String> strings = new Container(); strings.add( "" ); Set<ConstraintViolation<Foo>> constraintViolations = validator.validate( new Foo( strings ) ); assertNoViolations( constraintViolations ); }

Target:
public void testMultipleContainersAtTheSameTimeShouldNotThrowException() throws Exception { List<String> strings = new Container(); strings.add( "" ); strings.add( null ); Set<ConstraintViolation<Foo>> constraintViolations = validator.validate( new Foo( strings ) ); assertThat( constraintViolations ).containsOnlyViolations( violationOf( NotNull.class ).withMessage( "must not be null" ) ); }
Source:
public void testInsertTaskWithStartAndDueMovedForward() { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); DateTime start = DateTime.now(); DateTime due = start.addDuration(new Duration(1, 1, 0)); Duration duration = new Duration(1, 2, 0); DateTime startNew = start.addDuration(duration); DateTime dueNew = due.addDuration(duration); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<TaskLists>()), new Put<>(task, new TimeData(start, due)), new Put<>(task, new TimeData(startNew, dueNew)) ), resultsIn(mClient, new Assert<>(task, new TimeData(startNew, dueNew)), new AssertRelated<>(new InstanceTable(mAuthority), Instances.TASK_ID, task, new AllOf( new EqArg(Instances.INSTANCE_START, startNew.getTimestamp()), new EqArg(Instances.INSTANCE_ORIGINAL_TIME, startNew.getTimestamp()), new EqArg(Instances.INSTANCE_DUE, dueNew.getTimestamp()), new EqArg(Instances.INSTANCE_START_SORTING, startNew.getInstance()), new EqArg(Instances.INSTANCE_DUE_SORTING, dueNew.getInstance()), new EqArg(Instances.INSTANCE_DURATION, dueNew.getTimestamp() - startNew.getTimestamp()), new EqArg(Tasks.TZ, start.isAllDay() ? "UTC" : start.getTimeZone().getID()) )) )); }

Target:
public void testInsertTaskWithStartAndDueMovedForward() { RowSnapshot<TaskLists> taskList = new VirtualRowSnapshot<>(new LocalTaskListsTable(mAuthority)); RowSnapshot<Tasks> task = new VirtualRowSnapshot<>(new TaskListScoped(taskList, new TasksTable(mAuthority))); DateTime start = DateTime.now(); DateTime due = start.addDuration(new Duration(1, 1, 0)); Duration duration = new Duration(1, 2, 0); DateTime startNew = start.addDuration(duration); DateTime dueNew = due.addDuration(duration); assertThat(new Seq<>( new Put<>(taskList, new EmptyRowData<TaskLists>()), new Put<>(task, new TimeData(start, due)), new Put<>(task, new TimeData(startNew, dueNew)) ), resultsIn(mClient, new Assert<>(task, new TimeData(startNew, dueNew)), new AssertRelated<>(new InstanceTable(mAuthority), Instances.TASK_ID, task, new AllOf( new EqArg(Instances.INSTANCE_START, startNew.getTimestamp()), new EqArg(Instances.INSTANCE_ORIGINAL_TIME, startNew.getTimestamp()), new EqArg(Instances.INSTANCE_DUE, dueNew.getTimestamp()), new EqArg(Instances.INSTANCE_START_SORTING, startNew.shiftTimeZone(TimeZone.getDefault()).getInstance()), new EqArg(Instances.INSTANCE_DUE_SORTING, dueNew.shiftTimeZone(TimeZone.getDefault()).getInstance()), new EqArg(Instances.INSTANCE_DURATION, dueNew.getTimestamp() - startNew.getTimestamp()), new EqArg(Tasks.TZ, start.isAllDay() ? "UTC" : start.getTimeZone().getID()) )) )); }
Source:
public void testUpdate() throws Exception { for (String regionId : regions) { UpdateCDNContainerOptions opts = new UpdateCDNContainerOptions(); opts.ttl(1234567); opts.logRetention(true); opts.enabled(false); assertTrue(api.cdnApiInRegion(regionId).update(name, opts)); CDNContainer container = api.cdnApiInRegion(regionId).get(name); assertEquals(container.getTtl(), 1234567); assertTrue(container.isLogRetentionEnabled()); assertFalse(container.isEnabled()); } }

Target:
public void testUpdate() throws Exception { for (String regionId : regions) { assertNotNull(api.cdnApiInRegion(regionId).enable(name, 777777)); CDNContainer original = api.cdnApiInRegion(regionId).get(name); assertTrue(original.isEnabled()); assertCDNContainerNotNull(original); UpdateCDNContainerOptions opts = new UpdateCDNContainerOptions() .ttl(1234567) .logRetention(true) .enabled(false); assertTrue(api.cdnApiInRegion(regionId).update(name, opts)); CDNContainer updated = api.cdnApiInRegion(regionId).get(name); assertFalse(updated.isEnabled()); assertCDNContainerNotNull(updated); assertNotEquals(original.getTtl(), updated.getTtl()); assertTrue(updated.isLogRetentionEnabled()); } }
Source:
public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RC_CHOOSE_PHOTO) { if (resultCode == ResultCodes.OK) { Uri selectedImage = data.getData(); uploadPhoto(selectedImage); } else { Toast.makeText(this, "No image chosen", Toast.LENGTH_SHORT).show(); } } }

Target:
public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RC_CHOOSE_PHOTO) { if (resultCode == RESULT_OK) { Uri selectedImage = data.getData(); uploadPhoto(selectedImage); } else { Toast.makeText(this, "No image chosen", Toast.LENGTH_SHORT).show(); } } }
Source:
public static Archive<?> deploy_charset() { WebArchive war = TestUtil.prepareArchive(DefaultCharsetTest.class.getSimpleName() + "_true"); war.addAsWebInfResource(DefaultCharsetTest.class.getPackage(), "DefaultCharsetTestWeb_true.xml", "web.xml"); System.out.println(war.toString(true)); return TestUtil.finishContainerPrepare(war, null, DefaultCharsetResource.class); }

Target:
public static Archive<?> deploy_charset() { WebArchive war = TestUtil.prepareArchive(DefaultCharsetTest.class.getSimpleName() + "_true"); war.addAsWebInfResource(DefaultCharsetTest.class.getPackage(), "DefaultCharsetTestWeb_true.xml", "web.xml"); return TestUtil.finishContainerPrepare(war, null, DefaultCharsetResource.class); }
Source:
private GroupByQuery( final DataSource dataSource, final QuerySegmentSpec querySegmentSpec, final VirtualColumns virtualColumns, final DimFilter dimFilter, final Granularity granularity, final List<DimensionSpec> dimensions, final List<AggregatorFactory> aggregatorSpecs, final List<PostAggregator> postAggregatorSpecs, final HavingSpec havingSpec, final LimitSpec limitSpec, final @Nullable Function<Sequence<Row>, Sequence<Row>> postProcessingFn, final Map<String, Object> context ) { super(dataSource, querySegmentSpec, false, context, granularity); this.virtualColumns = VirtualColumns.nullToEmpty(virtualColumns); this.dimFilter = dimFilter; this.dimensions = dimensions == null ? ImmutableList.of() : dimensions; for (DimensionSpec spec : this.dimensions) { Preconditions.checkArgument(spec != null, "dimensions has null DimensionSpec"); } Preconditions.checkNotNull(granularity, "Must specify a granularity"); this.aggregatorSpecs = aggregatorSpecs == null ? ImmutableList.<AggregatorFactory>of() : aggregatorSpecs; this.postAggregatorSpecs = Queries.prepareAggregations( this.dimensions.stream().map(DimensionSpec::getOutputName).collect(Collectors.toList()), this.aggregatorSpecs, postAggregatorSpecs == null ? ImmutableList.<PostAggregator>of() : postAggregatorSpecs ); this.havingSpec = havingSpec; this.limitSpec = LimitSpec.nullToNoopLimitSpec(limitSpec); verifyOutputNames(this.dimensions, this.aggregatorSpecs, this.postAggregatorSpecs); this.postProcessingFn = postProcessingFn != null ? postProcessingFn : makePostProcessingFn(); this.applyLimitPushDown = determineApplyLimitPushDown(); }

Target:
private GroupByQuery( final DataSource dataSource, final QuerySegmentSpec querySegmentSpec, final VirtualColumns virtualColumns, final DimFilter dimFilter, final Granularity granularity, final List<DimensionSpec> dimensions, final List<AggregatorFactory> aggregatorSpecs, final List<PostAggregator> postAggregatorSpecs, final HavingSpec havingSpec, final LimitSpec limitSpec, final @Nullable Function<Sequence<Row>, Sequence<Row>> postProcessingFn, final Map<String, Object> context ) { super(dataSource, querySegmentSpec, false, context, granularity); this.virtualColumns = VirtualColumns.nullToEmpty(virtualColumns); this.dimFilter = dimFilter; this.dimensions = dimensions == null ? ImmutableList.of() : dimensions; for (DimensionSpec spec : this.dimensions) { Preconditions.checkArgument(spec != null, "dimensions has null DimensionSpec"); } this.aggregatorSpecs = aggregatorSpecs == null ? ImmutableList.<AggregatorFactory>of() : aggregatorSpecs; this.postAggregatorSpecs = Queries.prepareAggregations( this.dimensions.stream().map(DimensionSpec::getOutputName).collect(Collectors.toList()), this.aggregatorSpecs, postAggregatorSpecs == null ? ImmutableList.<PostAggregator>of() : postAggregatorSpecs ); this.havingSpec = havingSpec; this.limitSpec = LimitSpec.nullToNoopLimitSpec(limitSpec); verifyOutputNames(this.dimensions, this.aggregatorSpecs, this.postAggregatorSpecs); this.postProcessingFn = postProcessingFn != null ? postProcessingFn : makePostProcessingFn(); this.applyLimitPushDown = determineApplyLimitPushDown(); }
Source:
static void sendAllScheduled() { TIMER.cancel(); if (ENABLED) { for (Event event : QUEUE) { send(event); } QUEUE = new ArrayList<>(); } }

Target:
static synchronized void sendAllScheduled() { TIMER.cancel(); if (ENABLED) { send(QUEUE); QUEUE.clear(); } }
Source:
public void sign(@NonNull CommitBuilder commit, String gpgSigningKey, @NonNull PersonIdent committer) { if (gpgSigningKey == null || gpgSigningKey.isEmpty()) { gpgSigningKey = committer.getEmailAddress(); } BouncyCastleGpgKeyLocator keyHelper = new BouncyCastleGpgKeyLocator(gpgSigningKey); try { PGPSecretKey secretKey = keyHelper.findSecretKey(); CharArrayType passphrase = keyHelper.getCachedPassphrase(); PGPPrivateKey privateKey = secretKey .extractPrivateKey(new JcePBESecretKeyDecryptorBuilder() .setProvider(BouncyCastleProvider.PROVIDER_NAME) .build(passphrase.getValue())); PGPSignatureGenerator signatureGenerator = new PGPSignatureGenerator( new JcaPGPContentSignerBuilder( secretKey.getPublicKey().getAlgorithm(), HashAlgorithmTags.SHA256).setProvider( BouncyCastleProvider.PROVIDER_NAME)); signatureGenerator.init(PGPSignature.BINARY_DOCUMENT, privateKey); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try (ArmoredOutputStream aOut = new ArmoredOutputStream(buffer); BCPGOutputStream bOut = new BCPGOutputStream(aOut)) { signatureGenerator.update(commit.build()); signatureGenerator.generate().encode(bOut); } commit.setGpgSignature(new GpgSignature(buffer.toByteArray())); } catch (PGPException | IOException e) { throw new JGitInternalException(e.getMessage(), e); } finally { if (keyHelper.getCachedPassphrase() != null) { keyHelper.getCachedPassphrase().clear(); } } }

Target:
public void sign(@NonNull CommitBuilder commit, String gpgSigningKey, @NonNull PersonIdent committer) { if (gpgSigningKey == null || gpgSigningKey.isEmpty()) { gpgSigningKey = committer.getEmailAddress(); } BouncyCastleGpgKeyLocator keyHelper = new BouncyCastleGpgKeyLocator( gpgSigningKey); try { PGPSecretKey secretKey = keyHelper.findSecretKey(); CharArrayType passphrase = keyHelper.getCachedPassphrase(); PGPPrivateKey privateKey = secretKey .extractPrivateKey(new JcePBESecretKeyDecryptorBuilder() .setProvider(BouncyCastleProvider.PROVIDER_NAME) .build(passphrase.getValue())); PGPSignatureGenerator signatureGenerator = new PGPSignatureGenerator( new JcaPGPContentSignerBuilder( secretKey.getPublicKey().getAlgorithm(), HashAlgorithmTags.SHA256).setProvider( BouncyCastleProvider.PROVIDER_NAME)); signatureGenerator.init(PGPSignature.BINARY_DOCUMENT, privateKey); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try (BCPGOutputStream out = new BCPGOutputStream( new ArmoredOutputStream(buffer))) { signatureGenerator.update(commit.build()); signatureGenerator.generate().encode(out); } commit.setGpgSignature(new GpgSignature(buffer.toByteArray())); } catch (PGPException | IOException e) { throw new JGitInternalException(e.getMessage(), e); } finally { if (keyHelper.getCachedPassphrase() != null) { keyHelper.getCachedPassphrase().clear(); } } }
Source:
default void check() { if (meshProxy().isPresent()) { checkArgument(maxNumRetries() == 0, "If meshProxy is configured then maxNumRetries must be 0"); } }

Target:
default void check() { if (meshProxy().isPresent()) { checkArgument(maxNumRetries() == 0, "If meshProxy is configured then maxNumRetries must be 0"); checkArgument(uris().size() == 1, "If meshProxy is configured then uris must contain exactly 1 URI"); } }
Source:
public static String toHex(byte[] byteArray) { return StringUtil.byteArray2HexString(byteArray); }

Target:
public static String toHex(byte[] byteArray) { return StringUtil.byteArray2Hex(byteArray); }
Source:
public void shutdown() throws InterruptedException { logger.debug("shutdown the fetcher " + getName()); interrupt(); shutdownLatch.await(5, TimeUnit.SECONDS); }

Target:
public void shutdown() throws InterruptedException { logger.debug("shutdown the fetcher " + getName()); client.shutdown(); }
Source:
public void testToJsonOnInstance() throws IOException { checkToJson(new Function<Statistics, String>() { @Override public String apply(Statistics t) { try { return t.toJson(); } catch (IOException e) { e.printStackTrace(); } return null; } }); }

Target:
public void testToJsonOnInstance() throws IOException { checkToJson(new Function<Statistics, String>() { @Override public String apply(Statistics t) { try { return t.toJson(); } catch (JsonProcessingException e) { Assert.fail(e.toString()); } return null; } }); }
Source:
private boolean useProtocolV2() { return Objects.equals(transferConfig.protocolVersion, ProtocolVersion.V2) && clientRequestedV2; }

Target:
private boolean useProtocolV2() { return ProtocolVersion.V2.equals(transferConfig.protocolVersion) && clientRequestedV2; }
Source:
public boolean shouldCheckSpelling(DocDisplay dd, Range r) { String word = dd.getTextForRange(r); if (r.getEnd().getColumn() - r.getStart().getColumn() > 250) return false; Scope s = ((AceEditor)dd).getScopeAtPosition(r.getStart()); if (s.isYaml()) return false; String line = dd.getLine(r.getStart().getRow()); Pattern p = Pattern.create("\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem).*{.*" + word + ".*}"); if (p.test(line)) return false; return true; }

Target:
public boolean shouldCheckSpelling(DocDisplay dd, Range r) { String word = dd.getTextForRange(r); if (r.getEnd().getColumn() - r.getStart().getColumn() > 250) return false; Scope s = ((AceEditor)dd).getScopeAtPosition(r.getStart()); if (s.isYaml()) return false; int start = r.getStart().getColumn(); int end = start + word.length(); String line = dd.getLine(r.getStart().getRow()); Pattern p = Pattern.create("\\{[^\\{\\}]*" + word + "[^\\{\\}]*\\}"); Match m = p.match(line, 0); while (m != null) { if (m.getIndex() < start && (m.getIndex() + m.getValue().length()) > end) return false; m = m.nextMatch(); } return true; }
Source:
public void processRecord(ComputationContext context, String inputStreamName, Record record) { System.out.println(metadata.name() + " GOT A RECORD: " + record); context.produceRecord("o1", record); context.askForCheckpoint(); }

Target:
public void processRecord(ComputationContext context, String inputStreamName, Record record) { log.warn(metadata.name() + " got record: " + record); context.produceRecord("o1", record); context.askForCheckpoint(); }
Source:
public void run() { setPriority(Thread.NORM_PRIORITY); try { while ((currentJob = pool.startJob(this)) != null) { IStatus result = Status.OK_STATUS; try { if (CANCEL_CHECK_ACTIVATED) { CancelCheckMonitor pm = new CancelCheckMonitor(currentJob.getProgressMonitor()); currentJob.setProgressMonitor(pm); result = currentJob.run(pm.willStart()); pm.hasStopped(); IStatus citizenshipStatus = checkCancel(currentJob, pm); if (!citizenshipStatus.isOK()) { RuntimeLog.log(citizenshipStatus); } } else { result = currentJob.run(currentJob.getProgressMonitor()); } } catch (OperationCanceledException e) { result = Status.CANCEL_STATUS; } catch (Exception e) { result = handleException(currentJob, e); } catch (ThreadDeath e) { result = handleException(currentJob, e); throw e; } catch (Error e) { result = handleException(currentJob, e); } finally { Thread.interrupted(); if (result == null) result = handleException(currentJob, new NullPointerException()); pool.endJob(currentJob, result); currentJob = null; setPriority(Thread.NORM_PRIORITY); } } } catch (Throwable t) { RuntimeLog.log(new Status(IStatus.ERROR, JobManager.PI_JOBS, JobManager.PLUGIN_ERROR, "Unhandled error", t)); } finally { currentJob = null; pool.endWorker(this); } }

Target:
public void run() { setPriority(Thread.NORM_PRIORITY); try { while ((currentJob = pool.startJob(this)) != null) { IStatus result = Status.OK_STATUS; try { if (CANCEL_CHECK_ACTIVATED) { CancelCheckMonitor pm = new CancelCheckMonitor(currentJob.getProgressMonitor()); currentJob.setProgressMonitor(pm); result = currentJob.run(pm.willStart()); pm.hasStopped(); IStatus cancelStatus = checkCancel(currentJob, pm); if (!cancelStatus.isOK()) { RuntimeLog.log(cancelStatus); } } else { result = currentJob.run(currentJob.getProgressMonitor()); } } catch (OperationCanceledException e) { result = Status.CANCEL_STATUS; } catch (Exception e) { result = handleException(currentJob, e); } catch (ThreadDeath e) { result = handleException(currentJob, e); throw e; } catch (Error e) { result = handleException(currentJob, e); } finally { Thread.interrupted(); if (result == null) result = handleException(currentJob, new NullPointerException()); pool.endJob(currentJob, result); currentJob = null; setPriority(Thread.NORM_PRIORITY); } } } catch (Throwable t) { RuntimeLog.log(new Status(IStatus.ERROR, JobManager.PI_JOBS, JobManager.PLUGIN_ERROR, "Unhandled error", t)); } finally { currentJob = null; pool.endWorker(this); } }
Source:
private void deleteWorkingDirectory(ModelRunStatus modelRunStatus) { if (modelRunStatus.equals(ModelRunStatus.COMPLETED) && !dryRun) { try { FileUtils.deleteDirectory(workingDirectoryPath.toFile()); } catch (IOException e) { logger.error(String.format(LOG_COULD_NOT_DELETE_WORKSPACE_DIR, workingDirectoryPath.toAbsolutePath())); } } else if (dryRun) { logger.info(String.format(LOG_NOT_DELETED_WORKSPACE_DIR_DRY_RUN, workingDirectoryPath.toAbsolutePath())); } else { logger.warn(String.format(LOG_NOT_DELETED_WORKSPACE_DIR, workingDirectoryPath.toAbsolutePath())); } }

Target:
private void deleteWorkingDirectory(ModelRunStatus modelRunStatus) { if (dryRun) { logger.info(String.format(LOG_NOT_DELETED_WORKSPACE_DIR_DRY_RUN, workingDirectoryPath.toAbsolutePath())); } else if (!modelRunStatus.equals(ModelRunStatus.COMPLETED)) { logger.warn(String.format(LOG_NOT_DELETED_WORKSPACE_DIR, workingDirectoryPath.toAbsolutePath())); } else { try { FileUtils.deleteDirectory(workingDirectoryPath.toFile()); } catch (IOException e) { logger.error(String.format(LOG_COULD_NOT_DELETE_WORKSPACE_DIR, workingDirectoryPath.toAbsolutePath())); } } }
Source:
private void createClient() { Client client = Clients.builder() .setOrgUrl("https://{yourOktaDomain}") .setClientCredentials(new TokenClientCredentials("yourApiToken")) .build(); }

Target:
private void createClient() { Client client = Clients.builder() .setOrgUrl("https://{yourOktaDomain}") .setClientCredentials(new TokenClientCredentials("{apiToken}")) .build(); }
Source:
private void storeConfigInCoordinatorStream() { MetadataStore metadataStore = null; try { createCoordinatorStream(); MetadataStoreFactory metadataStoreFactory = Util.getObj(new JobConfig(config).getMetadataStoreFactory(), MetadataStoreFactory.class); metadataStore = metadataStoreFactory.getMetadataStore(CONFIG_TYPE, config, new MetricsRegistryMap()); metadataStore.init(); CoordinatorStreamValueSerde jsonSerde = new CoordinatorStreamValueSerde(CONFIG_TYPE); for (Map.Entry<String, String> entry : config.entrySet()) { byte[] serializedValue = jsonSerde.toBytes(entry.getValue()); metadataStore.put(entry.getKey(), serializedValue); } } finally { if (metadataStore != null) { LOG.info("Stopping the coordinator system producer."); metadataStore.close(); } } }

Target:
private void storeConfigInCoordinatorStream() { MetadataStore metadataStore = null; try { createCoordinatorStream(); MetadataStoreFactory metadataStoreFactory = Util.getObj(new JobConfig(config).getMetadataStoreFactory(), MetadataStoreFactory.class); metadataStore = metadataStoreFactory.getMetadataStore(SetConfig.TYPE, config, metrics.getMetricsRegistry()); metadataStore.init(); CoordinatorStreamValueSerde jsonSerde = new CoordinatorStreamValueSerde(SetConfig.TYPE); for (Map.Entry<String, String> entry : config.entrySet()) { byte[] serializedValue = jsonSerde.toBytes(entry.getValue()); metadataStore.put(entry.getKey(), serializedValue); } } finally { if (metadataStore != null) { LOG.info("Stopping the coordinator system producer."); metadataStore.close(); } } }
Source:
private TestDescription getChaoticDescription(Random rand) { final int MAX_NODE_COUNT = 120; final int MAX_SPH = 60; final int MAX_K = 10; TestDescription td = new TestDescription(); List<String> haGroupTags = new ArrayList<>(); haGroupTags.add("0"); int nodeCount = rand.nextInt(MAX_NODE_COUNT) + 1; assert(nodeCount > 0); int[] sph = new int[nodeCount]; for (int i = 0; i < nodeCount; i++) sph[i] = 0; List<PartitionDescription> partitions = new ArrayList<PartitionDescription>(); List<Integer> allHostIndexes = IntStream.range(0, nodeCount).boxed().collect(Collectors.toList()); for (int i = 0; i < nodeCount; i++) { int k = rand.nextInt(Math.min(MAX_K + 1, nodeCount)); Collections.shuffle(allHostIndexes); for (int j = 0; j < k + 1; j++) { sph[allHostIndexes.get(j)] = sph[allHostIndexes.get(j)] + 1; } partitions.add(new PartitionDescription(k)); } td.hosts = new HostDescription[nodeCount]; for (int i = 0; i < nodeCount; i++) { int haIndex = rand.nextInt(haGroupTags.size()); td.hosts[i] = new HostDescription(i, sph[i], haGroupTags.get(haIndex)); } td.partitions = partitions.toArray(new PartitionDescription[0]); td.expectedMaxReplicationPerHAGroup = 0; td.expectedPartitionGroups = Integer.MAX_VALUE; return td; }

Target:
private TestDescription getChaoticDescription(Random rand) { final int MAX_NODE_COUNT = 120; final int MAX_K = 10; TestDescription td = new TestDescription(); List<String> haGroupTags = new ArrayList<>(); haGroupTags.add("0"); int nodeCount = rand.nextInt(MAX_NODE_COUNT) + 1; assert(nodeCount > 0); int[] sph = new int[nodeCount]; for (int i = 0; i < nodeCount; i++) sph[i] = 0; List<PartitionDescription> partitions = new ArrayList<PartitionDescription>(); List<Integer> allHostIndexes = IntStream.range(0, nodeCount).boxed().collect(Collectors.toList()); for (int i = 0; i < nodeCount; i++) { int k = rand.nextInt(Math.min(MAX_K + 1, nodeCount)); Collections.shuffle(allHostIndexes); for (int j = 0; j < k + 1; j++) { sph[allHostIndexes.get(j)] = sph[allHostIndexes.get(j)] + 1; } partitions.add(new PartitionDescription(k)); } td.hosts = new HostDescription[nodeCount]; for (int i = 0; i < nodeCount; i++) { int haIndex = rand.nextInt(haGroupTags.size()); td.hosts[i] = new HostDescription(i, sph[i], haGroupTags.get(haIndex)); } td.partitions = partitions.toArray(new PartitionDescription[0]); td.expectedMaxReplicationPerHAGroup = 0; td.expectedPartitionGroups = Integer.MAX_VALUE; return td; }
Source:
public void verifyDiscussionFollow(String title, boolean isFollowing) { waitForElementByElement(discussionTitle); waitForElementByElement(followButton); waitForTextToBePresentInElementByElement(discussionTitle, title); Assertion.assertEquals( getAttributeValue(followButton, PageContent.followAttributeName).equals(PageContent.followAttributeValue), isFollowing ); PageObjectLogging.log("verifyDiscussionFollow", "thread following checked", true, driver); }

Target:
public void verifyDiscussionFollow(String title, boolean isFollowing) { waitForElementByElement(discussionTitle); waitForElementByElement(followButton); waitForTextToBePresentInElementByElement(discussionTitle, title); Assertion.assertEquals( getAttributeValue(followButton, PageContent.followAttributeName).equals(PageContent.followAttributeValue), isFollowing ); PageObjectLogging.log("verifyDiscussionFollow", "thread: " + title + "following checked", true, driver); }
Source:
public void testConfigurationEntries() throws Exception { filter.clearFilterEntries(); filter.addFilterEntries( Collections.singletonList( new FirstMatchSimpleFilter.FilterEntry("message0", false, "smtp", "dbtest1@redhat.com")) ); filter.processEvent(new E("message0")); filter.processEvent(new E("message1")); AuditLogEvent event = smtp.getEvents().get(0); String address = smtp.getNames().get(0); Assert.assertEquals("message0", event.getName()); Assert.assertEquals("dbtest1@redhat.com", address); }

Target:
public void testConfigurationEntries() throws Exception { filter.clearFilterEntries(); filter.addFilterEntries( Collections.singletonList( new FirstMatchSimpleFilter.FilterEntry("message0", false, "smtp", "dbtest1@redhat.com")) ); filter.processEvent(new E("message0")); filter.processEvent(new E("message1")); AuditLogEvent event = smtp.getEvents().get(0); String address = smtp.getNames().get(0); assertEquals("message0", event.getName()); assertEquals("dbtest1@redhat.com", address); }
Source:
public void findV6() throws Exception { final List<IPv6.Availability> availabilities = Lists.newArrayList(Availability.AVAILABLE); List<String> dto = Lists.newArrayList("AVAILABLE"); context.checking(new Expectations() {{ oneOf(v6Catalog).findAll(); will(returnValue(availabilities)); }}); Reply<?> reply = service.findV6(); assertThat(reply, contains(dto)); assertThat(reply, isOk()); }

Target:
public void findV6() throws Exception { final List<IPv6.Availability> availabilities = Lists.newArrayList(IPv6.Availability.AVAILABLE); List<String> dto = Lists.newArrayList("AVAILABLE"); context.checking(new Expectations() {{ oneOf(v6Catalog).findAll(); will(returnValue(availabilities)); }}); Reply<?> reply = service.findV6(); assertThat(reply, contains(dto)); assertThat(reply, isOk()); }
Source:
protected Block computeBlock(BlockType type, Attributes attributes) { switch (type) { case PARAGRAPH: return new ContentBlock(type, "", "", 2, 2); case QUOTE: return new ContentBlock(type, "[quote]\n----\n", "\n----\n", 1, 1); case BULLETED_LIST: case DEFINITION_LIST: case NUMERIC_LIST: if (currentBlock != null) { BlockType currentBlockType = currentBlock.getBlockType(); if (currentBlockType == BlockType.LIST_ITEM || currentBlockType == BlockType.DEFINITION_ITEM || currentBlockType == BlockType.DEFINITION_TERM) { return new ListBlock(type, 1); } } return new ListBlock(type, 2); case LIST_ITEM: if (computeCurrentListType() == BlockType.NUMERIC_LIST) { return new ListItemBlock("1. "); } return new ListItemBlock("* "); case CODE: case PREFORMATTED: return new ContentBlock(type, "[listing]\n----\n", "\n----", 1, 2); case TABLE: return new ContentBlock(type, "|===\n", "|===", 1, 1); case TABLE_ROW: return new ContentBlock(type, "", "", 2, 1); case TABLE_CELL_HEADER: case TABLE_CELL_NORMAL: return new ContentBlock(type, "|", " ", 0, 0); case DIV: return new ContentBlock(type, "", "", 0, 0); case DEFINITION_ITEM: return new ContentBlock(BlockType.DEFINITION_ITEM, ":: ", "", 0, 1); case DEFINITION_TERM: return new ContentBlock(type, "", "", 0, 0); default: Logger.getLogger(getClass().getName()).warning("Unexpected block type: " + type); return new ContentBlock(type, "", "", 2, 2); } }

Target:
protected Block computeBlock(BlockType type, Attributes attributes) { switch (type) { case PARAGRAPH: return new ContentBlock(type, "", "", 2, 2); case QUOTE: return new ContentBlock(type, "[quote]\n----\n", "\n----\n", 1, 1); case BULLETED_LIST: case DEFINITION_LIST: case NUMERIC_LIST: if (currentBlock != null) { BlockType currentBlockType = currentBlock.getBlockType(); if (currentBlockType == BlockType.LIST_ITEM || currentBlockType == BlockType.DEFINITION_ITEM || currentBlockType == BlockType.DEFINITION_TERM) { return new ListBlock(type, 1); } } return new ListBlock(type, 2); case LIST_ITEM: if (computeCurrentListType() == BlockType.NUMERIC_LIST) { return new ListItemBlock("1. "); } return new ListItemBlock("* "); case CODE: case PREFORMATTED: return new ContentBlock(type, "[listing]\n----\n", "\n----", 1, 2); case TABLE: return new ContentBlock(type, "|===\n", "|===", 1, 1); case TABLE_ROW: return new ContentBlock(type, "", "", 2, 1); case TABLE_CELL_HEADER: case TABLE_CELL_NORMAL: return new ContentBlock(type, "|", " ", 0, 0); case DIV: return new ContentBlock(type, "", "", 0, 0); case DEFINITION_ITEM: return new ContentBlock(type, ":: ", "", 0, 1); case DEFINITION_TERM: return new ContentBlock(type, "", "", 0, 0); default: Logger.getLogger(getClass().getName()).warning("Unexpected block type: " + type); return new ContentBlock(type, "", "", 2, 2); } }
Source:
protected int parseIntOrDefault(String valueAsString, int defaultValue) { if (valueAsString == null || valueAsString.isEmpty()) { return defaultValue; } return Integer.parseInt(valueAsString); }

Target:
protected int parseIntOrDefault(String valueAsString, int defaultValue) { if (StringUtils.isEmpty(valueAsString)) { return defaultValue; } try { return Integer.parseInt(valueAsString); } catch (NumberFormatException e) { log.error("Invalid number for RecordFilter option: " + valueAsString, e); return defaultValue; } }
Source:
public void testCheckWriteSkewWithMultipleModifications() throws Exception { final CountDownLatch latch1 = new CountDownLatch(1); final CountDownLatch latch2 = new CountDownLatch(1); final CountDownLatch latch3 = new CountDownLatch(1); Future<Void> t1 = fork(() -> { latch1.await(); tm.begin(); try { try { cache.get("k1"); cache.put("k1", "v1"); cache.put("k2", "thread 1"); } finally { latch2.countDown(); } latch3.await(); commit(); fail("Commit should have failed!"); } catch (Exception e) { if (tm.getTransaction() != null) { try { tm.rollback(); } catch (SystemException e1) { log.error("Failed to rollback", e1); } } assertTrue(e instanceof RollbackException); } return null; }); Future<Void> t2 = fork(() -> { latch2.await(); tm.begin(); try { try { cache.get("k1"); cache.put("k1", "v2"); cache.put("k3", "thread 2"); commit(); } finally { latch3.countDown(); } } catch (Exception e) { if (tm.getTransaction() != null) { try { tm.rollback(); } catch (SystemException e1) { log.error("Failed to rollback", e1); } } throw e; } return null; }); latch1.countDown(); t1.get(10, SECONDS); t2.get(10, SECONDS); assertTrue("k1 is expected to be in cache.", cache.containsKey("k1")); assertEquals("Wrong value for key k1.", "v2", cache.get("k1")); }

Target:
public void testCheckWriteSkewWithMultipleModifications() throws Exception { final CountDownLatch latch1 = new CountDownLatch(1); final CountDownLatch latch2 = new CountDownLatch(1); final CountDownLatch latch3 = new CountDownLatch(1); Future<Void> t1 = fork(() -> { latch1.await(); tm.begin(); try { try { cache.get("k1"); cache.put("k1", "v1"); cache.put("k2", "thread 1"); } finally { latch2.countDown(); } latch3.await(); Exceptions.expectException(RollbackException.class, this::commit); } catch (Exception e) { log.error("Unexpected exception in transaction 1", e); tm.rollback(); } return null; }); Future<Void> t2 = fork(() -> { latch2.await(); tm.begin(); try { try { cache.get("k1"); cache.put("k1", "v2"); cache.put("k3", "thread 2"); commit(); } finally { latch3.countDown(); } } catch (Exception e) { if (tm.getTransaction() != null) { try { tm.rollback(); } catch (SystemException e1) { log.error("Failed to rollback", e1); } } throw e; } return null; }); latch1.countDown(); t1.get(10, SECONDS); t2.get(10, SECONDS); assertTrue("k1 is expected to be in cache.", cache.containsKey("k1")); assertEquals("Wrong value for key k1.", "v2", cache.get("k1")); }
Source:
public void setUp() throws Throwable { Activity activity = mActivityTestRule.getActivity(); TestUtils.setKeepScreenOn(mActivityTestRule, activity); mContext = activity; mReceiver = BlockingReceiver.registerForPendingIntent(mContext); final PendingIntent intent = mReceiver.getPendingIntent(); mTextClassifier = new TextClassifier() { @Override public TextClassification classifyText(@NonNull TextClassification.Request r) { final RemoteActionCompat remoteAction = new RemoteActionCompat(ICON, ITEM, "desc", intent); remoteAction.setShouldShowIcon(false); return new TextClassification.Builder() .addAction(remoteAction) .build(); } }; final Map<String, Float> scores = new ArrayMap<>(); scores.put(TextClassifier.TYPE_EMAIL, 1f); mTextLink = new TextLink(0, ENTITY.length(), scores); }

Target:
public void setUp() throws Throwable { Activity activity = mActivityTestRule.getActivity(); TestUtils.keepScreenOn(mActivityTestRule, activity); mContext = activity; mReceiver = BlockingReceiver.registerForPendingIntent(mContext); final PendingIntent intent = mReceiver.getPendingIntent(); mTextClassifier = new TextClassifier() { @Override public TextClassification classifyText(@NonNull TextClassification.Request r) { final RemoteActionCompat remoteAction = new RemoteActionCompat(ICON, ITEM, "desc", intent); remoteAction.setShouldShowIcon(false); return new TextClassification.Builder() .addAction(remoteAction) .build(); } }; final Map<String, Float> scores = new ArrayMap<>(); scores.put(TextClassifier.TYPE_EMAIL, 1f); mTextLink = new TextLink(0, ENTITY.length(), scores); }
Source:
public boolean isMemoryBlockAvailable() { return (numberOfInMemBlockPermits.get() > 0) || ((storage == null) && !areSubscribersBehindByMax()); }

Target:
public boolean isMemoryBlockAvailable() { return (numberOfInMemBlockPermits.get() > 0); }
Source:
protected String invalidFileNames(U version) { Set<SourceFile> sourceFiles = version.getSourceFiles(); StringBuilder invalidFileNames = new StringBuilder(); sourceFiles.stream().forEach(sourceFile -> { sourceFile.getPath().endsWith("/"); if (sourceFile.getPath().endsWith("/")) { invalidFileNames.append(sourceFile.getPath() + " "); } }); return invalidFileNames.toString(); }

Target:
protected List<String> invalidFileNames(U version) { Set<SourceFile> sourceFiles = version.getSourceFiles(); List<String> invalidFileNames = new ArrayList<>(); sourceFiles.stream().forEach(sourceFile -> { if (sourceFile.getPath().endsWith("/")) { invalidFileNames.add(sourceFile.getPath()); } }); return invalidFileNames; }
Source:
public void init(Configuration config) { checkArgument(!isNullOrEmpty(config.getString(ACCESS_KEY))); checkArgument(!isNullOrEmpty(config.getString(SECRET_KEY))); String accessKey = config.getString(ACCESS_KEY); String secretKey = config.getString(SECRET_KEY); try { AwsBasicCredentials awsBasicCredentials = AwsBasicCredentials.create(accessKey, secretKey); s3Client = S3Client.builder() .region(Region.AP_SOUTHEAST_1) .credentialsProvider(StaticCredentialsProvider.create(awsBasicCredentials)) .build(); } catch (S3Exception e) { throw new RuntimeException("Could not initialize S3PinotFS", e); } }

Target:
public void init(Configuration config) { Preconditions.checkArgument(!isNullOrEmpty(config.getString(REGION))); String region = config.getString(REGION); AwsCredentialsProvider awsCredentialsProvider; try { if (!isNullOrEmpty(config.getString(ACCESS_KEY)) && !isNullOrEmpty(config.getString(SECRET_KEY))) { String accessKey = config.getString(ACCESS_KEY); String secretKey = config.getString(SECRET_KEY); AwsBasicCredentials awsBasicCredentials = AwsBasicCredentials.create(accessKey, secretKey); awsCredentialsProvider = StaticCredentialsProvider.create(awsBasicCredentials); } else { awsCredentialsProvider = AwsCredentialsProviderChain.builder().addCredentialsProvider(SystemPropertyCredentialsProvider.create()) .addCredentialsProvider(EnvironmentVariableCredentialsProvider.create()).build(); } _s3Client = S3Client.builder().region(Region.of(region)).credentialsProvider(awsCredentialsProvider).build(); } catch (S3Exception e) { throw new RuntimeException("Could not initialize S3PinotFS", e); } }
Source:
public void adminsCanChangeSomeValuesResearchersCannot() { study = TestUtils.getValidStudy(StudyServiceTest.class); study.setStudyIdExcludedInExport(true); study.setEmailVerificationEnabled(true); study.setExternalIdValidationEnabled(false); study.setExternalIdRequiredOnSignup(false); study.setEmailSignInEnabled(false); study.setPhoneSignInEnabled(false); study.setReauthenticationEnabled(false); study.setAccountLimit(0); study.setAutoVerificationPhoneSuppressed(false); study = studyService.createStudy(study); study = studyService.getStudy(study.getIdentifier()); assertStudyDefaults(study); changeStudyDefaults(study); study = studyService.updateStudy(study, false); assertStudyDefaults(study); changeStudyDefaults(study); study = studyService.updateStudy(study, true); assertFalse(study.isStudyIdExcludedInExport()); assertFalse(study.isEmailVerificationEnabled()); assertTrue(study.isAutoVerificationPhoneSuppressed()); assertTrue(study.isExternalIdValidationEnabled()); assertTrue(study.isExternalIdRequiredOnSignup()); assertTrue(study.isEmailSignInEnabled()); assertTrue(study.isPhoneSignInEnabled()); assertTrue(study.isReauthenticationEnabled()); assertEquals(10, study.getAccountLimit()); }

Target:
public void adminsCanChangeSomeValuesResearchersCannot() { study = TestUtils.getValidStudy(StudyServiceTest.class); study.setStudyIdExcludedInExport(true); study.setEmailVerificationEnabled(true); study.setExternalIdValidationEnabled(false); study.setExternalIdRequiredOnSignup(false); study.setEmailSignInEnabled(false); study.setPhoneSignInEnabled(false); study.setReauthenticationEnabled(false); study.setAccountLimit(0); study = studyService.createStudy(study); study = studyService.getStudy(study.getIdentifier()); assertStudyDefaults(study); changeStudyDefaults(study); study = studyService.updateStudy(study, false); assertStudyDefaults(study); changeStudyDefaults(study); study = studyService.updateStudy(study, true); assertFalse(study.isStudyIdExcludedInExport()); assertFalse(study.isEmailVerificationEnabled()); assertTrue(study.isAutoVerificationPhoneSuppressed()); assertTrue(study.isExternalIdValidationEnabled()); assertTrue(study.isExternalIdRequiredOnSignup()); assertTrue(study.isEmailSignInEnabled()); assertTrue(study.isPhoneSignInEnabled()); assertTrue(study.isReauthenticationEnabled()); assertEquals(10, study.getAccountLimit()); }
Source:
public static CucumberFeature parseResource(Resource resource) { requireNonNull(resource); URI path = resource.getPath(); String source = read(resource); try { Parser<GherkinDocument> parser = new Parser<>(new AstBuilder()); TokenMatcher matcher = new TokenMatcher(); GherkinDocument gherkinDocument = parser.parse(source, matcher); List<PickleEvent> pickleEvents = compilePickles(gherkinDocument, resource); return new CucumberFeature(gherkinDocument, path, source, pickleEvents); } catch (ParserException e) { throw new CucumberException("Failed to parse resourse at: " + path.toString(), e); } }

Target:
public static CucumberFeature parseResource(Resource resource) { requireNonNull(resource); URI path = resource.getPath(); String source = read(resource); try { Parser<GherkinDocument> parser = new Parser<>(new AstBuilder()); TokenMatcher matcher = new TokenMatcher(); GherkinDocument gherkinDocument = parser.parse(source, matcher); List<PickleEvent> pickleEvents = compilePickles(gherkinDocument, resource); return new CucumberFeature(gherkinDocument, path, source, pickleEvents); } catch (ParserException e) { throw new CucumberException("Failed to parse resource at: " + path.toString(), e); } }
Source:
public void shutdown() throws InterruptedException { synchronized (m_shutdownLock) { m_snapshotCreateSetupBarrier = null; m_snapshotCreateFinishBarrier = null; } if (m_snapshotTargetTerminators != null) { for (Thread t : m_snapshotTargetTerminators) { t.join(); } } }

Target:
public void shutdown() throws InterruptedException { m_snapshotCreateSetupBarrier.reset(); m_snapshotCreateFinishBarrier.reset(); if (m_snapshotTargetTerminators != null) { for (Thread t : m_snapshotTargetTerminators) { t.join(); } } }
Source:
public Host getActiveHostByName(String serverName) { final Host host = VdsmManager.getInstance().getHostByName(serverName); return host; }

Target:
public Host getActiveHostByName(String serverName) { return VdsmManager.getInstance().getHostByName(serverName); }
Source:
private void updateGraphicsDevice(GraphicsType type) { final GraphicsDevice existingGraphicsDevice = getGraphicsDevOfType(type); final GraphicsDevice paramsGraphicsDevice = getParameters().getGraphicsDevices().get(type); if (existingGraphicsDevice == null) { if (paramsGraphicsDevice != null) { paramsGraphicsDevice.setVmId(getVmId()); getBackend().runInternalAction(VdcActionType.AddGraphicsDevice, new GraphicsParameters(paramsGraphicsDevice)); } } else { if (paramsGraphicsDevice == null) { getBackend().runInternalAction(VdcActionType.RemoveGraphicsDevice, new GraphicsParameters(existingGraphicsDevice)); } else { paramsGraphicsDevice.setVmId(getVmId()); getBackend().runInternalAction(VdcActionType.UpdateGraphicsDevice, new GraphicsParameters(paramsGraphicsDevice)); } } }

Target:
private void updateGraphicsDevice(GraphicsType type) { GraphicsDevice existingGraphicsDevice = getGraphicsDevOfType(type); GraphicsDevice paramsGraphicsDevice = getParameters().getGraphicsDevices().get(type); if (existingGraphicsDevice == null) { if (paramsGraphicsDevice != null) { paramsGraphicsDevice.setVmId(getVmId()); getBackend().runInternalAction(VdcActionType.AddGraphicsDevice, new GraphicsParameters(paramsGraphicsDevice)); } } else { if (paramsGraphicsDevice == null) { getBackend().runInternalAction(VdcActionType.RemoveGraphicsDevice, new GraphicsParameters(existingGraphicsDevice)); } else { paramsGraphicsDevice.setVmId(getVmId()); getBackend().runInternalAction(VdcActionType.UpdateGraphicsDevice, new GraphicsParameters(paramsGraphicsDevice)); } } }
Source:
public ServiceMessageCodec( @Nullable HeadersCodec headersCodec, @Nullable Collection<DataCodec> dataCodecs) { this.headersCodec = headersCodec == null ? new BinaryHeadersCodec() : headersCodec; Map<String, DataCodec> defaultCodecs = DataCodec.INSTANCES; if (dataCodecs == null) { this.dataCodecs = defaultCodecs; } else { this.dataCodecs = dataCodecs.stream() .collect( collectingAndThen( toMap(DataCodec::contentType, identity(), (c1, c2) -> c2), usersCodec -> { Map<String, DataCodec> buffer = new HashMap<>(defaultCodecs); buffer.putAll(usersCodec); return Collections.unmodifiableMap(buffer); })); } }

Target:
public ServiceMessageCodec( @Nullable HeadersCodec headersCodec, @Nullable Collection<DataCodec> dataCodecs) { this.headersCodec = headersCodec == null ? new DefaultHeadersCodec() : headersCodec; Map<String, DataCodec> defaultCodecs = DataCodec.INSTANCES; if (dataCodecs == null) { this.dataCodecs = defaultCodecs; } else { this.dataCodecs = dataCodecs.stream() .collect( collectingAndThen( toMap(DataCodec::contentType, identity(), (c1, c2) -> c2), usersCodec -> { Map<String, DataCodec> buffer = new HashMap<>(defaultCodecs); buffer.putAll(usersCodec); return Collections.unmodifiableMap(buffer); })); } }
Source:
public List<Boolean> getDeviceVpnConnectionStatuses() { return Arrays.stream(deviceVpnConnectionStatuses.split(DeviceBase.DEVICE_NAMES_SEPARATOR)).map(Boolean::parseBoolean) .collect(Collectors.toList()); }

Target:
public List<Boolean> getDeviceVpnConnectionStatuses() { return Arrays.stream(deviceVpnConnectionStatuses.split(SEPARATOR)).map(Boolean::parseBoolean) .collect(Collectors.toList()); }