auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testBasicInvocation() { final LifecycleEnvironment le = mock(LifecycleEnvironment.class); final String poolName = this.getClass().getSimpleName(); final ScheduledExecutorServiceBuilder test = new ScheduledExecutorServiceBuilder(le, poolName, false); this.execTracker = test.build(); assertTrue(this.execTracker instanceof ScheduledThreadPoolExecutor); final ScheduledThreadPoolExecutor castedExec = (ScheduledThreadPoolExecutor) this.execTracker; assertFalse(castedExec.getRemoveOnCancelPolicy()); final ArgumentCaptor<ExecutorServiceManager> esmCaptor = ArgumentCaptor.forClass(ExecutorServiceManager.class); verify(le, times(1)).manage(esmCaptor.capture()); final ExecutorServiceManager esmCaptured = esmCaptor.getValue(); assertSame(this.execTracker, esmCaptured.getExecutor()); assertEquals(DEFAULT_SHUTDOWN_PERIOD, esmCaptured.getShutdownPeriod()); assertSame(poolName, esmCaptured.getPoolName()); }

Target:
public void testBasicInvocation() { final String poolName = this.getClass().getSimpleName(); final ScheduledExecutorServiceBuilder test = new ScheduledExecutorServiceBuilder(this.le, poolName, false); this.execTracker = test.build(); assertThat(this.execTracker).isInstanceOf(ScheduledThreadPoolExecutor.class); final ScheduledThreadPoolExecutor castedExec = (ScheduledThreadPoolExecutor) this.execTracker; assertThat(castedExec.getRemoveOnCancelPolicy()).isFalse(); final ArgumentCaptor<ExecutorServiceManager> esmCaptor = ArgumentCaptor.forClass(ExecutorServiceManager.class); verify(this.le).manage(esmCaptor.capture()); final ExecutorServiceManager esmCaptured = esmCaptor.getValue(); assertThat(esmCaptured.getExecutor()).isSameAs(this.execTracker); assertThat(esmCaptured.getShutdownPeriod()).isEqualTo(DEFAULT_SHUTDOWN_PERIOD); assertThat(esmCaptured.getPoolName()).isSameAs(poolName); }
Source:
public Collection<Order> getOrder(String... orderIds) throws IOException { List<String> orderIdList = Arrays.asList(orderIds); OpenOrders openOrders = getOpenOrders(); List<Order> returnValue = openOrders .getOpenOrders() .stream() .filter( f-> orderIdList.contains(f.getId())) .collect(Collectors.toList()); returnValue.addAll( orderIdList.stream() .filter( f-> !returnValue.stream().filter( a-> a.getId().equals(f)).findFirst().isPresent()) .map( f-> { try { return PoloniexAdapters.adaptUserTradesToOrderStatus(returnOrderTrades(f)); } catch (IOException e) { e.printStackTrace(); } return null; } ) .filter( f-> f != null) .collect(Collectors.toList()) ); return returnValue; }

Target:
public Collection<Order> getOrder(String... orderIds) throws IOException { List<String> orderIdList = Arrays.asList(orderIds); OpenOrders openOrders = getOpenOrders(); List<Order> returnValue = openOrders .getOpenOrders() .stream() .filter( f-> orderIdList.contains(f.getId())) .collect(Collectors.toList()); returnValue.addAll( orderIdList.stream() .filter( f-> !returnValue.stream().filter( a-> a.getId().equals(f)).findFirst().isPresent()) .map( f-> { try { return PoloniexAdapters.adaptUserTradesToOrderStatus(f,returnOrderTrades(f)); } catch (IOException e) { LOG.error("Unable to find status for Poloniex order id: " + f,e); } return null; } ) .filter( f-> f != null) .collect(Collectors.toList()) ); return returnValue; }
Source:
public UriAuthority(String authority) { MatchResult matcher = AUTHORITY_REGEXP.exec(authority == null ? EMPTY_STRING : authority); if (matcher != null) { setHost(matcher.getGroup(1)); setPort(matcher.getGroup(2)); valid = validatePort(); } else { valid = false; } }

Target:
public UriAuthority(String authority) { MatchResult matcher = AUTHORITY_REGEXP.exec(authority == null ? EMPTY_STRING : authority); if (matcher == null) { this.host = null; this.port = null; valid = false; } else { String group1 = matcher.getGroup(1); this.host = (group1 == null) ? EMPTY_STRING : group1; String group2 = matcher.getGroup(2); this.port = (group2 == null) ? EMPTY_STRING : group2; valid = validatePort(); } }
Source:
private void setInput(String location, Job job) throws IOException { this.setLocationHasBeenCalled = true; this.location = location; setInputPaths(job, location); if(UDFContext.getUDFContext().isFrontend()) { storeInUDFContext(PARQUET_COLUMN_INDEX_ACCESS, Boolean.toString(columnIndexAccess)); } schema = PigSchemaConverter.parsePigSchema(getPropertyFromUDFContext(PARQUET_PIG_SCHEMA)); requiredFieldList = PigSchemaConverter.deserializeRequiredFieldList(getPropertyFromUDFContext(PARQUET_PIG_REQUIRED_FIELDS)); columnIndexAccess = Boolean.parseBoolean(getPropertyFromUDFContext(PARQUET_COLUMN_INDEX_ACCESS)); initSchema(job); if(UDFContext.getUDFContext().isFrontend()) { storeInUDFContext(PARQUET_PIG_SCHEMA, pigSchemaToString(schema)); storeInUDFContext(PARQUET_PIG_REQUIRED_FIELDS, serializeRequiredFieldList(requiredFieldList)); } getConfiguration(job).set(PARQUET_PIG_SCHEMA, pigSchemaToString(schema)); getConfiguration(job).set(PARQUET_PIG_REQUIRED_FIELDS, serializeRequiredFieldList(requiredFieldList)); getConfiguration(job).set(PARQUET_COLUMN_INDEX_ACCESS, Boolean.toString(columnIndexAccess)); SerializationUtil.writeObjectToConfAsBase64(ParquetInputFormat.FILTER_PREDICATE, getFromUDFContext(ParquetInputFormat.FILTER_PREDICATE), getConfiguration(job)); }

Target:
private void setInput(String location, Job job) throws IOException { this.setLocationHasBeenCalled = true; this.location = location; setInputPaths(job, location); if(UDFContext.getUDFContext().isFrontend()) { storeInUDFContext(PARQUET_COLUMN_INDEX_ACCESS, Boolean.toString(columnIndexAccess)); } schema = PigSchemaConverter.parsePigSchema(getPropertyFromUDFContext(PARQUET_PIG_SCHEMA)); requiredFieldList = PigSchemaConverter.deserializeRequiredFieldList(getPropertyFromUDFContext(PARQUET_PIG_REQUIRED_FIELDS)); columnIndexAccess = Boolean.parseBoolean(getPropertyFromUDFContext(PARQUET_COLUMN_INDEX_ACCESS)); initSchema(job); if(UDFContext.getUDFContext().isFrontend()) { storeInUDFContext(PARQUET_PIG_SCHEMA, pigSchemaToString(schema)); storeInUDFContext(PARQUET_PIG_REQUIRED_FIELDS, serializeRequiredFieldList(requiredFieldList)); } getConfiguration(job).set(PARQUET_PIG_SCHEMA, pigSchemaToString(schema)); getConfiguration(job).set(PARQUET_PIG_REQUIRED_FIELDS, serializeRequiredFieldList(requiredFieldList)); getConfiguration(job).set(PARQUET_COLUMN_INDEX_ACCESS, Boolean.toString(columnIndexAccess)); FilterPredicate filterPredicate = (FilterPredicate) getFromUDFContext(ParquetInputFormat.FILTER_PREDICATE); if(filterPredicate != null) { ParquetInputFormat.setFilterPredicate(getConfiguration(job), filterPredicate); } }
Source:
protected void updateModuleHandlerFactory(ModuleHandlerFactory moduleHandlerFactory) { logger.debug("ModuleHandlerFactory updated, updating handlers"); Collection<String> types = new LinkedList<String>(moduleHandlerFactory.getTypes()); Collection<String> newTypes = new LinkedList<String>(moduleHandlerFactory.getTypes()); Collection<String> removedTypes = new LinkedList<String>(); Set<Entry<String, ModuleHandlerFactory>> snapshot = new HashSet<Map.Entry<String, ModuleHandlerFactory>>(); synchronized (this) { snapshot.addAll(moduleHandlerFactories.entrySet()); } for (Map.Entry<String, ModuleHandlerFactory> entry : snapshot) { if (entry.getValue().equals(moduleHandlerFactory)) { String key = entry.getKey(); if (types.contains(key)) { newTypes.remove(key); } else { removedTypes.add(key); } } } if (removedTypes.size() > 0) { removeMissingModuleTypes(removedTypes); } if (newTypes.size() > 0) { addNewModuleTypes(moduleHandlerFactory, newTypes); } }

Target:
protected void updateModuleHandlerFactory(ModuleHandlerFactory moduleHandlerFactory) { logger.debug("ModuleHandlerFactory updated, updating handlers"); Collection<String> types = new HashSet<String>(moduleHandlerFactory.getTypes()); Collection<String> newTypes = new HashSet<String>(moduleHandlerFactory.getTypes()); Collection<String> removedTypes = new ArrayList<String>(); Set<Entry<String, ModuleHandlerFactory>> snapshot = new HashSet<Map.Entry<String, ModuleHandlerFactory>>(); synchronized (this) { snapshot.addAll(moduleHandlerFactories.entrySet()); } for (Map.Entry<String, ModuleHandlerFactory> entry : snapshot) { if (entry.getValue().equals(moduleHandlerFactory)) { String key = entry.getKey(); if (types.contains(key)) { newTypes.remove(key); } else { removedTypes.add(key); } } } if (removedTypes.size() > 0) { removeMissingModuleTypes(removedTypes); updateModuleHandlerFactoryMap(removedTypes); } if (newTypes.size() > 0) { addNewModuleTypes(moduleHandlerFactory, newTypes); } }
Source:
public void readEntityFromNBT(NBTTagCompound nbt) { super.readEntityFromNBT(nbt); spells = ((List<Spell>) NBTExtras.NBTToList(nbt.getTagList("spells", Constants.NBT.TAG_STRING), (NBTTagString tag) -> Spell.get(tag.getString()))); }

Target:
public void readEntityFromNBT(NBTTagCompound nbt) { super.readEntityFromNBT(nbt); spells = (NBTHelper.getList(nbt.getTagList("spells", Constants.NBT.TAG_STRING), tag -> Spell.get(((NBTTagString) tag).getString()))); }
Source:
public Launcher createLauncher(TaskListener listener) { Launcher launcher = super.createLauncher(listener); if (template != null) { Executor executor = Executor.currentExecutor(); if (executor != null) { Queue.Executable currentExecutable = executor.getCurrentExecutable(); if (currentExecutable != null && executables.add(currentExecutable)) { listener.getLogger().println(Messages.KubernetesSlave_AgentIsProvisionedFromTemplate( ModelHyperlinkNote.encodeTo("/computer/" + getNodeName(), getNodeName()), getTemplate().getDisplayName()) ); listener.getLogger().println(getTemplate().getDescriptionForLogging(this)); checkHomeAndWarnIfNeeded(listener); } } } return launcher; }

Target:
public Launcher createLauncher(TaskListener listener) { Launcher launcher = super.createLauncher(listener); if (template != null) { Executor executor = Executor.currentExecutor(); if (executor != null) { Queue.Executable currentExecutable = executor.getCurrentExecutable(); if (currentExecutable != null && executables.add(currentExecutable)) { listener.getLogger().println(Messages.KubernetesSlave_AgentIsProvisionedFromTemplate( ModelHyperlinkNote.encodeTo("/computer/" + getNodeName(), getNodeName()), getTemplate().getDisplayName()) ); printAgentDescription(listener); checkHomeAndWarnIfNeeded(listener); } } } return launcher; }
Source:
public double calculate(double goal, double current, double p, double i, double d, double f) { m_targetInputValue = goal; m_currentInputValue = current; double result; m_error = m_targetInputValue - m_currentInputValue; if (i != 0) { double potentialIGain = (m_totalError + m_error) * i; if (potentialIGain < m_maximumOutput) { if (potentialIGain > m_minimumOutput) { m_totalError += m_error; } else { m_totalError = m_minimumOutput / i; } } else { m_totalError = m_maximumOutput / i; } } m_derivativeValue = m_error - m_prevError; m_result = p * m_error + i * m_totalError + d * (m_derivativeValue) + f * goal; m_prevError = m_error; if (m_result > m_maximumOutput) { m_result = m_maximumOutput; } else if (m_result < m_minimumOutput) { m_result = m_minimumOutput; } result = m_result; errorIsSmall = false; if (checkErrorThreshold) { errorIsSmall = Math.abs(m_targetInputValue - m_currentInputValue) < errorTolerance; } derivativeIsSmall = false; if (checkDerivativeThreshold) { derivativeIsSmall = Math.abs(m_derivativeValue) < derivativeTolerance; } return result; }

Target:
public double calculate(double goal, double current, double p, double i, double d, double f) { m_targetInputValue = goal; m_currentInputValue = current; double result; m_error = m_targetInputValue - m_currentInputValue; if (i != 0) { double potentialIGain = (m_totalError + m_error) * i; if (potentialIGain < m_maximumOutput) { if (potentialIGain > m_minimumOutput) { m_totalError += m_error; } else { m_totalError = m_minimumOutput / i; } } else { m_totalError = m_maximumOutput / i; } } m_derivativeValue = m_error - m_prevError; m_result = p * m_error + i * m_totalError + d * (m_derivativeValue) + f * goal; m_prevError = m_error; if (m_result > m_maximumOutput) { m_result = m_maximumOutput; } else if (m_result < m_minimumOutput) { m_result = m_minimumOutput; } result = m_result; errorIsSmall = checkErrorThreshold && Math.abs(m_targetInputValue - m_currentInputValue) < errorTolerance; derivativeIsSmall = checkDerivativeThreshold && Math.abs(m_derivativeValue) < derivativeTolerance; return result; }
Source:
public void registerCapabilities(ManagementResourceRegistration resourceRegistration) { if (capabilities!=null) { for (RuntimeCapability c : capabilities) { resourceRegistration.registerCapability(c); } } if (incorporatingCapabilities != null) { resourceRegistration.registerIncorporatingCapabilities(incorporatingCapabilities); } if(requirements != null) { resourceRegistration.registerRequirements(requirements); } }

Target:
public void registerCapabilities(ManagementResourceRegistration resourceRegistration) { if (capabilities!=null) { for (RuntimeCapability c : capabilities) { resourceRegistration.registerCapability(c); } } if (incorporatingCapabilities != null) { resourceRegistration.registerIncorporatingCapabilities(incorporatingCapabilities); } assert requirements != null; resourceRegistration.registerRequirements(requirements); }
Source:
protected void executeForStream(String filename, Producer<InputStream> inputSupplier) throws Exception { if (isValid(inputSupplier)) { for (Consumer<BiConsumer<String, NodeHandler>> handlerConsumer : fetchHandlersList()) { try (InputStream inputStream = inputSupplier.create()) { executeForValidStream(inputStream, handlerConsumer); } } } else { process.log(ProcessLog.error() .withNLSKey("XMLImportJob.invalidXMLDetected") .withContext("fileName", filename)); } }

Target:
protected void executeForStream(String filename, Producer<InputStream> inputSupplier) throws Exception { if (isValid(inputSupplier)) { for (Consumer<BiConsumer<String, NodeHandler>> handlerConsumer : fetchStages()) { try (InputStream inputStream = inputSupplier.create()) { executeProcessingStage(inputStream, handlerConsumer); } } } else { process.log(ProcessLog.error() .withNLSKey("XMLImportJob.invalidXMLDetected") .withContext("fileName", filename)); } }
Source:
private RequestDispatcher createDispatcher() { if (executorService == null) { executorService = defaultExecutorService(); } final RequestDispatcher dispatcher = new DefaultRequestDispatcher( createHttpConnector(sslHostnameVerification), executorService); return new RetryingRequestDispatcher(dispatcher, executorService, new SystemClock(), 5, TimeUnit.SECONDS); }

Target:
private RequestDispatcher createDispatcher() { if (executorService == null) { executorService = defaultExecutorService(); } final RequestDispatcher dispatcher = new DefaultRequestDispatcher( createHttpConnector(sslHostnameVerification), executorService, shutDownExecutorOnClose); return new RetryingRequestDispatcher(dispatcher, executorService, new SystemClock(), 5, TimeUnit.SECONDS); }
Source:
private void createLoadBalancer(Set<AddNode> addNodes) throws TimeoutException { System.out.println("Create Cloud Load Balancer"); CreateLoadBalancer createLB = CreateLoadBalancer.builder() .name(Constants.NAME) .protocol("MYSQL") .port(3306) .algorithm(LoadBalancer.Algorithm.RANDOM) .nodes(addNodes) .virtualIPType(VirtualIP.Type.PUBLIC) .build(); LoadBalancer loadBalancer; do { loadBalancer = lbApi.create(createLB); try { Thread.sleep(30000); } catch (InterruptedException e) { e.printStackTrace(); } } while(loadBalancer == null); if (!LoadBalancerPredicates.awaitAvailable(lbApi).apply(loadBalancer)) { throw new TimeoutException("Timeout on loadBalancer: " + loadBalancer); } System.out.println(" " + loadBalancer); System.out.println(" Go to http://" + getVirtualIPv4(loadBalancer.getVirtualIPs())); }

Target:
private void createLoadBalancer(Set<AddNode> addNodes) throws TimeoutException { System.out.println("Create Cloud Load Balancer"); CreateLoadBalancer createLB = CreateLoadBalancer.builder() .name(Constants.NAME) .protocol("MYSQL") .port(3306) .algorithm(LoadBalancer.Algorithm.RANDOM) .nodes(addNodes) .virtualIPType(VirtualIP.Type.PUBLIC) .build(); LoadBalancer loadBalancer; do { loadBalancer = lbApi.create(createLB); Uninterruptibles.sleepUninterruptibly(30, TimeUnit.SECONDS); } while(loadBalancer == null); if (!LoadBalancerPredicates.awaitAvailable(lbApi).apply(loadBalancer)) { throw new TimeoutException("Timeout on loadBalancer: " + loadBalancer); } System.out.println(" " + loadBalancer); System.out.println(" Go to http://" + getVirtualIPv4(loadBalancer.getVirtualIPs())); }
Source:
public InternalJob loadJobWithTasksIfNotRemoved(final JobId id) { return executeReadOnlyTransaction(new SessionWork<InternalJob>() { @Override public InternalJob doInTransaction(Session session) { Query jobQuery = session.getNamedQuery("loadJobWithTasksIfNotRemoved").setReadOnly(true); List<InternalJob> result = new ArrayList<>(); batchLoadJobs(session, false, jobQuery, Collections.singletonList(jobId(id)), result); if (result.isEmpty()) { return null; } else { return result.get(0); } } }); }

Target:
public InternalJob loadJobWithTasksIfNotRemoved(final JobId id) { return executeReadOnlyTransaction(new SessionWork<InternalJob>() { @Override public InternalJob doInTransaction(Session session) { Query jobQuery = session.getNamedQuery("loadJobDataIfNotRemoved").setReadOnly(true); List<InternalJob> result = new ArrayList<>(); batchLoadJobs(session, false, jobQuery, Collections.singletonList(jobId(id)), result); if (result.isEmpty()) { return null; } else { return result.get(0); } } }); }
Source:
public String getIconFileName() { boolean hasPerm = folder.hasPermission(Item.EXTENDED_READ); if (hasPerm) { ENDED_READ but not configure should still see this. final SecurityContext impersonate = ACL.impersonate(ACL.SYSTEM); try { hasPerm = folder.hasPermission(Item.CONFIGURE); } finally { SecurityContextHolder.setContext(impersonate); } } return folder.hasPermission(Item.EXTENDED_READ) ? ConfigFilesManagement.ICON_PATH : null; }

Target:
public String getIconFileName() { boolean hasPerm = folder.hasPermission(Item.CONFIGURE) || (folder.hasPermission(Item.EXTENDED_READ) && hasStore()); return hasPerm ? ConfigFilesManagement.ICON_PATH : null; }
Source:
public void addAction(Action a) { super.addAction(a); }

Target:
@Override public void addAction(Action a) { super.addAction(a); }
Source:
public String getCsvDetailedFeedbackParticipantCommentOnResponse(FeedbackResponseAttributes response) { if (!this.responseComments.containsKey(response.getId())) { return " "; } List<FeedbackResponseCommentAttributes> frcList = this.responseComments.get(response.getId()); for (FeedbackResponseCommentAttributes frc : frcList) { if (frc.isCommentFromFeedbackParticipant) { return frc.convertCommentTextToStringForCsv(); } } return " "; }

Target:
public String getCsvDetailedFeedbackParticipantCommentOnResponse(FeedbackResponseAttributes response) { if (!this.responseComments.containsKey(response.getId())) { return ""; } List<FeedbackResponseCommentAttributes> frcList = this.responseComments.get(response.getId()); for (FeedbackResponseCommentAttributes frc : frcList) { if (frc.isCommentFromFeedbackParticipant) { return frc.getCommentAsCsvString(); } } return ""; }
Source:
public InstanceAdapter insert(SQLiteDatabase db, InstanceAdapter entityAdapter, boolean isSyncAdapter) { validate(entityAdapter, isSyncAdapter); Optional<Long> instanceId = new NullSafe<>(entityAdapter.taskAdapter().valueOf(TaskAdapter.ORIGINAL_INSTANCE_ID)); if (instanceId.isPresent()) { String timeStampString = Long.toString(entityAdapter.taskAdapter().valueOf(TaskAdapter.ORIGINAL_INSTANCE_TIME).getTimestamp()); try (Cursor c = db.query( TaskDatabaseHelper.Tables.INSTANCE_VIEW, new String[] { TaskContract.Instances._ID }, String.format("(%1$s == ? or %2$s == ?) and (%3$s == ? or %3$s is null and %4$s == ? or %3$s is null and %4$s is null and %5$s == ?) ", TaskContract.Instances.TASK_ID, TaskContract.Instances.ORIGINAL_INSTANCE_ID, TaskContract.Instances.INSTANCE_ORIGINAL_TIME, TaskContract.Instances.INSTANCE_START, TaskContract.Instances.INSTANCE_DUE), new String[] { instanceId.value().toString(), instanceId.value().toString(), timeStampString, timeStampString, timeStampString }, null, null, null)) { if (c.getCount() > 0) { throw new UnsupportedOperationException(String.format(Locale.ENGLISH, "Instance %s of task %d already exists", entityAdapter.taskAdapter().valueOf(TaskAdapter.ORIGINAL_INSTANCE_TIME).toString(), instanceId.value())); } } } return mDelegate.insert(db, entityAdapter, false); }

Target:
public InstanceAdapter insert(SQLiteDatabase db, InstanceAdapter entityAdapter, boolean isSyncAdapter) { validateIsSyncAdapter(isSyncAdapter); validateValues(entityAdapter); validateInstanceIsNew(db, entityAdapter); return mDelegate.insert(db, entityAdapter, false); }
Source:
public static List<String> runShellCommand(String cmd) throws ShellNotRunningException { if (MainActivity.shellInteractive == null || !MainActivity.shellInteractive.isRunning()) throw new ShellNotRunningException(); final List<String> result = new ArrayList<>(); MainActivity.shellInteractive.addCommand(cmd, 0, (commandCode, exitCode, output) -> result.addAll(output)); MainActivity.shellInteractive.waitForIdle(); return result; }

Target:
public static ArrayList<String> runShellCommand(String cmd) throws ShellNotRunningException { if (MainActivity.shellInteractive == null || !MainActivity.shellInteractive.isRunning()) throw new ShellNotRunningException(); final ArrayList<String> result = new ArrayList<>(); MainActivity.shellInteractive.addCommand(cmd, 0, (commandCode, exitCode, output) -> result.addAll(output)); MainActivity.shellInteractive.waitForIdle(); return result; }
Source:
public <ASSERT extends AbstractAssert<?, ?>> ASSERT extracting(String propertyOrField, InstanceOfAssertFactory<?, ASSERT> assertFactory) { return extracting(propertyOrField, this::newObjectAssert).asInstanceOf(assertFactory); }

Target:
public <ASSERT extends AbstractAssert<?, ?>> ASSERT extracting(String propertyOrField, InstanceOfAssertFactory<?, ASSERT> assertFactory) { return super.extracting(propertyOrField, this::newObjectAssert).asInstanceOf(assertFactory); }
Source:
public synchronized void updateSnapshots(ResourceControllerDataProvider dataProvider) { if (_oldSnapshot == null || _newSnapshot == null) { initializeSnapshots(); } _oldSnapshot = new ResourceChangeSnapshot(_newSnapshot); _newSnapshot = new ResourceChangeSnapshot(dataProvider); dataProvider.clearRefreshedChangeTypes(); clearCachedComputation(); }

Target:
public synchronized void updateSnapshots(ResourceControllerDataProvider dataProvider) { _oldSnapshot = new ResourceChangeSnapshot(_newSnapshot); _newSnapshot = new ResourceChangeSnapshot(dataProvider); dataProvider.clearRefreshedChangeTypes(); clearCachedComputation(); }
Source:
public void deleteApplication(UUID applicationId) throws Exception { EntityManager em = getEntityManager(CpNamingUtils.SYSTEM_APP_ID); Query q = Query.fromQL(String.format("select * where applicationUuid = '%s'", applicationId.toString())); Results results = em.searchCollection( em.getApplicationRef(), "appinfos", q); Entity appToDelete = results.getEntity(); if(appToDelete != null) { em.delete(appToDelete); em.create("deleted_appinfo", appToDelete.getProperties()); } EntityIndex ei = managerCache.getEntityIndex(new ApplicationScopeImpl( new SimpleId(applicationId, TYPE_APPLICATION))); ei.deleteIndex(); }

Target:
public void deleteApplication(UUID applicationId) throws Exception { EntityManager em = getEntityManager(CpNamingUtils.SYSTEM_APP_ID); Query q = Query.fromQL(String.format("select * where applicationUuid = '%s'", applicationId.toString())); Results results = em.searchCollection(em.getApplicationRef(), "appinfos", q); Entity appToDelete = results.getEntity(); if(appToDelete != null) { em.create("deleted_appinfo", appToDelete.getProperties()); em.delete(appToDelete); } EntityIndex ei = managerCache.getEntityIndex(new ApplicationScopeImpl(new SimpleId(applicationId, TYPE_APPLICATION))); ei.deleteIndex(); em.refreshIndex(); }
Source:
public Response help(@Context final HttpServletRequest request) { LOGGER.info("Request: {}", RestServiceHelper.getRequestURI(request)); return Response.ok(rdapObjectMapper.mapHelp(getRequestUrl(request))) .header("Content-Type", CONTENT_TYPE_RDAP_JSON) .build(); }

Target:
public Response help(@Context final HttpServletRequest request) { return Response.ok(rdapObjectMapper.mapHelp(getRequestUrl(request))) .header(CONTENT_TYPE, CONTENT_TYPE_RDAP_JSON) .build(); }
Source:
public void setFeedInfo(URL feedUrl, SyndFeedInfo feedInfo) { try { String url = urlToString(feedUrl); String regex = atomClientConfigService.getRegexForFeedUrl(url); FeedRecord record = feedRecordDataService.findByURL(url); if (record != null) { SyndFeedInfo cachedFeedInfo = feedRecordToFeedInfo(record); if (sendMessagesForChangedEntries(url, cachedFeedInfo.getSyndFeed(), feedInfo.getSyndFeed(), regex)) { feedRecordDataService.delete(record); feedRecordDataService.create(recordFromFeed(url, feedInfo)); } } else { sendMessagesForNewFeedData(url, feedInfo.getSyndFeed(), regex); feedRecordDataService.create(recordFromFeed(url, feedInfo)); } } catch (IOException | FeedException | ClassNotFoundException ex) { LOGGER.error(ex.getMessage(), ex); } }

Target:
public synchronized void setFeedInfo(URL feedUrl, SyndFeedInfo feedInfo) { try { String url = FeedCacheUtils.urlToString(feedUrl); String regex = atomClientConfigService.getRegexForFeedUrl(url); FeedRecord record = feedRecordDataService.findByURL(url); if (record != null) { SyndFeedInfo cachedFeedInfo = FeedCacheUtils.feedRecordToFeedInfo(record); if (sendMessagesForChangedEntries(url, cachedFeedInfo.getSyndFeed(), feedInfo.getSyndFeed(), regex)) { feedRecordDataService.delete(record); feedRecordDataService.create(FeedCacheUtils.recordFromFeed(url, feedInfo)); } } else { sendMessagesForNewFeedData(url, feedInfo.getSyndFeed(), regex); feedRecordDataService.create(FeedCacheUtils.recordFromFeed(url, feedInfo)); } } catch (IOException | FeedException | ClassNotFoundException ex) { LOGGER.error("Error writing FeedRecord to the database {}", ex.getMessage()); } }
Source:
public Mono<BlobContainer> createResourceAsync() { BlobContainersInner client = this.manager().inner().blobContainers(); return client .createAsync(this.resourceGroupName, this.accountName, this.containerName, this.inner()) .map(innerToFluentMap(this)); }

Target:
public Mono<BlobContainer> createResourceAsync() { BlobContainersInner client = this.manager().inner().blobContainers(); return client .createAsync(this.resourceGroupName, this.accountName, this.containerName, this.inner().withPublicAccess(cpublicAccess).withMetadata(cmetadata)) .map(innerToFluentMap(this)); }
Source:
public static synchronized void dispose() { ScriptingDataProviderManager manager = INSTANCE; if (manager != null) { TmfSignalManager.deregister(manager); manager.fInstances.clear(); } INSTANCE = null; }

Target:
public static synchronized void dispose() { ScriptingDataProviderManager manager = INSTANCE; if (manager != null) { TmfSignalManager.deregister(manager); manager.fInstances.clear(); INSTANCE = null; } }
Source:
private int parseInteger(String line, String name) { int ret = 0; try { ret = Integer.parseInt(line.substring(line.indexOf(name) + name.length(), line.length() - 1).trim()); } catch (NumberFormatException e) { logger.error(FAILED_PARSE_LINE_MSG, line, e); } return ret; }

Target:
private int parseInteger(String line, String name) throws KuraException { int ret = 0; try { ret = Integer.parseInt(line.substring(line.indexOf(name) + name.length(), line.length() - 1).trim()); } catch (NumberFormatException e) { logger.error(FAILED_PARSE_LINE_MSG, line, e); throw new KuraException(KuraErrorCode.INVALID_PARAMETER, e); } return ret; }
Source:
public PropertyConstraintMappingContext constraint(ConstraintDef<?, ?> definition) { if ( property.getKind() == Property.Kind.FIELD ) { super.addConstraint( ConfiguredConstraint.forProperty( definition, property ) ); } else { super.addConstraint( ConfiguredConstraint.forExecutable( definition, property.as( Callable.class ) ) ); } return this; }

Target:
public PropertyConstraintMappingContext constraint(ConstraintDef<?, ?> definition) { if ( property instanceof JavaBeanField ) { super.addConstraint( ConfiguredConstraint.forProperty( definition, property ) ); } else { super.addConstraint( ConfiguredConstraint.forExecutable( definition, property.as( Callable.class ) ) ); } return this; }
Source:
private short[] toShortArray(int[] ints) { if (ints == null) { return null; } short[] shorts = new short[ints.length]; for (int i = 0; i < shorts.length; i++) { shorts[i] = toShort(ints[i]); } return shorts; }

Target:
private static short[] toShortArray(int[] ints) { if (ints == null) { return null; } short[] shorts = new short[ints.length]; for (int i = 0; i < shorts.length; i++) { shorts[i] = toShort(ints[i]); } return shorts; }
Source:
private List<Pair<VariantContext, Genotype>> composeQualifyingCallsList(final TargetCollection<Target> targets, final List<Pair<VariantContext, Genotype>> calls) { return calls.stream() .filter(pair -> !pair.getRight().getAlleles().isEmpty() && !pair.getRight().getAlleles().get(0).equals(Allele.NO_CALL) && !pair.getRight().getAlleles().get(0).equals(pair.getLeft().getReference())) .filter(pair -> { final double callSQ = callQuality(pair.getRight()); return callSQ >= filterArguments.minimumCalledSegmentQuality; }) .filter(pair -> targets.targetCount(pair.getLeft()) >= filterArguments.minimumCalledSegmentLength) .filter(pair -> { final double[] calledAF = GATKProtectedVariantContextUtils.getAttributeAsDoubleArray(pair.getLeft(), VCFConstants.ALLELE_FREQUENCY_KEY, () -> new double[pair.getLeft().getAlleles().size() - 1], 0.0); final double nonRefAF = MathUtils.sum(calledAF); return nonRefAF <= filterArguments.maximumCalledEventFrequency && !(filterArguments.applyMultiAllelicCalledFilter && calledAF.length > 1 && calledAF[0] > 0 && calledAF[1] > 0); }) .collect(Collectors.toList()); }

Target:
private List<Pair<VariantContext, Genotype>> composeQualifyingCallsList(final TargetCollection<Target> targets, final List<Pair<VariantContext, Genotype>> calls) { return calls.stream() .filter(pair -> pair.getRight().getAlleles().stream().anyMatch(a -> a.isCalled() && a.isNonReference())) .filter(pair -> callQuality(pair.getRight()) >= filterArguments.minimumCalledSegmentQuality) .filter(pair -> targets.targetCount(pair.getLeft()) >= filterArguments.minimumCalledSegmentLength) .filter(pair -> { final double[] calledAF = GATKProtectedVariantContextUtils.getAttributeAsDoubleArray(pair.getLeft(), VCFConstants.ALLELE_FREQUENCY_KEY, () -> new double[pair.getLeft().getAlleles().size() - 1], 0.0); final double nonRefAF = MathUtils.sum(calledAF); return nonRefAF <= filterArguments.maximumCalledEventFrequency && !(filterArguments.applyMultiAllelicCalledFilter && calledAF.length > 1 && calledAF[0] > 0 && calledAF[1] > 0); }) .collect(Collectors.toList()); }
Source:
private List<File> scanJarsInPluginsDirectory() { if (pluginsDir == null || !pluginsDir.exists()) { return Collections.emptyList(); } File[] matches = pluginsDir.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { String n = pathname.getName(); return (n.endsWith(".jar") || n.endsWith(".jar.disabled")) && pathname.isFile(); } }); if (matches == null) { log.error("Cannot list " + pluginsDir.getAbsolutePath()); return Collections.emptyList(); } return Arrays.asList(matches); }

Target:
private List<File> scanJarsInPluginsDirectory() { if (pluginsDir == null || !pluginsDir.exists()) { return Collections.emptyList(); } File[] matches = pluginsDir.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { String n = pathname.getName(); return (n.endsWith(".jar") && pathname.isFile()); } }); if (matches == null) { ui.message("WARN: Cannot list %s", pluginsDir.getAbsolutePath()); return Collections.emptyList(); } Arrays.sort(matches, new Comparator<File>() { @Override public int compare(File o1, File o2) { return o1.getName().compareTo(o2.getName()); } }); return Arrays.asList(matches); }
Source:
public void shouldCreateANewChargeWithExternalMetadata() throws IOException { GatewayAccountEntity gatewayAccount = new GatewayAccountEntity(defaultTestAccount.getPaymentProvider(), new HashMap<>(), TEST); gatewayAccount.setId(defaultTestAccount.getAccountId()); ExternalMetadata expectedExternalMetadata = new ExternalMetadata( Map.of("key1", "String1", "key2", 123, "key3", true)); ChargeEntity chargeEntity = aValidChargeEntity() .withId(null) .withGatewayAccountEntity(gatewayAccount) .withExternalMetadata(expectedExternalMetadata) .build(); assertThat(chargeEntity.getId(), is(nullValue())); chargeDao.persist(chargeEntity); chargeDao.forceRefresh(chargeEntity); Optional<ChargeEntity> charge = chargeDao.findById(chargeEntity.getId()); assertThat(charge.get().getExternalMetadata().get().getMetadata(), equalTo(expectedExternalMetadata.getMetadata())); }

Target:
public void shouldCreateANewChargeWithExternalMetadata() throws IOException { GatewayAccountEntity gatewayAccount = new GatewayAccountEntity(defaultTestAccount.getPaymentProvider(), new HashMap<>(), TEST); gatewayAccount.setId(defaultTestAccount.getAccountId()); ExternalMetadata expectedExternalMetadata = new ExternalMetadata( Map.of("key1", "String1", "key2", 123, "key3", true)); ChargeEntity chargeEntity = aValidChargeEntity() .withGatewayAccountEntity(gatewayAccount) .withExternalMetadata(expectedExternalMetadata) .build(); chargeDao.persist(chargeEntity); chargeDao.forceRefresh(chargeEntity); Optional<ChargeEntity> charge = chargeDao.findById(chargeEntity.getId()); assertThat(charge.get().getExternalMetadata().get().getMetadata(), equalTo(expectedExternalMetadata.getMetadata())); }
Source:
public static boolean isSymlink(File path) throws IOException { return FileUtils.isSymlink(path); }

Target:
public static boolean isSymlink(File path) { return FileUtils.isSymlink(path); }
Source:
public void shouldSendAvroAfterSubscriptionContentTypeChanged() throws InterruptedException, ExecutionException, TimeoutException, IOException { Topic topic = operations.buildTopic(topic() .withName("publishAvroAfterTopicEditing.topic") .withValidation(true) .withMessageSchema(user.getSchemaAsString()) .withContentType(AVRO).build()); operations.createSubscription(topic, "subscription", HTTP_ENDPOINT_URL, JSON); assertThat(publisher.publish("publishAvroAfterTopicEditing.topic", user.asBytes())).hasStatus(CREATED); remoteService.waitUntilReceived(json -> assertThatJson(json).isEqualTo("{\"name\":\"Bob\",\"age\":50,\"favoriteColor\":\"blue\"}")); remoteService.reset(); assertThat(management.subscription() .update(topic.getQualifiedName(), "subscription", subscription().withContentType(ContentType.AVRO).build())) .hasStatus(OK); wait.untilSubscriptionContentTypeChanged(topic, "subscription", ContentType.AVRO); wait.untilSubscriptionIsActivated(topic, "subscription"); assertThat(publisher.publish("publishAvroAfterTopicEditing.topic", user.asBytes())).hasStatus(CREATED); remoteService.waitUntilReceived(body -> { System.out.println(body); AvroUser avroUser = AvroUser.create(user.getSchema(), body.getBytes()); assertThat(avroUser.getName()).isEqualTo("Bob"); assertThat(avroUser.getAge()).isEqualTo(50); assertThat(avroUser.getFavoriteColor()).isEqualTo("blue"); }); }

Target:
public void shouldSendAvroAfterSubscriptionContentTypeChanged() throws InterruptedException, ExecutionException, TimeoutException, IOException { Topic topic = operations.buildTopic(topic() .withName("publishAvroAfterTopicEditing.topic") .withValidation(true) .withMessageSchema(user.getSchemaAsString()) .withContentType(AVRO).build()); operations.createSubscription(topic, "subscription", HTTP_ENDPOINT_URL, JSON); assertThat(publisher.publish("publishAvroAfterTopicEditing.topic", user.asBytes())).hasStatus(CREATED); remoteService.waitUntilReceived(json -> assertThatJson(json).isEqualTo(user.asJson())); remoteService.reset(); assertThat(management.subscription() .update(topic.getQualifiedName(), "subscription", subscription().withContentType(ContentType.AVRO).build())) .hasStatus(OK); wait.untilSubscriptionContentTypeChanged(topic, "subscription", ContentType.AVRO); wait.untilSubscriptionIsActivated(topic, "subscription"); assertThat(publisher.publish("publishAvroAfterTopicEditing.topic", user.asBytes())).hasStatus(CREATED); remoteService.waitUntilReceived(body -> { System.out.println(body); AvroUser avroUser = AvroUser.create(user.getSchema(), body.getBytes()); assertThat(avroUser.getName()).isEqualTo("Bob"); assertThat(avroUser.getAge()).isEqualTo(50); assertThat(avroUser.getFavoriteColor()).isEqualTo("blue"); }); }
Source:
private void onMaybeMuteChanged(){ if (player.isMuted()) { muteButton.setColorFilter(ContextCompat.getColor(getApplicationContext(), R.color.white)); } else { muteButton.setColorFilter(ContextCompat.getColor(getApplicationContext(), R.color.gray)); } }

Target:
private void onMaybeMuteChanged() { if (menu != null && player != null) { MenuItem item = menu.findItem(R.id.action_mute); item.setTitle(player.isMuted() ? R.string.unmute : R.string.mute); TypedArray a = getTheme().obtainStyledAttributes(R.style.Theme_AppCompat, new int[]{R.attr.volume_off}); int attributeResourceId = a.getResourceId(0, 0); Drawable drawableMuted = getResources().getDrawable(attributeResourceId); Drawable drawableUnmuted = getResources().getDrawable(R.drawable.ic_volume_off_gray_24dp); item.setIcon(player.isMuted() ? drawableMuted : drawableUnmuted); } }
Source:
private void renameNote(NotebookSocket conn, HashSet<String> userAndRoles, Notebook notebook, Message fromMessage) throws SchedulerException, IOException { String noteId = (String) fromMessage.get("id"); String name = (String) fromMessage.get("name"); if (noteId == null) { return; } NotebookAuthorization notebookAuthorization = notebook.getNotebookAuthorization(); if (!notebookAuthorization.isOwner(noteId, userAndRoles)) { permissionError(conn, "rename the note", fromMessage.principal, userAndRoles, notebookAuthorization.getOwners(noteId)); return; } Note note = notebook.getNote(noteId); if (note != null) { note.setName(name); AuthenticationInfo subject = new AuthenticationInfo(fromMessage.principal); note.persist(subject); broadcastNote(note); broadcastNoteList(subject, userAndRoles); } }

Target:
private void renameNote(NotebookSocket conn, HashSet<String> userAndRoles, Notebook notebook, Message fromMessage) throws SchedulerException, IOException { String noteId = (String) fromMessage.get("id"); String name = (String) fromMessage.get("name"); if (noteId == null) { return; } NotebookAuthorization notebookAuthorization = notebook.getNotebookAuthorization(); if (!notebookAuthorization.isOwner(noteId, userAndRoles)) { permissionError(conn, "rename", fromMessage.principal, userAndRoles, notebookAuthorization.getOwners(noteId)); return; } Note note = notebook.getNote(noteId); if (note != null) { note.setName(name); AuthenticationInfo subject = new AuthenticationInfo(fromMessage.principal); note.persist(subject); broadcastNote(note); broadcastNoteList(subject, userAndRoles); } }
Source:
public List<DomainRouterVO> listIsolatedByHostId(final Long hostId) { final SearchCriteria<DomainRouterVO> sc = HostUpSearch.create(); if (hostId != null) { sc.setParameters("host", hostId); } sc.setJoinParameters("networkRouter", "type", Network.GuestType.Isolated); final List<DomainRouterVO> routerIds = listBy(sc); final List<DomainRouterVO> routers = new ArrayList<DomainRouterVO>(); for (DomainRouterVO router : routerIds) { router = findById(router.getId()); if (router != null) { routers.add(router); } } return routers; }

Target:
public List<DomainRouterVO> listIsolatedByHostId(final Long hostId) { final SearchCriteria<DomainRouterVO> sc = HostUpSearch.create(); if (hostId != null) { sc.setParameters("host", hostId); } sc.setJoinParameters("networkRouter", "type", Network.GuestType.Isolated); final List<DomainRouterVO> routerIds = listBy(sc); final List<DomainRouterVO> routers = new ArrayList<DomainRouterVO>(); for (final DomainRouterVO router : routerIds) { CollectionUtils.addIgnoreNull(routers, findById(router.getId())); } return routers; }
Source:
ReactorHookRegistrar(final Tracer tracer, final TraceKeys traceKeys) { if (log.isDebugEnabled()) { log.debug("Registering the Trace Scheduler Single Factory"); } Schedulers.setFactory(new Schedulers.Factory() { @Override public Scheduler newSingle(ThreadFactory threadFactory) { return new TraceScheduler(Schedulers.Factory.super.newSingle(threadFactory), tracer, traceKeys); } }); }

Target:
ReactorHookRegistrar(final Tracer tracer, final TraceKeys traceKeys) { if (log.isDebugEnabled()) { log.debug("Registering the Trace Scheduler Single Factory"); } Schedulers.setFactory(new Schedulers.Factory() { @Override public Scheduler newSingle(ThreadFactory threadFactory) { return new TraceScheduler(Schedulers.Factory.super.newSingle(threadFactory), tracer, traceKeys); } @Override public Scheduler newElastic(int ttlSeconds, ThreadFactory threadFactory) { return new TraceScheduler(Schedulers.Factory.super.newElastic(ttlSeconds, threadFactory), tracer, traceKeys); } @Override public Scheduler newParallel(int parallelism, ThreadFactory threadFactory) { return new TraceScheduler(Schedulers.Factory.super.newParallel(parallelism, threadFactory), tracer, traceKeys); } }); }
Source:
public Response updateContentTypeFieldByVar(@PathParam("typeId") final String typeId, @PathParam("fieldVar") final String fieldVar, final String fieldJson, @Context final HttpServletRequest req) throws DotDataException, DotSecurityException { final InitDataObject initData = this.webResource.init(null, false, req, false, null); final User user = initData.getUser(); Response response = null; try { Field field = new JsonFieldTransformer(fieldJson).from(); if (!UtilMethods.isSet(field.id())) { response = ExceptionMapperUtil.createResponse(null, "Field 'id' should be set"); } else { final Field currentField = fieldAPI.byContentTypeIdAndVar(typeId, fieldVar); if (!currentField.id().equals(field.id())) { throw new DotDataValidationException("Field var '"+ fieldVar +"' does not match a field with id '"+ field.id() +"'"); } else { field = fieldAPI.save(field, user); response = Response.ok(new ResponseEntityView(new JsonFieldTransformer(field).mapObject())).build(); } } } catch (Exception e) { response = ResponseUtil.mapExceptionResponse(e); } return response; }

Target:
public Response updateContentTypeFieldByVar(@PathParam("typeId") final String typeId, @PathParam("fieldVar") final String fieldVar, final String fieldJson, @Context final HttpServletRequest req) throws DotDataException, DotSecurityException { final InitDataObject initData = this.webResource.init(null, false, req, false, null); final User user = initData.getUser(); Response response = null; try { Field field = new JsonFieldTransformer(fieldJson).from(); if (!UtilMethods.isSet(field.id())) { response = ExceptionMapperUtil.createResponse(null, "Field 'id' should be set"); } else { final Field currentField = fieldAPI.byContentTypeIdAndVar(typeId, fieldVar); if (!currentField.id().equals(field.id())) { throw new DotDataValidationException("Field id '"+ field.id() +"' does not match a field with id '"+ currentField.id() +"'"); } else { field = fieldAPI.save(field, user); response = Response.ok(new ResponseEntityView(new JsonFieldTransformer(field).mapObject())).build(); } } } catch (Exception e) { response = ResponseUtil.mapExceptionResponse(e); } return response; }
Source:
void save(CallbackGroup group) { if (pendingGroup != null) { pendingGroup.addListener(group); return; } String message = editArea.getValue().trim(); if (message.length() == 0) { return; } CommentInfo input = CommentInfo.copy(comment); input.message(message); enableEdit(false); pendingGroup = group; GerritCallback<CommentInfo> cb = new GerritCallback<CommentInfo>() { @Override public void onSuccess(CommentInfo result) { enableEdit(true); pendingGroup = null; set(result); setEdit(false); if (autoClosed) { setOpen(false); } getCommentManager().setUnsaved(DraftBox.this, false); } @Override public void onFailure(Throwable e) { enableEdit(true); pendingGroup = null; super.onFailure(e); } }; if (input.id() == null) { CommentApi.createDraft(psId, input, group.add(cb)); } else { CommentApi.updateDraft(psId, input.id(), input, group.add(cb)); } CodeMirror cm = getCm(); cm.setOption("keyMap", "vim_ro"); cm.focus(); }

Target:
void save(CallbackGroup group) { if (pendingGroup != null) { pendingGroup.addListener(group); return; } String message = editArea.getValue().trim(); if (message.length() == 0) { return; } CommentInfo input = CommentInfo.copy(comment); input.message(message); enableEdit(false); pendingGroup = group; GerritCallback<CommentInfo> cb = new GerritCallback<CommentInfo>() { @Override public void onSuccess(CommentInfo result) { enableEdit(true); pendingGroup = null; set(result); setEdit(false); if (autoClosed) { setOpen(false); } getCommentManager().setUnsaved(DraftBox.this, false); } @Override public void onFailure(Throwable e) { enableEdit(true); pendingGroup = null; super.onFailure(e); } }; if (input.id() == null) { CommentApi.createDraft(psId, input, group.add(cb)); } else { CommentApi.updateDraft(psId, input.id(), input, group.add(cb)); } CodeMirror cm = getCm(); cm.vim().handleKey("<Esc>"); cm.focus(); }
Source:
public TextFlow getDescription() { List<String> words = new SentenceAnalyzer(query).getWords(); String firstWord = words.isEmpty() ? "" : words.get(0); String temp = regExp ? Localization.lang( "This search contains entries in which any field contains the regular expression <b>%0</b>") : Localization.lang("This search contains entries in which any field contains the term <b>%0</b>"); List<Text> textList = TooltipTextUtil.formatToTexts(temp, new TooltipTextUtil.TextReplacement("<b>%0</b>", firstWord, TooltipTextUtil.TextType.BOLD)); if (words.size() > 1) { List<String> unprocessedWords = words.subList(1, words.size()); for (String word : unprocessedWords) { textList.add(TooltipTextUtil.createText(String.format(" %s ", Localization.lang("and")), TooltipTextUtil.TextType.NORMAL)); textList.add(TooltipTextUtil.createText(word, TooltipTextUtil.TextType.BOLD)); } } textList.add(getCaseSensitiveDescription()); textList.add(TooltipTextUtil.createText("\n\nHint: To search specific fields only, enter for example:\n")); textList.add(TooltipTextUtil.createText("author=smith and title=electrical")); TextFlow searchDescription = new TextFlow(); searchDescription.getChildren().setAll(textList); return searchDescription; }

Target:
public TextFlow getDescription() { List<String> words = new SentenceAnalyzer(query).getWords(); String firstWord = words.isEmpty() ? "" : words.get(0); String temp = regExp ? Localization.lang( "This search contains entries in which any field contains the regular expression <b>%0</b>") : Localization.lang("This search contains entries in which any field contains the term <b>%0</b>"); List<Text> textList = TooltipTextUtil.formatToTexts(temp, new TooltipTextUtil.TextReplacement("<b>%0</b>", firstWord, TooltipTextUtil.TextType.BOLD)); if (words.size() > 1) { List<String> unprocessedWords = words.subList(1, words.size()); for (String word : unprocessedWords) { textList.add(TooltipTextUtil.createText(String.format(" %s ", Localization.lang("and")), TooltipTextUtil.TextType.NORMAL)); textList.add(TooltipTextUtil.createText(word, TooltipTextUtil.TextType.BOLD)); } } textList.add(getCaseSensitiveDescription()); textList.add(TooltipTextUtil.createText("\n\n" + Localization.lang("Hint: To search specific fields only, enter for example:"))); textList.add(TooltipTextUtil.createText(" author=smith and title=electrical", TooltipTextUtil.TextType.MONOSPACED)); TextFlow searchDescription = new TextFlow(); searchDescription.getChildren().setAll(textList); return searchDescription; }