auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { return next.process() .flatMap(response -> { HttpResponse responseAfterScrub = scrubETagHeader(response); return Mono.justOrEmpty(responseAfterScrub); }); }

Target:
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { return next.process() .flatMap(response -> Mono.just(scrubETagHeader(response))); }
Source:
protected void configure() { bind(DateAdapter.class).to(Iso8601DateAdapter.class); super.configure(); }

Target:
protected void configure() { super.configure(); }
Source:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } VDSGroup cluster = getVdsGroup(); if (cluster == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID); return false; } if (!cluster.supportsGlusterService()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_DOES_NOT_SUPPORT_GLUSTER); return false; } GlusterVolumeEntity volume = getDbFacade().getGlusterVolumeDao().getById(snapshot.getVolumeId()); if (volume.getStatus() == GlusterStatus.DOWN) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN); } if (!isVolumeThinlyProvisioned(volume)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_NOT_THINLY_PROVISIONED); } return true; }

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } VDSGroup cluster = getVdsGroup(); if (cluster == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID); return false; } if (!cluster.supportsGlusterService()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_DOES_NOT_SUPPORT_GLUSTER); return false; } if (volume != null && volume.getStatus() == GlusterStatus.DOWN) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN); } if (!isVolumeThinlyProvisioned(volume)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_NOT_THINLY_PROVISIONED); } return true; }
Source:
public NewSubAppCommand(FBNetwork fbNetwork, List<?> selection, int x, int y) { super(fbNetwork, LibraryElementFactory.eINSTANCE.createSubApp(), x, y); getSubApp().setSubAppNetwork(LibraryElementFactory.eINSTANCE.createFBNetwork()); PositioningUtilities.removeXYOffsetForFBNetwork(selection); addElements = new AddElementsToSubAppCommand(getSubApp(), selection); checkMapping(selection); }

Target:
public NewSubAppCommand(FBNetwork fbNetwork, List<?> selection, int x, int y) { super(fbNetwork, LibraryElementFactory.eINSTANCE.createSubApp(), x, y); getSubApp().setSubAppNetwork(LibraryElementFactory.eINSTANCE.createFBNetwork()); addElements = new AddElementsToSubAppCommand(getSubApp(), selection); checkMapping(selection); }
Source:
public ConnectionFactory connectionFactory() { return ConnectionFactories.get(connectionString); }

Target:
public ConnectionFactory connectionFactory() { ConnectionFactory connectionFactory = ConnectionFactories.get(connectionString); ConnectionPoolConfiguration configuration = ConnectionPoolConfiguration .builder(connectionFactory) .maxIdleTime(Duration.ofMillis(1000)) .maxSize(20) .build(); return new ConnectionPool(configuration); }
Source:
public void dbNameIsRequired() throws Exception { parameters.remove(JobParametersNames.DB_NAME); validator.validate(new JobParameters(parameters)); }

Target:
public void dbNameIsRequired() throws Exception { requiredParameters.remove(JobParametersNames.DB_NAME); validator.validate(new JobParameters(requiredParameters)); }
Source:
public void scrollToBottom(WebDriver driver) { ((JavascriptExecutor) driver) .executeScript("window.scrollTo(0, document.body.scrollHeight)"); }

Target:
public PostsListPage scrollToBottom(WebDriver driver) { ((JavascriptExecutor) driver) .executeScript("window.scrollTo(0, document.body.scrollHeight)"); return this; }
Source:
private List<ACL> removeDuplicates(List<ACL> acl) { ArrayList<ACL> retval = new ArrayList<ACL>(); if(acl != null) { Iterator<ACL> it = acl.iterator(); while (it.hasNext()) { ACL a = it.next(); if (retval.contains(a) == false) { retval.add(a); } } } return retval; }

Target:
private List<ACL> removeDuplicates(List<ACL> acl) { LinkedList<ACL> retval = new LinkedList<ACL>(); if (acl != null) { for (ACL a : acl) { if (!retval.contains(a)) { retval.add(a); } } } return retval; }
Source:
public int execute(DriverContext driverContext) { if (driverContext.getCtx().getExplainAnalyze() == AnalyzeState.RUNNING) { return 0; } try { Hive db = Hive.get(conf); DDLDesc ddlDesc = work.getDDLDesc(); if (DESC_TO_OPARATION.containsKey(ddlDesc.getClass())) { DDLOperation<?> ddlOperation = DESC_TO_OPARATION.get(ddlDesc.getClass()).newInstance(); ddlOperation.init(db, conf, driverContext, ddlDesc); return ddlOperation.execute(); } else { throw new IllegalArgumentException("Unknown DDL request: " + ddlDesc.getClass()); } } catch (Throwable e) { failed(e); return 1; } }

Target:
public int execute(DriverContext driverContext) { if (driverContext.getCtx().getExplainAnalyze() == AnalyzeState.RUNNING) { return 0; } try { DDLDesc ddlDesc = work.getDDLDesc(); if (DESC_TO_OPARATION.containsKey(ddlDesc.getClass())) { DDLOperationContext context = new DDLOperationContext(conf, driverContext); Class<? extends DDLOperation> ddlOpertaionClass = DESC_TO_OPARATION.get(ddlDesc.getClass()); Constructor<? extends DDLOperation> constructor = ddlOpertaionClass.getConstructor(DDLOperationContext.class, ddlDesc.getClass()); DDLOperation ddlOperation = constructor.newInstance(context, ddlDesc); return ddlOperation.execute(); } else { throw new IllegalArgumentException("Unknown DDL request: " + ddlDesc.getClass()); } } catch (Throwable e) { failed(e); return 1; } }
Source:
public Object[] getUserAndServerUrl(RealmConfiguration config) { if (config instanceof SyncConfiguration) { SyncConfiguration syncConfig = (SyncConfiguration) config; SyncUser user = syncConfig.getUser(); if (!user.isValid()) { throw new IllegalStateException("SyncUser is no longer valid, probably logged out."); } else { String rosServerUrl = syncConfig.getServerUrl().toString(); String rosUserIdentity = user.getIdentity(); String syncRealmAuthUrl = user.getAuthenticationUrl().toString(); String rosRefreshToken = user.toJson(); return new Object[]{rosUserIdentity, rosServerUrl, syncRealmAuthUrl, rosRefreshToken, syncConfig.syncClientValidateSsl(), syncConfig.getServerCertificateFilePath()}; } } else { return new Object[6]; } }

Target:
public Object[] getUserAndServerUrl(RealmConfiguration config) { if (config instanceof SyncConfiguration) { SyncConfiguration syncConfig = (SyncConfiguration) config; SyncUser user = syncConfig.getUser(); if (!user.isValid()) { if (user.getAccessToken() == null) { throw new IllegalStateException("The SyncUser is already logged out and can not use the provided configuration to open a Realm."); } else { RealmLog.warn("Can not use the provided configuration to open a Realm, the SyncUser is no longer valid."); } } String rosServerUrl = syncConfig.getServerUrl().toString(); String rosUserIdentity = user.getIdentity(); String syncRealmAuthUrl = user.getAuthenticationUrl().toString(); String rosSerializedUser = user.toJson(); return new Object[]{rosUserIdentity, rosServerUrl, syncRealmAuthUrl, rosSerializedUser, syncConfig.syncClientValidateSsl(), syncConfig.getServerCertificateFilePath()}; } else { return new Object[6]; } }
Source:
private void lockAxis() { double min = 0; double max = 0; try { min = Double.parseDouble(fMinText.getText()); max = Double.parseDouble(fMaxText.getText()); fChartViewer.setFixedYRange(new AxisRange(min, max)); super.okPressed(); } catch (Exception e) { TraceUtils.displayErrorMsg(Messages.TmfChartView_Error, Messages.TmfChartView_InvalidRange); } }

Target:
private void lockAxis() { double min = 0; double max = 0; try { min = Double.parseDouble(fMinText.getText()); max = Double.parseDouble(fMaxText.getText()); fChartViewer.setFixedYRange(new AxisRange(min, max)); } catch (NumberFormatException e) { } }
Source:
public PayloadValidatingInterceptor payloadValidatingInterceptor() { final PayloadValidatingInterceptor payloadValidatingInterceptor = new PayloadValidatingInterceptor(); final Resource[] resources = new Resource[] { new ClassPathResource("schemas/common.xsd"), new ClassPathResource("schemas/sm-installation.xsd"), new ClassPathResource("schemas/sm-management.xsd"), new ClassPathResource("schemas/sm-bundle.xsd"), new ClassPathResource("schemas/sm-monitoring.xsd"), new ClassPathResource("schemas/sm-adhoc.xsd"), new ClassPathResource("schemas/sm-configuration.xsd") }; payloadValidatingInterceptor.setSchemas(resources); return payloadValidatingInterceptor; }

Target:
public PayloadValidatingInterceptor payloadValidatingInterceptor() { final PayloadValidatingInterceptor payloadValidatingInterceptor = new PayloadValidatingInterceptor(); final Resource[] resources = new Resource[] { new ClassPathResource(COMMON_XSD_PATH), new ClassPathResource(SMART_METERING_INSTALLATION_XSD_PATH), new ClassPathResource(SMART_METERING_MANAGEMENT_XSD_PATH), new ClassPathResource(SMART_METERING_BUNDLE_XSD_PATH), new ClassPathResource(SMART_METERING_MONITORING_XSD_PATH), new ClassPathResource(SMART_METERING_ADHOC_XSD_PATH), new ClassPathResource(SMART_METERING_CONFIGURATION_XSD_PATH) }; payloadValidatingInterceptor.setSchemas(resources); return payloadValidatingInterceptor; }
Source:
public void execute(IProgressMonitor monitor) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, 2); progress.setTaskName(NLS.bind(CoreText.TagOperation_performingTagging, tag.getTag())); ObjectId tagId = !annotated ? tag.getObjectId() : updateTagObject(); progress.worked(1); updateRepo(tagId); progress.worked(1); }

Target:
public void execute(IProgressMonitor monitor) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, 2); progress.setTaskName(NLS.bind(CoreText.TagOperation_performingTagging, tag.getTag())); ObjectId tagId = annotated ? updateTagObject() : tag.getObjectId(); progress.worked(1); updateRepo(tagId); progress.worked(1); }
Source:
static void trackVisitedUrl(String url) { synchronized (Gh4Application.class) { if (sHasCrashlytics) { FabricApplication.trackVisitedUrl(url, sNextUrlTrackingPosition); if (++sNextUrlTrackingPosition >= MAX_TRACKED_URLS) { sNextUrlTrackingPosition = 0; } } } }

Target:
static void trackVisitedUrl(String url) { synchronized (Gh4Application.class) { CrashReportingHelper.trackVisitedUrl(get(), url); } }
Source:
public Condition getCondition() { return condition; }

Target:
public TriggerCondition getCondition() { return condition; }
Source:
public void publishMetrics(List<MetricDatumWithKey<CloudWatchMetricKey>> dataToPublish) { for (int startIndex = 0; startIndex < dataToPublish.size(); startIndex += BATCH_SIZE) { int endIndex = Math.min(dataToPublish.size(), startIndex + BATCH_SIZE); PutMetricDataRequest.Builder request = PutMetricDataRequest.builder(); request = request.namespace(namespace); List<MetricDatum> metricData = new ArrayList<>(); for (int i = startIndex; i < endIndex; i++) { metricData.add(dataToPublish.get(i).datum); } request = request.metricData(metricData); try { cloudWatchClient.putMetricData(request.build()).get(PUT_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); } catch (Exception e) { log.warn("Could not publish datums to CloudWatch", endIndex - startIndex, e instanceof ExecutionException ? e.getCause() : e); } } }

Target:
public void publishMetrics(List<MetricDatumWithKey<CloudWatchMetricKey>> dataToPublish) { for (int startIndex = 0; startIndex < dataToPublish.size(); startIndex += BATCH_SIZE) { int endIndex = Math.min(dataToPublish.size(), startIndex + BATCH_SIZE); PutMetricDataRequest.Builder request = PutMetricDataRequest.builder(); request = request.namespace(namespace); List<MetricDatum> metricData = new ArrayList<>(); for (int i = startIndex; i < endIndex; i++) { metricData.add(dataToPublish.get(i).datum); } request = request.metricData(metricData); try { PutMetricDataRequest.Builder finalRequest = request; blockingExecute(cloudWatchAsyncClient.putMetricData(finalRequest.build()), PUT_TIMEOUT_MILLIS, CW_EXCEPTION_MANAGER); } catch(CloudWatchException | TimeoutException e) { log.warn("Could not publish datums to CloudWatch", endIndex - startIndex, e); } catch (Exception e) { log.error("Unknown exception while publishing datums to CloudWatch", endIndex - startIndex, e); } } }
Source:
static <T> Iterator<T> reverseIterator(Iterable<T> iterable) { if (iterable instanceof java.util.List) { final java.util.List<T> list = (java.util.List<T>) iterable; return new Iterator<T>() { java.util.ListIterator<T> delegate = list.listIterator(list.size()); @Override public boolean hasNext() { return delegate.hasPrevious(); } @Override public T next() { return delegate.previous(); } }; } else if (iterable instanceof Seq) { return ((Seq<T>) iterable).reverseIterator(); } else { return Iterator.ofAll(iterable).foldLeft(List.<T>empty(), List::prepend).iterator(); } }

Target:
static <T> Iterator<T> reverseIterator(Iterable<T> iterable) { if (iterable instanceof java.util.List) { final java.util.List<T> list = (java.util.List<T>) iterable; return new Iterator<T>() { java.util.ListIterator<T> delegate = list.listIterator(list.size()); @Override public boolean hasNext() { return delegate.hasPrevious(); } @Override public T next() { return delegate.previous(); } }; } else if (iterable instanceof Seq) { return ((Seq<T>) iterable).reverseIterator(); } else { return List.<T>empty().pushAll(iterable).iterator(); } }
Source:
public HelixVcrCluster(CloudConfig cloudConfig, ClusterMapConfig clusterMapConfig, ClusterMap clusterMap) { if (Utils.isNullOrEmpty(CloudConfig.VCR_CLUSTER_ZK_CONNECT_STRING)) { throw new IllegalArgumentException("Missing value for " + CloudConfig.VCR_CLUSTER_ZK_CONNECT_STRING); } else if (Utils.isNullOrEmpty(CloudConfig.VCR_CLUSTER_NAME)) { throw new IllegalArgumentException("Missing value for " + CloudConfig.VCR_CLUSTER_NAME); } this.cloudConfig = cloudConfig; currentDataNode = new CloudDataNode(cloudConfig, clusterMapConfig); List<? extends PartitionId> allPartitions = clusterMap.getAllPartitionIds(null); logger.info("All partitions from clusterMap: {}.", allPartitions); partitionIdMap = allPartitions.stream().collect(Collectors.toMap(PartitionId::toPathString, Function.identity())); vcrClusterName = cloudConfig.vcrClusterName; vcrInstanceName = ClusterMapUtils.getInstanceName(clusterMapConfig.clusterMapHostName, clusterMapConfig.clusterMapPort); metrics = new HelixVcrClusterMetrics(clusterMap.getMetricRegistry(), assignedPartitionIds); }

Target:
public HelixVcrCluster(CloudConfig cloudConfig, ClusterMapConfig clusterMapConfig, ClusterMap clusterMap) { if (Utils.isNullOrEmpty(cloudConfig.vcrClusterZkConnectString)) { throw new IllegalArgumentException("Missing value for " + CloudConfig.VCR_CLUSTER_ZK_CONNECT_STRING); } else if (Utils.isNullOrEmpty(cloudConfig.vcrClusterName)) { throw new IllegalArgumentException("Missing value for " + CloudConfig.VCR_CLUSTER_NAME); } this.cloudConfig = cloudConfig; currentDataNode = new CloudDataNode(cloudConfig, clusterMapConfig); List<? extends PartitionId> allPartitions = clusterMap.getAllPartitionIds(null); logger.info("All partitions from clusterMap: {}.", allPartitions); partitionIdMap = allPartitions.stream().collect(Collectors.toMap(PartitionId::toPathString, Function.identity())); vcrClusterName = cloudConfig.vcrClusterName; vcrInstanceName = ClusterMapUtils.getInstanceName(clusterMapConfig.clusterMapHostName, clusterMapConfig.clusterMapPort); metrics = new HelixVcrClusterMetrics(clusterMap.getMetricRegistry(), assignedPartitionIds); }
Source:
List<Document> parse() { final List<Document> documents = new LinkedList<>(); for (final Pair<LongWritable, Text> keyValue : dataSet) { final String text = keyValue.getSecond().toString().trim(); if (text.startsWith("#") || text.length() == 0) { continue; } final String[] split = text.split("\\s+"); final List<Integer> wordList = new LinkedList<>(); for (final String word : split) { wordList.add(Integer.parseInt(word)); } final int[] words = new int[wordList.size()]; for (int i = 0; i < words.length; i++) { words[i] = wordList.get(i); } documents.add(new Document(words, numTopics)); } LOG.log(Level.INFO, "Parsed {0} lines", documents.size()); return documents; }

Target:
List<Document> parse() { final List<Document> documents = new LinkedList<>(); for (final Pair<LongWritable, Text> keyValue : dataSet) { final String text = keyValue.getSecond().toString().trim(); if (text.startsWith("#") || text.length() == 0) { continue; } final String[] split = text.split("\\s+"); final int[] words = new int[split.length]; for (int i = 0; i < split.length; i++) { words[i] = Integer.parseInt(split[i]); } documents.add(new Document(words, numTopics)); } LOG.log(Level.INFO, "Parsed {0} lines", documents.size()); return documents; }
Source:
private static OutputWrapper connectPostgres(String param) throws IOException { try { Class.forName("org.postgresql.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:postgresql:" + param); return new OutputWrapper(conn); } catch (Exception e) { throw new IOException(e.toString()); } }

Target:
private static OutputWrapper connectPostgres(String param) throws IOException { try { Class.forName("org.postgresql.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:postgresql:" + param); return new OutputWrapper(conn); } catch (Exception e) { throw new IOException(e); } }
Source:
public double evaluate(JavaSparkContext sparkContext, PMML model, Path modelParentPath, JavaRDD<String> testData) { KMeansPMMLUtils.validatePMMLVsSchema(model, inputSchema); JavaRDD<Vector> testingData = parsedToVectorRDD(testData.map(MLFunctions.PARSE_FN)); List<ClusterInfo> clusterInfoList = KMeansPMMLUtils.read(model); double cost; switch (evaluationStrategy) { case "DAVIES-BOULDIN" : cost = Evaluation.daviesBouldinIndex(clusterInfoList, testingData); break; case "DUNN" : cost = Evaluation.dunnIndex(clusterInfoList, testingData); break; default : cost = pmmlToKMeansModel(model).computeCost(testingData.rdd()); break; } double eval = 1.0 / cost; log.info("Cost / eval {}", cost, eval); return eval; }

Target:
public double evaluate(JavaSparkContext sparkContext, PMML model, Path modelParentPath, JavaRDD<String> testData) { KMeansPMMLUtils.validatePMMLVsSchema(model, inputSchema); JavaRDD<Vector> testingData = parsedToVectorRDD(testData.map(MLFunctions.PARSE_FN)); List<ClusterInfo> clusterInfoList = KMeansPMMLUtils.read(model); KMeansEvaluation kMeansEvaluation = new KMeansEvaluation(clusterInfoList); double cost; double eval = 0.0; log.info("Evaluation Strategy is {}", evaluationStrategy.name()); switch (evaluationStrategy) { case DAVIES_BOULDIN : eval = kMeansEvaluation.daviesBouldinIndex(testingData); log.info("Eval {}", eval); break; case DUNN : eval = kMeansEvaluation.dunnIndex(testingData); log.info("Eval {}", eval); break; case SILHOUETTE: log.info("Eval {}", eval); break; case SSE : cost = pmmlToKMeansModel(model).computeCost(testingData.rdd()); eval = 1.0 / cost; log.info("Cost / eval {}", cost, eval); break; } return eval; }
Source:
private long doForceInsertExistingDocumentWithHistory(BasicDocumentRevision newRevision, List<String> revisions, Map<String, Object> attachments) { logger.entering(this.getClass().getName(), "doForceInsertExistingDocumentWithHistory", new Object[]{newRevision, revisions, attachments}); Preconditions.checkNotNull(newRevision, "New document revision must not be null."); Preconditions.checkArgument(this.containsDocument(newRevision.getId()), "DocumentRevisionTree must exist."); Preconditions.checkNotNull(revisions, "Revision history should not be null."); Preconditions.checkArgument(revisions.size() > 0, "Revision history should have at least one revision." ); long docNumericID = this.getDocNumericId(newRevision.getId()); DocumentRevisionTree localRevs = getAllRevisionsOfDocument(docNumericID); assert localRevs != null; long sequence; BasicDocumentRevision parent = localRevs.lookup(newRevision.getId(), revisions.get(0)); if(parent == null) { sequence = insertDocumentHistoryToNewTree(newRevision, revisions, docNumericID, localRevs); } else { sequence = insertDocumentHistoryIntoExistingTree(newRevision, revisions, docNumericID, localRevs, attachments); } return sequence; }

Target:
private long doForceInsertExistingDocumentWithHistory(BasicDocumentRevision newRevision, List<String> revisions, Map<String, Object> attachments) { logger.entering("BasicDatastore", "doForceInsertExistingDocumentWithHistory", new Object[]{newRevision, revisions, attachments}); Preconditions.checkNotNull(newRevision, "New document revision must not be null."); Preconditions.checkArgument(this.containsDocument(newRevision.getId()), "DocumentRevisionTree must exist."); Preconditions.checkNotNull(revisions, "Revision history should not be null."); Preconditions.checkArgument(revisions.size() > 0, "Revision history should have at least one revision." ); long docNumericID = this.getDocNumericId(newRevision.getId()); DocumentRevisionTree localRevs = getAllRevisionsOfDocument(docNumericID); assert localRevs != null; long sequence; BasicDocumentRevision parent = localRevs.lookup(newRevision.getId(), revisions.get(0)); if(parent == null) { sequence = insertDocumentHistoryToNewTree(newRevision, revisions, docNumericID, localRevs); } else { sequence = insertDocumentHistoryIntoExistingTree(newRevision, revisions, docNumericID, localRevs, attachments); } return sequence; }
Source:
@Override public Object adapt(Call<R> call) { Observable<Response<R>> responseObservable = isAsync ? new CallEnqueueObservable<>(call) : new CallExecuteObservable<>(call); Observable<?> observable; if (isResult) { observable = new ResultObservable<>(responseObservable); } else if (isBody) { observable = new BodyObservable<>(responseObservable, !isCompletable); } else { observable = responseObservable; } if (scheduler != null) { observable = observable.subscribeOn(scheduler); } if (isFlowable) { return observable.toFlowable(BackpressureStrategy.LATEST); } if (isSingle) { return observable.singleOrError(); } if (isMaybe) { return observable.singleElement(); } if (isCompletable) { return observable.ignoreElements(); } return RxJavaPlugins.onAssembly(observable); }

Target:
@Override public Object adapt(Call<R> call) { Observable<Response<R>> responseObservable = isAsync ? new CallEnqueueObservable<>(call) : new CallExecuteObservable<>(call); Observable<?> observable; if (isResult) { observable = new ResultObservable<>(responseObservable); } else if (isBody) { observable = new BodyObservable<>(responseObservable, isSingle); } else { observable = responseObservable; } if (scheduler != null) { observable = observable.subscribeOn(scheduler); } if (isFlowable) { return observable.toFlowable(BackpressureStrategy.LATEST); } if (isSingle) { return observable.singleOrError(); } if (isMaybe) { return observable.singleElement(); } if (isCompletable) { return observable.ignoreElements(); } return RxJavaPlugins.onAssembly(observable); }
Source:
void submitDeleteBlobOperation(String blobIdString, FutureResult<Void> futureResult, Callback<Void> callback) { try { BlobId blobId = RouterUtils.getBlobIdFromString(blobIdString, clusterMap); DeleteOperation deleteOperation = new DeleteOperation(routerConfig, responseHandler, blobId, futureResult, callback, time, routerMetrics); deleteOperations.add(deleteOperation); } catch (RouterException e) { routerMetrics.operationDequeuingRate.mark(); routerMetrics.countError(e, NonBlockingRouter.RouterOperationType.DeleteBlob); operationCompleteCallback.completeOperation(futureResult, callback, null, e); } }

Target:
void submitDeleteBlobOperation(String blobIdString, FutureResult<Void> futureResult, Callback<Void> callback) { try { BlobId blobId = RouterUtils.getBlobIdFromString(blobIdString, clusterMap); DeleteOperation deleteOperation = new DeleteOperation(routerConfig, routerMetrics, responseHandler, blobId, futureResult, callback, time); deleteOperations.add(deleteOperation); } catch (RouterException e) { routerMetrics.operationDequeuingRate.mark(); routerMetrics.deleteBlobErrorCount.inc(); routerMetrics.countError(e); operationCompleteCallback.completeOperation(futureResult, callback, null, e); } }
Source:
private void updateCourseLevelPrivileges(Map<String, Boolean> privilegesMap, InstructorAttributes toUpdate) { for (HashMap.Entry<String, Boolean> entry : privilegesMap.entrySet()) { toUpdate.privileges.updatePrivilege(entry.getKey(), entry.getValue()); } }

Target:
private void updateCourseLevelPrivileges(Map<String, Boolean> privilegesMap, InstructorAttributes toUpdate) { for (Map.Entry<String, Boolean> entry : privilegesMap.entrySet()) { toUpdate.privileges.updatePrivilege(entry.getKey(), entry.getValue()); } }
Source:
public String getAttribute() { if (fAttribute.equals(NOT_SET)) { setAttribute(); } return fAttribute; }

Target:
public synchronized String getAttribute() { if (fAttribute.equals(NOT_SET)) { setAttribute(); } return fAttribute; }
Source:
public OrganizationalUnit newOrganizationalUnit(final SpaceInfo spaceInfo) { OrganizationalUnitImpl organizationalUnit = new OrganizationalUnitImpl(spaceInfo.getName(), spaceInfo.getDefaultGroupId(), spaceInfo.isDeleted()); final List<RepositoryInfo> repositories = spaceInfo.getRepositories(); if (repositories != null) { for (RepositoryInfo alias : repositories) { Space space = spacesAPI.getSpace(organizationalUnit.getName()); final Repository repo = repositoryService.getRepositoryFromSpace(space, alias.getName()); if (repo != null) { organizationalUnit.getRepositories().add(repo); } } } final List<String> securityGroups = spaceInfo.getSecurityGroups(); if (securityGroups != null) { organizationalUnit.getGroups().addAll(securityGroups); } final Collection<Contributor> contributors = spaceInfo.getContributors(); if (contributors != null) { organizationalUnit.getContributors().addAll(contributors); } return organizationalUnit; }

Target:
public OrganizationalUnit newOrganizationalUnit(final SpaceInfo spaceInfo) { OrganizationalUnitImpl organizationalUnit = new OrganizationalUnitImpl(spaceInfo.getName(), spaceInfo.getDefaultGroupId()); final List<RepositoryInfo> repositories = spaceInfo.getRepositories(); if (repositories != null) { for (RepositoryInfo alias : repositories) { Space space = spacesAPI.getSpace(organizationalUnit.getName()); final Repository repo = repositoryService.getRepositoryFromSpace(space, alias.getName()); if (repo != null) { organizationalUnit.getRepositories().add(repo); } } } final List<String> securityGroups = spaceInfo.getSecurityGroups(); if (securityGroups != null) { organizationalUnit.getGroups().addAll(securityGroups); } final Collection<Contributor> contributors = spaceInfo.getContributors(); if (contributors != null) { organizationalUnit.getContributors().addAll(contributors); } return organizationalUnit; }
Source:
public void shutdown() { if (clientFactory != null) { for (TSocket eachTransfer: clientFactory.clientSocketMap.values()) { eachTransfer.close(); } } }

Target:
public void shutdown() { if (clientFactory != null) { clientFactory.close(); } }
Source:
public synchronized Set<String> getDataTypes(final String evalId) { if (!evalPartitions.containsKey(evalId)) { LOG.log(Level.WARNING, "The evaluator {0} does not exist.", evalId); return new HashSet<>(); } return new HashSet<>(evalPartitions.get(evalId).keySet()); }

Target:
public synchronized Set<String> getDataTypes(final String evalId) { if (!evalPartitions.containsKey(evalId)) { LOG.log(Level.WARNING, "The evaluator {0} does not exist.", evalId); return new HashSet<>(); } final Set<String> dataTypeSet = new HashSet<>(evalPartitions.get(evalId).size()); for (final Map.Entry<String, TreeSet<LongRange>> entry : evalPartitions.get(evalId).entrySet()) { if (!entry.getValue().isEmpty()) { dataTypeSet.add(entry.getKey()); } } return dataTypeSet; }
Source:
public void prepareFiles() { try { TMP_JBOSS_CLI_FILE = File.createTempFile("tmp-jboss-cli", ".xml"); } catch (IOException e) { fail(e.getLocalizedMessage()); } }

Target:
public void prepareFiles() { try { tempJbossConfigFile = File.createTempFile("tmp-jboss-cli", ".xml"); } catch (IOException e) { fail(e.getLocalizedMessage()); } }
Source:
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 1) { return false; } final String tag = FUtil.rainbowify(ChatColor.stripColor(FUtil.colorize(StringUtils.join(args, " ")))); for (String word : Command_tag.FORBIDDEN_WORDS) { if (tag.contains(word)) { msg("That tag contains a forbidden word."); return true; } } plugin.pl.getPlayer(playerSender).setTag(tag); msg("Set tag to " + tag); return true; }

Target:
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 1) { return false; } final String tag = ChatColor.stripColor(FUtil.colorize(StringUtils.join(args, " "))); if(tag.length() > 20) { msg("That tag is too long (Max is 20 characters)."); return true; } for (String word : Command_tag.FORBIDDEN_WORDS) { if (tag.contains(word)) { msg("That tag contains a forbidden word."); return true; } } plugin.pl.getPlayer(playerSender).setTag(FUtil.rainbowify(tag)); msg("Set tag to " + tag); return true; }
Source:
public int hashCode() { return HashUtil.combineHashCodes(multipleInstanceCollectionInput.hashCode(), multipleInstanceCollectionOutput.hashCode(), multipleInstanceDataInput.hashCode(), multipleInstanceDataOutput.hashCode(), multipleInstanceCompletionCondition.hashCode(), onEntryAction.hashCode(), onExitAction.hashCode(), miTrigger.hashCode(), isAsync.hashCode()); }

Target:
public int hashCode() { return HashUtil.combineHashCodes(Objects.hashCode(multipleInstanceCollectionInput), Objects.hashCode(multipleInstanceCollectionOutput), Objects.hashCode(multipleInstanceDataInput), Objects.hashCode(multipleInstanceDataOutput), Objects.hashCode(multipleInstanceCompletionCondition), Objects.hashCode(onEntryAction), Objects.hashCode(onExitAction), Objects.hashCode(miTrigger), Objects.hashCode(isAsync)); }
Source:
public String getSpecParams() { this.specParams = VmDeviceCommonUtils.appendDeviceIdToSpecParams(this.getId().getDeviceId(), this.specParams); return this.specParams; }

Target:
public String getSpecParams() { specParams = VmDeviceCommonUtils.appendDeviceIdToSpecParams(this.getId().getDeviceId(), specParams); return this.specParams; }
Source:
protected Map<String, Object> updateSection(ParameterParser params, SessionState state) { String message; Map<String, Object> results = new HashMap<String, Object>(); try { String addSectionHTML = params.getString("addSectionHTML"); int locationId = params.getInt("locationId"); String cleanAddSectionHTML = getFormattedText().processFormattedText(addSectionHTML, new StringBuilder(), true, true); cleanAddSectionHTML = cleanAddSectionHTML.replaceAll("'", "&#8217;").replaceAll("\"", "&#8220;"); CitationCollectionOrder.SectionType sectionType = CitationCollectionOrder.SectionType.valueOf(params.getString("sectionType")); CitationCollection collection = getCitationCollection(state, false); CitationCollectionOrder citationCollectionOrder = new CitationCollectionOrder(collection.getId(), locationId, sectionType, cleanAddSectionHTML); getCitationService().updateSection(citationCollectionOrder); message = rb.getString("resource.updated"); } catch (Exception e){ message = e.getMessage(); logger.warn("Exception in updateSection() " + e); } if(message != null && ! message.trim().equals("")) { results.put("message", message); } return results; }

Target:
protected Map<String, Object> updateSection(ParameterParser params, SessionState state) { String message; Map<String, Object> results = new HashMap<String, Object>(); try { String addSectionHTML = params.getString("addSectionHTML"); int locationId = params.getInt("locationId"); String cleanAddSectionHTML = getFormattedText().processFormattedText(addSectionHTML, new StringBuilder(), true, true); cleanAddSectionHTML = cleanAddSectionHTML.replaceAll("'", "&#39;").replaceAll("\"", "&#34;"); CitationCollectionOrder.SectionType sectionType = CitationCollectionOrder.SectionType.valueOf(params.getString("sectionType")); CitationCollection collection = getCitationCollection(state, false); CitationCollectionOrder citationCollectionOrder = new CitationCollectionOrder(collection.getId(), locationId, sectionType, cleanAddSectionHTML); getCitationService().updateSection(citationCollectionOrder); message = rb.getString("resource.updated"); } catch (Exception e){ message = e.getMessage(); logger.warn("Exception in updateSection() " + e); } if(message != null && ! message.trim().equals("")) { results.put("message", message); } return results; }
Source:
public static List<InternalAPI> loadInternalAPIs(String apiFilePath) { List<InternalAPI> internalApis = new ArrayList<>(); OMElement apiConfig = MiscellaneousUtil.loadXMLConfig(apiFilePath); if (apiConfig != null) { if (!ROOT_Q.equals(apiConfig.getQName())) { handleException("Invalid internal api configuration file"); } Iterator iterator = apiConfig.getChildrenWithName(HANDLER_Q); while (iterator.hasNext()) { OMElement handlerElem = (OMElement) iterator.next(); String name = null; if (handlerElem.getAttribute(NAME_ATT) != null) { name = handlerElem.getAttributeValue(NAME_ATT); } else { handleException("Name not defined in one or more handlers"); } if (handlerElem.getAttribute(CLASS_Q) != null) { String className = handlerElem.getAttributeValue(CLASS_Q); if (!"".equals(className)) { InternalAPI internalApi = createAPI(className); if (internalApi != null) { internalApis.add(internalApi); internalApi.setName(name); } } else { handleException("Class name is null for Internal InternalAPI name : " + name); } } else { handleException("Class name not defined for Internal InternalAPI named : " + name); } } } return internalApis; }

Target:
public static List<InternalAPI> loadInternalAPIs(String apiFilePath) { List<InternalAPI> internalApis = new ArrayList<>(); OMElement apiConfig = MiscellaneousUtil.loadXMLConfig(apiFilePath); if (apiConfig != null) { if (!ROOT_Q.equals(apiConfig.getQName())) { handleException("Invalid internal api configuration file"); } Iterator iterator = apiConfig.getChildrenWithName(HANDLER_Q); while (iterator.hasNext()) { OMElement handlerElem = (OMElement) iterator.next(); String name = null; if (handlerElem.getAttribute(NAME_ATT) != null) { name = handlerElem.getAttributeValue(NAME_ATT); } else { handleException("Name not defined in one or more handlers"); } if (handlerElem.getAttribute(CLASS_Q) != null) { String className = handlerElem.getAttributeValue(CLASS_Q); if (!className.isEmpty()) { InternalAPI internalApi = createAPI(className); if (internalApi != null) { internalApis.add(internalApi); internalApi.setName(name); } } else { handleException("Class name is null for Internal InternalAPI name : " + name); } } else { handleException("Class name not defined for Internal InternalAPI named : " + name); } } } return internalApis; }
Source:
public Message next() { Message message; do { updateFilter(); message = receiver.next(); } while (consuming && filter(message)); return message; }

Target:
public Message next() { Message message; do { message = receiver.next(); } while (consuming && filter(message)); return message; }
Source:
public void foreach(Callback<T> callback) { for (T pair : pairs) { Object observer = pair.observerRef.get(); if (observer == null) { pairs.remove(pair); } else if (cleared) { break; } else if (!pair.removed) { callback.onCalled(pair, observer); } } }

Target:
public void foreach(Callback<T> callback) { for (T pair : pairs) { if (cleared) { break; } else { Object observer = pair.observerRef.get(); if (observer == null) { pairs.remove(pair); } else if (!pair.removed) { callback.onCalled(pair, observer); } } } }
Source:
private CacheStoreHolder initDir(File cacheWorkDir, int grpId, int partitions, LongAdderMetric allocatedTracker, boolean encrypted) throws IgniteCheckedException { try { boolean dirExisted = checkAndInitCacheWorkDir(cacheWorkDir); File idxFile = new File(cacheWorkDir, INDEX_FILE_NAME); if (dirExisted && !idxFile.exists()) grpsWithoutIdx.add(grpId); FileVersionCheckingFactory pageStoreFactory = (FileVersionCheckingFactory)getPageStoreFactory(grpId, encrypted); if (encrypted) { int headerSize = pageStoreFactory.headerSize(pageStoreFactory.latestVersion()); ((EncryptedFileIOFactory)pageStoreFileIoFactory).headerSize(headerSize); ((EncryptedFileIOFactory)pageStoreV1FileIoFactory).headerSize(headerSize); } PageStore idxStore = pageStoreFactory.createPageStore( PageMemory.FLAG_IDX, idxFile, allocatedTracker); if (cctx.snapshotMgr() != null) idxStore.setListener(new SnapshotPageStoreListener(grpId, INDEX_PARTITION, cctx.snapshotMgr(), idxStore)); PageStore[] partStores = new PageStore[partitions]; for (int partId = 0; partId < partStores.length; partId++) { final int p = partId; PageStore partStore = pageStoreFactory.createPageStore( PageMemory.FLAG_DATA, () -> getPartitionFilePath(cacheWorkDir, p), allocatedTracker); if (cctx.snapshotMgr() != null) partStore.setListener(new SnapshotPageStoreListener(grpId, partId, cctx.snapshotMgr(), partStore)); partStores[partId] = partStore; } return new CacheStoreHolder(idxStore, partStores); } catch (IgniteCheckedException e) { if (X.hasCause(e, StorageException.class, IOException.class)) cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e)); throw e; } }

Target:
private CacheStoreHolder initDir(File cacheWorkDir, int grpId, int partitions, LongAdderMetric allocatedTracker, boolean encrypted) throws IgniteCheckedException { try { boolean dirExisted = checkAndInitCacheWorkDir(cacheWorkDir); File idxFile = new File(cacheWorkDir, INDEX_FILE_NAME); if (dirExisted && !idxFile.exists()) grpsWithoutIdx.add(grpId); FilePageStoreFactory pageStoreFactory = getPageStoreFactory(grpId, encrypted); PageStore idxStore = pageStoreFactory.createPageStore( PageMemory.FLAG_IDX, idxFile, allocatedTracker); PageStore[] partStores = new PageStore[partitions]; for (int partId = 0; partId < partStores.length; partId++) { final int p = partId; PageStore partStore = pageStoreFactory.createPageStore( PageMemory.FLAG_DATA, () -> getPartitionFilePath(cacheWorkDir, p), allocatedTracker); partStores[partId] = partStore; } return new CacheStoreHolder(idxStore, partStores); } catch (IgniteCheckedException e) { if (X.hasCause(e, StorageException.class, IOException.class)) cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e)); throw e; } }
Source:
public void whenConsumeWithJsonb_thenGetPerson() { String url = BASE_URL + API_PERSON + "/1"; String result = RestConsumer.consumeWithJsonb(url); Person person = JsonbBuilder.create().fromJson(result, Person.class); assertEquals(person.getId(), 1); assertEquals(person.getUsername(), "normanlewis"); assertEquals(person.getEmail(), "normanlewis@email.com"); }

Target:
public void whenConsumeWithJsonb_thenGetPerson() { String url = BASE_URL + API_PERSON + "/1"; String result = RestConsumer.consumeWithJsonb(url); Person person = JsonbBuilder.create().fromJson(result, Person.class); assertEquals(1, person.getId()); assertEquals("normanlewis", person.getUsername()); assertEquals("normanlewis@email.com", person.getEmail()); }
Source:
public Attribute fillAttribute(PerunSessionImpl perunSession, User user, AttributeDefinition attribute) throws InternalErrorException { Attribute filledAttribute = new Attribute(attribute); if (attribute.getFriendlyName().equals(attrNameFenix)) { filledAttribute.setValue(sha1HashCount(user, getDomainNameFenix()).toString() + getDomainNameFenix()); return filledAttribute; } else { return filledAttribute; } }

Target:
public Attribute fillAttribute(PerunSessionImpl perunSession, User user, AttributeDefinition attribute) throws InternalErrorException { Attribute filledAttribute = new Attribute(attribute); if (attribute.getFriendlyName().equals(attrNameFenix)) { String domain = "@" + getDomainNameFenix(); filledAttribute.setValue(sha1HashCount(user, domain).toString() + domain); return filledAttribute; } else { return filledAttribute; } }
Source:
public void deleteFolderWithAllCopiedFiles() throws Exception { final File directory = new File(DEST_PATH); if (directory.exists()) { FileUtils.cleanDirectory(directory); if (!directory.delete()) { throw new RuntimeException("Could not delete folder " + DEST_PATH); } } }

Target:
public void deleteFolderWithAllCopiedFiles() throws Exception { final File directory = new File(DEST_PATH); FileUtils.deleteDirectory(directory); }
Source:
private void configNonVpnNetwork() { final Network network = new Network(mNetwork); final Network[] networks = new Network[] {network}; doReturn(networks).when(sMockConnectivityManager).getAllNetworks(); final NetworkCapabilities nonVpnCapabilities = new NetworkCapabilities(); doReturn(nonVpnCapabilities).when(sMockConnectivityManager).getNetworkCapabilities(network); }

Target:
private void configNonVpnNetwork() { final Network[] networks = new Network[] {new Network(mNetwork)}; doReturn(networks).when(sMockConnectivityManager).getAllNetworks(); final NetworkCapabilities nonVpnCapabilities = new NetworkCapabilities() .addTransportType(NetworkCapabilities.TRANSPORT_WIFI); doReturn(nonVpnCapabilities).when(sMockConnectivityManager).getNetworkCapabilities( mNetwork); }
Source:
private static long getRecommendedMetaspaceSize(long loadedClassesCount) { return (loadedClassesCount * 5800) + 14000000; }

Target:
private static long getRecommendedMetaspaceSize(long loadedClassesCount) { return (loadedClassesCount * 5800) + 14_000_000; }
Source:
public static Endpoint createFixed(String url) { checkNotNull(url, "URL == null"); if (url.trim().length() == 0) { throw new IllegalArgumentException("URL is empty"); } final HttpUrl httpUrl = HttpUrl.parse(url); if (httpUrl == null) { throw new IllegalArgumentException("Invalid URL: " + url); } return new Endpoint() { @Override public HttpUrl url() { return httpUrl; } }; }

Target:
public static Endpoint createFixed(String url) { checkNotNull(url, "url == null"); if (url.trim().length() == 0) { throw new IllegalArgumentException("Empty URL"); } final HttpUrl httpUrl = HttpUrl.parse(url); if (httpUrl == null) { throw new IllegalArgumentException("Invalid URL: " + url); } return new Endpoint() { @Override public HttpUrl url() { return httpUrl; } }; }
Source:
public void cancelQuery( @QueryParam("uri") String uri, @QueryParam("hmac") String hash, @Context HttpServletRequest servletRequest, @Suspended AsyncResponse asyncResponse) { if (!hmac.hashString(uri, UTF_8).equals(HashCode.fromString(hash))) { throw badRequest(FORBIDDEN, "Failed to validate HMAC of URI"); } Request.Builder request = prepareDelete().setUri(URI.create(uri)); performRequest(servletRequest, asyncResponse, request, response -> responseWithHeaders(Response.noContent(), response)); }

Target:
public void cancelQuery( @QueryParam("uri") String uri, @QueryParam("hmac") String hash, @Context HttpServletRequest servletRequest, @Suspended AsyncResponse asyncResponse) { if (!hmac.hashString(uri, UTF_8).equals(HashCode.fromString(hash))) { throw badRequest(FORBIDDEN, "Failed to validate HMAC of URI"); } Request.Builder request = prepareDelete().setUri(URI.create(uri)); performRequest(servletRequest, asyncResponse, request, response -> responseWithHeaders(noContent(), response)); }
Source:
public void setImageList(List<Guid> value) { privateImageList = value; }

Target:
private void setImageList(List<Guid> value) { privateImageList = value; }
Source:
public void testCharacterUnboxingAutoReboxing() throws IOException { String translation = translateSourceFile( "class Test { " + "void test() { Character toChar = 'A', toInt = 'A', toLong = 'A', toFlt = 'A', toDbl = 'A'; " + "Object[] arr = {(char) toChar, (int) toInt, (long) toLong, (float) toFlt, (double) toDbl}; } }", "Test", "Test.m"); assertTranslation(translation, "IOSObjectArray *arr = [IOSObjectArray arrayWithObjects:(id[]){ " + "JavaLangCharacter_valueOfWithChar_([toChar charValue]), JavaLangInteger_valueOfWithInt_((jint) " + "[toInt charValue]), JavaLangLong_valueOfWithLong_((jlong) [toLong charValue]), " + "JavaLangFloat_valueOfWithFloat_((jfloat) [toFlt charValue]), JavaLangDouble_valueOfWithDouble_" + "((jdouble) [toDbl charValue]) } count:5 type:NSObject_class_()];"); }

Target:
public void testCharacterUnboxingAutoReboxing() throws IOException { String translation = translateSourceFile( "class Test { " + "void test() { " + "Character toChar = 'A', toInt = 'A', toLong = 'A', toFlt = 'A', toDbl = 'A'; " + "Object[] arr = " + "{(char) toChar, (int) toInt, (long) toLong, (float) toFlt, (double) toDbl}; } }", "Test", "Test.m"); assertTranslation( translation, "IOSObjectArray *arr = [IOSObjectArray arrayWithObjects:(id[]){ " + "JavaLangCharacter_valueOfWithChar_([toChar charValue]), " + "JavaLangInteger_valueOfWithInt_((jint) [toInt charValue]), " + "JavaLangLong_valueOfWithLong_((jlong) [toLong charValue]), " + "JavaLangFloat_valueOfWithFloat_((jfloat) [toFlt charValue])," + " JavaLangDouble_valueOfWithDouble_((jdouble) [toDbl charValue]) }" + " count:5 type:NSObject_class_()];"); }
Source:
private static Label createErrorLabel(Composite parent) { final Label label = new Label(parent, SWT.WRAP); Color color = new Color(parent.getDisplay(), 0xe7, 0x4c, 0x3c); label.setForeground(color); final FontDescriptor fd = FontDescriptor.createFrom(parent.getFont()); fd.setHeight(9); Font font = fd.createFont(parent.getDisplay()); label.setFont(font); label.addDisposeListener(e -> { color.dispose(); font.dispose(); }); return label; }

Target:
private static Label createErrorLabel(Composite parent) { final Label label = new Label(parent, SWT.WRAP); Color color = new Color(parent.getDisplay(), 0xe7, 0x4c, 0x3c); label.setForeground(color); final FontDescriptor fd = FontDescriptor.createFrom(parent.getFont()); fd.setHeight(9); Font font = fd.createFont(parent.getDisplay()); label.setFont(font); label.addDisposeListener(e -> { color.dispose(); fd.destroyFont(font); }); return label; }
Source:
public boolean configure(FeatureContext context) { if(context.getConfiguration().getRuntimeType() == RuntimeType.CLIENT) return false; Dispatcher dispatcher = ResteasyProviderFactory.getContextData(Dispatcher.class); if(dispatcher == null) { System.err.println("Creating new context for "+context.getConfiguration().getRuntimeType()+" deployment because it looks like we're in a special thread"); return false; } dispatcher.getDefaultContextObjects().put(Context.class, new Context()); return true; }

Target:
public boolean configure(FeatureContext context) { if(context.getConfiguration().getRuntimeType() == RuntimeType.CLIENT) return false; Dispatcher dispatcher = ResteasyProviderFactory.getContextData(Dispatcher.class); if(dispatcher == null) { return false; } dispatcher.getDefaultContextObjects().put(Context.class, new Context()); return true; }