auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void test() throws Exception { Foo foo = new Foo(); String json = SimpleJsonSerializer.toJson(foo, "fileInfo"); @SuppressWarnings("unchecked") Map<String, Object> fromJson = JsonObjectMapperProvider.newInstance().fromJson(json, Map.class); assertThat(fromJson.get("bool"), equalTo(Boolean.TRUE)); assertThat(fromJson.get("bar"), equalTo(42)); assertThat(fromJson.get("foo"), equalTo("bar")); assertThat(fromJson.get("dub"), equalTo(1.6)); assertNull(fromJson.get("fileInfo")); }

Target:
public void test() throws Exception { Foo foo = new Foo("foo"); String json = SimpleJsonSerializer.toJson(foo, "fileInfo"); Foo fooOut = JsonObjectMapperProvider.newInstance().fromJson(json, Foo.class); assertThat(fooOut.bool, equalTo(Boolean.TRUE)); assertThat(fooOut.bar, equalTo(42L)); assertThat(fooOut.foo, equalTo("bar")); assertThat(fooOut.dub, equalTo(1.6)); assertNull(fooOut.fileInfo); }
Source:
private static HttpScheme connectionScheme(ChannelHandlerContext ctx) { final HttpScheme scheme = connectionSchemeAttribute(ctx).get(); return (scheme == null) ? HttpScheme.HTTP : scheme; }

Target:
private static HttpScheme connectionScheme(ChannelHandlerContext ctx) { final HttpScheme scheme = connectionSchemeAttribute(ctx).get(); return scheme == null ? HttpScheme.HTTP : scheme; }
Source:
Mono<DecryptResult> decrypt(DecryptOptions decryptOptions, Context context) { Objects.requireNonNull(decryptOptions, "'decryptOptions' cannot be null."); Objects.requireNonNull(decryptOptions.getAlgorithm(), "Encryption algorithm cannot be null."); Objects.requireNonNull(decryptOptions.getCipherText(), "Cipher text content to be decrypted cannot be null."); EncryptionAlgorithm algorithm = decryptOptions.getAlgorithm(); byte[] iv = decryptOptions.getIv(); byte[] additionalAuthenticatedData = decryptOptions.getAdditionalAuthenticatedData(); byte[] authenticationTag = decryptOptions.getAuthenticationTag(); KeyOperationParameters parameters = new KeyOperationParameters() .setAlgorithm(algorithm) .setValue(decryptOptions.getCipherText()) .setIv(iv) .setAdditionalAuthenticatedData(additionalAuthenticatedData) .setAuthenticationTag(authenticationTag); context = context == null ? Context.NONE : context; return service.decrypt(vaultUrl, keyName, version, apiVersion, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context.addData(AZ_TRACING_NAMESPACE_KEY, KEYVAULT_TRACING_NAMESPACE_VALUE)) .doOnRequest(ignored -> logger.info("Decrypting content with algorithm - {}", algorithm.toString())) .doOnSuccess(response -> logger.info("Retrieved decrypted content with algorithm- {}", algorithm.toString())) .doOnError(error -> logger.warning("Failed to decrypt content with algorithm - {}", algorithm.toString(), error)) .flatMap(keyOperationResultResponse -> Mono.just( new DecryptResult(keyOperationResultResponse.getValue().getResult(), algorithm, keyId))); }

Target:
Mono<DecryptResult> decrypt(DecryptOptions decryptOptions, Context context) { Objects.requireNonNull(decryptOptions, "'decryptOptions' cannot be null."); EncryptionAlgorithm algorithm = decryptOptions.getAlgorithm(); byte[] iv = decryptOptions.getIv(); byte[] additionalAuthenticatedData = decryptOptions.getAdditionalAuthenticatedData(); byte[] authenticationTag = decryptOptions.getAuthenticationTag(); KeyOperationParameters parameters = new KeyOperationParameters() .setAlgorithm(algorithm) .setValue(decryptOptions.getCiphertext()) .setIv(iv) .setAdditionalAuthenticatedData(additionalAuthenticatedData) .setAuthenticationTag(authenticationTag); context = context == null ? Context.NONE : context; return service.decrypt(vaultUrl, keyName, version, apiVersion, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE, context.addData(AZ_TRACING_NAMESPACE_KEY, KEYVAULT_TRACING_NAMESPACE_VALUE)) .doOnRequest(ignored -> logger.info("Decrypting content with algorithm - {}", algorithm.toString())) .doOnSuccess(response -> logger.info("Retrieved decrypted content with algorithm- {}", algorithm.toString())) .doOnError(error -> logger.warning("Failed to decrypt content with algorithm - {}", algorithm.toString(), error)) .flatMap(keyOperationResultResponse -> Mono.just( new DecryptResult(keyOperationResultResponse.getValue().getResult(), algorithm, keyId))); }
Source:
private boolean parseSystemPluginOutput(String regfilePath, AbstractFile regAbstractFile) { File regfile = new File(regfilePath); try (BufferedReader reader = new BufferedReader(new FileReader(regfile))) { String line = reader.readLine(); while (line != null) { line = line.trim(); if (line.matches("^bam v.*")) { parseBamKey(regAbstractFile, reader, Bundle.Registry_System_Bam()); } else if (line.matches("^bthport v..*")) { parseBlueToothDevices(regAbstractFile, reader) ; } line = reader.readLine(); } return true; } catch (FileNotFoundException ex) { logger.log(Level.WARNING, "Error finding the registry file.", ex); } catch (IOException ex) { logger.log(Level.WARNING, "Error reading the system hive: {0}", ex); } return false; }

Target:
private boolean parseSystemPluginOutput(String regfilePath, AbstractFile regAbstractFile) { File regfile = new File(regfilePath); try (BufferedReader reader = new BufferedReader(new FileReader(regfile))) { String line = reader.readLine(); while (line != null) { line = line.trim(); if (line.toLowerCase().matches("^bam v.*")) { parseBamKey(regAbstractFile, reader, Bundle.Registry_System_Bam()); } else if (line.toLowerCase().matches("^bthport v..*")) { parseBlueToothDevices(regAbstractFile, reader); } line = reader.readLine(); } return true; } catch (FileNotFoundException ex) { logger.log(Level.WARNING, "Error finding the registry file.", ex); } catch (IOException ex) { logger.log(Level.WARNING, "Error reading the system hive: {0}", ex); } return false; }
Source:
private void reset() { setId( next = NO_ID ); }

Target:
private void reset() { next = NO_ID; setId( NO_ID ); }
Source:
public List<Agent> sort(List<String> agentKeys) throws AgentException { Map<String, Agent> sorted = new HashMap<>(); Set<String> pending = new HashSet<>(); if (agentKeys != null) { for (String agentKey : agentKeys) { doSort(agentKeys, parse(agentKey), sorted, pending); } } return new ArrayList<>(sorted.values()); }

Target:
public List<AgentKey> sort(List<String> agentKeys) throws AgentException { List<AgentKey> sorted = new ArrayList<>(); Set<String> pending = new HashSet<>(); if (agentKeys != null) { for (String agentKey : agentKeys) { doSort(agentKeys, AgentKeyImpl.parse(agentKey), sorted, pending); } } return sorted; }
Source:
public DataSchema( @JsonProperty("dataSource") String dataSource, @JsonProperty("parser") InputRowParser parser, @JsonProperty("metricsSpec") AggregatorFactory[] aggregators, @JsonProperty("granularitySpec") GranularitySpec granularitySpec ) { this.dataSource = dataSource; final Set<String> dimensionExclusions = Sets.newHashSet(); if (parser != null && parser.getParseSpec() != null && parser.getParseSpec().getTimestampSpec() != null) { dimensionExclusions.add(parser.getParseSpec().getTimestampSpec().getTimestampColumn()); for (AggregatorFactory aggregator : aggregators) { dimensionExclusions.add(aggregator.getName()); } } if (parser != null && parser.getParseSpec() != null && parser.getParseSpec().getDimensionsSpec() != null) { this.parser = parser.withParseSpec( parser.getParseSpec() .withDimensionsSpec( parser.getParseSpec() .getDimensionsSpec() .withDimensionExclusions(dimensionExclusions) ) ); } else { this.parser = parser; } this.aggregators = aggregators; this.granularitySpec = granularitySpec == null ? new UniformGranularitySpec(null, null, null, null) : granularitySpec; }

Target:
public DataSchema( @JsonProperty("dataSource") String dataSource, @JsonProperty("parser") InputRowParser parser, @JsonProperty("metricsSpec") AggregatorFactory[] aggregators, @JsonProperty("granularitySpec") GranularitySpec granularitySpec ) { this.dataSource = dataSource; final Set<String> dimensionExclusions = Sets.newHashSet(); for (AggregatorFactory aggregator : aggregators) { dimensionExclusions.add(aggregator.getName()); } if (parser != null && parser.getParseSpec() != null) { if (parser.getParseSpec().getTimestampSpec() != null) { dimensionExclusions.add(parser.getParseSpec().getTimestampSpec().getTimestampColumn()); } if (parser.getParseSpec().getDimensionsSpec() != null) { this.parser = parser.withParseSpec( parser.getParseSpec() .withDimensionsSpec( parser.getParseSpec() .getDimensionsSpec() .withDimensionExclusions(dimensionExclusions) ) ); } else { this.parser = parser; } } else { this.parser = parser; } this.aggregators = aggregators; this.granularitySpec = granularitySpec == null ? new UniformGranularitySpec(null, null, null, null) : granularitySpec; }
Source:
public void removeResourceSelfServiceGroup(PerunSession sess, Resource resource, Group group) throws InternalErrorException, PrivilegeException, GroupNotAdminException { Utils.checkPerunSession(sess); Vo vo; Facility facility; try { facility = sess.getPerun().getFacilitiesManager().getFacilityById(sess, resource.getFacilityId()); } catch (FacilityNotExistsException e) { throw new InternalErrorException("Failed to find facility for given resource."); } try { vo = sess.getPerun().getVosManager().getVoById(sess, resource.getVoId()); } catch (VoNotExistsException e) { throw new InternalErrorException("Failed to find vo for given resource."); } if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo) && !AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { throw new PrivilegeException(sess, "addResourceSelfServiceUser"); } getResourcesManagerBl().removeResourceSelfServiceGroup(sess, resource, group); }

Target:
public void removeResourceSelfServiceGroup(PerunSession sess, Resource resource, Group group) throws InternalErrorException, PrivilegeException, GroupNotAdminException { Utils.checkPerunSession(sess); Vo vo; Facility facility; try { facility = sess.getPerun().getFacilitiesManager().getFacilityById(sess, resource.getFacilityId()); } catch (FacilityNotExistsException e) { throw new InternalErrorException("Failed to find facility for given resource."); } try { vo = sess.getPerun().getVosManager().getVoById(sess, resource.getVoId()); } catch (VoNotExistsException e) { throw new InternalErrorException("Failed to find vo for given resource."); } if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, vo) && !AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { throw new PrivilegeException(sess, "removeResourceSelfServiceGroup"); } getResourcesManagerBl().removeResourceSelfServiceGroup(sess, resource, group); }
Source:
public synchronized void schedule(ScheduledJob scheduledJob) { String id = scheduledJob.getId(); String cronExpression = scheduledJob.getCronExpression(); String name = scheduledJob.getName(); if (!CronExpression.isValidExpression(cronExpression)) { throw new MolgenisValidationException( singleton( new ConstraintViolation("Invalid cronexpression '" + cronExpression + "'", null))); } try { if (quartzScheduler.checkExists(new JobKey(id, SCHEDULED_JOB_GROUP))) { unschedule(id); } if (!Boolean.TRUE.equals(scheduledJob.getBoolean(ScheduledJobMetadata.ACTIVE))) { return; } Trigger trigger = newTrigger() .withIdentity(id, SCHEDULED_JOB_GROUP) .withSchedule(cronSchedule(cronExpression)) .build(); schedule(scheduledJob, trigger); LOG.info("Scheduled Job '{}' with trigger '{}'", name, trigger); } catch (SchedulerException e) { LOG.error("Error schedule job", e); throw new ScheduledJobException("Error schedule job", e); } }

Target:
public synchronized void schedule(ScheduledJob scheduledJob) { String id = scheduledJob.getId(); String cronExpression = scheduledJob.getCronExpression(); String name = scheduledJob.getName(); if (!CronExpression.isValidExpression(cronExpression)) { throw new MolgenisValidationException( singleton( new ConstraintViolation("Invalid cronexpression '" + cronExpression + "'", null))); } try { if (quartzScheduler.checkExists(new JobKey(id, SCHEDULED_JOB_GROUP))) { unschedule(id); } if (!scheduledJob.isActive()) { return; } Trigger trigger = newTrigger() .withIdentity(id, SCHEDULED_JOB_GROUP) .withSchedule(cronSchedule(cronExpression)) .build(); schedule(scheduledJob, trigger); LOG.info("Scheduled Job '{}' with trigger '{}'", name, trigger); } catch (SchedulerException e) { LOG.error("Error schedule job", e); throw new ScheduledJobException("Error schedule job", e); } }
Source:
private boolean getCustomCheckpointing(DatastreamTask task) { boolean customCheckpointing = _connectors.get(task.getConnectorType()).isCustomCheckpointing(); Datastream datastream = task.getDatastreams().get(0); if (datastream.hasMetadata() && datastream.getMetadata() != null && datastream.getMetadata().containsKey(DatastreamMetadataConstants.CUSTOM_CHECKPOINT)) { customCheckpointing = Boolean.parseBoolean( datastream.getMetadata().get(DatastreamMetadataConstants.CUSTOM_CHECKPOINT)); _log.info(String.format("Custom checkpointing overridden by metadata to be: %b for datastream: %s", customCheckpointing, datastream)); } return customCheckpointing; }

Target:
private boolean getCustomCheckpointing(DatastreamTask task) { boolean customCheckpointing = _connectors.get(task.getConnectorType()).isCustomCheckpointing(); Datastream datastream = task.getDatastreams().get(0); if (datastream.hasMetadata() && Objects.requireNonNull(datastream.getMetadata()).containsKey(DatastreamMetadataConstants.CUSTOM_CHECKPOINT)) { customCheckpointing = Boolean.parseBoolean( datastream.getMetadata().get(DatastreamMetadataConstants.CUSTOM_CHECKPOINT)); _log.info(String.format("Custom checkpointing overridden by metadata to be: %b for datastream: %s", customCheckpointing, datastream)); } return customCheckpointing; }
Source:
protected Iterable<? extends PlotDatasetDto> assemble(Collection<LatencyRawData> rawDataList) { List<PlotDatasetDto> plotDatasetDtoList = new ArrayList<PlotDatasetDto>(2); String sessionId = rawDataList.iterator().next().getSessionId(); List<PointDto> pointDtoLatencyList = new ArrayList<PointDto>(rawDataList.size()); List<PointDto> pointDtoLatencyStdDevList = new ArrayList<PointDto>(rawDataList.size()); for (LatencyRawData rawData : rawDataList) { double x = DataProcessingUtil.round(rawData.getTime() / 1000.0D); double yLatency = DataProcessingUtil.round(rawData.getLatency()); double yLatencyStdDev = DataProcessingUtil.round(rawData.getLatencyStdDev()); pointDtoLatencyList.add(new PointDto(x, yLatency)); pointDtoLatencyStdDevList.add(new PointDto(x, yLatencyStdDev)); } String legend = legendProvider.generatePlotLegend(sessionId, DefaultWorkloadParameters.LATENCY.getDescription(), true); PlotDatasetDto plotDatasetDto = new PlotDatasetDto(pointDtoLatencyList, legend, ColorCodeGenerator.getHexColorCode(ColorCodeGenerator.LATENCY_COLOR_ID_1, sessionId)); plotDatasetDtoList.add(plotDatasetDto); legend = legendProvider.generatePlotLegend(sessionId, DefaultWorkloadParameters.LATENCY_STD_DEV.getDescription(), true); plotDatasetDto = new PlotDatasetDto(pointDtoLatencyStdDevList, legend, ColorCodeGenerator.getHexColorCode(ColorCodeGenerator.LATENCY_COLOR_ID_2, sessionId)); plotDatasetDtoList.add(plotDatasetDto); return plotDatasetDtoList; }

Target:
protected Iterable<? extends PlotDatasetDto> assemble(Collection<LatencyRawData> rawDataList) { List<PlotDatasetDto> plotDatasetDtoList = new ArrayList<PlotDatasetDto>(2); String sessionId = rawDataList.iterator().next().getSessionId(); List<PointDto> pointDtoLatencyList = new ArrayList<PointDto>(rawDataList.size()); List<PointDto> pointDtoLatencyStdDevList = new ArrayList<PointDto>(rawDataList.size()); for (LatencyRawData rawData : rawDataList) { double x = DataProcessingUtil.round(rawData.getTime() / 1000.0D); double yLatency = DataProcessingUtil.round(rawData.getLatency()); double yLatencyStdDev = DataProcessingUtil.round(rawData.getLatencyStdDev()); pointDtoLatencyList.add(new PointDto(x, yLatency)); pointDtoLatencyStdDevList.add(new PointDto(x, yLatencyStdDev)); } String legend = legendProvider.generatePlotLegend(sessionId, DefaultWorkloadParameters.LATENCY.getDescription(), true); PlotDatasetDto plotDatasetDto = new PlotDatasetDto(pointDtoLatencyList, legend, ColorCodeGenerator.getHexColorCode(ColorCodeGenerator.LATENCY_COLOR, sessionId)); plotDatasetDtoList.add(plotDatasetDto); legend = legendProvider.generatePlotLegend(sessionId, DefaultWorkloadParameters.LATENCY_STD_DEV.getDescription(), true); plotDatasetDto = new PlotDatasetDto(pointDtoLatencyStdDevList, legend, ColorCodeGenerator.getHexColorCode(ColorCodeGenerator.LATENCY_STD_DEV_COLOR, sessionId)); plotDatasetDtoList.add(plotDatasetDto); return plotDatasetDtoList; }
Source:
protected SessionFactory getSessionFactory() { hibernateUtil.buildSessionFactory(); return hibernateUtil.getSessionFactory(); }

Target:
protected SessionFactory getSessionFactory() { SessionFactory fact = null; HibernateUtil util = HibernateUtilFactory.getEventHibernateUtil(); if (util != null) { fact = util.getSessionFactory(); } return fact; }
Source:
private Mono<Void> run(CancellationToken cancellationToken) { PartitionLoadBalancerImpl self = this; return Flux.just(self) .flatMap(value -> self.leaseContainer.getAllLeases()) .collectList() .flatMap(allLeases -> { if (cancellationToken.isCancellationRequested()) return Mono.empty(); List<Lease> leasesToTake = self.partitionLoadBalancingStrategy.selectLeasesToTake(allLeases); if (cancellationToken.isCancellationRequested()) return Mono.empty(); return Flux.fromIterable(leasesToTake) .flatMap(lease -> { if (cancellationToken.isCancellationRequested()) return Mono.empty(); return self.partitionController.addOrUpdateLease(lease); }) .then(); }) .repeat(() -> { if (cancellationToken.isCancellationRequested()) return false; long remainingWork = this.leaseAcquireInterval.toMillis(); try { while (!cancellationToken.isCancellationRequested() && remainingWork > 0) { Thread.sleep(100); remainingWork -= 100; } } catch (InterruptedException ex) { logger.warn("Partition load balancer caught an interrupted exception", ex); } if (cancellationToken.isCancellationRequested()) return false; return true; }) .then() .onErrorResume(throwable -> { logger.info("Partition load balancer task stopped."); return this.stop(); }); }

Target:
private Mono<Void> run(CancellationToken cancellationToken) { return Flux.just(this) .flatMap(value -> this.leaseContainer.getAllLeases()) .collectList() .flatMap(allLeases -> { if (cancellationToken.isCancellationRequested()) return Mono.empty(); List<Lease> leasesToTake = this.partitionLoadBalancingStrategy.selectLeasesToTake(allLeases); if (cancellationToken.isCancellationRequested()) return Mono.empty(); return Flux.fromIterable(leasesToTake) .flatMap(lease -> { if (cancellationToken.isCancellationRequested()) return Mono.empty(); return this.partitionController.addOrUpdateLease(lease); }) .then(Mono.just(this) .flatMap(value -> { if (cancellationToken.isCancellationRequested()) { return Mono.empty(); } ZonedDateTime stopTimer = ZonedDateTime.now().plus(this.leaseAcquireInterval); return Mono.just(value) .delayElement(Duration.ofMillis(100)) .repeat( () -> { ZonedDateTime currentTime = ZonedDateTime.now(); return !cancellationToken.isCancellationRequested() && currentTime.isBefore(stopTimer); }).last(); }) ); }) .repeat(() -> { return !cancellationToken.isCancellationRequested(); }) .then() .onErrorResume(throwable -> { logger.info("Partition load balancer task stopped."); return this.stop(); }); }
Source:
public CollectionConfig(String collection, Path collectionConfigs) { File matchingConfig = collectionConfigs.resolve(Paths.get(collection, "collection.properties")).toFile(); Properties collectionProps = new Properties(); if (matchingConfig.exists()) { try { collectionProps.load(new FileInputStream(matchingConfig)); } catch (IOException e) { LOGGER.debug("Unable to read matching collection properties file.", e); } } if (collectionProps.size() == 0) { File defaultConfig = collectionConfigs.resolve("default/collection.properties").toFile(); if (defaultConfig.exists()) { try { collectionProps.load(new FileInputStream(defaultConfig)); } catch (IOException e) { LOGGER.debug("Unable to read default collection properties file.", e); } } } shardCount = NumberUtils.toInt( collectionProps.getProperty("numShards", System.getProperty("solr.cloud.shardCount")), 2); replicationFactor = NumberUtils.toInt( collectionProps.getProperty( "replicationFactor", System.getProperty("solr.cloud.replicationFactor")), 2); maximumShardsPerNode = NumberUtils.toInt( collectionProps.getProperty( "maxShardsPerNode", System.getProperty("solr.cloud.maxShardPerNode")), 2); }

Target:
public CollectionConfig(String collection, Path collectionConfigs) { File matchingConfig = collectionConfigs.resolve(Paths.get(collection, "collection.properties")).toFile(); Properties collectionProps = new Properties(); if (matchingConfig.exists()) { try (InputStream collectionConfigStream = new FileInputStream(matchingConfig)) { collectionProps.load(collectionConfigStream); } catch (IOException e) { LOGGER.debug("Unable to read matching collection properties file.", e); } } if (collectionProps.size() == 0) { File defaultConfig = collectionConfigs.resolve("default/collection.properties").toFile(); if (defaultConfig.exists()) { try (InputStream defaultConfigStream = new FileInputStream(defaultConfig)) { collectionProps.load(defaultConfigStream); } catch (IOException e) { LOGGER.debug("Unable to read default collection properties file.", e); } } } shardCount = NumberUtils.toInt( collectionProps.getProperty("numShards", System.getProperty("solr.cloud.shardCount")), 2); replicationFactor = NumberUtils.toInt( collectionProps.getProperty( "replicationFactor", System.getProperty("solr.cloud.replicationFactor")), 2); maximumShardsPerNode = NumberUtils.toInt( collectionProps.getProperty( "maxShardsPerNode", System.getProperty("solr.cloud.maxShardPerNode")), 2); }
Source:
public void setSwitchScale(float scale) { mSwitchScale = scale; requestLayout(); }

Target:
private void setSwitchScale(float scale) { mSwitchScale = scale; requestLayout(); }
Source:
public String getLinkTemplate(ResourceMappingContext rmc) { return InjectLinkFieldDescriptor.getLinkTemplate(rmc, link); }

Target:
public String getLinkTemplate(ResourceMappingContext rmc) { return LinkDescriptorUtil.getLinkTemplate(rmc, link); }
Source:
public void testHashCode() { BoundDimFilter boundDimFilter = new BoundDimFilter("dimension", "12", "15", null, null, true, null); BoundDimFilter boundDimFilterWithExtract = new BoundDimFilter("dimension", "12", "15", null, null, true, extractionFn); int hashCode = 1917945602; int hashCodeWithExtract = hashCode + extractionFn.hashCode(); Assert.assertEquals(hashCode, boundDimFilter.hashCode()); Assert.assertEquals(hashCodeWithExtract, boundDimFilterWithExtract.hashCode()); }

Target:
public void testHashCode() { BoundDimFilter boundDimFilter = new BoundDimFilter("dimension", "12", "15", null, null, true, null); BoundDimFilter boundDimFilterWithExtract = new BoundDimFilter("dimension", "12", "15", null, null, true, extractionFn); Assert.assertNotEquals(boundDimFilter.hashCode(), boundDimFilterWithExtract.hashCode()); }
Source:
@Test public void testResourceToString_ExistingResourceAtRootPackage() throws Exception { final long fileSize = new File(getClass().getResource("/test-file-utf8.bin").getFile()).length(); final String content = IOUtils.resourceToString("/test-file-utf8.bin", Charset.defaultCharset()); assertNotNull(content); assertEquals(fileSize, content.getBytes().length); }

Target:
@Test public void testResourceToString_ExistingResourceAtRootPackage() throws Exception { final long fileSize = new File(getClass().getResource("/test-file-utf8.bin").getFile()).length(); final String content = IOUtils.resourceToString("/test-file-utf8.bin", StandardCharsets.UTF_8); assertNotNull(content); assertEquals(fileSize, content.getBytes().length); }
Source:
public static void retryDeadEvents(BaseActivity activity) { synchronized (sDeadApiEvents) { if (sDeadApiEvents.isEmpty()) { return; } List<ApiEvent<?>> deadApiEvents = sDeadApiEvents; sDeadApiEvents = new LinkedList<ApiEvent<?>>(); int activityid = activity.getActivityid(); if (activityid == -1) { Log.w("Api", "Invalid activityid!"); } for (ApiEvent<?> apiEvent : deadApiEvents) { if (activityid == apiEvent.mApiCall.mActivityid) { if (BuildConfig.DEBUG) { Log.i("Api", "Retrying dead event: " + apiEvent.getClass().getName()); } MainApplication.getBus().post(apiEvent); } else { if (BuildConfig.DEBUG) { Log.i("Api", "Adding dead event: " + apiEvent.getClass().toString()); } sDeadApiEvents.add(apiEvent); } } if (BuildConfig.DEBUG && sDeadApiEvents.size() > 0) { Log.i("Api", "Skipped " + sDeadApiEvents.size() + " dead events"); } } }

Target:
public static void retryDeadEvents(BaseActivity activity) { synchronized (sDeadApiEvents) { if (sDeadApiEvents.isEmpty()) { return; } List<ApiEvent<?>> deadApiEvents = sDeadApiEvents; sDeadApiEvents = new LinkedList<ApiEvent<?>>(); int activityid = activity.getActivityid(); for (ApiEvent<?> apiEvent : deadApiEvents) { if (activityid == apiEvent.mApiCall.mActivityid) { if (BuildConfig.DEBUG) { Log.i("Api", "Retrying dead event: " + apiEvent.getClass().getName()); } MainApplication.getBus().post(apiEvent); } else { if (BuildConfig.DEBUG) { Log.i("Api", "Adding dead event: " + apiEvent.getClass().toString()); } sDeadApiEvents.add(apiEvent); } } if (BuildConfig.DEBUG && sDeadApiEvents.size() > 0) { Log.i("Api", "Skipped " + sDeadApiEvents.size() + " dead events"); } } }
Source:
private API addSummary(API api) { HashMap<String, Integer> stats = getSystemStatistics(); ApiSummary summary = new ApiSummary(); if (appMode != ApplicationMode.GlusterOnly) { summary.setVMs(new VMs()); summary.getVMs().setTotal(get(stats, "total_vms")); summary.getVMs().setActive(get(stats, "active_vms")); } summary.setHosts(new Hosts()); summary.getHosts().setTotal(get(stats, "total_vds")); summary.getHosts().setActive(get(stats, "active_vds")); summary.setUsers(new Users()); summary.getUsers().setTotal(get(stats, "total_users")); summary.getUsers().setActive(get(stats, "active_users")); summary.setStorageDomains(new StorageDomains()); summary.getStorageDomains().setTotal(get(stats, "total_storage_domains")); summary.getStorageDomains().setActive(get(stats, "active_storage_domains")); api.setSummary(summary); return api; }

Target:
private API addSummary(API api) { HashMap<String, Integer> stats = getSystemStatistics(); ApiSummary summary = new ApiSummary(); summary.setVMs(new VMs()); summary.getVMs().setTotal(get(stats, "total_vms")); summary.getVMs().setActive(get(stats, "active_vms")); summary.setHosts(new Hosts()); summary.getHosts().setTotal(get(stats, "total_vds")); summary.getHosts().setActive(get(stats, "active_vds")); summary.setUsers(new Users()); summary.getUsers().setTotal(get(stats, "total_users")); summary.getUsers().setActive(get(stats, "active_users")); summary.setStorageDomains(new StorageDomains()); summary.getStorageDomains().setTotal(get(stats, "total_storage_domains")); summary.getStorageDomains().setActive(get(stats, "active_storage_domains")); api.setSummary(summary); return api; }
Source:
private static List<StartIdentifiedAtlasDbTransactionResponse> getStartTransactionResponses( LockLeaseService lockLeaseService, LockWatchEventCache lockWatchEventCache, int numberOfTransactions) { List<StartIdentifiedAtlasDbTransactionResponse> result = new ArrayList<>(); while (result.size() < numberOfTransactions) { StartTransactionResponseV5 response = lockLeaseService.startTransactionsWithWatches( lockWatchEventCache.lastKnownVersion().version(), numberOfTransactions - result.size()); lockWatchEventCache.processStartTransactionsUpdate( response.timestamps().stream().boxed().collect(Collectors.toSet()), response.lockWatchUpdate()); result.addAll(split(response)); } return result; }

Target:
private static List<StartIdentifiedAtlasDbTransactionResponse> getStartTransactionResponses( LockLeaseService lockLeaseService, LockWatchEventCache lockWatchEventCache, int numberOfTransactions) { List<StartIdentifiedAtlasDbTransactionResponse> result = new ArrayList<>(); while (result.size() < numberOfTransactions) { ConjureStartTransactionsResponse response = lockLeaseService.startTransactionsWithWatches( lockWatchEventCache.lastKnownVersion().version(), numberOfTransactions - result.size()); lockWatchEventCache.processStartTransactionsUpdate( response.getTimestamps().stream().boxed().collect(Collectors.toSet()), response.getLockWatchUpdate()); result.addAll(split(response)); } return result; }
Source:
public void createTopic(Topic topic) { if (Topic.ContentType.AVRO == topic.getContentType() || !isNullOrEmpty(topic.getMessageSchema())) { schemaValidatorProvider.provide(topic.getContentType()).check(topic.getMessageSchema()); } topicRepository.createTopic(topic); try { multiDCAwareService.manageTopic(brokerTopicManagement -> brokerTopicManagement.createTopic(topic.getName(), topic.getRetentionTime()) ); } catch (Exception exception) { logger.error( String.format("Could not create topic %s, rollback topic creation.", topic.getQualifiedName()), exception ); topicRepository.removeTopic(topic.getName()); } }

Target:
public void createTopic(Topic topic) { if (topic.isSchemaValidationRequired()) { schemaValidatorProvider.provide(topic.getContentType()).check(topic.getMessageSchema()); } topicRepository.createTopic(topic); try { multiDCAwareService.manageTopic(brokerTopicManagement -> brokerTopicManagement.createTopic(topic.getName(), topic.getRetentionTime()) ); } catch (Exception exception) { logger.error( String.format("Could not create topic %s, rollback topic creation.", topic.getQualifiedName()), exception ); topicRepository.removeTopic(topic.getName()); } }
Source:
public HierarchyElementView(Context context, HierarchyElement it) { super(context); RelativeLayout layout = (RelativeLayout)inflate(context, R.layout.hierarchy_element_view, null); setBackgroundColor(it.getBgColor()); mPrimaryTextView = ((TextView)layout.findViewById(R.id.hev_primary_text)); mPrimaryTextView.setText(it.getPrimaryText()); mPrimaryTextView.setTextColor(it.getTextColor()); mSecondaryTextView = ((TextView)layout.findViewById(R.id.hev_secondary_text)); mSecondaryTextView.setText(it.getSecondaryText()); mSecondaryTextView.setTextColor(it.getTextColor()); mIcon = ((ImageView)layout.findViewById(R.id.hev_icon)); mIcon.setImageDrawable(it.getIcon()); addView(layout); }

Target:
public HierarchyElementView(Context context, HierarchyElement it) { super(context); RelativeLayout layout = (RelativeLayout)inflate(context, R.layout.hierarchy_element_view, null); mPrimaryTextView = ((TextView)layout.findViewById(R.id.hev_primary_text)); mSecondaryTextView = ((TextView)layout.findViewById(R.id.hev_secondary_text)); mIcon = ((ImageView)layout.findViewById(R.id.hev_icon)); setFromHierarchyElement(it); addView(layout); }
Source:
public void testServerSpanWithURL() throws RetryAttemptException { SpanCache spanCacheMock = Mockito.mock(SpanCache.class); NodeDetailsDeriver nodeDetailsDeriver = new NodeDetailsDeriver(spanCacheMock); Annotation sr = new Annotation(); sr.setValue("sr"); sr.setTimestamp(0); Annotation ss = new Annotation(); ss.setTimestamp(1000); ss.setValue("ss"); BinaryAnnotation httpAddress = new BinaryAnnotation(); httpAddress.setKey(Constants.ZIPKIN_BIN_ANNOTATION_HTTP_URL); httpAddress.setValue("http://localhost/hello"); Span serverSpan = new Span(Arrays.asList(httpAddress), Arrays.asList(sr, ss)); serverSpan.setId("2"); serverSpan.setTraceId("1"); serverSpan.setTimestamp(0L); serverSpan.setDuration(ss.getTimestamp() - sr.getTimestamp()); NodeDetails result = nodeDetailsDeriver.processOneToOne(null, serverSpan); assertEquals("/hello", result.getUri()); }

Target:
public void testServerSpanWithURL() throws RetryAttemptException { SpanCache spanCacheMock = Mockito.mock(SpanCache.class); NodeDetailsDeriver nodeDetailsDeriver = new NodeDetailsDeriver(spanCacheMock); Annotation sr = new Annotation(); sr.setValue("sr"); Annotation ss = new Annotation(); ss.setValue("ss"); BinaryAnnotation httpAddress = new BinaryAnnotation(); httpAddress.setKey(Constants.ZIPKIN_BIN_ANNOTATION_HTTP_URL); httpAddress.setValue("http://localhost/hello"); Span serverSpan = new Span(Arrays.asList(httpAddress), Arrays.asList(sr, ss)); serverSpan.setId("2"); serverSpan.setTraceId("1"); NodeDetails result = nodeDetailsDeriver.processOneToOne(null, serverSpan); assertEquals("/hello", result.getUri()); }
Source:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); } catch (ServletException ex) { LogFactory.getLog(PNGGenarateServlet.class).error("Unable to process GET request", ex); } }

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); } catch (ServletException ex) { log.error("Unable to process GET request", ex); } }
Source:
private Info getInfo() { Info info = new Info(); info.setTitle("KIE-Server API"); info.setVersion("7.8.0"); return info; }

Target:
private Info getInfo() { Info info = new Info(); info.setVersion("7.0"); return info; }
Source:
public void cancelRequest(ImageView view) { if (view == null) { throw new AssertionError("view cannot be null."); } cancelExistingRequest(view); }

Target:
public void cancelRequest(ImageView view) { if (view == null) { throw new IllegalArgumentException("view cannot be null."); } cancelExistingRequest(view); }
Source:
public void setValue(CharSequence value) { setValue(value, 0, value.length()); }

Target:
public void setValue(CharSequence value) { Validate.notNull(value); setValue(value, 0, value.length()); }
Source:
private static ListenableFuture<?> firstFinishedFuture(List<ListenableFuture<?>> futures) { if (futures.size() == 1) { return futures.get(0); } SettableFuture<?> result = SettableFuture.create(); ExecutorService executor = newDirectExecutorService(); for (ListenableFuture<?> future : futures) { future.addListener(() -> result.set(null), executor); } return result; }

Target:
private static ListenableFuture<?> firstFinishedFuture(List<ListenableFuture<?>> futures) { SettableFuture<?> result = SettableFuture.create(); ExecutorService executor = newDirectExecutorService(); for (ListenableFuture<?> future : futures) { future.addListener(() -> result.set(null), executor); } return result; }
Source:
static Set<Long> longEntityNamespaces(UpdateOptions updateOptions) { if (updateOptions.entityNamespaces() == null) return DEFAULT_ENTITY_NAMESPACES; return splitByComma(Collections.singletonList(updateOptions.entityNamespaces())) .stream() .map(Long::parseLong) .collect(toImmutableSet()); }

Target:
static Set<Long> longEntityNamespaces(UpdateOptions updateOptions) { if (updateOptions.entityNamespaces() == null) return DEFAULT_ENTITY_NAMESPACES; return splitByComma(singletonList(updateOptions.entityNamespaces())) .stream() .map(Long::parseLong) .collect(toImmutableSet()); }
Source:
private void onMessage(StreamMessage message, Observer<StreamMessage> emitter) { Qualifier qualifier = Qualifier.fromString(message.qualifier()); if (Qualifier.Q_ON_COMPLETED.asString().equalsIgnoreCase(qualifier.asString())) { emitter.onCompleted(); System.err.println("onCompleted" + message); return; } if (Qualifier.Q_ERROR_NAMESPACE.equalsIgnoreCase(qualifier.getNamespace())) { emitter.onError(exceptionMapper.toException(qualifier, message.data())); System.err.println("onError" + message); return; } emitter.onNext(message); System.err.println("onNext" + message); }

Target:
private void onMessage(StreamMessage message, Observer<StreamMessage> emitter) { Qualifier qualifier = Qualifier.fromString(message.qualifier()); if (Qualifier.Q_ON_COMPLETED.asString().equalsIgnoreCase(qualifier.asString())) { emitter.onCompleted(); return; } if (Qualifier.Q_ERROR_NAMESPACE.equalsIgnoreCase(qualifier.getNamespace())) { emitter.onError(exceptionMapper.toException(qualifier, message.data())); return; } emitter.onNext(message); }
Source:
public StyledString getStyledText(Object element) { String rawText = getText(element); if (element.getClass().equals(GitModelCommit.class)) { GitModelCommit commit = (GitModelCommit) element; StyledString string = new StyledString(rawText); String commitId = commit.getRemoteCommit().getName(); String format = " [" + commitId.substring(0, 6) + "]"; string.append(format, StyledString.DECORATIONS_STYLER); return string; } return new StyledString(rawText); }

Target:
public StyledString getStyledText(Object element) { String rawText = getText(element); if (element.getClass().equals(GitModelCommit.class)) { StyledString string = new StyledString(rawText); GitModelCommit commit = (GitModelCommit) element; String format = " [" + getAbbreviatedId(commit) + "]"; string.append(format, StyledString.DECORATIONS_STYLER); return string; } return new StyledString(rawText); }
Source:
public void testSerdeMetadataStorageTablesConfig() throws Exception { Injector injector = Guice.createInjector(new TestTableModule()); ObjectMapper mapper = injector.getInstance(ObjectMapper.class); Properties props = injector.getInstance(Properties.class); MetadataStorageTablesConfig config = injector.getInstance(MetadataStorageTablesConfig.class); Assert.assertEquals(props.getProperty("druid.metadata.storage.tables.base"), config.getBase()); Assert.assertEquals(props.getProperty("druid.metadata.storage.tables.segments"), config.getSegmentsTable()); Assert.assertEquals(props.getProperty("druid.metadata.storage.tables.rules"), config.getRulesTable()); Assert.assertEquals(props.getProperty("druid.metadata.storage.tables.config"), config.getConfigTable()); Assert.assertEquals( props.getProperty("druid.metadata.storage.tables.tasks"), config.getEntryTable(MetadataStorageTablesConfig.TASK_ENTRY_TYPE) ); Assert.assertEquals( props.getProperty("druid.metadata.storage.tables.taskLog"), config.getLogTable(MetadataStorageTablesConfig.TASK_ENTRY_TYPE) ); Assert.assertEquals( props.getProperty("druid.metadata.storage.tables.taskLock"), config.getLockTable(MetadataStorageTablesConfig.TASK_ENTRY_TYPE) ); Assert.assertEquals( "{\"base\":\"druid\",\"segments\":\"aaa_segments\",\"rules\":\"bbb_rules\",\"config\":\"ccc_config\",\"tasks\":\"ddd_tasks\",\"taskLog\":\"eee_tasklog\",\"taskLock\":\"fff_tasklock\",\"audit\":\"ggg_audit\"}", mapper.writeValueAsString(config) ); }

Target:
public void testSerdeMetadataStorageTablesConfig() throws Exception { Injector injector = Guice.createInjector( new Module() { @Override public void configure(Binder binder) { binder.install(new PropertiesModule(Arrays.asList("test.runtime.properties"))); binder.install(new ConfigModule()); binder.install(new DruidGuiceExtensions()); JsonConfigProvider.bind(binder, "druid.metadata.storage.tables", MetadataStorageTablesConfig.class); } @Provides @LazySingleton public ObjectMapper jsonMapper() { return new DefaultObjectMapper(); } } ); Properties props = injector.getInstance(Properties.class); MetadataStorageTablesConfig config = injector.getInstance(MetadataStorageTablesConfig.class); Assert.assertEquals(props.getProperty("druid.metadata.storage.tables.base"), config.getBase()); Assert.assertEquals(props.getProperty("druid.metadata.storage.tables.segments"), config.getSegmentsTable()); Assert.assertEquals(props.getProperty("druid.metadata.storage.tables.rules"), config.getRulesTable()); Assert.assertEquals(props.getProperty("druid.metadata.storage.tables.config"), config.getConfigTable()); Assert.assertEquals( props.getProperty("druid.metadata.storage.tables.tasks"), config.getEntryTable(MetadataStorageTablesConfig.TASK_ENTRY_TYPE) ); Assert.assertEquals( props.getProperty("druid.metadata.storage.tables.taskLog"), config.getLogTable(MetadataStorageTablesConfig.TASK_ENTRY_TYPE) ); Assert.assertEquals( props.getProperty("druid.metadata.storage.tables.taskLock"), config.getLockTable(MetadataStorageTablesConfig.TASK_ENTRY_TYPE) ); }
Source:
public static void registerFluid(Fluid fluid, String name) { name = name.toLowerCase(); if (FLUID_TO_NAMES.containsKey(fluid)) { FLUID_TO_NAMES.get(fluid).add(name); } else { FLUID_TO_NAMES.put(fluid, NonNullList.<String>withSize(1, name)); } if (NAME_TO_FLUIDS.containsKey(name)) { NAME_TO_FLUIDS.get(name).add(fluid); } else { NAME_TO_FLUIDS.put(name, NonNullList.<Fluid>withSize(1, fluid)); } }

Target:
public static void registerFluid(Fluid fluid, String name) { Preconditions.checkArgument(ForgeRegistries.FLUIDS.containsValue(fluid), "Cannot register FluidDictionary entry for unregistered fluid %s", fluid); name = name.toLowerCase(Locale.ENGLISH); if (FLUID_TO_NAMES.containsKey(fluid)) { FLUID_TO_NAMES.get(fluid).add(name); } else { FLUID_TO_NAMES.put(fluid, NonNullList.<String>withSize(1, name)); } if (NAME_TO_FLUIDS.containsKey(name)) { NAME_TO_FLUIDS.get(name).add(fluid); } else { NAME_TO_FLUIDS.put(name, NonNullList.<Fluid>withSize(1, fluid)); } }
Source:
public int prepare(final Xid xid) throws XAException { prepareCalled = true; return XAResource.XA_OK; }

Target:
public int prepare(final Xid xid) throws XAException { System.out.println("[" + Thread.currentThread().getName() + "] DummyXAResource XA_PREPARE [" + xid + "]"); File dir = new File("DummyXAResource/"); dir.mkdirs(); file = new File(dir, new Uid().fileStringForm() + "_"); try { file.createNewFile(); final int formatId = xid.getFormatId(); final byte[] gtrid = xid.getGlobalTransactionId(); final int gtrid_length = gtrid.length; final byte[] bqual = xid.getBranchQualifier(); final int bqual_length = bqual.length; DataOutputStream fos = new DataOutputStream(new FileOutputStream(file)); fos.writeInt(formatId); fos.writeInt(gtrid_length); fos.write(gtrid, 0, gtrid_length); fos.writeInt(bqual_length); fos.write(bqual, 0, bqual_length); fos.flush(); fos.close(); } catch (IOException e) { throw new XAException(XAException.XAER_RMERR); } return XA_OK; }
Source:
public static Index setUp(List<Object> fieldNames, String indexName, String indexType, Map<String, String> indexSettings) { if (fieldNames == null || fieldNames.isEmpty()) { logger.log(Level.SEVERE, "No field names were provided."); return null; } if (indexName == null || indexName.isEmpty()) { logger.log(Level.SEVERE, "No index name was provided."); return null; } if (indexType == null || indexType.isEmpty()) { logger.log(Level.SEVERE, "No index type was provided."); return null; } if (!validTypes.contains(indexType.toLowerCase())) { logger.log(Level.SEVERE, String.format("Invalid index type %s.", indexType)); return null; } if (indexType.equalsIgnoreCase(JSON_TYPE) && indexSettings != null) { logger.log(Level.WARNING, String.format("Index type is %s, index settings %s ignored.", indexType, indexSettings.toString())); indexSettings = null; } else if (indexType.equalsIgnoreCase(TEXT_TYPE)) { if (indexSettings == null) { indexSettings = new HashMap<String, String>(); indexSettings.put(TOKENIZE, DEFAULT_TOKENIZER); logger.log(Level.INFO, String.format("Index type is %s, defaulting settings to %s.", indexType, indexSettings.toString())); } else { for (String parameter : indexSettings.keySet()) { if (!validSettings.contains(parameter.toLowerCase())) { String msg = String.format("Invalid parameter %s in index settings %s.", parameter, indexSettings); logger.log(Level.SEVERE, msg); return null; } } } } return new Index(fieldNames, indexName, indexType, indexSettings); }

Target:
public static Index setUp(List<Object> fieldNames, String indexName, String indexType, Map<String, String> indexSettings) { if (fieldNames == null || fieldNames.isEmpty()) { logger.log(Level.SEVERE, "No field names were provided."); return null; } if (indexName == null || indexName.isEmpty()) { logger.log(Level.SEVERE, "No index name was provided."); return null; } if (indexType == null || indexType.isEmpty()) { logger.log(Level.SEVERE, "No index type was provided."); return null; } if (!validTypes.contains(indexType.toLowerCase())) { logger.log(Level.SEVERE, String.format("Invalid index type %s.", indexType)); return null; } if (indexType.equalsIgnoreCase(JSON_TYPE) && indexSettings != null) { logger.log(Level.WARNING, String.format("Index type is %s, index settings %s ignored.", indexType, indexSettings.toString())); indexSettings = null; } else if (indexType.equalsIgnoreCase(TEXT_TYPE)) { if (indexSettings == null) { indexSettings = new HashMap<String, String>(); indexSettings.put(TEXT_TOKENIZE, TEXT_DEFAULT_TOKENIZER); logger.log(Level.FINE, String.format("Index type is %s, defaulting settings to %s.", indexType, indexSettings.toString())); } else { for (String parameter : indexSettings.keySet()) { if (!validSettings.contains(parameter.toLowerCase())) { String msg = String.format("Invalid parameter %s in index settings %s.", parameter, indexSettings); logger.log(Level.SEVERE, msg); return null; } } } } return new Index(fieldNames, indexName, indexType, indexSettings); }
Source:
private static Matcher<Object> withProjectName(final Matcher<String> expectedName) { return new BoundedMatcher<Object, ProjectData>(ProjectData.class) { @Override public boolean matchesSafely(final ProjectData actualObject) { return expectedName.matches(actualObject.projectName); } @Override public void describeTo(final Description description) { description.appendText("project name matches"); } }; }

Target:
private static Matcher<Object> withProjectName(final Matcher<String> expectedName) { return new BoundedMatcher<Object, ProjectData>(ProjectData.class) { @Override public boolean matchesSafely(final ProjectData actualProjectData) { return expectedName.matches(actualProjectData.projectName); } @Override public void describeTo(final Description description) { description.appendText("project name matches"); } }; }
Source:
public void blockedUserShouldBeAbleToChangeEmail() { String username = Configuration.getCredentials().emailQaart2; String password = Configuration.getCredentials().emailPasswordQaart2; EditPreferencesPage editPrefPage = new EditPreferencesPage(driver).openEmailSection(); editPrefPage.verifyUserLoggedIn(User.BLOCKED_USER); editPrefPage.openEmailSection(); MailFunctions.deleteAllEmails(username, password); String newEmailAddress = MailFunctions.getEmail(editPrefPage.getEmailAdress()); editPrefPage.changeEmail(newEmailAddress); PreferencesPageObject prefPage = editPrefPage.clickSaveButton(); Assertion.assertTrue(prefPage.getBannerNotifications().isNotificationMessageVisible(), "Notification message is not visible"); prefPage.enterEmailChangeLink(username, password); editPrefPage.openEmailSection(); Assertion.assertEquals(editPrefPage.getEmailAdress(), newEmailAddress); }

Target:
public void blockedUserShouldBeAbleToChangeEmail() { String username = Configuration.getCredentials().emailQaart2; String password = Configuration.getCredentials().emailPasswordQaart2; EditPreferencesPage editPrefPage = new EditPreferencesPage(driver).openEmailSection(); editPrefPage.verifyUserLoggedIn(User.BLOCKED_USER); editPrefPage.openEmailSection(); EmailUtils.deleteAllEmails(username, password); String newEmailAddress = EmailUtils.getEmail(editPrefPage.getEmailAdress()); editPrefPage.changeEmail(newEmailAddress); PreferencesPageObject prefPage = editPrefPage.clickSaveButton(); Assertion.assertTrue(prefPage.getBannerNotifications().isNotificationMessageVisible(), "Notification message is not visible"); prefPage.enterEmailChangeLink(username, password); editPrefPage.openEmailSection(); Assertion.assertEquals(editPrefPage.getEmailAdress(), newEmailAddress); }
Source:
public TimeGraphScale(Composite parent, TimeGraphColorScheme colors, int style) { super(parent, colors, SWT.NO_BACKGROUND | SWT.NO_FOCUS | SWT.DOUBLE_BUFFERED); TmfSignalManager.register(this); addMouseListener(this); addMouseMoveListener(this); TimeDraw.updateTimeZone(); addDisposeListener((e) -> { TmfSignalManager.deregister(TimeGraphScale.this); }); GC gc = new GC(parent.getDisplay()); fDigitWidth = gc.getCharWidth('0'); gc.dispose(); fAlign = style & SWT.TOP | style & SWT.BOTTOM; }

Target:
public TimeGraphScale(Composite parent, TimeGraphColorScheme colors, int style) { super(parent, colors, SWT.NO_BACKGROUND | SWT.NO_FOCUS | SWT.DOUBLE_BUFFERED); TmfSignalManager.register(this); addMouseListener(this); addMouseMoveListener(this); TimeDraw.updateTimeZone(); addDisposeListener((e) -> { TmfSignalManager.deregister(TimeGraphScale.this); }); GC gc = new GC(parent.getDisplay()); fDigitWidth = gc.getCharWidth('0'); gc.dispose(); int styleMask = SWT.TOP | SWT.BOTTOM; fAlign = (style & styleMask) == 0 ? SWT.BOTTOM : style & styleMask; }