auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Object postProcessAfterInitialization(final Object bean, final String beanName) { if (bean == null) { return null; } final Class<?> targetClass = getTargetClass(bean); final TaskChannel taskChannel = targetClass.getAnnotation(TaskChannel.class); if (taskChannel != null) { LOGGER.debug("The @TaskChannel annotation was found in {}", targetClass.getName()); doWithMethods(targetClass, new ReflectionUtils.MethodCallback() { <START> @Override <END> public void doWith(Method method) throws IllegalAccessException { Method targetMethod = findMethod( targetClass, method.getName(), method.getParameterTypes() ); if (targetMethod != null) { TaskAction taskAction = targetMethod.getAnnotation(TaskAction.class); if (taskAction != null) { String serviceInterface = getServiceInterface(targetClass); Channel channel = getChannel(taskChannel); addActionTaskEvent(channel, serviceInterface, targetMethod, taskAction); } } } }); } return bean; }</code><technical_language>Debug information actions etc. doWith</technical_language>

Target:
public Object postProcessAfterInitialization(final Object bean, final String beanName) { if (bean == null) { return null; } final Class<?> targetClass = getTargetClass(bean); final TaskChannel taskChannel = targetClass.getAnnotation(TaskChannel.class); if (taskChannel != null) { LOGGER.debug("The @TaskChannel annotation was found in {}", targetClass.getName()); doWithMethods(targetClass, new ReflectionUtils.MethodCallback() { @Override public void doWith(Method method) throws IllegalAccessException { Method targetMethod = findMethod( targetClass, method.getName(), method.getParameterTypes() ); if (targetMethod != null) { TaskAction taskAction = targetMethod.getAnnotation(TaskAction.class); if (taskAction != null) { LOGGER.debug("The @TaskAction annotation was found in method: {}", targetMethod.getName()); String serviceInterface = getServiceInterface(targetClass); Channel channel = getChannel(taskChannel); addActionTaskEvent(channel, serviceInterface, targetMethod, taskAction); } } } }); } return bean; }
Source:
<code>public PaginableDocumentModelListImpl run() throws OperationException { OperationChain chain = new OperationChain("operation"); Map<String, Object> vars = new HashMap<>(); { <START> StringList sl = new StringList(); <END> sl.add(searchTerm + (searchTerm.endsWith("%") ? "" : "%")); sl.add(DocumentPageProviderOperation.CURRENT_USERID_PATTERN); vars.put("queryParams", sl); vars.put("providerName", CollectionConstants.COLLECTION_PAGE_PROVIDER); } OperationParameters oparams = new OperationParameters(DocumentPageProviderOperation.ID, vars); chain.add(oparams); return (PaginableDocumentModelListImpl) service.run(ctx, chain); }</code><technical_language>adding a sub-scope for sl is worth it</technical_language>

Target:
public PaginableDocumentModelListImpl run() throws OperationException { StringList sl = new StringList(); sl.add(searchTerm + (searchTerm.endsWith("%") ? "" : "%")); sl.add(DocumentPageProviderOperation.CURRENT_USERID_PATTERN); OperationChain chain = new OperationChain("operation"); Map<String, Object> vars = new HashMap<>(); vars.put("queryParams", sl); vars.put("providerName", CollectionConstants.COLLECTION_PAGE_PROVIDER); OperationParameters oparams = new OperationParameters(DocumentPageProviderOperation.ID, vars); chain.add(oparams); return (PaginableDocumentModelListImpl) service.run(ctx, chain); }
Source:
<code>private void addTableFromEntity(Entity entity, List<String> tableList) { Table tbl; switch (entity.getType()) { case TABLE: <START> tbl = entity.getTable(); <END> break; case PARTITION: case DUMMYPARTITION: tbl = entity.getPartition().getTable(); break; default: return; } String fullTableName = AcidUtils.getFullTableName(tbl.getDbName(), tbl.getTableName()); if (AcidUtils.isTransactionalTable(tbl) && !tableList.contains(fullTableName)) { tableList.add(fullTableName); } }</code><technical_language>this a set instead</technical_language>

Target:
private void addTableFromEntity(Entity entity, List<String> tableList) { Table tbl; switch (entity.getType()) { case TABLE: { tbl = entity.getTable(); break; } case PARTITION: case DUMMYPARTITION: { tbl = entity.getPartition().getTable(); break; } default: { return; } } String fullTableName = AcidUtils.getFullTableName(tbl.getDbName(), tbl.getTableName()); if (AcidUtils.isTransactionalTable(tbl) && !tableList.contains(fullTableName)) { tableList.add(fullTableName); } }
Source:
<code>protected String getText(Object element, int columnIndex) { switch(columnIndex) { case PACKAGE_ELEMENT_COLUMN_INDEX: return umlLabelProvider.getText(element); case PROFILE_APPLICATION_NAME_COLUMN_INDEX: <START> if(element instanceof Profile) { <END> return ((Profile)element).getQualifiedName(); } default: return ""; } }</code><technical_language>this checking for instanceof ProfileApplication</technical_language>

Target:
protected String getText(Object element, int columnIndex) { switch(columnIndex) { case PACKAGE_ELEMENT_COLUMN_INDEX: return umlLabelProvider.getText(element); case PROFILE_APPLICATION_NAME_COLUMN_INDEX: if(element instanceof ProfileApplication) { return ((ProfileApplication)element).getAppliedProfile().getQualifiedName(); } default: return ""; } }
Source:
<code>public BaseResponseDto findProductDetail(ProductDetailRequestDto productDetailRequestDto) { if (productDetailRequestDto.getProductId() == null) { logger.error(MessageFormat.format("Product id is null (userId = {0})", productDetailRequestDto.getBaseParam().getUserId())); return new BaseResponseDto<>(ReturnMessage.POINTS_PRODUCT_IS_NOT_NULL.getCode(), ReturnMessage.POINTS_PRODUCT_IS_NOT_NULL.getMsg()); } ProductModel productModel = productMapper.findById(Long.parseLong(productDetailRequestDto.getProductId())); ProductDetailResponseDto productDetailResponseDto = new ProductDetailResponseDto(productModel); String[] description; <START> CouponModel couponModel = couponMapper.findById(productModel.getCouponId()); <END> if (productModel.getType() == GoodsType.COUPON && couponModel != null) { description = new String[]{couponModel.getAmount() > 0 ? MessageFormat.format("投资满{0}元即可使用;", couponModel.getAmount()) : "", MessageFormat.format("{0}天产品可用;", couponModel.getProductTypes().toString().replaceAll("_","")), MessageFormat.format("有效期限:{0}天。", couponModel.getDeadline())}; } else { description = new String[]{productModel.getDescription()}; } BaseResponseDto baseResponseDto = new BaseResponseDto(); productDetailResponseDto.setProductDes(Lists.newArrayList(description)); baseResponseDto.setData(productDetailResponseDto); baseResponseDto.setCode(ReturnMessage.SUCCESS.getCode()); return baseResponseDto; }</code><technical_language>List<String></technical_language>

Target:
public BaseResponseDto findProductDetail(ProductDetailRequestDto productDetailRequestDto) { if (productDetailRequestDto.getProductId() == null) { logger.info(MessageFormat.format("Product id is null (userId = {0})", productDetailRequestDto.getBaseParam().getUserId())); return new BaseResponseDto<>(ReturnMessage.POINTS_PRODUCT_IS_NOT_NULL.getCode(), ReturnMessage.POINTS_PRODUCT_IS_NOT_NULL.getMsg()); } ProductModel productModel = productMapper.findById(Long.parseLong(productDetailRequestDto.getProductId())); ProductDetailResponseDto productDetailResponseDto = new ProductDetailResponseDto(productModel.getId(),bannerServer + productModel.getImageUrl(),productModel.getName(),productModel.getPoints(),productModel.getType(),productModel.getTotalCount() - productModel.getUsedCount()); List<String> description = Lists.newArrayList(); CouponModel couponModel = couponMapper.findById(productModel.getCouponId()); if (productModel.getType() == GoodsType.COUPON && couponModel != null) { description.add(couponModel.getAmount() > 0 ? MessageFormat.format("投资满{0}元即可使用;", couponModel.getAmount()) : ""); description.add(MessageFormat.format("{0}天产品可用;", couponModel.getProductTypes().toString().replaceAll("_",""))); description.add(MessageFormat.format("有效期限:{0}天。", couponModel.getDeadline())); } else { description.add(productModel.getDescription()); } BaseResponseDto baseResponseDto = new BaseResponseDto(); productDetailResponseDto.setProductDes(Lists.newArrayList(description)); baseResponseDto.setData(productDetailResponseDto); baseResponseDto.setCode(ReturnMessage.SUCCESS.getCode()); baseResponseDto.setMessage(ReturnMessage.SUCCESS.getMsg()); return baseResponseDto; }
Source:
<code><START> public void largeBlobTest() <END> throws Exception { List<OperationInfo> opInfos = new ArrayList<>(); for (int i = 0; i < 2; i++) { Queue<OperationType> opChain = new LinkedList<>(); opChain.add(OperationType.PUT_NB); opChain.add(OperationType.AWAIT_CREATION); opChain.add(OperationType.GET_INFO_NB); opChain.add(OperationType.GET_NB); opChain.add(OperationType.DELETE_NB); opChain.add(OperationType.AWAIT_DELETION); opChain.add(OperationType.GET_INFO_DELETED_NB); opChain.add(OperationType.GET_DELETED_NB); opInfos.add(testFramework.startOperationChain(RouterServerTestFramework.CHUNK_SIZE * 4 + 1, i, opChain)); } testFramework.checkOperationChains(opInfos); }</code><technical_language>This test takes a long time finish mac, more 30s</technical_language>

Target:
public void largeBlobTest() throws Exception { final int blobSize = RouterServerTestFramework.CHUNK_SIZE * 2 + 1; List<OperationChain> opChains = new ArrayList<>(); for (int i = 0; i < 2; i++) { Queue<OperationType> operations = new LinkedList<>(); operations.add(OperationType.PUT_NB); operations.add(OperationType.AWAIT_CREATION); operations.add(OperationType.GET_INFO_NB); operations.add(OperationType.GET_NB); operations.add(OperationType.DELETE_NB); operations.add(OperationType.AWAIT_DELETION); operations.add(OperationType.GET_INFO_DELETED_NB); operations.add(OperationType.GET_DELETED_NB); opChains.add(testFramework.startOperationChain(blobSize, i, operations)); } testFramework.checkOperationChains(opChains); }
Source:
<code>public static BasisFunctionKnots fromKnots(double[] knots, int degree) { ArgumentChecker.notEmpty(knots, "knots"); ArgumentChecker.notNegative(degree, "degree"); <START> final int nKnots = knots.length; <END> ArgumentChecker.isTrue(nKnots - 3 * degree > 0, "Require at least knots for degree {}, only given {}", 3 * degree + 1, degree, nKnots); for (int i = 1; i < nKnots; i++) { ArgumentChecker.isTrue(knots[i] - knots[i - 1] > 0, "knots are not ascending"); } int nSplines = nKnots - degree - 1; return new BasisFunctionKnots(knots, degree, nSplines); }</code><technical_language>Remove final</technical_language>

Target:
public static BasisFunctionKnots fromKnots(double[] knots, int degree) { ArgumentChecker.notEmpty(knots, "knots"); ArgumentChecker.notNegative(degree, "degree"); int nKnots = knots.length; ArgumentChecker.isTrue(nKnots - 3 * degree > 0, "Require at least knots for degree {}, only given {}", 3 * degree + 1, degree, nKnots); for (int i = 1; i < nKnots; i++) { ArgumentChecker.isTrue(knots[i] - knots[i - 1] > 0, "knots are not ascending"); } int nSplines = nKnots - degree - 1; return new BasisFunctionKnots(knots, degree, nSplines); }
Source:
<code>protected void getAsync(AnnotationConfigApplicationContext context, String path, Callback<Void> callback) { Mono<ClientResponse> request = client(context).get().uri(path).exchange(); request.subscribe(new CoreSubscriber<ClientResponse>() { final AtomicReference<Subscription> ref = new AtomicReference<>(); @Override public void onSubscribe(Subscription s) { if (Operators.validate(ref.getAndSet(s), s)) { s.request(Long.MAX_VALUE); } else { s.cancel(); } } @Override public void onNext(ClientResponse clientResponse) { if (ref.getAndSet(null) != null) { callback.onSuccess(null); } else { Operators.onNextDropped(clientResponse, currentContext()); } } @Override public void onError(Throwable t) { if (ref.getAndSet(null) != null) { callback.onError(t); } } @Override public void onComplete() { if (ref.getAndSet(null) != null) { <START> callback.onError( <END> new RuntimeException("onComplete() called before onNext!")); } } @Override public Context currentContext() { return Context.empty(); } }); }</code><technical_language>path testing "empty source" case? ie. if ref set null previously, means completed directly, aka. source is empty. this is error. note a well-formed source guarantee onNext-before-onComplete order</technical_language>

Target:
protected void getAsync(AnnotationConfigApplicationContext context, String path, Callback<Void> callback) { Mono<ClientResponse> request = client(context).get().uri(path).exchange(); TestCallbackSubscriber.subscribe(request, callback); }
Source:
<code>public int runCmd(CommandLine cmdLine) throws Exception { LedgerManagerFactory mFactory = null; LedgerManager m = null; try { <START> mFactory = LedgerManagerFactory.newLedgerManagerFactory( <END> bkConf, RegistrationManager.instantiateRegistrationManager(bkConf).getLayoutManager()); m = mFactory.newLedgerManager(); LedgerRangeIterator iter = m.getLedgerRanges(); if (cmdLine.hasOption("m")) { List<ReadMetadataCallback> futures = new ArrayList<ReadMetadataCallback>(LIST_BATCH_SIZE); while (iter.hasNext()) { LedgerRange r = iter.next(); for (Long lid : r.getLedgers()) { ReadMetadataCallback cb = new ReadMetadataCallback(lid); m.readLedgerMetadata(lid, cb); futures.add(cb); } if (futures.size() >= LIST_BATCH_SIZE) { while (futures.size() > 0) { ReadMetadataCallback cb = futures.remove(0); printLedgerMetadata(cb); } } } while (futures.size() > 0) { ReadMetadataCallback cb = futures.remove(0); printLedgerMetadata(cb); } } else { while (iter.hasNext()) { LedgerRange r = iter.next(); for (Long lid : r.getLedgers()) { System.out.println(ledgerIdFormatter.formatLedgerId(lid)); } } } } finally { if (m != null) { try { m.close(); mFactory.uninitialize(); } catch (IOException ioe) { LOG.error("Failed to close ledger manager : ", ioe); } } } return 0; }</code><technical_language>I lacking some close(). considering adding a close() method LedgerManagerFactory AutoCloseable in order try-with-resources</technical_language>

Target:
public int runCmd(CommandLine cmdLine) throws Exception { try (LedgerManagerFactory mFactory = LedgerManagerFactory.newLedgerManagerFactory( bkConf, RegistrationManager.instantiateRegistrationManager(bkConf).getLayoutManager())) { try (LedgerManager m = mFactory.newLedgerManager()) { LedgerRangeIterator iter = m.getLedgerRanges(); if (cmdLine.hasOption("m")) { List<ReadMetadataCallback> futures = new ArrayList<ReadMetadataCallback>(LIST_BATCH_SIZE); while (iter.hasNext()) { LedgerRange r = iter.next(); for (Long lid : r.getLedgers()) { ReadMetadataCallback cb = new ReadMetadataCallback(lid); m.readLedgerMetadata(lid, cb); futures.add(cb); } if (futures.size() >= LIST_BATCH_SIZE) { while (futures.size() > 0) { ReadMetadataCallback cb = futures.remove(0); printLedgerMetadata(cb); } } } while (futures.size() > 0) { ReadMetadataCallback cb = futures.remove(0); printLedgerMetadata(cb); } } else { while (iter.hasNext()) { LedgerRange r = iter.next(); for (Long lid : r.getLedgers()) { System.out.println(ledgerIdFormatter.formatLedgerId(lid)); } } } } } return 0; }
Source:
<code><START> public NGuid getStorageDomainId() { <END> DiskImage firstImage = null; NGuid result = null; if (diskInfoMap.size() > 0) { Iterator<DiskImage> iterator = diskInfoMap.values().iterator(); firstImage = iterator.next(); result = ImagesHandler.getStorageDomainId(firstImage); } return result; }</code><technical_language>this check for single domain? I thought command support multiple storage domains</technical_language>

Target:
public NGuid getStorageDomainId() { List<DiskImage> images = getDiskImageDao().getAllSnapshotsForVmSnapshot(sourceSnapshotId); return (!images.isEmpty()) ? ImagesHandler.getStorageDomainId(images.get(0)) : Guid.Empty; }
Source:
<code>public Response getRemoteByUrl( final @PathParam( "packageType" ) String packageType, <START> final @ApiParam( allowableValues = "remote", required = true ) <END> @PathParam( "type" ) String type, final @QueryParam( "url" ) String url, @Context final HttpServletRequest request, final @Context SecurityContext securityContext ) { if ( !"remote".equals( type ) ) { return ResponseUtils.formatBadRequestResponse( String.format( "Not supporte repository type of %s", type ) ); } logger.info( "Get remote repository by url: {}", url ); Response response; try { final RemoteRepository remote = adminController.getRemoteByUrl( url ); logger.info( "Returning remote repository: {}", remote ); if ( remote == null ) { response = Response.status( Status.NOT_FOUND ) .build(); } else { response = formatOkResponseWithJsonEntity( remote, objectMapper ); } } catch ( final IndyWorkflowException e ) { logger.error( e.getMessage(), e ); response = formatResponse( e ); } return response; }</code><technical_language>I understand meaning of this param. If is allowed sense for remote repos, I remove this one. EDIT: Sorry, I I understand now, needs of path variable. ignore this one</technical_language>

Target:
public Response getRemoteByUrl( final @PathParam( "packageType" ) String packageType, final @ApiParam( allowableValues = "remote", required = true ) @PathParam( "type" ) String type, final @QueryParam( "url" ) String url, @Context final HttpServletRequest request, final @Context SecurityContext securityContext ) { if ( !"remote".equals( type ) ) { return ResponseUtils.formatBadRequestResponse( String.format( "Not supporte repository type of %s", type ) ); } logger.info( "Get remote repository by url: {}", url ); Response response; try { final List<RemoteRepository> remotes = adminController.getRemoteByUrl( url ); logger.info( "According to url {}, Returning remote listing remote repositories: {}", url, remotes ); if ( remotes == null || remotes.isEmpty() ) { response = Response.status( Status.NOT_FOUND ).build(); } else { final StoreListingDTO<RemoteRepository> dto = new StoreListingDTO<>( remotes ); response = formatOkResponseWithJsonEntity( dto, objectMapper ); } } catch ( final IndyWorkflowException e ) { logger.error( e.getMessage(), e ); response = formatResponse( e ); } return response; }
Source:
<code>@Override protected RepositoryMetadata getRepositoryMetadata(Class<?> repoItf) { Assert.notNull(repoItf, "Repository interface must be set."); Assert.isAssignable(IgniteRepository.class, repoItf, "Repository must implement IgniteRepository interface."); RepositoryConfig annotation = repoItf.getAnnotation(RepositoryConfig.class); Assert.notNull(annotation, "Set a name of an Apache Ignite cache using @RepositoryConfig annotation to map " + "this repository to the underlying cache."); Assert.hasText(annotation.cacheName(), "Set a name of an Apache Ignite cache using @RepositoryConfig " + "annotation to map this repository to the underlying cache."); String cacheName = null; if (!looksLikeExpression(annotation.cacheName())) { <START> cacheName = annotation.cacheName(); <END> } else { SpelExpressionParser parser = new SpelExpressionParser(); Expression expression = parser.parseExpression(annotation.cacheName()); StandardEvaluationContext ec = new StandardEvaluationContext(); ec.setBeanResolver(new BeanFactoryResolver(ctx.getAutowireCapableBeanFactory())); cacheName = (String)expression.getValue(ec); } repoToCache.put(repoItf, cacheName); return super.getRepositoryMetadata(repoItf); }</code><technical_language>line if statements brackets: java if (!looksLikeExpression(annotation.cacheName())) cacheName = annotation.cacheName();</technical_language>

Target:
@Override protected RepositoryMetadata getRepositoryMetadata(Class<?> repoItf) { Assert.notNull(repoItf, "Repository interface must be set."); Assert.isAssignable(IgniteRepository.class, repoItf, "Repository must implement IgniteRepository interface."); RepositoryConfig annotation = repoItf.getAnnotation(RepositoryConfig.class); Assert.notNull(annotation, "Set a name of an Apache Ignite cache using @RepositoryConfig annotation to map " + "this repository to the underlying cache."); Assert.hasText(annotation.cacheName(), "Set a name of an Apache Ignite cache using @RepositoryConfig " + "annotation to map this repository to the underlying cache."); String cacheName = evaluateExpression(annotation.cacheName()); repoToCache.put(repoItf, cacheName); return super.getRepositoryMetadata(repoItf); }
Source:
<code>public long getAgedQueuedFlowSize() { long size = 0L; <START> int minimum_age_minutes = this.azkProps.getInt( <END> ConfigurationKeys.MIN_AGE_FOR_CLASSIFYING_A_JOB_AGED_MINUTES, Constants.MIN_AGE_FOR_CLASSIFYING_A_FLOW_AGED_MINUTES); try { size = this.executorLoader.fetchAgedQueuedFlows(Duration.ofMinutes(minimum_age_minutes)) .size(); } catch (final ExecutorManagerException e) { this.logger.error("Failed to get flows queued for a long time.", e); } return size; }</code><technical_language>invalid values for this (such a negative) checked in stack</technical_language>

Target:
public long getAgedQueuedFlowSize() { long size = 0L; int minimum_age_minutes = this.azkProps.getInt( ConfigurationKeys.MIN_AGE_FOR_CLASSIFYING_A_FLOW_AGED_MINUTES, Constants.DEFAULT_MIN_AGE_FOR_CLASSIFYING_A_FLOW_AGED_MINUTES); try { size = this.executorLoader.fetchAgedQueuedFlows(Duration.ofMinutes(minimum_age_minutes)) .size(); } catch (final ExecutorManagerException e) { this.logger.error("Failed to get flows queued for a long time.", e); } return size; }
Source:
<code>private void redeployStreamModule(CuratorFramework client, ModuleDeployment moduleDeployment) throws Exception { Stream stream = (Stream) moduleDeployment.deploymentUnit; ModuleDescriptor moduleDescriptor = moduleDeployment.moduleDescriptor; ModuleDeploymentProperties deploymentProperties = moduleDeployment.deploymentProperties; final ModuleDeploymentProperties mergedProperties = DeploymentPropertiesUtility.createModuleDeploymentProperties( stream.getDeploymentProperties(), moduleDescriptor); mergedProperties.putAll(deploymentProperties); ModuleDeploymentStatus deploymentStatus = null; if (mergedProperties.getCount() > 0) { try { <START> client.setData().forPath( <END> Paths.build(Paths.STREAM_DEPLOYMENTS, stream.getName(), Paths.STATUS), ZooKeeperUtils.mapToBytes(new DeploymentUnitStatus( DeploymentUnitStatus.State.deploying).toMap())); deploymentStatus = moduleDeploymentWriter.writeDeployment( moduleDescriptor, mergedProperties, instantiateContainerMatcher(client, moduleDescriptor)); } catch (NoContainerException e) { logger.warn("No containers available for redeployment of for stream {}", moduleDescriptor.getModuleLabel(), stream.getName()); } finally { updateDeploymentUnitState(client, moduleDeployment, deploymentStatus); } } else { logUnwantedRedeployment(mergedProperties.getCriteria(), moduleDescriptor.getModuleLabel()); } }</code><technical_language>factor out a method like: updateStreamState(client, streamname, state)</technical_language>

Target:
private void redeployStreamModule(CuratorFramework client, ModuleDeployment moduleDeployment) throws Exception { Stream stream = (Stream) moduleDeployment.deploymentUnit; ModuleDescriptor moduleDescriptor = moduleDeployment.moduleDescriptor; ModuleDeploymentProperties deploymentProperties = moduleDeployment.deploymentProperties; final ModuleDeploymentProperties mergedProperties = DeploymentPropertiesUtility.createModuleDeploymentProperties( stream.getDeploymentProperties(), moduleDescriptor); mergedProperties.putAll(deploymentProperties); ModuleDeploymentStatus deploymentStatus = null; if (mergedProperties.getCount() > 0) { try { deploymentStatus = deployModule(client, moduleDeployment, instantiateContainerMatcher(client, moduleDescriptor)); } catch (NoContainerException e) { logger.warn("No containers available for redeployment of for stream {}", moduleDescriptor.getModuleLabel(), stream.getName()); } finally { updateDeploymentUnitState(client, moduleDeployment, deploymentStatus); } } else { logUnwantedRedeployment(mergedProperties.getCriteria(), moduleDescriptor.getModuleLabel()); } }
Source:
<code>public DocumentModel run(DocumentModel input) throws IOException { PDFTextExtractor textExtractor = new PDFTextExtractor(input, pdfxpath); textExtractor.setPassword(password); String extractedText; if (StringUtils.isBlank(patterntofind)) { extractedText = textExtractor.getAllExtractedLines(); } else { extractedText = removepatternfromresult ? textExtractor.extractLastPartOfLine(patterntofind) : textExtractor.extractLineOf(patterntofind); } <START> if (extractedText != null) { <END> input.setPropertyValue(targetxpath, extractedText); } else { DocumentHelper.removeProperty(input, targetxpath); } if (save) { input = session.saveDocument(input); } return input; }</code><technical_language>one. For readability write this as: if (StringUtils.isBlank(patterntofind)) { extractedText = textExtractor.getAllExtractedLines(); } else if (removepatternfromresult) { extractedText = textExtractor.extractLastPartOfLine(patterntofind); } else { extractedText = textExtractor.extractLineOf(patterntofind); }</technical_language>

Target:
public DocumentModel run(DocumentModel input) throws IOException { PDFTextExtractor textExtractor = new PDFTextExtractor(input, pdfxpath); textExtractor.setPassword(password); String extractedText; if (StringUtils.isBlank(patterntofind)) { extractedText = textExtractor.getAllExtractedLines(); } else if (removepatternfromresult) { extractedText = textExtractor.extractLastPartOfLine(patterntofind); } else { extractedText = textExtractor.extractLineOf(patterntofind); } if (extractedText != null) { input.setPropertyValue(targetxpath, extractedText); } else { DocumentHelper.removeProperty(input, targetxpath); } if (save) { input = session.saveDocument(input); } return input; }
Source:
<code>public void refreshAllUsers() { DbUserDAO dao = DbFacade.getInstance().getDbUserDao(); List<DbUser> dbUsers = dao.getAll(); <START> dbGroups.clear(); <END> for (DbGroup dbGroup : DbFacade.getInstance().getDbGroupDao().getAll()) { MultiValueMapUtils.addToMap(dbGroup.getNamespace(), dbGroup, dbGroups); } Map<String, List<DbUser>> authzToPrincipalMap = new HashMap<>(); Map<String, ExtensionProxy> authzMap = new HashMap<>(); for (DbUser dbUser : dbUsers) { ExtensionProxy authz = EngineExtensionsManager.getInstance().getExtensionByName(dbUser.getDomain()); if (authz == null) { log.warn(String.format("No authz extension was found for user %1$s. It is possible that the relevant " + "domain for the user was removed for the user. Marking the user as inactive", dbUser.getLoginName())); if (dbUser.isActive()) { dbUser.setActive(false); dao.update(dbUser); } continue; } String auhtzName = AuthzUtils.getName(authz); MultiValueMapUtils.addToMap(auhtzName, dbUser, authzToPrincipalMap); authzMap.put(auhtzName, authz); } List<DbUser> updates = new ArrayList<>(); for (Map.Entry<String, List<DbUser>> entry : authzToPrincipalMap.entrySet()) { List<DbUser> refreshed = refreshUsers(entry.getValue(), authzMap.get(entry.getKey())); updates.addAll(refreshed); } for (DbUser dbUser : updates) { dao.update(dbUser); } }</code><technical_language>if clear need a parameter object state</technical_language>

Target:
public void refreshAllUsers() { DbUserDAO dao = DbFacade.getInstance().getDbUserDao(); List<DbUser> dbUsers = dao.getAll(); Map<String, List<DbGroup>> dbGroups = new HashMap<>(); for (DbGroup dbGroup : DbFacade.getInstance().getDbGroupDao().getAll()) { MultiValueMapUtils.addToMap(dbGroup.getNamespace(), dbGroup, dbGroups); } Map<String, List<DbUser>> authzToPrincipalMap = new HashMap<>(); Map<String, ExtensionProxy> authzMap = new HashMap<>(); for (DbUser dbUser : dbUsers) { ExtensionProxy authz = EngineExtensionsManager.getInstance().getExtensionByName(dbUser.getDomain()); if (authz == null) { log.warn(String.format("No authz extension was found for user %1$s. It is possible that the relevant " + "domain for the user was removed for the user. Marking the user as inactive", dbUser.getLoginName())); if (dbUser.isActive()) { dbUser.setActive(false); dao.update(dbUser); } continue; } String auhtzName = AuthzUtils.getName(authz); MultiValueMapUtils.addToMap(auhtzName, dbUser, authzToPrincipalMap); authzMap.put(auhtzName, authz); } List<DbUser> updates = new ArrayList<>(); for (Map.Entry<String, List<DbUser>> entry : authzToPrincipalMap.entrySet()) { List<DbUser> refreshed = refreshUsers(entry.getValue(), authzMap.get(entry.getKey()), dbGroups); updates.addAll(refreshed); } for (DbUser dbUser : updates) { dao.update(dbUser); } }
Source:
<code>private Map<String, String> getCallsToDockerMap(String mainDescriptor, String defaultContainer) { Map<String, String> map = new HashMap<>(); try { List<GroovySourceAST> processList = getGroovySourceASTList(mainDescriptor, "process"); for (GroovySourceAST processAST : processList) { String processName; try { processName = getProcessValue(processAST); <START> } catch (NullPointerException e) { <END> continue; } GroovySourceAST containerAST = getFirstAstWithKeyword(processAST, "container", false); String containerName; if (containerAST != null) { containerName = containerAST.getNextSibling().getFirstChild().getText(); } else { containerName = defaultContainer; } if (containerName != null) { map.put(processName, containerName); LOG.debug("found container: " + containerName + " in process " + processName); } } } catch (IOException | TokenStreamException | RecognitionException e) { LOG.warn("could not parse", e); } return map; }</code><technical_language>getProcessValue throw NPE -- catch in return null. I need a null check instead of a catch. better, IMHO, getProcessValue return Optional<String>, getProcessValue(processAST).ifPresent(processName -> { ... });</technical_language>

Target:
private Map<String, String> getCallsToDockerMap(String mainDescriptor, String defaultContainer) { Map<String, String> map = new HashMap<>(); try { List<GroovySourceAST> processList = getGroovySourceASTList(mainDescriptor, "process"); for (GroovySourceAST processAST : processList) { String processName = getProcessValue(processAST); if (processName == null) { continue; } GroovySourceAST containerAST = getFirstAstWithKeyword(processAST, "container", false); String containerName; if (containerAST != null) { containerName = containerAST.getNextSibling().getFirstChild().getText(); } else { containerName = defaultContainer; } if (containerName != null) { map.put(processName, containerName); LOG.debug("found container: " + containerName + " in process " + processName); } } } catch (IOException | TokenStreamException | RecognitionException e) { LOG.warn("could not parse", e); } return map; }
Source:
<code>public void testParsingJats10() throws Exception { String filePath = "/eu/dnetlib/iis/workflows/ingest/pmc/metadata/data/document_jats10.xml"; InputStream inputStream = null; try { SAXParserFactory saxFactory = SAXParserFactory.newInstance(); saxFactory.setValidating(false); SAXParser saxParser = saxFactory.newSAXParser(); XMLReader reader = saxParser.getXMLReader(); reader.setFeature("<LINK_2>", false); reader.setFeature("<LINK_0>", false); reader.setFeature("<LINK_1>", false); ExtractedDocumentMetadata.Builder metaBuilder = ExtractedDocumentMetadata.newBuilder(); metaBuilder.setId("some-id"); metaBuilder.setText(""); PmcXmlHandler pmcXmlHandler = new PmcXmlHandler(metaBuilder); saxParser.parse(inputStream = PmcXmlHandler.class.getResourceAsStream(filePath), pmcXmlHandler); checkJats10Metadata(metaBuilder.build()); } finally { if (inputStream != null) { inputStream.close(); <START> } <END> } }</code><technical_language>If inputStream declared class variable, closed in @After section of junit test. omit try/finally block in test methods</technical_language>

Target:
public void testParsingJats10() throws Exception { saxParser.parse(inputStream = PmcXmlHandler.class .getResourceAsStream(xmlResourcesRootClassPath + "document_jats10.xml"), pmcXmlHandler); checkJats10Metadata(metaBuilder.build()); }
Source:
<code>public void testShowTablesLikeWithEscape() { <START> MaterializedResult withEscape = computeActual("SHOW TABLES LIKE '%$_%' ESCAPE '$'"); <END> assertThat(withEscape.getOnlyColumnAsSet()).allMatch(tableName -> ((String) tableName).contains("_")); }</code><technical_language>s/withEscape/result/</technical_language>

Target:
public void testShowTablesLikeWithEscape() { }
Source:
<code>public Object getCompareValue(FormElementModel fem, String value) { switch (fem.getElementType()) { case BOOLEAN: return WebUtils.parseBoolean(value); <START> case JRDATETIME: <END> return WebUtils.parseDate(value); case JRDATE: return WebUtils.parseDate(value); case JRTIME: return WebUtils.parseDate(value); case INTEGER: return Long.valueOf(value); case DECIMAL: return new BigDecimal(value); case SELECT1: return value; case STRING: return value; case GEOPOINT: return new BigDecimal(value); default: throw new IllegalArgumentException("Can't get the compare value for FormElementModel type " + fem.getElementType()); } }</code><technical_language>suggestion consolidating cases</technical_language>

Target:
public Object getCompareValue(FormElementModel fem, String value) { switch (fem.getElementType()) { case BOOLEAN: return WebUtils.parseBoolean(value); case JRDATETIME: case JRDATE: case JRTIME: return WebUtils.parseDate(value); case INTEGER: return Long.valueOf(value); case DECIMAL: return new BigDecimal(value); case SELECT1: case STRING: return value; case GEOPOINT: return new BigDecimal(value); default: throw new IllegalArgumentException("Can't get the compare value for FormElementModel type " + fem.getElementType()); } }
Source:
<code>private void test_expected_event_types(boolean withNaturalEventType, final int numOfAddEventExpected, final int numOfUpdateEventExpected) { Config config = getConfig(); config.setProperty(PROP_LISTENER_WITH_PREDICATE_PRODUCES_NATURAL_EVENT_TYPES, String.valueOf(withNaturalEventType)); <START> config.setProperty("hazelcast.logging.type", "log4j2"); <END> HazelcastInstance node = createHazelcastInstance(config); final AtomicInteger addedEntryCount = new AtomicInteger(); final AtomicInteger updatedEntryCount = new AtomicInteger(); IMap<Integer, Employee> map = node.getMap("test"); map.addEntryListener(new MapListenerAdapter<Integer, Employee>() { @Override public void entryAdded(EntryEvent<Integer, Employee> event) { addedEntryCount.incrementAndGet(); } @Override public void entryUpdated(EntryEvent<Integer, Employee> event) { updatedEntryCount.incrementAndGet(); } }, greaterEqual("age", 3), true); int key = 1; map.set(key, new Employee(1)); map.set(key, new Employee(2)); map.set(key, new Employee(3)); map.set(key, new Employee(4)); assertTrueEventually(new AssertTask() { @Override public void run() { assertEquals(numOfAddEventExpected, addedEntryCount.get()); assertEquals(numOfUpdateEventExpected, updatedEntryCount.get()); } }); }</code><technical_language>expliciitly configuring logging</technical_language>

Target:
private void test_expected_event_types(boolean withNaturalEventType, final int numOfAddEventExpected, final int numOfUpdateEventExpected) { Config config = getConfig(); config.setProperty(PROP_LISTENER_WITH_PREDICATE_PRODUCES_NATURAL_EVENT_TYPES, String.valueOf(withNaturalEventType)); HazelcastInstance node = createHazelcastInstance(config); final AtomicInteger addedEntryCount = new AtomicInteger(); final AtomicInteger updatedEntryCount = new AtomicInteger(); IMap<Integer, Employee> map = node.getMap("test"); map.addEntryListener(new MapListenerAdapter<Integer, Employee>() { @Override public void entryAdded(EntryEvent<Integer, Employee> event) { addedEntryCount.incrementAndGet(); } @Override public void entryUpdated(EntryEvent<Integer, Employee> event) { updatedEntryCount.incrementAndGet(); } }, greaterEqual("age", 3), true); int key = 1; map.set(key, new Employee(1)); map.set(key, new Employee(2)); map.set(key, new Employee(3)); map.set(key, new Employee(4)); assertTrueEventually(new AssertTask() { @Override public void run() { assertEquals(numOfAddEventExpected, addedEntryCount.get()); assertEquals(numOfUpdateEventExpected, updatedEntryCount.get()); } }); }
Source:
<code>public synchronized long getPeakMemoryUsage() { <START> return delegate.getPeakMemoryUsage(); <END> }</code><technical_language>delegate null. copy pattern of code in other methods isOverutilized</technical_language>

Target:
public long getPeakMemoryUsage() { OutputBuffer outputBuffer; synchronized (this) { outputBuffer = delegate; } if (outputBuffer != null) { return outputBuffer.getPeakMemoryUsage(); } return 0; }
Source:
<code>public TmfGraphBuildRequest(ITmfGraphProvider provider, IProgressMonitor monitor) { super(TmfEvent.class, TmfTimeRange.ETERNITY, 0, ITmfEventRequest.ALL_DATA, ITmfEventRequest.ExecutionType.BACKGROUND); fProvider = provider; long nbEvents = provider.getTrace().getNbEvents(); fEventFactor = nbEvents / DEFAULT_FACTOR; <START> fMonitor = SubMonitor.convert(monitor, DEFAULT_FACTOR + 2); <END> }</code><technical_language>I get it... For 10,000 events call worked(1) 100 times</technical_language>

Target:
public TmfGraphBuildRequest(ITmfGraphProvider provider, IProgressMonitor monitor) { super(TmfEvent.class, TmfTimeRange.ETERNITY, 0, ITmfEventRequest.ALL_DATA, ITmfEventRequest.ExecutionType.BACKGROUND); fProvider = provider; long nbEvents = provider.getTrace().getNbEvents(); fEventFactor = Math.max(DEFAULT_FACTOR, nbEvents / DEFAULT_FACTOR); fMonitor = SubMonitor.convert(monitor, DEFAULT_FACTOR + 2); }
Source:
<code>private void parseAll() throws ConfigInvalidException, IOException { walk.markStart(walk.parseCommit(tip)); for (RevCommit commit : walk) { <START> walk.parseBody(commit); <END> parse(commit); } pruneReviewers(); for (Collection<PatchSetApproval> v : approvals.asMap().values()) { Collections.sort((List<PatchSetApproval>) v, PSA_BY_TIME); } }</code><technical_language>Unnecessary rewalking a previously walked graph</technical_language>

Target:
private void parseAll() throws ConfigInvalidException, IOException { walk.markStart(walk.parseCommit(tip)); for (RevCommit commit : walk) { parse(commit); } pruneReviewers(); for (Collection<PatchSetApproval> v : approvals.asMap().values()) { Collections.sort((List<PatchSetApproval>) v, PSA_BY_TIME); } }
Source:
<code>public synchronized ILogData current() { final QueuedStreamContext context = getCurrentContext(); if (Address.nonAddress(context.getGlobalPointer())) { return null; } <START> return read(context.getGlobalPointer()); <END> }</code><technical_language>checking compaction mark here</technical_language>

Target:
public synchronized ILogData current() { final QueuedStreamContext context = getCurrentContext(); if (Address.nonAddress(context.getGlobalPointer())) { return null; } return read(context.getGlobalPointer(), context.getGlobalPointer()); }
Source:
<code><START> public String getDefaultSchemaName() { <END> return defaultSchemaName; }</code><technical_language>public instead of protected</technical_language>

Target:
protected String getDefaultSchemaName() { return defaultSchemaName; }
Source:
<code>String cause() default ""; } public interface Condition { boolean shouldIgnore(); <START> default boolean supportClassRule() { <END> return false; } }</code><technical_language>supportsClassRulle()</technical_language>

Target:
String cause() default ""; } public interface Condition { boolean shouldIgnore(); default boolean supportsClassRule() { return false; } }
Source:
<code>public static void log(Throwable e) { <START> log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, e.getLocalizedMessage(), e)); <END> }</code><technical_language>localized? localize log message, if a translated IOException in log hard understand submit bug</technical_language>

Target:
public static void log(Throwable e) { log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, e.getMessage(), e)); }
Source:
<code>public String getName(IterationInfo iteration) { FeatureInfo feature = iteration.getFeature(); if (!feature.isReportIterations()) { return feature.getName(); } StringJoiner nameJoiner = new StringJoiner(", ", "[", "]"); Map<String, Object> dataVariables = iteration.getDataVariables(); if (dataVariables != null) { dataVariables.forEach((name, value) -> <START> nameJoiner.add(format("%s: %s", name, GroovyRuntimeUtil.toString(value)))); <END> } nameJoiner.add(format("iterationIndex: %d", iteration.getIterationIndex())); return format("%s %s", feature.getName(), nameJoiner.toString()); }</code><technical_language>org.spockframework.util.RenderUtil#toStringOrDump instead</technical_language>

Target:
public String getName(IterationInfo iteration) { FeatureInfo feature = iteration.getFeature(); if (!feature.isReportIterations()) { return feature.getName(); } StringJoiner nameJoiner = new StringJoiner(", ", "[", "]"); Map<String, Object> dataVariables = iteration.getDataVariables(); if (dataVariables != null) { dataVariables.forEach((name, value) -> { String valueString; try { valueString = toStringOrDump(value); } catch (Exception e) { valueString = format("#Error:%s during rendering", e.getClass().getSimpleName()); } nameJoiner.add(format("%s: %s", name, valueString)); }); } nameJoiner.add(format("#%d", iteration.getIterationIndex())); return format("%s %s", feature.getName(), nameJoiner.toString()); }
Source:
<code>public byte[] doFinal(byte[] input) throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException { hmac.update(input); byte[] hash = hmac.doFinal(aadLength); byte[] tag = new byte[hmacKey.length]; System.arraycopy(hash, 0, tag, 0, hmacKey.length); if (!ByteExtensions.sequenceEqualConstantTime(tag, tag)) { <START> throw new IllegalArgumentException("Data is not authentic"); <END> } return inner.doFinal(input); }</code><technical_language>logger.logAndThrow() instead of throwing. Update other places in this java file</technical_language>

Target:
public byte[] doFinal(byte[] input) throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException { hmac.update(input); byte[] hash = hmac.doFinal(aadLength); byte[] tag = new byte[hmacKey.length]; System.arraycopy(hash, 0, tag, 0, hmacKey.length); if (!ByteExtensions.sequenceEqualConstantTime(tag, tag)) { logger.logAndThrow(new IllegalArgumentException("Data is not authentic")); } return inner.doFinal(input); }
Source:
<code>public void setAtomInfo(String atomName, int serialNumber, char alternativeLocationId, float x, float y, float z, float occupancy, float temperatureFactor, String element, int charge) { Atom atom = new AtomImpl(); Group altGroup = null; atom.setPDBserial(serialNumber); atom.setName(atomName.trim()); atom.setElement(Element.valueOfIgnoreCase(element)); if(alternativeLocationId==MmtfStructure.UNAVAILABLE_CHAR_VALUE){ alternativeLocationId = ' '; } if (alternativeLocationId != ' ') { altGroup = getCorrectAltLocGroup(alternativeLocationId); atom.setAltLoc(alternativeLocationId); } else { atom.setAltLoc(Character.valueOf(' ')); } atom.setX(x); atom.setY(y); atom.setZ(z); atom.setOccupancy(occupancy); atom.setTempFactor(temperatureFactor); atom.setCharge((short) charge); if (altGroup == null) { group.addAtom(atom); } else { altGroup.setChain(chain); altGroup.addAtom(atom); } if (!group.hasAtom(atom.getName())) { if (group.getPDBName().equals(atom.getGroup().getPDBName())) { if(StructureTools.hasNonDeuteratedEquiv(atom,group)){ } else{ group.addAtom(atom); <START> } <END> } } atomsInGroup.add(atom); allAtoms[atomCounter] = atom; atomCounter++; }</code><technical_language>inverse logic here? good practice leave empty if blocks... If I read in 2 years time I forgot add some code in if block</technical_language>

Target:
public void setAtomInfo(String atomName, int serialNumber, char alternativeLocationId, float x, float y, float z, float occupancy, float temperatureFactor, String element, int charge) { Atom atom = new AtomImpl(); Group altGroup = null; atom.setPDBserial(serialNumber); atom.setName(atomName.trim()); atom.setElement(Element.valueOfIgnoreCase(element)); if(alternativeLocationId==MmtfStructure.UNAVAILABLE_CHAR_VALUE){ alternativeLocationId = ' '; } if (alternativeLocationId != ' ') { altGroup = getCorrectAltLocGroup(alternativeLocationId); atom.setAltLoc(alternativeLocationId); } else { atom.setAltLoc(Character.valueOf(' ')); } atom.setX(x); atom.setY(y); atom.setZ(z); atom.setOccupancy(occupancy); atom.setTempFactor(temperatureFactor); atom.setCharge((short) charge); if (altGroup == null) { group.addAtom(atom); } else { altGroup.setChain(chain); altGroup.addAtom(atom); } if (!group.hasAtom(atom.getName())) { if (group.getPDBName().equals(atom.getGroup().getPDBName())) { if(!StructureTools.hasNonDeuteratedEquiv(atom,group)){ group.addAtom(atom); } } } atomsInGroup.add(atom); allAtoms[atomCounter] = atom; atomCounter++; }
Source:
<code>protected void closeReviewer(int result, boolean saveDeck) { <START> if( mMicToolBar != null ) { <END> mMicToolBar.notifyStopRecord(); } if( tempAudioPath != null ) { File tempAudioPathToDelete = new File(tempAudioPath); if (tempAudioPathToDelete.exists()) tempAudioPathToDelete.delete(); } mTimeoutHandler.removeCallbacks(mShowAnswerTask); mTimeoutHandler.removeCallbacks(mShowQuestionTask); mTimerHandler.removeCallbacks(removeChosenAnswerText); longClickHandler.removeCallbacks(longClickTestRunnable); longClickHandler.removeCallbacks(startLongClickAction); AbstractFlashcardViewer.this.setResult(result); if (saveDeck) { UIUtils.saveCollectionInBackground(this); } finishWithAnimation(ActivityTransitionAnimation.RIGHT); }</code><technical_language>suggestion if (mMicToolBar != null) {</technical_language>

Target:
protected void closeReviewer(int result, boolean saveDeck) { if (mMicToolBar != null) { mMicToolBar.notifyStopRecord(); } if (mTempAudioPath != null) { File tempAudioPathToDelete = new File(mTempAudioPath); if (tempAudioPathToDelete.exists()) { tempAudioPathToDelete.delete(); } } mTimeoutHandler.removeCallbacks(mShowAnswerTask); mTimeoutHandler.removeCallbacks(mShowQuestionTask); mTimerHandler.removeCallbacks(removeChosenAnswerText); longClickHandler.removeCallbacks(longClickTestRunnable); longClickHandler.removeCallbacks(startLongClickAction); AbstractFlashcardViewer.this.setResult(result); if (saveDeck) { UIUtils.saveCollectionInBackground(this); } finishWithAnimation(ActivityTransitionAnimation.RIGHT); }
Source:
<code>public void initialize(URL location, ResourceBundle resources) { xpathExpressionArea.setSyntaxHighlightingEnabled(new XPathSyntaxHighlighter()); initGenerateXPathFromStackTrace(); EventStreams.valuesOf(xpathResultListView.getSelectionModel().selectedItemProperty()) .filter(Objects::nonNull) <START> .subscribe(parent::onNodeItemSelected); <END> Platform.runLater(this::bindToParent); xpathExpressionArea.richChanges() .filter(t -> !t.getInserted().equals(t.getRemoved())) .successionEnds(XPATH_REFRESH) .subscribe(x -> parent.xPathEvaluate()); }</code><technical_language>a bug shows selecting XPath result, select other node in AST treeview. XPath result reselected immediately afterwards, making unusable. Fixing bug requires add a .conditionOn(xpathResultListView.focusedProperty()) call in pipeline, subscribe call</technical_language>

Target:
public void initialize(URL location, ResourceBundle resources) { xpathExpressionArea.setSyntaxHighlightingEnabled(new XPathSyntaxHighlighter()); initGenerateXPathFromStackTrace(); EventStreams.valuesOf(xpathResultListView.getSelectionModel().selectedItemProperty()) .conditionOn(xpathResultListView.focusedProperty()) .filter(Objects::nonNull) .subscribe(parent::onNodeItemSelected); Platform.runLater(this::bindToParent); xpathExpressionArea.richChanges() .filter(t -> !t.getInserted().equals(t.getRemoved())) .successionEnds(XPATH_REFRESH) .subscribe(x -> parent.refreshXPathResults()); }