auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static String serializeBlockInfo(Config cfg) { try { StringWriter stringWriter = new StringWriter(); JsonWriter jsonWriter = new JsonWriter(stringWriter); jsonWriter.setLenient(true); jsonWriter.beginObject(); for (String key : cfg.getKeys()) { jsonWriter.name(key).value(cfg.getString(key)); } jsonWriter.endObject(); return stringWriter.toString(); } catch (IOException e) { <START> throw new AssertionError(e); <END> } }</code><technical_language>AssertionError is completely inappropriate here. Assertion catching exception throw another serves benefit here. hsould instead properly log exception creating a new real sense here</technical_language>

Target:
private static String serializeBlockInfo(Config cfg) { try { StringWriter stringWriter = new StringWriter(); JsonWriter jsonWriter = new JsonWriter(stringWriter); jsonWriter.setLenient(true); jsonWriter.beginObject(); for (String key : cfg.getKeys()) { jsonWriter.name(key).value(cfg.getString(key)); } jsonWriter.endObject(); return stringWriter.toString(); } catch (IOException x) { Slimefun.getLogger().log(Level.SEVERE, "An error occurred while serializing BlockInfo", x); return null; } }
Source:
<code>public int read() throws IOException { final int read = read(single, 0, 1); <START> return read == 1 ? single[0] : -1; <END> }</code><technical_language>need return single[0] & 0xff. result unsigned</technical_language>

Target:
public int read() throws IOException { final int read = read(single, 0, 1); return read == 1 ? single[0] & 0xff : -1; }
Source:
<code>private void addMergeConfig(Repository clonedRepo, Ref head) throws IOException { String branchName = Repository.shortenRefName(head.getName()); clonedRepo.getConfig().setString(ConfigConstants.CONFIG_BRANCH_SECTION, branchName, ConfigConstants.CONFIG_KEY_REMOTE, remote); clonedRepo.getConfig().setString(ConfigConstants.CONFIG_BRANCH_SECTION, branchName, ConfigConstants.CONFIG_KEY_MERGE, head.getName()); String autosetupRebase = clonedRepo.getConfig().getString( ConfigConstants.CONFIG_BRANCH_SECTION, null, ConfigConstants.CONFIG_KEY_AUTOSETUPREBASE); if (ConfigConstants.CONFIG_KEY_ALWAYS.equals(autosetupRebase) <START> || ConfigConstants.CONFIG_KEY_TRUE.equals(autosetupRebase)) <END> clonedRepo.getConfig().setBoolean( ConfigConstants.CONFIG_BRANCH_SECTION, branchName, ConfigConstants.CONFIG_KEY_REBASE, true); clonedRepo.getConfig().save(); }</code><technical_language>native git "true" is a valid for option "branch.autosetuprebase". Native git reports error "error: Malformed for branch.autosetuprebase " "true" for this option</technical_language>

Target:
private void addMergeConfig(Repository clonedRepo, Ref head) throws IOException { String branchName = Repository.shortenRefName(head.getName()); clonedRepo.getConfig().setString(ConfigConstants.CONFIG_BRANCH_SECTION, branchName, ConfigConstants.CONFIG_KEY_REMOTE, remote); clonedRepo.getConfig().setString(ConfigConstants.CONFIG_BRANCH_SECTION, branchName, ConfigConstants.CONFIG_KEY_MERGE, head.getName()); String autosetupRebase = clonedRepo.getConfig().getString( ConfigConstants.CONFIG_BRANCH_SECTION, null, ConfigConstants.CONFIG_KEY_AUTOSETUPREBASE); if (ConfigConstants.CONFIG_KEY_ALWAYS.equals(autosetupRebase) || ConfigConstants.CONFIG_KEY_REMOTE.equals(autosetupRebase)) clonedRepo.getConfig().setBoolean( ConfigConstants.CONFIG_BRANCH_SECTION, branchName, ConfigConstants.CONFIG_KEY_REBASE, true); clonedRepo.getConfig().save(); }
Source:
<code>public void callback(Persona persona) { JButton personaButton = personaUIComponents.getPersonaActionButton(); if (persona != null) { personaUIComponents.getPersonaNameLabel().setText(persona.getName()); personaUIComponents.getPersonaActionButton().setText(Bundle.ContactArtifactViewer_persona_button_view()); for (ActionListener act : personaButton.getActionListeners()) { personaButton.removeActionListener(act); } personaButton.addActionListener(new ViewPersonaButtonListener (persona)); } <START> personaButton.getParent().revalidate(); <END> }</code><technical_language>I add a call repaint here</technical_language>

Target:
public void callback(Persona persona) { JButton personaButton = personaUIComponents.getPersonaActionButton(); if (persona != null) { personaUIComponents.getPersonaNameLabel().setText(persona.getName()); personaUIComponents.getPersonaActionButton().setText(Bundle.ContactArtifactViewer_persona_button_view()); for (ActionListener act : personaButton.getActionListeners()) { personaButton.removeActionListener(act); } personaButton.addActionListener(new ViewPersonaButtonListener(persona)); } personaButton.getParent().revalidate(); personaButton.getParent().repaint(); }
Source:
<code>private KieBuilderImpl kieBuilderClone( final KieFileSystem kieFileSystemClone ) { KieBuilderImpl kieBuilder = null; if ( this.kieBuilder != null ) { <START> kieBuilder = (KieBuilderImpl) createKieBuilder( kieFileSystemClone ); <END> kieBuilder.setkModule( ( (KieBuilderImpl) this.kieBuilder ).getkModule() ); kieBuilder.setTrgMfs( ( (KieFileSystemImpl) kieFileSystemClone ).getMfs() ); } return kieBuilder; }</code><technical_language>is OK createKieBuilder return KieBuilderImpl. break in future in case support more implementations</technical_language>

Target:
private KieBuilderImpl kieBuilderClone( final KieFileSystem kieFileSystemClone ) { KieBuilderImpl kieBuilder = null; if ( this.kieBuilder != null ) { kieBuilder = createKieBuilder( kieFileSystemClone ); kieBuilder.setkModule( ( (KieBuilderImpl) this.kieBuilder ).getkModule() ); kieBuilder.setTrgMfs( ( (KieFileSystemImpl) kieFileSystemClone ).getMfs() ); } return kieBuilder; }
Source:
<code>public void verifyFileSystemConfiguration() { try { final FileSystem hdfs = getFileSystemInstance(); final String hdfsWorkingDir = configuration.configuration().getSinkConfiguration(name, FileSinkConfiguration.class).fileStrategy.workingDir; final String hdfsPublishDir = configuration.configuration().getSinkConfiguration(name, FileSinkConfiguration.class).fileStrategy.publishDir; if (!hdfs.isDirectory(new Path(hdfsWorkingDir))) { throw new RuntimeException("Working directory for in-flight AVRO records does not exist: " + hdfsWorkingDir); } if (!hdfs.isDirectory(new Path(hdfsPublishDir))) { throw new RuntimeException("Working directory for publishing AVRO records does not exist: " + hdfsPublishDir); } } catch (final IOException ioe) { logger.error("Could not initialize HDFS filesystem or failed to check for existence of publish and / or working directories..", ioe); <START> throw new RuntimeException("Could not initialize HDFS filesystem.", ioe); <END> } }</code><technical_language>This UncheckedIOException</technical_language>

Target:
public void verifyFileSystemConfiguration() { try { final FileSystem hdfs = getFileSystemInstance(); final String hdfsWorkingDir = configuration.configuration().getSinkConfiguration(name, FileSinkConfiguration.class).fileStrategy.workingDir; final String hdfsPublishDir = configuration.configuration().getSinkConfiguration(name, FileSinkConfiguration.class).fileStrategy.publishDir; if (!hdfs.isDirectory(new Path(hdfsWorkingDir))) { throw new RuntimeException("Working directory for in-flight AVRO records does not exist: " + hdfsWorkingDir); } if (!hdfs.isDirectory(new Path(hdfsPublishDir))) { throw new RuntimeException("Working directory for publishing AVRO records does not exist: " + hdfsPublishDir); } } catch (final IOException ioe) { logger.error("Could not initialize HDFS filesystem or failed to check for existence of publish and / or working directories..", ioe); throw new UncheckedIOException("Could not initialize HDFS filesystem.", ioe); } }
Source:
<code>protected Optional<Pair<ConnectionFactory, SearchResponse>> searchLdapForId(final LdapAcceptableUsagePolicyProperties ldap, final String id) throws Exception { val filter = LdapUtils.newLdaptiveSearchFilter(ldap.getSearchFilter(), LdapUtils.LDAP_SEARCH_FILTER_DEFAULT_PARAM_NAME, CollectionUtils.wrap(id)); LOGGER.debug("Constructed LDAP filter [{}]", filter); <START> val connectionFactory = connectionFactoryList.get(ldap); <END> val response = LdapUtils.executeSearchOperation(connectionFactory, ldap.getBaseDn(), filter, ldap.getPageSize()); if (LdapUtils.containsResultEntry(response)) { LOGGER.debug("LDAP query located an entry for and responded with [{}]", id, response); return Optional.of(Pair.of(connectionFactory, response)); } LOGGER.debug("LDAP query could not locate an entry for [{}]", id); return Optional.empty(); }</code><technical_language>suggestion val connectionFactory = connectionFactoryList.get(ldap.getLdapUrl());</technical_language>

Target:
protected Optional<Pair<ConnectionFactory, SearchResponse>> searchLdapForId(final LdapAcceptableUsagePolicyProperties ldap, final String id) throws Exception { val filter = LdapUtils.newLdaptiveSearchFilter(ldap.getSearchFilter(), LdapUtils.LDAP_SEARCH_FILTER_DEFAULT_PARAM_NAME, CollectionUtils.wrap(id)); LOGGER.debug("Constructed LDAP filter [{}]", filter); val connectionFactory = connectionFactoryList.get(ldap.getLdapUrl()); val response = LdapUtils.executeSearchOperation(connectionFactory, ldap.getBaseDn(), filter, ldap.getPageSize()); if (LdapUtils.containsResultEntry(response)) { LOGGER.debug("LDAP query located an entry for and responded with [{}]", id, response); return Optional.of(Pair.of(connectionFactory, response)); } LOGGER.debug("LDAP query could not locate an entry for [{}]", id); return Optional.empty(); }
Source:
<code>public void updateFromItem(final InfoItem infoItem, final HistoryRecordManager historyRecordManager) { super.updateFromItem(infoItem, historyRecordManager); if (!(infoItem instanceof ChannelInfoItem)) { return; } <START> final ChannelInfoItem item; item = (ChannelInfoItem) infoItem; <END> itemChannelDescriptionView.setText(item.getDescription()); }</code><technical_language>Mmmh, this line automatically changed here, in info_list/holder/ChannelMiniInfoItemHolder.java line 36|41? revert suggestion final ChannelInfoItem item = (ChannelInfoItem) infoItem;</technical_language>

Target:
public void updateFromItem(final InfoItem infoItem, final HistoryRecordManager historyRecordManager) { super.updateFromItem(infoItem, historyRecordManager); if (!(infoItem instanceof ChannelInfoItem)) { return; } final ChannelInfoItem item = (ChannelInfoItem) infoItem; itemChannelDescriptionView.setText(item.getDescription()); }
Source:
<code>public List<File> getJars() throws CoreException { if (jars != null) { return jars; } jars = new ArrayList<File>(); if (homePath == null) { return jars; } File location = new File(homePath); ServerBeanLoader loader = new ServerBeanLoader(location); ServerBean serverBean = loader.getServerBean(); JBossServerType type = serverBean.getType(); <START> String version = serverBean.getVersion(); <END> if (JBossServerType.AS7.equals(type) || JBossServerType.AS72.equals(type) || JBossServerType.EAP61.equals(type) || JBossServerType.AS7GateIn.equals(type) || JBossServerType.EAP6.equals(type)) { getAS7xJars(); } else if (JBossServerType.AS.equals(type)) { if (IJBossToolingConstants.V6_0.equals(version) || IJBossToolingConstants.V6_1.equals(version)) { getAS6xJars(); } else if (IJBossToolingConstants.V5_0.equals(version) || IJBossToolingConstants.V5_1.equals(version)) { getAS5xJars(); } } else if (JBossServerType.EAP6.equals(type)) { getAS7xJars(); } else if (JBossServerType.SOAP.equals(type) || JBossServerType.EAP.equals(type) || EPP.equals(type) || JBossServerType.SOAP_STD.equals(type) || JBossServerType.EWP.equals(type) || JBossServerType.EAP_STD.equals(type)) { getAS5xJars(); } if (jars.size() == 0 && homePath != null) { IPath jarPath = new Path(homePath); addJars(jarPath, jars); } return jars; }</code><technical_language>@robstryker : is this code relevant, latest changes in ASTools</technical_language>

Target:
public List<File> getJars() throws CoreException { if (jars != null) { return jars; } jars = new ArrayList<File>(); if (runtime != null) { IPath[] paths = new RuntimeJarUtility().getJarsForRuntime(runtime, RuntimeJarUtility.ALL_JARS); if (paths != null && paths.length > 0) { for (IPath path:paths) { addFile(jars, path.toFile()); } return jars; } } if (homePath == null) { return jars; } IPath jarPath = new Path(homePath); addJars(jarPath, jars); return jars; }
Source:
<code>public boolean decide(DomainEventData<?> snapshot) { <START> <END> try { SerializedType payloadType = snapshot.getPayload().getType(); String payloadRevision = getOrDefault(payloadType.getRevision(), NO_REVSION); String aggregateRevision = getOrDefault(resolver.revisionOf(Class.forName(payloadType.getName())), NO_REVSION); return payloadRevision.equals(aggregateRevision); } catch (ClassNotFoundException e) { return false; } }</code><technical_language>For consistency other formats of functions, remove spaces start end of this function block</technical_language>

Target:
public boolean decide(DomainEventData<?> snapshot) { final SerializedType payloadType = snapshot.getPayload().getType(); final Optional<String> payloadRevision = Optional.ofNullable(payloadType.getRevision()); final Optional<String> aggregateRevision; try { aggregateRevision = Optional.ofNullable(resolver.revisionOf(Class.forName(payloadType.getName()))); } catch (ClassNotFoundException e) { return false; } return payloadRevision.equals(aggregateRevision); }
Source:
<code>public void testReboot() throws Exception { setUpGetEntityExpectations(1); setUriInfo(setUpActionExpectations(VdcActionType.RebootVm, PowerDownVmParameters.class, new String[] { "VmId" }, new Object[] { GUIDS[0] })); <START> verifyActionResponse(resource.reboot(new Action())); <END> }</code><technical_language>checking flow user sets grace period in action</technical_language>

Target:
public void testReboot() throws Exception { setUpPowerDownActionExpectations(VdcActionType.RebootVm, null, null); verifyActionResponse(resource.reboot(new Action())); }
Source:
<code>public void setup() { System.setProperty("org.jbpm.rm.init.timer", "false"); <START> logger.info("Using local cache for EJB timers: {}", (USE_LOCAL_CACHE ? "true" : "false")); <END> }</code><technical_language>do need conditional expression print true false, enough priny USELOCALCACHE</technical_language>

Target:
public void setup() { System.setProperty("org.jbpm.rm.init.timer", "false"); logger.info("Using local cache for EJB timers: {}", USE_LOCAL_CACHE); }
Source:
<code><START> public final void testWindowFrame1() throws Exception { <END> KeyValueSet tableOptions = new KeyValueSet(); tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER); tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N"); Schema schema = new Schema(); schema.addColumn("id", TajoDataTypes.Type.INT4); schema.addColumn("name", TajoDataTypes.Type.TEXT); schema.addColumn("num", TajoDataTypes.Type.INT4); String[] data = new String[]{ "1|abc|3", "2|def|2", "2|ghi|4", "2|abd|3", "2|abe|9" }; TajoTestingCluster.createTable("windowframe", schema, tableOptions, data, 1); try { ResultSet res = executeString( "select id, name, num, sum(num) over ( partition by id order by name ) as sum1, sum(num) over ( partition by id order by name rows 1 preceding ) as sum2, sum(num) over ( partition by id order by name rows between 1 preceding and 1 following) as sum3 from windowframe"); String ascExpected = "id,name,num,sum1,sum2,sum3\n" + "-------------------------------\n" + "1,abc,3,3,3,3\n" + "2,abd,3,3,3,12\n" + "2,abe,9,12,12,14\n" + "2,def,2,14,11,15\n" + "2,ghi,4,18,6,6\n"; assertEquals(ascExpected, resultSetToString(res)); res.close(); } finally { executeString("DROP TABLE windowframe PURGE"); } }</code><technical_language>tests testWindowFrame1, testWindowFrame2, testWindowFrame3, testWindowFrame4 good, if written follow test writing convention. is separating java codes, test queries, results</technical_language>

Target:
public final void testWindowFrame1() throws Exception { executeDDL("table1DDL.sql", "table1", "table1"); try { ResultSet res = executeQuery(); assertResultSet(res); cleanupQuery(res); } finally { executeString("DROP TABLE table1"); } }
Source:
<code>public boolean handle(TraceContext context, MutableSpan span) { if (context == null) { return true; <START> } <END> Stream.concat(whitelistedKeys(sleuthProperties.getBaggageKeys()), whitelistedKeys(sleuthProperties.getPropagationKeys())) .map(baggageItemKey -> new AbstractMap.SimpleEntry<>(baggageItemKey, ExtraFieldPropagation.get(context, baggageItemKey))) .filter(entry -> nonNull(entry.getValue())) .forEach(entry -> span.tag(entry.getKey(), entry.getValue())); return true; }</code><technical_language>If update Brave 5.6.0 add another exit condition of: !context.isLocalRoot() this tag span blow storage requirements. PS: I a feeling else block this merged is done</technical_language>

Target:
public boolean handle(TraceContext context, MutableSpan span) { Stream.of(sleuthProperties.getBaggageKeys(), sleuthProperties.getPropagationKeys()) .flatMap(Collection::stream) .filter(key -> this.tagPropagationProperties.getWhitelistedKeys().contains(key)) .map(baggageItemKey -> new AbstractMap.SimpleEntry<>(baggageItemKey, ExtraFieldPropagation.get(context, baggageItemKey))) .filter(entry -> nonNull(entry.getValue())) .forEach(entry -> span.tag(entry.getKey(), entry.getValue())); return true; }
Source:
<code>public void checkMainFeaturesTypeScriptLS() { <START> consoles.waitExpectedTextIntoConsole( <END> "Initialized language server 'org.eclipse.che.plugin.web.typescript'"); checkCodeValidation(); checkCodeAssistant(); checkGoToDefinition(); }</code><technical_language>Again, constant not</technical_language>

Target:
public void checkMainFeaturesTypeScriptLS() { consoles.waitExpectedTextIntoConsole(INITIALIZE_LANG_SERVER_MESSAGE); checkCodeValidation(); checkCodeAssistant(); checkGoToDefinition(); }
Source:
<code>Boolean isInForeground() { <START> ActivityManager.RunningAppProcessInfo info = getProcessInfo(); <END> if (info != null) { return info.importance <= ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND; } else { return null; } }</code><technical_language>This catch SecurityException thrown ActivityMonitor.getMyMemoryState (Line 48). Remove existing try-catch getProcessInfoPreApi16 catch this level</technical_language>

Target:
Boolean isInForeground() { try { ActivityManager.RunningAppProcessInfo info = getProcessInfo(); if (info != null) { return info.importance <= ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND; } else { return null; } } catch (RuntimeException exc) { return null; } }
Source:
<code>public static String createPath(final String fileSystemPrefix, String resultPath) { final URI uri; try { URI systemPrefix = new URI(fileSystemPrefix); if (!resultPath.startsWith("/")) { resultPath = "/" + resultPath; } uri = new URI("hdfs", null, systemPrefix.getHost(), systemPrefix.getPort(), systemPrefix.getPath() + resultPath, null, null); return uri.toString(); } catch (URISyntaxException e) { <START> logger.error("Error while trying to create url for saving the job", e); <END> } return null; }</code><technical_language>Is sense in logging error here, continuing a null value, effectively swallowing exception? failing fast is user needs change something</technical_language>

Target:
public static String createPath(final String fileSystemPrefix, String resultPath) throws URISyntaxException { final URI uri; try { URI systemPrefix = new URI(fileSystemPrefix); if (!resultPath.startsWith("/")) { resultPath = "/" + resultPath; } uri = new URI("hdfs", null, systemPrefix.getHost(), systemPrefix.getPort(), systemPrefix.getPath() + resultPath, null, null); return uri.toString(); } catch (URISyntaxException e) { logger.error("Error while trying to create url for saving the job", e); throw e; } }
Source:
<code>public static final ServiceProvider setCurrent(ServiceProvider provider) { Objects.requireNonNull(provider); ServiceProvider old = current.getAndSet(provider); <START> if (provider.equals(old)) { <END> Logger.getLogger("javax.measure.spi").log(Level.CONFIG, "Measurement ServiceProvider {1,choice,0#set to|1#replaced by} {0}.", new Object[] {provider.getClass().getName(), (old == null) ? 0 : 1}); } return old; }</code><technical_language>!provider.equals(old)? (missing !)</technical_language>

Target:
public static final ServiceProvider setCurrent(ServiceProvider provider) { Objects.requireNonNull(provider); ServiceProvider old = current.getAndSet(provider); if (old != provider) { Logger.getLogger("javax.measure.spi").log(Level.CONFIG, "Measurement ServiceProvider {1,choice,0#set to|1#replaced by} {0}.", new Object[] {provider.getClass().getName(), (old == null) ? 0 : 1}); } return old; }
Source:
<code>public Object getAttribute(String attribute) { if (SENSOR_NAME_TAG.equals(attribute)) { return getSensorName(); } <START> <END> synchronized (_lock) { if (!_attributeMap.containsKey(attribute)) { return null; } return _attributeMap.get(attribute).getAttributeValue(attribute); } }</code><technical_language>Please exceptions in signature. want complete logic throwing right exceptions moving forward</technical_language>

Target:
public Object getAttribute(String attribute) throws AttributeNotFoundException { if (SENSOR_NAME_TAG.equals(attribute)) { return getSensorName(); } DynamicMetric metric = _attributeMap.get(attribute); if (metric == null) { throw new AttributeNotFoundException("Attribute[" + attribute + "] is not found."); } return metric.getAttributeValue(attribute); }
Source:
<code>public String toString() { SimpleDateFormat dateFormat = new SimpleDateFormat("YYYY-MM-dd@HH:mm:ss.SSS"); <START> return "RedisLock [lockKey=" + RedisLockRegistry.this.registryKey + ":" + this.lockKey <END> + ",lockedAt=" + dateFormat.format(new Date(this.lockedAt)) + ", thread=" + this.threadName + ", lockHost=" + new String(this.lockHost) + "]"; }</code><technical_language>replaced this.constructLockKey()</technical_language>

Target:
public String toString() { SimpleDateFormat dateFormat = new SimpleDateFormat("YYYY-MM-dd@HH:mm:ss.SSS"); return "RedisLock [lockKey=" + constructLockKey() + ",lockedAt=" + dateFormat.format(new Date(this.lockedAt)) + ", thread=" + this.threadName + ", lockHost=" + new String(this.lockHost) + "]"; }
Source:
<code>public static synchronized @Nonnull Whitelist all() { Jenkins j = Jenkins.getInstanceOrNull(); if (j == null) { LOGGER.warning("No Jenkins.instance"); return new ProxyWhitelist(); } Whitelist all = allByJenkins.get(j); if (all == null) { ExtensionList<Whitelist> allWhitelists = j.getExtensionList(Whitelist.class); if (allWhitelists.isEmpty()) { <START> LOGGER.warning("Empty list of Whitelist"); <END> } else { System.err.println("Loading whitelists: " + allWhitelists); } all = new ProxyWhitelist(allWhitelists); allByJenkins.put(j, all); } return all; }</code><technical_language>A stack trace interesting here: suggestion LOGGER.log(java.util.logging.Level.WARNING, null, new Exception("Empty list of Whitelist"));</technical_language>

Target:
public static synchronized @Nonnull Whitelist all() { Jenkins j = Jenkins.getInstanceOrNull(); if (j == null) { LOGGER.log(Level.WARNING, "No Jenkins.instance", new Throwable("here")); return new ProxyWhitelist(); } Whitelist all = allByJenkins.get(j); if (all == null) { ExtensionList<Whitelist> allWhitelists = j.getExtensionList(Whitelist.class); if (allWhitelists.isEmpty()) { LOGGER.log(Level.WARNING, "No Whitelist instances registered", new Throwable("here")); return new ProxyWhitelist(); } else { LOGGER.fine(() -> "Loading whitelists: " + allWhitelists); } all = new ProxyWhitelist(allWhitelists); allByJenkins.put(j, all); } return all; }
Source:
<code>private byte[] readClasspathResource(String c) throws IOException { InputStream is = getClass().getResourceAsStream(c); try { return Util.readStream(is); } finally { <START> is.close(); <END> } }</code><technical_language>guard null is</technical_language>

Target:
private byte[] readClasspathResource(String c) throws IOException { InputStream is = getClass().getResourceAsStream(c); try { return Util.readStream(is); } finally { if (is != null) { is.close(); } } }
Source:
<code>public void handleRemoteResult(final String operationId, final boolean result, final ByteBuffer data) { final DataOperation finishedOperation = ongoingOperations.remove(operationId); if (finishedOperation == null) { <START> LOG.log(Level.INFO, "The operation is already handled or cancelled due to timeout. OpId: {0}", operationId); <END> return; } final Codec codec = serializer.getCodec(finishedOperation.getDataType()); final Object outputData = data == null ? null : codec.decode(data.array()); finishedOperation.setResultAndWakeupClientThread(result, Optional.ofNullable(outputData)); }</code><technical_language>WARNING instead of INFO this is unexpected behaviour</technical_language>

Target:
<T> void handleRemoteResult(final String operationId, final boolean result, final ByteBuffer data) { final DataOperation<T> finishedOperation = ongoingOperations.remove(operationId); if (finishedOperation == null) { LOG.log(Level.WARNING, "The operation is already handled or cancelled due to timeout. OpId: {0}", operationId); return; } final Codec codec = serializer.getCodec(finishedOperation.getDataType()); final Optional<T> outputData = data == null ? Optional.<T>empty() : Optional.of((T) codec.decode(data.array())); finishedOperation.setResultAndNotifyClient(result, outputData); }
Source:
<code>public static Client createClient() { VoltLogger.startAsynchronousLogging(); EstTimeUpdater.start(); ReverseDNSCache.start(); CLIENT_NUM.incrementAndGet(); <START> return new ClientImpl(new ClientConfig()); <END> }</code><technical_language>remove VoltLogger.startAsynchronousLogging(); EstTimeUpdater.start(); ReverseDNSCache.start(); CLIENT_NUM.incrementAndGet(); call return createClient(new ClientConfig());</technical_language>

Target:
public static Client createClient() { if (ACTIVE_CLIENT_COUNT.incrementAndGet() == 1) { VoltLogger.startAsynchronousLogging(); EstTimeUpdater.start(); ReverseDNSCache.start(); } return new ClientImpl(new ClientConfig()); }
Source:
<code>public ExecutionResult execute(Item item) { ConnectionItem connectionItem = (ConnectionItem) item; DatabaseConnection connection = (DatabaseConnection) connectionItem.getConnection(); if (connection != null) { <START> if (connection.getDatabaseType().equals("Microsoft SQL Server")) { <END> if (connection.getDbVersionString() == null) { connection.setDbVersionString(DEFAULT_VERSION); try { ProxyRepositoryFactory.getInstance().save(item); } catch (PersistenceException e) { ExceptionHandler.process(e); return ExecutionResult.FAILURE; } return ExecutionResult.SUCCESS_NO_ALERT; } } else { return ExecutionResult.NOTHING_TO_DO; } } return ExecutionResult.NOTHING_TO_DO; }</code><technical_language>EDatabaseTypeName instead of hard code here. Double check :do need change for MSSQL05_08</technical_language>

Target:
public ExecutionResult execute(Item item) { ConnectionItem connectionItem = (ConnectionItem) item; DatabaseConnection connection = (DatabaseConnection) connectionItem.getConnection(); if (connection != null) { if (connection.getDatabaseType().equals(EDatabaseTypeName.MSSQL.getDisplayName())) { if (connection.getDbVersionString() == null) { connection.setDbVersionString(EDatabaseVersion4Drivers.MSSQL.getVersionValue()); try { ProxyRepositoryFactory.getInstance().save(item); } catch (PersistenceException e) { ExceptionHandler.process(e); return ExecutionResult.FAILURE; } return ExecutionResult.SUCCESS_NO_ALERT; } } else { return ExecutionResult.NOTHING_TO_DO; } } return ExecutionResult.NOTHING_TO_DO; }
Source:
<code>public void testManageSnapshotAndRunFgOption2() { UpdateStatisticsTool tool = new UpdateStatisticsTool(); tool.parseOptions(new String[] {"-t", "table1", "-ms", "-runfg"}); <START> } <END></code><technical_language>add accessor for assert here</technical_language>

Target:
public void testManageSnapshotAndRunFgOption2() { UpdateStatisticsTool tool = new UpdateStatisticsTool(); try { tool.parseOptions(new String[] {"-t", "table1", "-ms", "-runfg"}); } catch (IllegalStateException e) { fail("IllegalStateException is not expected " + "since all required parameters are provided."); } }
Source:
<code>protected Map<String, List<ConcurStandardAccountingExtractDetailLine>> getConsolidatedPersonalExpensesMapForLine( ConcurStandardAccountingExtractDetailLine detailLine) { if (detailLine.getJournalAmount().isPositive()) { <START> if (collectorHelper.lineRepresentsReturnOfCorporateCardPersonalExpenseToUser(detailLine)) { <END> return consolidatedCorpCardPersonalExpenseCredits; } else { return consolidatedCorpCardPersonalExpenseDebits; } } else if (collectorHelper.lineRepresentsReturnOfCorporateCardPersonalExpenseToUniversity(detailLine)) { return consolidatedCorpCardPersonalExpenseDebits; } else { return consolidatedCorpCardPersonalExpenseCredits; } }</code><technical_language>I thinking reorganizing this a easier read. if/else levels confusing read is starting get long. if (detailLine.getJournalAmount().isPositive()) { getConsolidatedPersonalExpensesMapForPositiveLine(line); } else { getConsolidatedPersonalExpensesMapForNegativeLine(line) } move contents if if else new functions</technical_language>

Target:
protected Map<String, List<ConcurStandardAccountingExtractDetailLine>> getConsolidatedPersonalExpensesMapForLine( ConcurStandardAccountingExtractDetailLine detailLine) { if (detailLine.getJournalAmount().isPositive()) { return getConsolidatedPersonalExpensesMapForDebitLine(detailLine); } else { return getConsolidatedPersonalExpensesMapForCreditLine(detailLine); } }
Source:
<code>public void unstar() throws IOException { <START> root.createRequest().method("DELETE").setRawUrlPath(getApiTailUrl("star")).send(); <END> }</code><technical_language>This is a raw URL. add check setRawUrlPath requires starting http</technical_language>

Target:
public void unstar() throws IOException { root.createRequest().method("DELETE").withUrlPath(getApiTailUrl("star")).send(); }
Source:
<code>protected double computeUtilizationScore(double estimatedUsage, double currentUsage) { if (estimatedUsage == 0) { return 0; } <START> return SIGMOID.value(-(currentUsage / estimatedUsage - 1) * DEFAULT_ALPHA) * (MAX_SCORE <END> - MIN_SCORE); }</code><technical_language>Sigmoid function is complicated in Java. 1 / (1 + Math.exp(X)), tested result is same</technical_language>

Target:
protected double computeUtilizationScore(double estimatedUsage, double currentUsage) { if (estimatedUsage == 0) { return 0; } return currentUsage / estimatedUsage; }
Source:
<code>public void testCheckNoneOnHistoricProcessInstanceAndReadHistoryPermissionOnProcessDefinition() { processEngineConfiguration.setEnableHistoricInstancePermissions(true); String processInstanceId = startProcessAndExecuteJob(DEFAULT_PROCESS_KEY) .getProcessInstanceId(); createGrantAuthorization(Resources.HISTORIC_PROCESS_INSTANCE, processInstanceId, userId, HistoricProcessInstancePermissions.NONE); <START> createGrantAuthorization(PROCESS_DEFINITION, DEFAULT_PROCESS_KEY, userId, READ_HISTORY); <END> HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery(); assertThat(query.list()) .extracting("processInstanceId") .containsExactly(processInstanceId); }</code><technical_language>suggestion createGrantAuthorization(PROCESS_DEFINITION, DEFAULT_PROCESS_KEY, userId, ProcessDefinitionPermissions.READ_HISTORY); works, I guess. ProcessDefinitionPermissions.NONE in testCheckReadOnHistoricProcessInstanceAndNonePermissionOnProcessDefinition, stick format</technical_language>

Target:
public void testCheckNoneOnHistoricProcessInstanceAndReadHistoryPermissionOnProcessDefinition() { processEngineConfiguration.setEnableHistoricInstancePermissions(true); String processInstanceId = startProcessAndExecuteJob(DEFAULT_PROCESS_KEY) .getProcessInstanceId(); createGrantAuthorization(Resources.HISTORIC_PROCESS_INSTANCE, processInstanceId, userId, HistoricProcessInstancePermissions.NONE); createGrantAuthorization(PROCESS_DEFINITION, DEFAULT_PROCESS_KEY, userId, ProcessDefinitionPermissions.READ_HISTORY); HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery(); assertThat(query.list()) .extracting("processInstanceId") .containsExactly(processInstanceId); }
Source:
<code>public void createPermission() throws Exception { createdUser = safeCreateUser(client, createdDatabase.getId(), getUserDefinition()); CosmosPermissionProperties permissionSettings = new CosmosPermissionProperties() .setId(UUID.randomUUID().toString()) .setPermissionMode(PermissionMode.READ) <START> .setContainerName("AQAAAJ0fgTc=") <END> .setResourcePath(CosmosContainerChildResourceKind.ITEM, "doc1"); Mono<CosmosPermissionResponse> createObservable = createdUser.createPermission(permissionSettings, null); CosmosResponseValidator<CosmosPermissionResponse> validator = new CosmosResponseValidator.Builder<CosmosPermissionResponse>() .withId(permissionSettings.getId()) .withPermissionMode(PermissionMode.READ) .withPermissionContainerName("AQAAAJ0fgTc=") .withPermissionResourceKind(CosmosContainerChildResourceKind.ITEM) .withPermissionResourceName("doc1") .notNullEtag() .build(); validateSuccess(createObservable, validator); }</code><technical_language>this is called setContainerName in test .setContainerName("AQAAAJ0fgTc=") portion of selflink. is this container name a portion of selflink</technical_language>

Target:
public void createPermission() throws Exception { createdUser = safeCreateUser(client, createdDatabase.getId(), getUserDefinition()); CosmosPermissionProperties permissionSettings = new CosmosPermissionProperties() .setId(UUID.randomUUID().toString()) .setPermissionMode(PermissionMode.READ) .setContainerName("myContainer") .setResourcePath(ContainerChildResourceType.ITEM, "doc1"); Mono<CosmosPermissionResponse> createObservable = createdUser.createPermission(permissionSettings, null); CosmosResponseValidator<CosmosPermissionResponse> validator = new CosmosResponseValidator.Builder<CosmosPermissionResponse>() .withId(permissionSettings.getId()) .withPermissionMode(PermissionMode.READ) .withPermissionContainerName("myContainer") .withPermissionResourceKind(ContainerChildResourceType.ITEM) .withPermissionResourceName("doc1") .notNullEtag() .build(); validateSuccess(createObservable, validator); }
Source:
<code>void removeOverlaps() { Collections.sort(projects); Iterator<Project> iter = projects.iterator(); <START> if (iter.hasNext()) { <END> Project last = iter.next(); while (iter.hasNext()) { Project p = iter.next(); if (last.isParentTo(p)) iter.remove(); else last = p; } } }</code><technical_language>(optional) decrease indentation if (!iter.hasNext()) return;</technical_language>

Target:
void removeOverlaps() { Collections.sort(projects); Iterator<Project> iter = projects.iterator(); if (!iter.hasNext()) return; Project last = iter.next(); while (iter.hasNext()) { Project p = iter.next(); if (last.isAncestorOf(p)) iter.remove(); else last = p; } }
Source:
<code>public @Nullable SegmentStoreStatistics getTotalStatsForRange(long start, long end, IProgressMonitor monitor) { @Nullable ITmfTrace trace = getTrace(); if (trace != null && (start == TmfTimeRange.ETERNITY.getStartTime().toNanos() && end == TmfTimeRange.ETERNITY.getEndTime().toNanos()) <START> && (start <= trace.getStartTime().toNanos() && end >= trace.getEndTime().toNanos())) { <END> waitForCompletion(); return getTotalStats(); } return getTotalStats(start, end, monitor); }</code><technical_language>I trace.getEndTime() is coherent, especially traces analyses built. re-read trace end time updates itself. Anyway, this is useless is && start end equal start end of eternity ;-)</technical_language>

Target:
public @Nullable SegmentStoreStatistics getTotalStatsForRange(long start, long end, IProgressMonitor monitor) { @Nullable ITmfTrace trace = getTrace(); if (trace != null && (start == TmfTimeRange.ETERNITY.getStartTime().toNanos() && end == TmfTimeRange.ETERNITY.getEndTime().toNanos())) { waitForCompletion(); return getTotalStats(); } return getTotalStats(start, end, monitor); }
Source:
<code>public Connection wrapConnectionWithBufferWriter(final Connection connectionToWrap) { return new Connection() { final Connection wrappedConnection = connectionToWrap; @Override public void send(Event event) throws ConnectionException { <START> buffer.add(event); <END> wrappedConnection.send(event); } @Override public void addEventSendFailureCallback(EventSendFailureCallback eventSendFailureCallback) { wrappedConnection.addEventSendFailureCallback(eventSendFailureCallback); } @Override public void close() throws IOException { wrappedConnection.close(); } }; }</code><technical_language>Is OK a failure buffer event prevent event attempted sent</technical_language>

Target:
public Connection wrapConnectionWithBufferWriter(final Connection connectionToWrap) { return new Connection() { final Connection wrappedConnection = connectionToWrap; @Override public void send(Event event) throws ConnectionException { try { buffer.add(event); } catch (Exception e) { logger.error("Exception occurred while attempting to add Event to buffer: ", e); } wrappedConnection.send(event); } @Override public void addEventSendFailureCallback(EventSendFailureCallback eventSendFailureCallback) { wrappedConnection.addEventSendFailureCallback(eventSendFailureCallback); } @Override public void close() throws IOException { wrappedConnection.close(); } }; }
Source:
<code>public StatsPerTypeRequest(ITmfTrace trace, TmfTimeRange range) { super(trace.getEventType(), range, TmfDataRequest.ALL_DATA, <START> chunkSize, ITmfDataRequest.ExecutionType.FOREGROUND); <END> this.stats = new HashMap<String, Long>(); }</code><technical_language>background</technical_language>

Target:
public StatsPerTypeRequest(ITmfTrace trace, TmfTimeRange range) { super(trace.getEventType(), range, TmfDataRequest.ALL_DATA, trace.getCacheSize(), ITmfDataRequest.ExecutionType.BACKGROUND); this.stats = new HashMap<String, Long>(); }
Source:
<code><START> public ListDataVirtualHardDisksHandler(DataVirtualHardDiskHandler dataVirtualHardDiskHandler) { <END> this.dataVirtualHardDiskHandler = dataVirtualHardDiskHandler; }</code><technical_language>In general, injection constructors package protected. remove public modifier: java @Inject ListDataVirtualHardDisksHandler(DataVirtualHardDiskHandler dataVirtualHardDiskHandler) {</technical_language>

Target:
@Inject ListDataVirtualHardDisksHandler(DataVirtualHardDiskHandler dataVirtualHardDiskHandler) { this.dataVirtualHardDiskHandler = dataVirtualHardDiskHandler; }
Source:
<code>public boolean vetoes(K key, SoftLock<V> softLock) { <START> if (isInDoubt(softLock)) { <END> return true; } else { return wrappedVeto.vetoes(key, softLock.getOldValue()); } }</code><technical_language>return isInDoubt(softLock) || wrappedVeto.vetoes(key, softLock.getOldValue());</technical_language>

Target:
public boolean vetoes(K key, SoftLock<V> softLock) { return isInDoubt(softLock) || wrappedVeto.vetoes(key, softLock.getOldValue()); }
Source:
<code>private void mutateRootGcCandidates(Consumer<RootGcCandidates> mutator) { String zpath = context.getZooKeeperRoot() + ZROOT_TABLET_GC_CANDIDATES; try { context.getZooReaderWriter().mutate(zpath, new byte[0], ZooUtil.PUBLIC, currVal -> { String currJson = new String(currVal, UTF_8); <START> <END> RootGcCandidates rgcc = RootGcCandidates.fromJson(currJson); log.debug("Root GC candidates before change : {}", currJson); mutator.accept(rgcc); String newJson = rgcc.toJson(); log.debug("Root GC candidates after change : {}", newJson); if (newJson.length() > 1 << 18) { log.warn( "Root tablet deletion candidates stored in ZK at are getting large ({} bytes), is" + " Accumulo GC process running? Large nodes may cause problems for Zookeeper!", zpath, newJson.length()); } return newJson.getBytes(UTF_8); }); } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>nit. a lot of extra whitespace in this code... a blank line statement. a bit excessive, I need decrease font size, scrolling larger context for code</technical_language>

Target:
private void mutateRootGcCandidates(Consumer<RootGcCandidates> mutator) { String zpath = context.getZooKeeperRoot() + ZROOT_TABLET_GC_CANDIDATES; try { context.getZooReaderWriter().mutate(zpath, new byte[0], ZooUtil.PUBLIC, currVal -> { String currJson = new String(currVal, UTF_8); RootGcCandidates rgcc = RootGcCandidates.fromJson(currJson); log.debug("Root GC candidates before change : {}", currJson); mutator.accept(rgcc); String newJson = rgcc.toJson(); log.debug("Root GC candidates after change : {}", newJson); if (newJson.length() > 262_144) { log.warn( "Root tablet deletion candidates stored in ZK at are getting large ({} bytes), is" + " Accumulo GC process running? Large nodes may cause problems for Zookeeper!", zpath, newJson.length()); } return newJson.getBytes(UTF_8); }); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>public void testRemoveValue() throws Exception { <START> List<String> values = new ArrayList<>(2); <END> values.add("true"); values.add("false"); config.setStringList(TESTSECTION, null, TESTNAME, values); config.save(); getGitConfigurationPreferencePage(); preferencePage.bot().tree(1).getTreeItem(TESTSECTION).getNode( TESTNAME + "[0]").select(); preferencePage.bot() .button(UIText.ConfigurationEditorComponent_RemoveButton) .click(); preferencePage.bot().button(IDialogConstants.OK_LABEL).click(); config.load(); values = Arrays.asList(config .getStringList(TESTSECTION, null, TESTNAME)); assertEquals("Wrong number of values", 1, values.size()); assertTrue(values.contains("false")); }</code><technical_language>please avoid combining unrelated changes in commit</technical_language>

Target:
public void testRemoveValue() throws Exception { List<String> values = new ArrayList<String>(2); values.add("true"); values.add("false"); config.setStringList(TESTSECTION, null, TESTNAME, values); config.save(); getGitConfigurationPreferencePage(); preferencePage.bot().tree(1).getTreeItem(TESTSECTION).getNode( TESTNAME + "[0]").select(); preferencePage.bot() .button(UIText.ConfigurationEditorComponent_RemoveButton) .click(); preferencePage.bot().button(IDialogConstants.OK_LABEL).click(); config.load(); values = Arrays.asList(config .getStringList(TESTSECTION, null, TESTNAME)); assertEquals("Wrong number of values", 1, values.size()); assertTrue(values.contains("false")); }
Source:
<code>public Object bucket(HttpServletRequest request) { String <START> query = <END> requestExtract.apply(request); if (query == null) { return null; } for (Pattern p : patterns) { Matcher m = p.matcher(query); if (m.find()) { log.debug("Matched pattern on {}", p, query); return p; } } return null; }</code><technical_language>This a query anymore string extracted requestExtract. name it, query is slightly misleading</technical_language>

Target:
public Object bucket(HttpServletRequest request) { String requestData = requestExtract.apply(request); if (requestData == null) { return null; } for (Pattern p : patterns) { Matcher m = p.matcher(requestData); if (m.find()) { log.debug("Matched pattern on {}", p, requestData); return p; } } return null; }
Source:
<code>private boolean isDeclaredOwner() { if (declaredOwner == null) { <START> final GroupMembership effectiveGroups = user.getEffectiveGroups(); declaredOwner = state.anyOwner(new Predicate<Set<AccountGroup.UUID>>() { @Override public boolean apply(Set<AccountGroup.UUID> owners) { return effectiveGroups.containsAnyOf(owners); } }); <END> } return declaredOwner; }</code><technical_language>this simplified to: effectiveGroups.containsAnyOf(state.getOwners());</technical_language>

Target:
private boolean isDeclaredOwner() { if (declaredOwner == null) { GroupMembership effectiveGroups = user.getEffectiveGroups(); declaredOwner = effectiveGroups.containsAnyOf(state.getAllOwners()); } return declaredOwner; }
Source:
<code>public void tableAlreadyExists() { assertThatNoTableIsCreated(); SchemaTableName test1Table = new SchemaTableName("default", "test1"); SchemaTableName test2Table = new SchemaTableName("default", "test2"); metadata.createTable(SESSION, new ConnectorTableMetadata(test1Table, ImmutableList.of())); try { metadata.createTable(SESSION, new ConnectorTableMetadata(test1Table, ImmutableList.of())); fail("Should fail because table already exists"); } catch (PrestoException ex) { assertEquals(ex.getErrorCode(), ALREADY_EXISTS.toErrorCode()); } ConnectorTableHandle test1TableHandle = metadata.getTableHandle(SESSION, test1Table); metadata.createTable(SESSION, new ConnectorTableMetadata(test2Table, ImmutableList.of())); try { metadata.renameTable(SESSION, test1TableHandle, test2Table); fail("Should fail because table already exists"); } catch (PrestoException ex) { assertEquals(ex.getErrorCode(), ALREADY_EXISTS.toErrorCode()); <START> } <END> }</code><technical_language>check exc msg</technical_language>

Target:
public void tableAlreadyExists() { assertNoTables(); SchemaTableName test1Table = new SchemaTableName("default", "test1"); SchemaTableName test2Table = new SchemaTableName("default", "test2"); metadata.createTable(SESSION, new ConnectorTableMetadata(test1Table, ImmutableList.of())); try { metadata.createTable(SESSION, new ConnectorTableMetadata(test1Table, ImmutableList.of())); fail("Should fail because table already exists"); } catch (PrestoException ex) { assertEquals(ex.getErrorCode(), ALREADY_EXISTS.toErrorCode()); assertEquals(ex.getMessage(), "Table [default.test1] already exists"); } ConnectorTableHandle test1TableHandle = metadata.getTableHandle(SESSION, test1Table); metadata.createTable(SESSION, new ConnectorTableMetadata(test2Table, ImmutableList.of())); try { metadata.renameTable(SESSION, test1TableHandle, test2Table); fail("Should fail because table already exists"); } catch (PrestoException ex) { assertEquals(ex.getErrorCode(), ALREADY_EXISTS.toErrorCode()); assertEquals(ex.getMessage(), "Table [default.test2] already exists"); } }
Source:
<code>public Tags list() { if (isFiltered()) { GetTagsByUserIdParameters params = new GetTagsByUserIdParameters(getCurrent().get(VdcUser.class).getUserId().toString()); <START> return mapCollection(getBackendCollection(VdcQueryType.GetTagsByUserId, params)); <END> } else { List<tags> tags = getTags(); tags.add(getRootTag()); return mapCollection(tags); } }</code><technical_language>extra query needed here? filtering happen original one</technical_language>

Target:
public Tags list() { List<tags> tags = getTags(); tags.add(getRootTag()); return mapCollection(tags); }
Source:
<code>public List<RuleKey> disableTemplateRulesAndCustomRules(DbSession dbSession) { List<RuleDefinitionDto> rules = dbClient.ruleDao().selectAllDefinitions(dbSession).stream() .filter(r -> r.isTemplate() || r.isCustomRule()) .collect(Collectors.toList()); rules.forEach(r -> { r.setStatus(RuleStatus.REMOVED); dbClient.ruleDao().update(dbSession, r); }); <START> return rules.stream().map(RuleDefinitionDto::getKey).collect(Collectors.toList()); <END> }</code><technical_language>MoreCollectors get immutable collection</technical_language>

Target:
public List<RuleKey> disableTemplateRulesAndCustomRules(DbSession dbSession) { List<RuleDefinitionDto> rules = dbClient.ruleDao().selectAllDefinitions(dbSession).stream() .filter(r -> r.isTemplate() || r.isCustomRule()) .collect(toList()); rules.forEach(r -> { r.setStatus(RuleStatus.REMOVED); dbClient.ruleDao().update(dbSession, r); }); return rules.stream().map(RuleDefinitionDto::getKey).collect(toList()); }