auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void placeNewOrder(Market m, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { Stock stock = m.getStockForSymbol(symbol); if (stock != null){ for (int i = 0; i < ordersPlaced.size(); i++) { if (ordersPlaced.get(i).getStockSymbol() == symbol){ throw new StockMarketExpection("Cannot place multiple orders for the same Stock: " + symbol); } } if (orderType.equals(OrderType.BUY)) { if (stock.getPrice() * volume > cashInHand) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since there is not enough money. Trader: " + name); } BuyOrder order = new BuyOrder(symbol, volume, price, this); this.ordersPlaced.add(order); m.addOrder(order); } else { Order tmpOrder = null; <START> for (int i = 0; i < position.size(); i++) { <END> if (position.get(i).getStockSymbol() == symbol){ tmpOrder = position.get(i); } } if (!OrderUtility.owns(position, symbol)) { throw new StockMarketExpection("Cannot sell stock you do not own. Stock: " + symbol); } else if (tmpOrder.getSize() < volume) { throw new StockMarketExpection("Cannot sell more stock than you own. Stock: " + symbol + "Owned: " + volume); } else { SellOrder order = new SellOrder(symbol, volume, price, this); this.ordersPlaced.add(order); m.addOrder(order); } } } else { throw new StockMarketExpection("Invalid Stock: " + symbol); } }</code><technical_language>some of code for checking invalid orders, is common placeNewOrder() placeNewMarketOrder(), move common piece of code a new method reuse method</technical_language>

Target:
public void placeNewOrder(Market m, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { Stock stock = m.getStockForSymbol(symbol); if (stock != null){ for (int i = 0; i < ordersPlacedByTrader.size(); i++) { if (ordersPlacedByTrader.get(i).getStockSymbol() == symbol){ throw new StockMarketExpection("Cannot place multiple orders for the same Stock: " + symbol); } } if (orderType.equals(OrderType.BUY)) { if (stock.getPrice() * volume > cashInHand) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since there is not enough money. Trader: " + name); } BuyOrder order = new BuyOrder(symbol, volume, price, this); this.ordersPlacedByTrader.add(order); m.addOrder(order); } else { Order tmpOrder = null; for (int i = 0; i < stocksOwnedByTrader.size(); i++) { if (stocksOwnedByTrader.get(i).getStockSymbol() == symbol){ tmpOrder = stocksOwnedByTrader.get(i); } } checkForError(symbol, volume, tmpOrder); SellOrder order = new SellOrder(symbol, volume, price, this); this.ordersPlacedByTrader.add(order); m.addOrder(order); } } else { throw new StockMarketExpection("Invalid Stock: " + symbol); } }
Source:
<code>public static Request createMockRequest() { <START> Request request = new Request(); <END> request.setTitle("Beer Wanted"); request.setDescription( "It's a beautiful day, I've got a sandwich, " + "but I lack a beverage. When considering what beverage " + "I'd enjoy, I decided on a beer. Please, I need a beer." ); request.setCents(150); User client = new User(); client.setName("Herp Derpington"); client.setLocation(37.7583, -122.4275); client.setEmail("jazoff-facilitator@gmail.com"); request.setClient(client); User vendor = new User(); vendor.setName("Derp Herpington"); vendor.setLocation(37.7583, -122.4275); vendor.setEmail("jazoff+vendor@gmail.com"); request.setVendor(vendor); return request; }</code><technical_language>This needs new Request(Request.Type.OPEN) now</technical_language>

Target:
public static Request createMockRequest() { Request request = new Request(Request.State.OPEN); request.setTitle("Beer Wanted"); request.setDescription( "It's a beautiful day, I've got a sandwich, " + "but I lack a beverage. When considering what beverage " + "I'd enjoy, I decided on a beer. Please, I need a beer." ); request.setCents(150); User client = new User(); client.setName("Herp Derpington"); client.setLocation(37.7583, -122.4275); client.setEmail("jazoff-facilitator@gmail.com"); request.setClient(client); User vendor = new User(); vendor.setName("Derp Herpington"); vendor.setLocation(37.7583, -122.4275); vendor.setEmail("jazoff+vendor@gmail.com"); request.setVendor(vendor); return request; }
Source:
<code>public SecretAsContainerResourceProvisioner( @Named("che.workspace.provision.secret.labels") String[] labels) { <START> this.secretLabels = new HashMap<>(); <END> for (String keyValue : labels) { String[] pair = keyValue.split("=", 2); secretLabels.put(pair[0], pair.length == 1 ? "" : pair[1]); } }</code><technical_language>secretLabels = Arrays.stream(labels) .map(l -> l.split("=", 2)) .collect(Collectors.toMap(p -> p[0], p -> p.length == 1 ? "" : p[1]));</technical_language>

Target:
public SecretAsContainerResourceProvisioner( @Named("che.workspace.provision.secret.labels") String[] labels) { this.secretLabels = Arrays.stream(labels) .map(item -> item.split("=", 2)) .collect(toMap(p -> p[0], p -> p.length == 1 ? "" : p[1])); }
Source:
<code>public ASTValue eval(Environment environment) throws WordsRuntimeException { ASTValue varName = children.get(0).eval(environment); ASTValue rawValue = children.get(1).eval(environment); Variable value = null; if (rawValue.type == ASTValue.Type.NUM) { value = new Variable(rawValue.numValue); } else if (rawValue.type == ASTValue.Type.STRING) { value = new Variable(rawValue.stringValue); } <START> <END> environment.createLocalVariable(varName.stringValue, value); return null; }</code><technical_language>handling case ASTValue is NOTHING? legal assign a variable nothing, in, "x is nothing.". Also, is legal assign a variable object? For example: Fred is a person. X is Fred. (If legal, garbage collection harder, legal. if legal, code silently do nothing, I give a runtime exception user.)</technical_language>

Target:
public ASTValue eval(Environment environment) throws WordsRuntimeException { ASTValue varName = children.get(0).eval(environment); ASTValue rawValue = children.get(1).eval(environment); Variable value = null; if (rawValue.type == ASTValue.Type.NUM) { value = new Variable(rawValue.numValue); } else if (rawValue.type == ASTValue.Type.STRING) { value = new Variable(rawValue.stringValue); } else { throw new InvalidLocalVariableException(); } environment.createLocalVariable(varName.stringValue, value); return null; }
Source:
<code>protected abstract UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException; protected abstract GroupDetails retrieveGroup(String groupname); protected abstract boolean canRetrieveUserByName(); public GroupDetails loadGroupByGroupname(String groupname) { if( this.realm!=null && this.realm.getSsoEnabled()!=null && this.realm.getSsoEnabled().getCheckMode()!=null && this.realm.getSsoEnabled().getCheckMode().equalsIgnoreCase("no_check")==true && this.realm.getSsoEnabled().getDefaultGroup()!=null && <START> this.realm.getSsoEnabled().getDefaultGroup().equals(groupname)==true) <END> return new ActiveDirectoryGroupDetails(groupname); else return retrieveGroup(groupname); }</code><technical_language>a matter of preference maybe, conditions get complex, I generally extract a small dedicated boolean method. isBlahMode() hasSomethingSpecificBluhEnabled()</technical_language>

Target:
protected abstract UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException; protected abstract boolean canRetrieveUserByName(); public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException { return retrieveUser(username,null); }
Source:
<code>public TopicStatus(String topic, ConnectorTaskId task, long discoverTimestamp) { this.topic = topic; this.connector = task.connector(); this.task = task.task(); <START> this.discoverTimestamp = discoverTimestamp; <END> }</code><technical_language>replacing lines with: this(topic, Objects.requireNotNull(task).connector(), task.task(), discoverTimestamp); removing TODO line</technical_language>

Target:
public TopicStatus(String topic, ConnectorTaskId task, long discoverTimestamp) { this(topic, task.connector(), task.task(), discoverTimestamp); }
Source:
<code>public JdbcSinkConfig(Map<?, ?> props) { super(CONFIG_DEF, props); connectionUrl = getString(CONNECTION_URL); connectionUser = getString(CONNECTION_USER); connectionPassword = getPasswordValue(CONNECTION_PASSWORD); tableNameFormat = getString(TABLE_NAME_FORMAT).trim(); batchSize = getInt(BATCH_SIZE); maxRetries = getInt(MAX_RETRIES); retryBackoffMs = getInt(RETRY_BACKOFF_MS); autoCreate = getBoolean(AUTO_CREATE); autoEvolve = getBoolean(AUTO_EVOLVE); insertMode = InsertMode.valueOf(getString(INSERT_MODE).toUpperCase()); pkMode = PrimaryKeyMode.valueOf(getString(PK_MODE).toUpperCase()); pkFields = getList(PK_FIELDS); dialectName = getString(DIALECT_NAME_CONFIG); fieldsWhitelist = new HashSet<>(getList(FIELDS_WHITELIST)); String dbTimeZone = getString(DB_TIMEZONE_CONFIG); timeZone = dbTimeZone == null ? TimeZone.getTimeZone(ZoneOffset.UTC) : <START> TimeZone.getTimeZone(ZoneId.of(dbTimeZone)); <END> }</code><technical_language>getString(DB_TIMEZONE_CONFIG) method return a non-null string, default is UTC. means lines 405-406 simplified just: timeZone = TimeZone.getTimeZone(ZoneId.of(dbTimeZone)) Also, if invalid time zone is specified? prevent adding a Validator DB_TIMEZONE_CONFIG definition checks supplied is a valid time zone name</technical_language>

Target:
public JdbcSinkConfig(Map<?, ?> props) { super(CONFIG_DEF, props); connectionUrl = getString(CONNECTION_URL); connectionUser = getString(CONNECTION_USER); connectionPassword = getPasswordValue(CONNECTION_PASSWORD); tableNameFormat = getString(TABLE_NAME_FORMAT).trim(); batchSize = getInt(BATCH_SIZE); maxRetries = getInt(MAX_RETRIES); retryBackoffMs = getInt(RETRY_BACKOFF_MS); autoCreate = getBoolean(AUTO_CREATE); autoEvolve = getBoolean(AUTO_EVOLVE); insertMode = InsertMode.valueOf(getString(INSERT_MODE).toUpperCase()); pkMode = PrimaryKeyMode.valueOf(getString(PK_MODE).toUpperCase()); pkFields = getList(PK_FIELDS); dialectName = getString(DIALECT_NAME_CONFIG); fieldsWhitelist = new HashSet<>(getList(FIELDS_WHITELIST)); String dbTimeZone = getString(DB_TIMEZONE_CONFIG); timeZone = TimeZone.getTimeZone(ZoneId.of(dbTimeZone)); }
Source:
<code>private static String autoValuePropToBuilderSetterName( String prop, Set<String> builderSetterNames) { <START> Set<String> possiblePropNames = new LinkedHashSet<>(); <END> possiblePropNames.add(prop); if (prop.startsWith("get") && prop.length() > 3 && Character.isUpperCase(prop.charAt(3))) { possiblePropNames.add(Introspector.decapitalize(prop.substring(3))); } else if (prop.startsWith("is") && prop.length() > 2 && Character.isUpperCase(prop.charAt(2))) { possiblePropNames.add(Introspector.decapitalize(prop.substring(2))); } for (String propName : possiblePropNames) { HashSet<String> setterNamesToTry = new HashSet<>(); setterNamesToTry.add(propName); setterNamesToTry.add("set" + BuilderFrameworkSupportUtils.capitalize(propName)); for (String setterName : setterNamesToTry) { if (builderSetterNames.contains(setterName)) { return setterName; } } } return null; }</code><technical_language>size of this set is 1 2. a LinkedHashSet is overkill. array. 3 assignments array, of right-hand-side is new String[] { ... }</technical_language>

Target:
private static String autoValuePropToBuilderSetterName( String prop, Set<String> builderSetterNames) { String[] possiblePropNames; if (prop.startsWith("get") && prop.length() > 3 && Character.isUpperCase(prop.charAt(3))) { possiblePropNames = new String[] {prop, Introspector.decapitalize(prop.substring(3))}; } else if (prop.startsWith("is") && prop.length() > 2 && Character.isUpperCase(prop.charAt(2))) { possiblePropNames = new String[] {prop, Introspector.decapitalize(prop.substring(2))}; } else { possiblePropNames = new String[] {prop}; } for (String propName : possiblePropNames) { if (builderSetterNames.contains(propName)) { return propName; } String setterName = "set" + BuilderFrameworkSupportUtils.capitalize(propName); if (builderSetterNames.contains(setterName)) { return setterName; } } return null; }
Source:
<code>public boolean isValidValue(String value) { try { <START> if (this == NUMERIC_BIGDECIMAL) { <END> new BigDecimal(value); } else if (this == NUMERIC_BIGINTEGER) { new BigInteger(value); } else if (this == NUMERIC_BYTE) { new Byte(value); } else if (this == NUMERIC_DOUBLE) { new Double(value); } else if (this == NUMERIC_FLOAT) { new Float(value); } else if (this == NUMERIC_INTEGER) { new Integer(value); } else if (this == NUMERIC_LONG) { new Long(value); } else if (this == NUMERIC_SHORT) { new Short(value); } else if (this == BOOLEAN) { return value.trim().equalsIgnoreCase("true") || value.trim().equalsIgnoreCase("false"); } } catch (Exception e) { return false; } return true; }</code><technical_language>isValidValue() anc isNumeric() abstract enum, instance implementation. Arguably, nicer code, avoiding monster ifs potential bug a new type is added updating ifs I kind of code considered worse, due @Overrides. :-) consider</technical_language>

Target:
public boolean isValidValue(String value) { return true; }
Source:
<code>public String getPartitionKey() { if (docId != null) { return docId; <START> } else if (docIds != null && docIds.size() > 0) { <END> return docIds.get(0); } return getId(); }</code><technical_language>docIds.size() > 0 -> !docIds.isEmpty()</technical_language>

Target:
public String getPartitionKey() { if (docId != null) { return docId; } else if (docIds != null && !docIds.isEmpty()) { return docIds.get(0); } return getId(); }
Source:
<code>public AuditLogType getAuditLogTypeValue() { addCustomValue("SessionID", StringUtils.isEmpty(sessionId) ? UNKNOWN : sessionId); addCustomValue("SourceIP", StringUtils.isEmpty(sourceIp) ? UNKNOWN : sourceIp); addCustomValue("LoginErrMsg", ""); if (getSucceeded()) { return AuditLogType.USER_VDC_LOGIN; <START> } else { <END> if (getActionReturnValue() == CreateUserSessionsError.NUM_OF_SESSIONS_EXCEEDED) { addCustomValue("MaxUserSessions", String.valueOf(maxUserSessions)); return AuditLogType.USER_MAX_SESSIONS_EXCEEDED; } else { return AuditLogType.USER_VDC_LOGIN_FAILED; } } }</code><technical_language>else is required</technical_language>

Target:
public AuditLogType getAuditLogTypeValue() { addCustomValue("SessionID", StringUtils.isEmpty(sessionId) ? UNKNOWN : sessionId); addCustomValue("SourceIP", StringUtils.isEmpty(sourceIp) ? UNKNOWN : sourceIp); addCustomValue("LoginErrMsg", ""); if (getSucceeded()) { return AuditLogType.USER_VDC_LOGIN; } if (getActionReturnValue() == CreateUserSessionsError.NUM_OF_SESSIONS_EXCEEDED) { addCustomValue("MaxUserSessions", String.valueOf(maxUserSessions)); return AuditLogType.USER_MAX_SESSIONS_EXCEEDED; } return AuditLogType.USER_VDC_LOGIN_FAILED; }
Source:
<code>public static Predicate<ClusterProcess> marathon() { return abstractContainer -> abstractContainer instanceof Marathon; <START> } <END></code><technical_language>Refactor abstractContainer identifier process</technical_language>

Target:
public static Predicate<ClusterProcess> marathon() { return process -> process instanceof Marathon; }
Source:
<code>public String getRoleDescription(String role) { <START> return NLS.get("Permission." + role + ".description"); <END> }</code><technical_language>re-usable</technical_language>

Target:
public String getRoleDescription(String role) { return Permissions.getPermissionDescription(role); }
Source:
<code>public void display(IDebuggerConsole console) { if (console.equals(getCurrentConsole())) { return; } DebuggerConsoleWorkbenchPart part = fConsoleToPart.get(console); if (part != null) { <START> partActivated(part); <END> } }</code><technical_language>a call here, removed: "fActiveConsole.consoleSelected();" this call, gdb focus synchronizer notified console changed, change selection in DV. I need add back</technical_language>

Target:
public void display(IDebuggerConsole console) { if (console.equals(getCurrentConsole())) { return; } DebuggerConsoleWorkbenchPart part = fConsoleToPart.get(console); if (part != null) { partActivated(part); fActiveConsole.consoleSelected(); } }
Source:
<code>public PageProcessor(Optional<PageFilter> filter, List<? extends PageProjection> projections) { this.filter = requireNonNull(filter, "filter is null") .map(pageFilter -> { if (pageFilter.getInputChannels().size() == 1 && pageFilter.isDeterministic()) { return new DictionaryAwarePageFilter(pageFilter); } return pageFilter; }); this.projections = requireNonNull(projections, "projections is null").stream() .map(projection -> { if (projection.getInputChannels().size() == 1 && projection.isDeterministic()) { return new DictionaryAwarePageProjection(projection, dictionarySourceIdFunction); } return projection; }) .collect(toImmutableList()); <START> } <END></code><technical_language>Do need of overloaded methods? of tests, of is used, lets change tests</technical_language>

Target:
public PageProcessor(Optional<PageFilter> filter, List<? extends PageProjection> projections) { this(filter, projections, OptionalInt.of(1)); }
Source:
<code>private boolean isSparsifyCommandAvailable() { ArrayList<Disk> disks = getSelectedItems() != null ? Linq.<Disk> cast(getSelectedItems()) : new ArrayList<Disk>(); for (Disk disk : disks) { if (isDiskLocked(disk) <START> || <END> (!isVmDown() && disk.getPlugged())) { return false; } } return true; }</code><technical_language>space</technical_language>

Target:
private boolean isSparsifyCommandAvailable() { List<Disk> disks = getSelectedItems() != null ? Linq.<Disk> cast(getSelectedItems()) : new ArrayList<Disk>(); for (Disk disk : disks) { if (isDiskLocked(disk) || (!isVmDown() && disk.getPlugged())) { return false; } } return true; }
Source:
<code>public void onEvent(CourseUpgradedEvent event) { <START> EventBus.getDefault().removeStickyEvent(CourseUpgradedEvent.class); <END> if (!isOnCourseOutline || isVideoMode) { return; } hidePaymentsBanner(); getCourseComponentFromServer(true); }</code><technical_language>removeStickyEvent called CourseOutlineActivity other screens closed. <img src="<LINK_0>" height="480"></technical_language>

Target:
public void onEvent(CourseUpgradedEvent event) { if (!isOnCourseOutline || isVideoMode) { return; } hidePaymentsBanner(); getCourseComponentFromServer(true); }
Source:
<code><START> public FluoConfiguration setPositiveInt(String property, int value) { <END> Preconditions.checkArgument(value > 0, property+" must be positive"); setProperty(property, value); return this; }</code><technical_language>public part of API? I thinking of methods implementation. If part of API support them</technical_language>

Target:
private FluoConfiguration setPositiveInt(String property, int value) { Preconditions.checkArgument(value > 0, property+" must be positive"); setProperty(property, value); return this; }
Source:
<code>protected void configureModule() { add( CeTaskProcessorRepositoryImpl.class, <START> CeWorkerImpl.class, <END> CeWorkerFactoryImpl.class, CeProcessingSchedulerExecutorServiceImpl.class, CeProcessingSchedulerImpl.class); }</code><technical_language>is more need for instance of CeWorkerImpl in container CeWorkerImpl instances produced CeWorkerFactory</technical_language>

Target:
protected void configureModule() { add( CeTaskProcessorRepositoryImpl.class, CeWorkerFactoryImpl.class, CeProcessingSchedulerExecutorServiceImpl.class, CeProcessingSchedulerImpl.class); }
Source:
<code>public synchronized CompiledPlan planSqlCore(String sql, StatementPartitioning partitioning) { TrivialCostModel costModel = new TrivialCostModel(); DatabaseEstimates estimates = new DatabaseEstimates(); CompiledPlan plan = null; try (QueryPlanner planner = new QueryPlanner( sql, "PlannerTool", "PlannerToolProc", m_database, partitioning, m_hsql, estimates, !VoltCompiler.DEBUG_MODE, costModel, null, null, DeterminismMode.FASTER, false)) { planner.parse(); plan = planner.plan(); assert(plan != null); } catch (Exception e) { String loggedMsg = ""; if (!(e instanceof PlanningErrorException || e instanceof HSQLParseException)) { logException(e, "Error compiling query"); loggedMsg = " (Stack trace has been written to the log.)"; } <START> if (e instanceof NumberFormatException) { <END> throw new RuntimeException("Error compiling query: " + e.toString() + loggedMsg, e); } throw new RuntimeException("SQL error while compiling query: " + e.getMessage() + loggedMsg, e); } if (plan == null) { throw new RuntimeException("Null plan received in PlannerTool.planSql"); } return plan; }</code><technical_language>is NumberFormatException special</technical_language>

Target:
public synchronized CompiledPlan planSqlCore(String sql, StatementPartitioning partitioning) { TrivialCostModel costModel = new TrivialCostModel(); DatabaseEstimates estimates = new DatabaseEstimates(); CompiledPlan plan = null; try (QueryPlanner planner = new QueryPlanner( sql, "PlannerTool", "PlannerToolProc", m_database, partitioning, m_hsql, estimates, !VoltCompiler.DEBUG_MODE, costModel, null, null, DeterminismMode.FASTER, false)) { planner.parse(); plan = planner.plan(); assert(plan != null); } catch (Exception e) { String loggedMsg = ""; if (!(e instanceof PlanningErrorException || e instanceof HSQLParseException)) { logException(e, "Error compiling query"); loggedMsg = " (Stack trace has been written to the log.)"; } if (e.getMessage() != null) { throw new RuntimeException("SQL error while compiling query: " + e.getMessage() + loggedMsg, e); } throw new RuntimeException("SQL error while compiling query: " + e.toString() + loggedMsg, e); } if (plan == null) { throw new RuntimeException("Null plan received in PlannerTool.planSql"); } return plan; }
Source:
<code>public SimpleInterval getLocation() { if (getReadUnmappedFlag()) { return null; } else { <START> return new SimpleInterval(mReferenceName, mAlignmentStart, mAlignmentEnd); <END> } }</code><technical_language>This getAlignmentEnd instead of mAlignmentEnd, unset for mapped reads is called. is practice getters in calls anyhow</technical_language>

Target:
public SimpleInterval getLocation() { if (getReadUnmappedFlag()) { return null; } else { return new SimpleInterval(getReferenceName(), getAlignmentStart(), getAlignmentEnd()); } }
Source:
<code>public static boolean isCheckoutUpdateRequired(final Checkout checkout, final MaskedWallet maskedWallet) { if (checkout == null) { throw new NullPointerException("checkout cannot be null"); } if (maskedWallet == null) { throw new NullPointerException("maskedWallet cannot be null"); } Address shippingAddress = null; if (checkout.isRequiresShipping()) { shippingAddress = createShopifyAddress(maskedWallet.getBuyerShippingAddress()); } final Address billingAddress = createShopifyAddress(maskedWallet.getBuyerBillingAddress()); <START> return (checkout.isRequiresShipping() && shippingAddress != null && !shippingAddress.locationsAreEqual(checkout.getShippingAddress())) <END> || !billingAddress.locationsAreEqual(checkout.getBillingAddress()) || !TextUtils.equals(maskedWallet.getEmail(), checkout.getEmail()); }</code><technical_language>shipping code separated out a method name doing</technical_language>

Target:
public static boolean isCheckoutUpdateRequired(final Checkout checkout, final MaskedWallet maskedWallet) { if (checkout == null) { throw new NullPointerException("checkout cannot be null"); } if (maskedWallet == null) { throw new NullPointerException("maskedWallet cannot be null"); } return isShippingAddressChanged(checkout, maskedWallet) || isBillingAddressChanged(checkout, maskedWallet) || isEmailChanged(checkout, maskedWallet); }
Source:
<code>public void everyoneCanUpdateEntry() { DocumentModel entry = groupDirSession.getEntry("members"); assertNotNull(entry); assertEquals("cn=members,ou=editable,ou=groups,dc=example,dc=com", entry.getProperty(ExternalLDAPDirectoryFeature.GROUP_SCHEMANAME, "dn")); assertEquals(List.of("submembers"), <START> entry.getProperty(ExternalLDAPDirectoryFeature.GROUP_SCHEMANAME, "subGroups")); <END> entry.setProperty(ExternalLDAPDirectoryFeature.GROUP_SCHEMANAME, "description", "AWonderfulGroup"); entry.setProperty(ExternalLDAPDirectoryFeature.GROUP_SCHEMANAME, "members", Arrays.asList("user1", "user2")); groupDirSession.updateEntry(entry); entry = groupDirSession.getEntry("members"); Assert.assertEquals("AWonderfulGroup", entry.getProperty(ExternalLDAPDirectoryFeature.GROUP_SCHEMANAME, "description")); }</code><technical_language>a static import code in line</technical_language>

Target:
public void everyoneCanUpdateEntry() { DocumentModel entry = groupDirSession.getEntry("members"); assertNotNull(entry); assertEquals("cn=members,ou=editable,ou=groups,dc=example,dc=com", entry.getProperty(GROUP_SCHEMANAME, "dn")); assertEquals(List.of("submembers"), entry.getProperty(GROUP_SCHEMANAME, "subGroups")); entry.setProperty(GROUP_SCHEMANAME, "description", "AWonderfulGroup"); entry.setProperty(GROUP_SCHEMANAME, "members", Arrays.asList("user1", "user2")); groupDirSession.updateEntry(entry); entry = groupDirSession.getEntry("members"); assertEquals("AWonderfulGroup", entry.getProperty(GROUP_SCHEMANAME, "description")); }
Source:
<code><START> private void addDependenciesForTests() { <END> additionalRequirements.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "org.eclipse.core.runtime", VersionRange.emptyRange, null, true, true, true)); additionalRequirements.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "org.eclipse.ui.ide.application", VersionRange.emptyRange, null, true, true, true)); }</code><technical_language>good mention TestMojo#getTestDependencies() in sync</technical_language>

Target:
private void addDependenciesForTests() { additionalRequirements.add(optionalGreedyRequirementTo("org.eclipse.equinox.launcher")); additionalRequirements.add(optionalGreedyRequirementTo("org.eclipse.core.runtime")); additionalRequirements.add(optionalGreedyRequirementTo("org.eclipse.ui.ide.application")); }
Source:
<code>public void tearDown() { col.drop(); <START> client.close(); <END> }</code><technical_language>closing is done in driver. need repeat here</technical_language>

Target:
public void tearDown() { col.drop(); }
Source:
<code>private void traceBlockPowerStartSolid(GlowBlock srcBlock, RSManager rsManager, BlockFace toDir, boolean isDirect) { GlowBlock destBlock = srcBlock.getRelative(toDir); if (destBlock == null) { return; } Material destMat = destBlock.getType(); <START> if (destMat == Material.REDSTONE_WIRE) { <END> } else { return; } rsManager.traceFromBlock(srcBlock, toDir, 15, isDirect); }</code><technical_language>Reduces if (destMat != Material.REDSTONE_WIRE) return;</technical_language>

Target:
private void traceBlockPowerStartSolid(GlowBlock srcBlock, RSManager rsManager, BlockFace toDir, boolean isDirect) { GlowBlock destBlock = srcBlock.getRelative(toDir); if (destBlock == null) { return; } Material destMat = destBlock.getType(); if (destMat != Material.REDSTONE_WIRE) { return; } rsManager.traceFromBlock(srcBlock, toDir, 15, isDirect); }
Source:
<code>protected boolean set(Entity dataHolder, Boolean value) { <START> dataHolder.setGlowing(checkNotNull(value)); <END> return true; }</code><technical_language>checkNotNull(value, "value")</technical_language>

Target:
protected boolean set(Entity dataHolder, Boolean value) { dataHolder.setGlowing(checkNotNull(value, "value")); return true; }
Source:
<code>public static MongoClient getMongoClient(Properties properties) throws UnknownHostException { String authenticationDb = properties.getProperty("eva.mongo.auth.db", null); if (authenticationDb == null || authenticationDb.isEmpty()) { <START> return new MongoClient(); <END> } else { String[] hosts = properties.getProperty("eva.mongo.host").split(","); List<ServerAddress> servers = new ArrayList<>(); for (String host : hosts) { String[] params = host.split(":"); if (params.length > 1) { servers.add(new ServerAddress(params[0], Integer.parseInt(params[1]))); } else { servers.add(new ServerAddress(params[0], 27017)); } } MongoCredential mongoCredential = MongoCredential.createCredential( properties.getProperty("eva.mongo.user"), authenticationDb, properties.getProperty("eva.mongo.passwd").toCharArray()); return new MongoClient(servers, Collections.singletonList(mongoCredential)); } }</code><technical_language>authentication DB, a MongoClient initialized hosts credentials</technical_language>

Target:
public static MongoClient getMongoClient(Properties properties) throws UnknownHostException { String[] hosts = properties.getProperty("eva.mongo.host").split(","); List<ServerAddress> servers = new ArrayList<>(); for (String host : hosts) { String[] params = host.split(":"); if (params.length > 1) { servers.add(new ServerAddress(params[0], Integer.parseInt(params[1]))); } else { servers.add(new ServerAddress(params[0], 27017)); } } List<MongoCredential> mongoCredentialList = null; String authenticationDb = properties.getProperty("eva.mongo.auth.db", null); if (authenticationDb != null && !authenticationDb.isEmpty()) { mongoCredentialList = Collections.singletonList(MongoCredential.createCredential( properties.getProperty("eva.mongo.user"), authenticationDb, properties.getProperty("eva.mongo.passwd").toCharArray())); } return new MongoClient(servers, mongoCredentialList); }
Source:
<code>protected AllelicCount createRecord(final DataLine dataLine) { final String contig = dataLine.get(AllelicCountTableColumn.CONTIG); final int position = dataLine.getInt(AllelicCountTableColumn.POSITION); final int refReadCount = dataLine.getInt(AllelicCountTableColumn.REF_COUNT); final int altReadCount = dataLine.getInt(AllelicCountTableColumn.ALT_COUNT); <START> final Nucleotide refNucleotide = Nucleotide.valueOf(dataLine.get(AllelicCountTableColumn.REF_NUCLEOTIDE.name()).getBytes()[0]); <END> final Nucleotide altNucleotide = Nucleotide.valueOf(dataLine.get(AllelicCountTableColumn.ALT_NUCLEOTIDE.name()).getBytes()[0]); final SimpleInterval interval = new SimpleInterval(contig, position, position); return new AllelicCount(interval, refReadCount, altReadCount, refNucleotide, altNucleotide); }</code><technical_language>I mentioned before, REF_NUCLEOTIDE ALT_NUCLEOTIDE handled differently optional columns</technical_language>

Target:
protected AllelicCount createRecord(final DataLine dataLine) { try { final String contig = dataLine.get(AllelicCountTableColumn.CONTIG); final int position = dataLine.getInt(AllelicCountTableColumn.POSITION); final int refReadCount = dataLine.getInt(AllelicCountTableColumn.REF_COUNT); final int altReadCount = dataLine.getInt(AllelicCountTableColumn.ALT_COUNT); final Nucleotide refNucleotide = Nucleotide.valueOf(dataLine.get(AllelicCountTableColumn.REF_NUCLEOTIDE.name()).getBytes()[0]); final Nucleotide altNucleotide = Nucleotide.valueOf(dataLine.get(AllelicCountTableColumn.ALT_NUCLEOTIDE.name()).getBytes()[0]); final SimpleInterval interval = new SimpleInterval(contig, position, position); return new AllelicCount(interval, refReadCount, altReadCount, refNucleotide, altNucleotide); } catch (final IllegalArgumentException e) { throw new UserException.BadInput("AllelicCountCollection file must have all columns specified."); } }
Source:
<code>public boolean onScale(ScaleGestureDetector detector) { <START> if (scale == -1f){ <END> mGridView.setNumColumns(GridView.AUTO_FIT); scale = mGridView.getNumColumns(); } scale *= 1-(detector.getScaleFactor()- 1); scale = Math.max(2.0f, Math.min(scale, 10.0f)); Integer scaleInt = Math.round(scale); mGridView.setNumColumns(scaleInt); mGridView.invalidateViews(); return true; }</code><technical_language>space ) {</technical_language>

Target:
public boolean onScale(ScaleGestureDetector detector) { if (mScale == -1f) { mGridView.setNumColumns(GridView.AUTO_FIT); mScale = mGridView.getNumColumns(); } mScale *= 1.f - (detector.getScaleFactor() - 1.f); mScale = Math.max(2.0f, Math.min(mScale, 10.0f)); Integer scaleInt = Math.round(mScale); mGridView.setNumColumns(scaleInt); mGridView.invalidateViews(); return true; }
Source:
<code>public RecoveryAuthenticationProviderImpl(RecoveryService recoveryService) { <START> this.recoveryService = recoveryService; <END> }</code><technical_language>requireNonNull(recoveryService)</technical_language>

Target:
public RecoveryAuthenticationProviderImpl(RecoveryService recoveryService) { this.recoveryService = requireNonNull(recoveryService); }
Source:
<code><START> public F.Promise<Result> process(final String languageTag) { <END> final UserContext userContext = userContext(languageTag); final PlayJavaSphereClient sphere = sphere(); final F.Promise<Cart> cartPromise = getOrCreateCart(userContext, session()); return cartPromise.flatMap(cart -> { final Form<CheckoutShippingFormData> filledForm = Form.form(CheckoutShippingFormData.class, CheckoutShippingFormData.Validation.class).bindFromRequest(request()); final CheckoutShippingFormData checkoutShippingFormData = extractBean(request(), CheckoutShippingFormData.class); final Messages messages = messages(userContext); final String csrfToken = getCsrfToken(); final CheckoutShippingContent content = new CheckoutShippingContent(checkoutShippingFormData, cart, messages, configuration(), reverseRouter(), userContext, flash(), csrfToken, shippingMethods, productDataConfig); additionalValidations(filledForm, checkoutShippingFormData); if (filledForm.hasErrors()) { Logger.info("cart not valid"); content.getShippingForm().setErrors(new ErrorsBean(filledForm)); final SunrisePageData pageData = pageData(userContext, content); return F.Promise.pure(badRequest(templateService().renderToHtml("checkout-shipping", pageData, userContext.locales()))); } else { final Address shippingAddress = content.getShippingForm().getShippingAddress().toAddress(); final Address nullableBillingAddress = content.getShippingForm().isBillingAddressDifferentToBillingAddress() ? content.getShippingForm().getBillingAddress().toAddress() : null; final String shippingMethodId = checkoutShippingFormData.getShippingMethodId(); final List<UpdateAction<Cart>> updateActions = asList( SetShippingAddress.of(shippingAddress), SetBillingAddress.of(nullableBillingAddress), SetShippingMethod.of(Reference.of(ShippingMethod.referenceTypeId(), shippingMethodId)) ); return sphere.execute(CartUpdateCommand.of(cart, updateActions)) .map(updatedCart -> { Logger.info("cart updated " + updatedCart); final Result redirect = redirect(reverseRouter().showCheckoutShippingForm(languageTag)); return redirect; }); } }); }</code><technical_language>some big function... is split it</technical_language>

Target:
public F.Promise<Result> process(final String languageTag) { final UserContext userContext = userContext(languageTag); return getOrCreateCart(userContext, session()).flatMap(cart -> { final CheckoutShippingFormData checkoutShippingFormData = extractBean(request(), CheckoutShippingFormData.class); final Form<CheckoutShippingFormData> filledForm = obtainFilledForm(checkoutShippingFormData); final Messages messages = messages(userContext); final CheckoutShippingContent content = new CheckoutShippingContent(checkoutShippingFormData, cart, messages, configuration(), reverseRouter(), userContext, getCsrfToken(), shippingMethods, productDataConfig); if (filledForm.hasErrors()) { return F.Promise.pure(badRequest(userContext, filledForm, content)); } else { return updateCart(sphere(), cart, checkoutShippingFormData, content) .map(updatedCart -> redirect(reverseRouter().showCheckoutShippingForm(languageTag))); } }); }
Source:
<code>public void testDatetimeWithLength() throws Exception { if ( !server.getVersion().equals("5.6") ) return; String sql[] = { <START> "create TABLE `test_datetime` ( id datetime(3) )" <END> }; testIntegration(sql); }</code><technical_language>throw in ALTER a TIMESTAMP for good measure</technical_language>

Target:
public void testDatetimeWithLength() throws Exception { if ( !server.getVersion().equals("5.6") ) return; String sql[] = { "create TABLE `test_datetime` ( id datetime(3) )", "alter TABLE `test_datetime` add column ts timestamp(6)" }; testIntegration(sql); }
Source:
<code>public void setAgsOptions(final AgsContext opts) { combo.removeActionListener(this); combo.removeAllItems(); final ImList<ComboEntry> validEntries = opts.validStrategies.map(agsStrategy -> new ComboEntry(agsStrategy.key().displayName(), new Some<>(agsStrategy))); final Option<ComboEntry> defaultEntry = opts.defaultStrategy.map(agsStrategy -> { final String name = String.format("Auto (%s)", agsStrategy.key().displayName()); return new ComboEntry(name, None.<AgsStrategy>instance()); }); final ImList<ComboEntry> allEntries = defaultEntry.isEmpty() ? validEntries : validEntries.cons(defaultEntry.getValue()); final ComboBoxModel<ComboEntry> model = new DefaultComboBoxModel<>(new Vector<>(allEntries.toList())); validEntries.foreach(new ApplyOp<ComboEntry>() { @Override public void apply(ComboEntry comboEntry) { <START> System.out.println("ENT " + comboEntry); <END> } }); final Option<ComboEntry> sel = opts.usingDefault() ? defaultEntry : allEntries.find(comboEntry -> comboEntry.strategy.equals(opts.strategyOverride)); sel.foreach(model::setSelectedItem); combo.setModel(model); combo.addActionListener(this); }</code><technical_language>Is this left debugging</technical_language>

Target:
public void setAgsOptions(final AgsContext opts) { combo.removeActionListener(this); combo.removeAllItems(); final ImList<ComboEntry> validEntries = opts.validStrategies.map(agsStrategy -> new ComboEntry(agsStrategy.key().displayName(), new Some<>(agsStrategy))); final Option<ComboEntry> defaultEntry = opts.defaultStrategy.map(agsStrategy -> { final String name = String.format("Auto (%s)", agsStrategy.key().displayName()); return new ComboEntry(name, None.<AgsStrategy>instance()); }); final ImList<ComboEntry> allEntries = defaultEntry.isEmpty() ? validEntries : validEntries.cons(defaultEntry.getValue()); final ComboBoxModel<ComboEntry> model = new DefaultComboBoxModel<>(new Vector<>(allEntries.toList())); final Option<ComboEntry> sel = opts.usingDefault() ? defaultEntry : allEntries.find(comboEntry -> comboEntry.strategy.equals(opts.strategyOverride)); sel.foreach(model::setSelectedItem); combo.setModel(model); combo.addActionListener(this); }
Source:
<code>public void addFeedbackSessionWithStandardTimeZone(String feedbackSessionName, String courseId, LocalDateTime startTime, LocalDateTime endTime, LocalDateTime visibleTime, LocalDateTime publishTime, Text instructions, int gracePeriod) { addFeedbackSessionWithTimeZone(feedbackSessionName, courseId, startTime, endTime, visibleTime, publishTime, <START> instructions, gracePeriod, TimeHelper.convertToZoneId(8)); <END> }</code><technical_language>ZoneId.of("+08:00")? convertToZoneId removed eventually</technical_language>

Target:
public void addFeedbackSessionWithStandardTimeZone(String feedbackSessionName, String courseId, LocalDateTime startTime, LocalDateTime endTime, LocalDateTime visibleTime, LocalDateTime publishTime, Text instructions, int gracePeriod) { addFeedbackSessionWithTimeZone(feedbackSessionName, courseId, startTime, endTime, visibleTime, publishTime, instructions, gracePeriod, ZoneId.of("UTC+08:00")); }
Source:
<code>private void stopAncestryPath(GraphNode commit, Queue<GraphNode> theirQueue, Set<GraphNode> theirSet) { Queue<GraphNode> ancestorQueue = new LinkedList<GraphNode>(); ancestorQueue.add(commit); List<GraphNode> processed = new LinkedList<GraphNode>(); while (!ancestorQueue.isEmpty()) { GraphNode ancestor = ancestorQueue.poll(); for (GraphEdge parent : ancestor.getEdges(Direction.BOTH)) { GraphNode parentNode = parent.getToNode(); if (!parentNode.getIdentifier().equals(ancestor.getIdentifier())) { if (theirSet.contains(parentNode)) { ancestorQueue.add(parentNode); processed.add(parentNode); } <START> } else if (theirQueue.contains(parentNode)) { <END> theirQueue.remove(parentNode); } } } }</code><technical_language>remove is safe call if element is a member of list this contains check is unnecessary</technical_language>

Target:
private void stopAncestryPath(GraphNode commit, Queue<GraphNode> theirQueue, Set<GraphNode> theirSet) { Queue<GraphNode> ancestorQueue = new LinkedList<GraphNode>(); ancestorQueue.add(commit); List<GraphNode> processed = new LinkedList<GraphNode>(); while (!ancestorQueue.isEmpty()) { GraphNode ancestor = ancestorQueue.poll(); for (GraphEdge parent : ancestor.getEdges(Direction.BOTH)) { GraphNode parentNode = parent.getToNode(); if (!parentNode.getIdentifier().equals(ancestor.getIdentifier())) { if (theirSet.contains(parentNode)) { ancestorQueue.add(parentNode); processed.add(parentNode); } } else { theirQueue.remove(parentNode); } } } }
Source:
<code>private TestingCostProvider(Map<String, PlanNodeCostEstimate> costs, CostCalculator costCalculator, StatsProvider statsProvider, Session session, TypeProvider types) { <START> this.costs = requireNonNull(costs, "costs is null"); <END> this.costCalculator = requireNonNull(costCalculator, "costCalculator is null"); this.statsProvider = requireNonNull(statsProvider, "statsProvider is null"); this.session = requireNonNull(session, "session is null"); this.types = requireNonNull(types, "types is null"); }</code><technical_language>ImmutableMap.copyOf()</technical_language>

Target:
private TestingCostProvider(Map<String, PlanNodeCostEstimate> costs, CostCalculator costCalculator, StatsProvider statsProvider, Session session, TypeProvider types) { this.costs = ImmutableMap.copyOf(requireNonNull(costs, "costs is null")); this.costCalculator = requireNonNull(costCalculator, "costCalculator is null"); this.statsProvider = requireNonNull(statsProvider, "statsProvider is null"); this.session = requireNonNull(session, "session is null"); this.types = requireNonNull(types, "types is null"); }
Source:
<code>public OutputMappingBuilder setProcessTarget(final Data data) { <START> outputMapping.setProcessTarget(data);; <END> return this; }</code><technical_language>2 columns</technical_language>

Target:
public OutputMappingBuilder setProcessTarget(final Data data) { outputMapping.setProcessTarget(data); return this; }
Source:
<code>private void defaultPropertyValues() { if (isRepl()) { ActionBar(actionBarEnabled); } else { ActionBar(themeHelper.hasActionBar()); } Scrollable(false); Sizing("Responsive"); BackgroundImage(""); AboutScreen(""); BackgroundImage(""); AlignHorizontal(ComponentConstants.GRAVITY_LEFT); AlignVertical(ComponentConstants.GRAVITY_TOP); Title(""); ShowStatusBar(true); TitleVisible(true); ShowListsAsJson(true); ActionBar(false); AccentColor(DEFAULT_ACCENT_COLOR); PrimaryColor(DEFAULT_PRIMARY_COLOR); PrimaryColorDark(DEFAULT_PRIMARY_COLOR_DARK); Theme(ComponentConstants.DEFAULT_THEME); ScreenOrientation("unspecified"); BackgroundColor(Component.COLOR_DEFAULT); <START> AutoscaleImages(true); END> }</code><technical_language>do this if a program AutoscaleImages set false a screen is opened, reset true</technical_language>

Target:
private void defaultPropertyValues() { if (isRepl()) { ActionBar(actionBarEnabled); } else { ActionBar(themeHelper.hasActionBar()); } Scrollable(false); Sizing("Responsive"); BackgroundImage(""); AboutScreen(""); BackgroundImage(""); AlignHorizontal(ComponentConstants.GRAVITY_LEFT); AlignVertical(ComponentConstants.GRAVITY_TOP); Title(""); ShowStatusBar(true); TitleVisible(true); ShowListsAsJson(true); ActionBar(false); AccentColor(DEFAULT_ACCENT_COLOR); PrimaryColor(DEFAULT_PRIMARY_COLOR); PrimaryColorDark(DEFAULT_PRIMARY_COLOR_DARK); Theme(ComponentConstants.DEFAULT_THEME); ScreenOrientation("unspecified"); BackgroundColor(Component.COLOR_DEFAULT); }
Source:
<code>void startRetryTask() { if (retryScheduledFuture == null) { synchronized (retryCounter) { if (retryScheduledFuture == null) { retryScheduledFuture = retryExecutor.scheduleWithFixedDelay(new Runnable() { @Override public void run() { try { int times = retryCounter.incrementAndGet(); <START> logger.error("start to retry task for metadata report. retry times:" + times); <END> if (retry() && times > retryTimesIfNonFail) { cancelRetryTask(); } if (times > retryLimit) { cancelRetryTask(); } } catch (Throwable t) { logger.error("Unexpected error occur at failed retry, cause: " + t.getMessage(), t); } } }, 500, retryPeriod, TimeUnit.MILLISECONDS); } } } }</code><technical_language>**info** is better, in opinion</technical_language>

Target:
void startRetryTask() { if (retryScheduledFuture == null) { synchronized (retryCounter) { if (retryScheduledFuture == null) { retryScheduledFuture = retryExecutor.scheduleWithFixedDelay(new Runnable() { @Override public void run() { try { int times = retryCounter.incrementAndGet(); logger.info("start to retry task for metadata report. retry times:" + times); if (retry() && times > retryTimesIfNonFail) { cancelRetryTask(); } if (times > retryLimit) { cancelRetryTask(); } } catch (Throwable t) { logger.error("Unexpected error occur at failed retry, cause: " + t.getMessage(), t); } } }, 500, retryPeriod, TimeUnit.MILLISECONDS); } } } }
Source:
<code>@Override public boolean add(int element) { if (element < 0) <START> throw new UnsupportedOperationException("Negative or null values are not supported!"); <END> boolean alreadySet = bitSet.get(element); if (!alreadySet) { bitSet.set(element); size++; } return !alreadySet; }</code><technical_language>here, weird</technical_language>

Target:
@Override public boolean add(int element) { if (element < 0) throw new IllegalArgumentException("Negative or null values are not supported!"); boolean alreadySet = bitSet.get(element); if (!alreadySet) { bitSet.set(element); size++; return true; } else return false; }
Source:
<code>protected Object handleDefault(InvocationContext ctx, VisitableCommand cmd) throws Throwable { try { if (!ctx.isOriginLocal() || (watchLocal && isPrimaryOwner(cmd))) { <START> infof("Delaying command %s", cmd); <END> TestingUtil.sleepThread(5); } return invokeNextInterceptor(ctx, cmd); } finally { if (!ctx.isOriginLocal() || (watchLocal && isPrimaryOwner(cmd))) { logCommand(cmd); } else { infof("Not logging command (watchLocal=%b) %s", watchLocal, cmd); } } }</code><technical_language>I guessing this is needed anymore? reproduce issue correct</technical_language>

Target:
protected Object handleDefault(InvocationContext ctx, VisitableCommand cmd) throws Throwable { try { if (!ctx.isOriginLocal() || (watchLocal && isPrimaryOwner(cmd))) { debugf("Delaying command %s", cmd); TestingUtil.sleepThread(5); } return invokeNextInterceptor(ctx, cmd); } finally { if (!ctx.isOriginLocal() || (watchLocal && isPrimaryOwner(cmd))) { logCommand(cmd); } else { debugf("Not logging command (watchLocal=%b) %s", watchLocal, cmd); } } }
Source:
<code>private List<Question> doSearch(String query) { String sanitized = HtmlSanitizer.sanitize(query); List<Long> ids = index.findQuestionsByTitle(sanitized, 10); List<Question> questions = new ArrayList<>(); for (Long id : ids) { questions.add(dao.getById(id)); } return questions; <START> } <END></code><technical_language>Index return a List<Question> instead of List<Long>, right? logic controller,</technical_language>

Target:
private List<Question> doSearch(String query) { String sanitized = HtmlSanitizer.sanitize(query); List<Long> ids = index.findQuestionsByTitle(sanitized, 10); return questions.getByIds(ids); }