auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static RuleViolation addViolationSourceUUID(final String uuid, final RuleViolation violation) { try { ((AbstractRuleViolation) violation).setUuid(uuid); <START> } catch (final ClassCastException ignored) { <END> } return violation; }</code><technical_language>expect a CCE? this smells of a hack fix a problem had</technical_language>

Target:
public static RuleViolation addViolationSourceUUID(final String uuid, final RuleViolation violation) { if (violation instanceof AbstractRuleViolation) { ((AbstractRuleViolation) violation).setUuid(uuid); } return violation; }
Source:
<code>private void checkTableTypeConversion(Database db, Table oldTbl, Table newTbl) throws InvalidOperationException { if (!oldTbl.getTableType().equalsIgnoreCase(newTbl.getTableType()) && !conf.getBoolean(MetastoreConf.ConfVars.STRICT_MANAGED_TABLES.getHiveName(), false) <START> && ReplChangeManager.isSourceOfReplication(db)) { <END> throw new InvalidOperationException("Table type cannot be changed from " + oldTbl.getTableType() + " to " + newTbl.getTableType() + " for the table " + TableName.getQualified(oldTbl.getCatName(), oldTbl.getDbName(), oldTbl.getTableName()) + " as it is enabled for replication."); } }</code><technical_language>Is managed table converted ACID table replica? If not, restrict managed tables converted</technical_language>

Target:
private void checkTableTypeConversion(Database db, Table oldTbl, Table newTbl) throws InvalidOperationException { if (!conf.getBoolean(MetastoreConf.ConfVars.STRICT_MANAGED_TABLES.getHiveName(), false) && !oldTbl.getTableType().equalsIgnoreCase(newTbl.getTableType()) && ReplChangeManager.isSourceOfReplication(db)) { throw new InvalidOperationException("Table type cannot be changed from " + oldTbl.getTableType() + " to " + newTbl.getTableType() + " for the table " + TableName.getQualified(oldTbl.getCatName(), oldTbl.getDbName(), oldTbl.getTableName()) + " as it is enabled for replication."); } }
Source:
<code>public void populate(final int row, final MergeStrategySection ms) { table.setText(row, 1, ms.getName()); table.setText(row, 2, Util.toLongString(ms.getSubmitType())); final Image upImage = new Image(AdminResources.I.deleteHover()); final PushButton deleteMergeStrategyButton = new PushButton(upImage); deleteMergeStrategyButton.setStylePrimaryName(AdminResources.I.css() .deleteMergeStrategyButton()); deleteMergeStrategyButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { <START> table.removeRow(row); <END> } }); table.setWidget(row, 3, deleteMergeStrategyButton); final FlexCellFormatter fmt = table.getFlexCellFormatter(); fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().dataCell()); fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell()); fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell()); fmt.setVisible(row, 3, false); setRowItem(row, ms); }</code><technical_language>comparing this new UI UI edit access rights noticed if a row in merge strategies table is removed, is gone, if a row in access rights table is removed, is marked deleted user restore clicking restore icon. I nice restore functionility in merge strategies table</technical_language>

Target:
public void populate(final int row, final MergeStrategySection ms) { table.setText(row, 1, ms.getName()); table.setText(row, 2, Util.toLongString(ms.getSubmitType())); if (ms.isUseContentMerge()) { table.setWidget(row, 3, new Image(Gerrit.RESOURCES.greenCheck())); } setDeleteAvailable(row); final FlexCellFormatter fmt = table.getFlexCellFormatter(); fmt.setVisible(row, 4, false); setRowItem(row, ms); }
Source:
<code>private void sendResponseMessageToRequestingUser(UserDto respondingUser, DisclosureRequestMessage requestMessageEntity, String message) { UserAnonymizedDto toUser = userAnonymizedService.getUserAnonymized( requestMessageEntity.getRelatedUserAnonymizedId().orElseThrow(() -> new IllegalStateException( "Message with ID " + requestMessageEntity.getId() + " does not have a related user anonymized ID"))); <START> assert toUser != null; <END> messageService.sendMessageAndFlushToDatabase( DisclosureResponseMessage.createInstance(BuddyMessageDto.createBuddyInfoParametersInstance(respondingUser), requestMessageEntity.getTargetGoalConflictMessage(), requestMessageEntity.getStatus(), message), toUser); }</code><technical_language>orElseThrow guarantees toUser is null</technical_language>

Target:
private void sendResponseMessageToRequestingUser(UserDto respondingUser, DisclosureRequestMessage requestMessageEntity, String message) { UserAnonymizedDto toUser = userAnonymizedService.getUserAnonymized( requestMessageEntity.getRelatedUserAnonymizedId().orElseThrow(() -> new IllegalStateException( "Message with ID " + requestMessageEntity.getId() + " does not have a related user anonymized ID"))); messageService.sendMessageAndFlushToDatabase( DisclosureResponseMessage.createInstance(BuddyMessageDto.createBuddyInfoParametersInstance(respondingUser), requestMessageEntity.getTargetGoalConflictMessage(), requestMessageEntity.getStatus(), message), toUser); }
Source:
<code>protected void execute(Context context) throws SQLException { MassUpdate massUpdate = context.prepareMassUpdate(); massUpdate.select("select" + " pl.id" + " from project_links pl" + " where" + <START> " not exists (select 1 from projects p where p.uuid = pl.component_uuid and p.scope = ? and p.qualifier in (?,?))") <END> .setString(1, "PRJ") .setString(2, "TRK") .setString(3, "VW"); massUpdate.update("delete from project_links where id = ?"); massUpdate.rowPluralName("orphan project links"); massUpdate.execute(CleanOrphanRowsInProjectLinks::handle); }</code><technical_language>add p.enabled = true</technical_language>

Target:
protected void execute(Context context) throws SQLException { MassUpdate massUpdate = context.prepareMassUpdate(); massUpdate.select("select" + " pl.id" + " from project_links pl" + " where" + " not exists (" + " select" + " 1" + " from projects" + " p" + " where" + " p.uuid = pl.component_uuid" + " and p.scope = ?" + " and p.qualifier in (?,?)" + " and p.enabled = ?" + " )") .setString(1, "PRJ") .setString(2, "TRK") .setString(3, "VW") .setBoolean(4, true); massUpdate.update("delete from project_links where id = ?"); massUpdate.rowPluralName("orphan project links"); massUpdate.execute(CleanOrphanRowsInProjectLinks::handle); }
Source:
<code>public VmTemplate mapRow(ResultSet rs, int rowNum) throws SQLException { final VmTemplate entity = new VmTemplate(); map(rs, entity); entity.setId(getGuidDefaultEmpty(rs, "vmt_guid")); entity.setChildCount(rs.getInt("child_count")); entity.setName(rs.getString("name")); entity.setClusterId(getGuid(rs, "cluster_id")); entity.setStatus(VmTemplateStatus.forValue(rs.getInt("status"))); entity.setClusterName(rs.getString("cluster_name")); entity.setClusterCompatibilityVersion(new VersionRowMapper("cluster_compatibility_version").mapRow(rs, rowNum)); entity.setStoragePoolId(getGuid(rs, "storage_pool_id")); entity.setStoragePoolName(rs.getString("storage_pool_name")); entity.setQuotaName(rs.getString("quota_name")); entity.setQuotaEnforcementType(QuotaEnforcementTypeEnum.forValue(rs.getInt("quota_enforcement_type"))); entity.setDisabled(rs.getBoolean("is_disabled")); entity.setTrustedService(rs.getBoolean("trusted_service")); entity.setTemplateType(VmEntityType.valueOf(rs.getString("entity_type"))); entity.setClusterArch(ArchitectureType.forValue(rs.getInt("architecture"))); entity.setBaseTemplateId(getGuidDefaultEmpty(rs, "base_template_id")); entity.setTemplateVersionNumber(rs.getInt("template_version_number")); entity.setTemplateVersionName(rs.getString("template_version_name")); <START> entity.setUseTscFrequency(rs.getBoolean("use_tsc_frequency")); <END> return entity; }</code><technical_language>This line is needed. useTscFrequency field is set map() method called line 289</technical_language>

Target:
public VmTemplate mapRow(ResultSet rs, int rowNum) throws SQLException { final VmTemplate entity = new VmTemplate(); map(rs, entity); entity.setId(getGuidDefaultEmpty(rs, "vmt_guid")); entity.setChildCount(rs.getInt("child_count")); entity.setName(rs.getString("name")); entity.setClusterId(getGuid(rs, "cluster_id")); entity.setStatus(VmTemplateStatus.forValue(rs.getInt("status"))); entity.setClusterName(rs.getString("cluster_name")); entity.setClusterCompatibilityVersion(new VersionRowMapper("cluster_compatibility_version").mapRow(rs, rowNum)); entity.setStoragePoolId(getGuid(rs, "storage_pool_id")); entity.setStoragePoolName(rs.getString("storage_pool_name")); entity.setQuotaName(rs.getString("quota_name")); entity.setQuotaEnforcementType(QuotaEnforcementTypeEnum.forValue(rs.getInt("quota_enforcement_type"))); entity.setDisabled(rs.getBoolean("is_disabled")); entity.setTrustedService(rs.getBoolean("trusted_service")); entity.setTemplateType(VmEntityType.valueOf(rs.getString("entity_type"))); entity.setClusterArch(ArchitectureType.forValue(rs.getInt("architecture"))); entity.setBaseTemplateId(getGuidDefaultEmpty(rs, "base_template_id")); entity.setTemplateVersionNumber(rs.getInt("template_version_number")); entity.setTemplateVersionName(rs.getString("template_version_name")); return entity; }
Source:
<code>public void shouldReturnTrueIfUserWithinARoleCanViewAndEditTemplates() { ArrayList<PipelineTemplateConfig> templateList = new ArrayList<PipelineTemplateConfig>(); <START> for (int i = 0; i < 100; i++) { <END> templateList.add(PipelineTemplateConfigMother.createTemplate("template" + i)); } CaseInsensitiveString templateAdmin = new CaseInsensitiveString("template-admin"); Role securityConfigRole = new Role(new CaseInsensitiveString("role1"), new RoleUser(templateAdmin)); AdminRole templateAdminRole = new AdminRole(securityConfigRole); templateList.add(PipelineTemplateConfigMother.createTemplate("templateName", new Authorization(new AdminsConfig(templateAdminRole)), StageConfigMother.manualStage("stage-name"))); TemplatesConfig templates = new TemplatesConfig(templateList.toArray(new PipelineTemplateConfig[0])); List<Role> roles = new ArrayList<>(); roles.add(securityConfigRole); assertThat(templates.canViewAndEditTemplate(templateAdmin, roles), is(true)); }</code><technical_language>point of adding a 100 templates? 1</technical_language>

Target:
public void shouldReturnTrueIfUserWithinARoleCanViewAndEditTemplates() { CaseInsensitiveString templateAdmin = new CaseInsensitiveString("template-admin"); Role securityConfigRole = getSecurityConfigRole(templateAdmin); List<Role> roles = setupRoles(securityConfigRole); ArrayList<PipelineTemplateConfig> templateList = new ArrayList<PipelineTemplateConfig>(); templateList.add(PipelineTemplateConfigMother.createTemplate("templateName", new Authorization(new AdminsConfig(new AdminRole(securityConfigRole))), StageConfigMother.manualStage("some-random-stage"))); TemplatesConfig templates = new TemplatesConfig(templateList.toArray(new PipelineTemplateConfig[0])); assertThat(templates.canViewAndEditTemplate(templateAdmin, roles), is(true)); }
Source:
<code>private static boolean isUnreasonableName(final String name) { if (name.length() == 0) return true; if (name.indexOf('\\') >= 0) <START> return true; END> if (name.charAt(0) == '/') return true; if (new File(name).isAbsolute()) return true; if (name.startsWith("../")) return true; if (name.contains("/../")) return true; if (name.contains("/./")) return true; if (name.contains(" return true; return false; }</code><technical_language>spelling</technical_language>

Target:
private static boolean isUnreasonableName(final String name) { if (name.length() == 0) return true; if (name.indexOf('\\') >= 0) return true; if (new File(name).isAbsolute()) return true; if (name.startsWith("../")) return true; if (name.contains("/../")) return true; if (name.contains("/./")) return true; if (name.contains(" return true; return false; }
Source:
<code>public static List<QueryParam> buildTopologyIdAndVersionIdAwareQueryParams(Long topologyId, Long versionId, UriInfo uriInfo) { List<QueryParam> queryParams = new ArrayList<>(); <START> queryParams.add(new QueryParam("topologyId", topologyId.toString())); <END> queryParams.add(new QueryParam("versionId", versionId.toString())); addQueryParams(uriInfo, queryParams); return queryParams; }</code><technical_language>Lets adding strings constants</technical_language>

Target:
public static List<QueryParam> buildTopologyIdAndVersionIdAwareQueryParams(Long topologyId, Long versionId, UriInfo uriInfo) { List<QueryParam> queryParams = new ArrayList<>(); queryParams.add(new QueryParam(TOPOLOGY_ID, topologyId.toString())); queryParams.addAll(versionIdQueryParam(versionId)); addQueryParams(uriInfo, queryParams); return queryParams; }
Source:
<code>public void configure(CamelContext camelContext) { <START> TransformerDefinition transformer; <END> if (uri != null) { EndpointTransformerDefinition etd = new EndpointTransformerDefinition(); etd.setUri(uri); transformer = etd; } else if (dataFormat != null) { DataFormatTransformerDefinition dtd = new DataFormatTransformerDefinition(); dtd.setDataFormatType(dataFormat); transformer = dtd; } else if (clazz != null) { CustomTransformerDefinition ctd = new CustomTransformerDefinition(); ctd.setType(clazz.getName()); transformer = ctd; } else if (beanRef != null) { CustomTransformerDefinition ctd = new CustomTransformerDefinition(); ctd.setRef(beanRef); transformer = ctd; } else { throw new IllegalArgumentException("No Transformer type was specified"); } if (scheme != null) { transformer.setScheme(scheme); } else { transformer.setFrom(from); transformer.setTo(to); } camelContext.getTransformers().add(transformer); }</code><technical_language>do extract this big block of if else in a private method "createTransformerDefinition"</technical_language>

Target:
public void configure(CamelContext camelContext) { TransformerDefinition transformer; if (uri != null) { EndpointTransformerDefinition etd = new EndpointTransformerDefinition(); etd.setUri(uri); transformer = etd; } else if (dataFormat != null) { DataFormatTransformerDefinition dtd = new DataFormatTransformerDefinition(); dtd.setDataFormatType(dataFormat); transformer = dtd; } else if (clazz != null) { CustomTransformerDefinition ctd = new CustomTransformerDefinition(); ctd.setType(clazz.getName()); transformer = ctd; } else if (beanRef != null) { CustomTransformerDefinition ctd = new CustomTransformerDefinition(); ctd.setRef(beanRef); transformer = ctd; } else { throw new IllegalArgumentException("No Transformer type was specified"); } if (scheme != null) { transformer.setScheme(scheme); } else { transformer.setFromType(from); transformer.setToType(to); } camelContext.getTransformers().add(transformer); }
Source:
<code>private InMemoryManager getOrDefaultInMemoryManagerByTestId(Config config) { <START> if (!config.containsKey(TEST_ID) || config.get(TEST_ID) == null) { <END> return DEFAULT_MANAGER; } IN_MEMORY_MANAGERS.putIfAbsent(Integer.parseInt(config.get(TEST_ID)), new InMemoryManager()); return IN_MEMORY_MANAGERS.get(Integer.parseInt(config.get(TEST_ID))); }</code><technical_language>String inMemoryScope = config.get(...); if (inMemoryScope != null) { return IN_MEMORY_MANAGER.computeIfAbsent(inMemoryScope, new InMemoryManager()); } return DEFAULT_MANAGER;</technical_language>

Target:
private InMemoryManager getOrDefaultInMemoryManagerByTestId(Config config) { InMemorySystemConfig inMemorySystemConfig = new InMemorySystemConfig(config); return IN_MEMORY_MANAGERS.computeIfAbsent(inMemorySystemConfig.getInMemoryScope(), key -> new InMemoryManager()); }
Source:
<code>public static DeletePropertyFileResponseType deletePropertyFile(DeletePropertyFileRequestType part1) throws PropertyAccessException { DeletePropertyFileResponseType oOutput = new DeletePropertyFileResponseType(); <START> if (part1 != null && part1.getPropertyFile() != null && part1.getPropertyFile().length() > 0) { <END> String sPropertyFile = part1.getPropertyFile(); PropertyFileManager.deletePropertyFile(sPropertyFile); } oOutput.setSuccess(true); return oOutput; }</code><technical_language>Need a StringUtils.isNotEmpty check</technical_language>

Target:
public static DeletePropertyFileResponseType deletePropertyFile(DeletePropertyFileRequestType part1) throws PropertyAccessException { DeletePropertyFileResponseType oOutput = new DeletePropertyFileResponseType(); if (part1 != null && StringUtils.isNotEmpty(part1.getPropertyFile())) { String sPropertyFile = part1.getPropertyFile(); PropertyFileManager.deletePropertyFile(sPropertyFile); } oOutput.setSuccess(true); return oOutput; }
Source:
<code>public static H2ODrm RowRange(H2ODrm drmA, final Range R) { Frame A = drmA.frame; Vec keys = drmA.keys; Frame Arr = new MRTask() { public void map(Chunk chks[], NewChunk ncs[]) { int chunk_size = chks[0].len(); long chunk_start = chks[0].start(); if (chunk_start > R.end() || (chunk_start + chunk_size) < R.start()) return; for (int r = 0; r < chunk_size; r++) { if (!R.contains(chunk_start + r)) <START> continue; <END> for (int c = 0; c < chks.length; c++) ncs[c].addNum(chks[c].at0(r)); } } }.doAll(A.numCols(), A).outputFrame(null, null); Vec Vrr = (keys == null) ? null : new MRTask() { public void map(Chunk chk, NewChunk nc) { int chunk_size = chk.len(); long chunk_start = chk.start(); ValueString vstr = new ValueString(); if (chunk_start > R.end() || (chunk_start + chunk_size) < R.start()) return; for (int r = 0; r < chunk_size; r++) { if (!R.contains(chunk_start + r)) continue; nc.addStr(chk.atStr0(vstr, r).toString()); } } }.doAll(1, keys).outputFrame(null, null).anyVec(); return new H2ODrm(Arr, Vrr); }</code><technical_language>if statment needs braces</technical_language>

Target:
public static H2ODrm RowRange(H2ODrm drmA, final Range R) { Frame A = drmA.frame; Vec keys = drmA.keys; Frame Arr = new MRTask() { public void map(Chunk chks[], NewChunk ncs[]) { int chunk_size = chks[0].len(); long chunk_start = chks[0].start(); if (chunk_start > R.end() || (chunk_start + chunk_size) < R.start()) { return; } for (int r = 0; r < chunk_size; r++) { if (!R.contains(chunk_start + r)) { continue; } for (int c = 0; c < chks.length; c++) { ncs[c].addNum(chks[c].at0(r)); } } } }.doAll(A.numCols(), A).outputFrame(null, null); Vec Vrr = (keys == null) ? null : new MRTask() { public void map(Chunk chk, NewChunk nc) { int chunk_size = chk.len(); long chunk_start = chk.start(); ValueString vstr = new ValueString(); if (chunk_start > R.end() || (chunk_start + chunk_size) < R.start()) { return; } for (int r = 0; r < chunk_size; r++) { if (!R.contains(chunk_start + r)) { continue; } nc.addStr(chk.atStr0(vstr, r)); } } }.doAll(1, keys).outputFrame(null, null).anyVec(); return new H2ODrm(Arr, Vrr); }
Source:
<code>public void stop() { super.stop(); <START> createdStores.clear(); <END> diskPersistenceService = null; }</code><technical_language>in a finally block</technical_language>

Target:
public void stop() { try { createdStores.clear(); diskPersistenceService = null; } finally { super.stop(); } }
Source:
<code>public static InterpretedStatus from(SmartpayStatus gatewayStatus) { Optional<StatusMap> statusMap = validStatuses .stream() .filter(validStatus -> validStatus.getFromStatus().equals(gatewayStatus)) .findFirst(); if (statusMap.isEmpty()) { return new UnknownStatus(); } Optional<Status> statusMaybe = statusMap.flatMap(StatusMap::getToStatus); if (statusMaybe.isEmpty()) { return new IgnoredStatus(); } Status status = statusMaybe.get(); if (status instanceof ChargeStatus) { return new MappedChargeStatus((ChargeStatus) status); } if (status instanceof RefundStatus) { return new MappedRefundStatus((RefundStatus) status); } <START> return new UnknownStatus(); <END> }</code><technical_language>I Optional<Status> statusMaybe = replaced by: java return statusMap .flatMap(StatusMap::getToStatus) .map(status -> { if (status instanceof ChargeStatus) { return new MappedChargeStatus((ChargeStatus) status); } if (status instanceof RefundStatus) { return new MappedRefundStatus((RefundStatus) status); } return new UnknownStatus(); }) .orElseGet(IgnoredStatus::new);</technical_language>

Target:
public static InterpretedStatus from(SmartpayStatus gatewayStatus) { Optional<StatusMap> statusMap = validStatuses .stream() .filter(validStatus -> validStatus.getFromStatus().equals(gatewayStatus)) .findFirst(); if (statusMap.isEmpty()) { return new UnknownStatus(); } return statusMap .flatMap(StatusMap::getToStatus) .map(status -> { if (status instanceof ChargeStatus) { return new MappedChargeStatus((ChargeStatus) status); } if (status instanceof RefundStatus) { return new MappedRefundStatus((RefundStatus) status); } return new UnknownStatus(); }) .orElseGet(IgnoredStatus::new); }
Source:
<code>public void testSsModule() { <START> fTrace.openTrace(); <END> TmfStateSystemAnalysisModule module = (TmfStateSystemAnalysisModule) fTrace.getAnalysisModule(MODULE_SS); ITmfStateSystem ss = null; ss = module.getStateSystem(); assertNull(ss); module.schedule(); if (module.waitForCompletion(new NullProgressMonitor())) { ss = module.getStateSystem(); assertNotNull(ss); } else { fail("Module did not complete properly"); } }</code><technical_language>hmmok, do right, push another version in a</technical_language>

Target:
public void testSsModule() { TmfSignalManager.deregister(fTrace); fTrace.traceOpened(new TmfTraceOpenedSignal(this, fTrace, null)); TmfStateSystemAnalysisModule module = (TmfStateSystemAnalysisModule) fTrace.getAnalysisModule(MODULE_SS); ITmfStateSystem ss = null; ss = module.getStateSystem(); assertNull(ss); module.schedule(); if (module.waitForCompletion(new NullProgressMonitor())) { ss = module.getStateSystem(); assertNotNull(ss); } else { fail("Module did not complete properly"); } }
Source:
<code>public LocalDatasetBuilder(Map<K, V> upstreamMap, IgniteBiPredicate<K, V> filter, int partitions) { this.upstreamMap = upstreamMap; this.filter = filter; this.partitions = partitions; <START> this.transformers = new LinkedList<>(); <END> this.transformerDataSuppliers = new LinkedList<>(); }</code><technical_language>linked lists</technical_language>

Target:
public LocalDatasetBuilder(Map<K, V> upstreamMap, IgniteBiPredicate<K, V> filter, int partitions) { this.upstreamMap = upstreamMap; this.filter = filter; this.partitions = partitions; this.upstreamTransformers = UpstreamTransformerChain.empty(); }
Source:
<code>private void disableLuceneAutomaticCommit() { Config cfg = dbInjector.getInstance(Key.get(Config.class, GerritServerConfig.class)); if <START> (cfg.getEnum("index", null, "type", IndexType.SQL).equals( <END> IndexType.LUCENE)) { cfg.setString("index", "changes_open", "commitWithin", "-1"); cfg.setString("index", "changes_closed", "commitWithin", "-1"); } }</code><technical_language>IndexModule.getIndexType(dbInjector) == IndexType.LUCENE</technical_language>

Target:
private void disableLuceneAutomaticCommit() { Config cfg = dbInjector.getInstance(Key.get(Config.class, GerritServerConfig.class)); if (IndexModule.getIndexType(dbInjector) == IndexType.LUCENE) { cfg.setLong("index", "changes_open", "commitWithin", -1); cfg.setLong("index", "changes_closed", "commitWithin", -1); } }
Source:
<code>public byte[] marshal(@Nullable Object obj) throws BinaryObjectException { if (obj == null) return new byte[] { NULL }; try (BinaryWriterExImpl writer = new BinaryWriterExImpl(ctx)) { writer.marshal(obj); byte[] bytes = writer.array(); <START> if (fullCompressionMode && !CompressionUtils.isCompressionType(bytes[0])) { <END> byte[] buffer; Compressor compressor = compressorsSelector.get(fullCompressionType); buffer = CompressionUtils.compress(compressor, bytes); byte[] compressed = new byte[buffer.length + 1]; compressed[0] = (byte)fullCompressionType.getMode().typeId(); System.arraycopy(buffer, 0, compressed, 1, buffer.length); return compressed; } return bytes; } }</code><technical_language>do need negative mark here</technical_language>

Target:
public byte[] marshal(@Nullable Object obj) throws BinaryObjectException { if (obj == null) return new byte[] { NULL }; try (BinaryWriterExImpl writer = new BinaryWriterExImpl(ctx)) { writer.marshal(obj); if (fullCompressionMode) { byte[] arr = writer.array(); assert arr[0] != COMPRESSED : "Compressed byte array not allowed here, mode: " + arr[0]; byte[] buf = U.compress(compressor, arr); byte[] compressed = new byte[buf.length + 1]; compressed[0] = COMPRESSED; System.arraycopy(buf, 0, compressed, 1, buf.length); return compressed; } return writer.array(); } }
Source:
<code>public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<QuotaConsumptionParameter>(); if (isQuotaValidationNeeded()) { DiskImage oldDiskImage = (DiskImage) oldDisk; DiskImage newDiskImage = (DiskImage) newDisk; QuotaStorageConsumptionParameter consumptionRequest = new QuotaStorageConsumptionParameter( newDiskImage.getQuotaId(), null, QuotaStorageConsumptionParameter.QuotaAction.CONSUME, newDiskImage.getstorage_ids().get(0), (double)newDiskImage.getSizeInGigabytes()); QuotaStorageConsumptionParameter releaseRequest = new QuotaStorageConsumptionParameter( oldDiskImage.getQuotaId(), null, QuotaStorageConsumptionParameter.QuotaAction.RELEASE, oldDiskImage.getstorage_ids().get(0), (double)oldDiskImage.getSizeInGigabytes()); if (oldDiskImage.getQuotaId() == null || Guid.Empty.equals(oldDiskImage.getQuotaId())) { list.add(consumptionRequest); <START> } else { END> if (!oldDiskImage.getQuotaId().equals(newDiskImage.getQuotaId())) { list.add(consumptionRequest); list.add(releaseRequest); } } } return list; }</code><technical_language>Convert 'else if'</technical_language>

Target:
public List<QuotaConsumptionParameter> getQuotaStorageConsumptionParameters() { List<QuotaConsumptionParameter> list = new ArrayList<QuotaConsumptionParameter>(); if (isQuotaValidationNeeded()) { DiskImage oldDiskImage = (DiskImage) oldDisk; DiskImage newDiskImage = (DiskImage) newDisk; QuotaStorageConsumptionParameter consumptionRequest = new QuotaStorageConsumptionParameter( newDiskImage.getQuotaId(), null, QuotaStorageConsumptionParameter.QuotaAction.CONSUME, newDiskImage.getstorage_ids().get(0), (double)newDiskImage.getSizeInGigabytes()); QuotaStorageConsumptionParameter releaseRequest = new QuotaStorageConsumptionParameter( oldDiskImage.getQuotaId(), null, QuotaStorageConsumptionParameter.QuotaAction.RELEASE, oldDiskImage.getstorage_ids().get(0), (double)oldDiskImage.getSizeInGigabytes()); if (oldDiskImage.getQuotaId() == null || Guid.Empty.equals(oldDiskImage.getQuotaId())) { list.add(consumptionRequest); } else if (!oldDiskImage.getQuotaId().equals(newDiskImage.getQuotaId())) { list.add(consumptionRequest); list.add(releaseRequest); } } return list; }
Source:
<code>private void addCheckBox(T checkBoxValue) { String checkBoxLabel = renderer.render(checkBoxValue); if (checkBoxLabel == null) { throw new IllegalArgumentException("null value is not permited"); } <START> if (checkBoxes.containsKey(checkBoxValue)) { <END> throw new IllegalArgumentException("Duplicate value: " + checkBoxLabel); } final CheckBox newCheckBox = buildCheckbox(checkBoxValue); checkBoxes.put(checkBoxValue, newCheckBox); }</code><technical_language>places call this method check if is a duplicate key, check again</technical_language>

Target:
private void addCheckBox(T checkBoxValue) { String checkBoxLabel = renderer.render(checkBoxValue); if (checkBoxLabel == null) { throw new IllegalArgumentException("null value is not permited"); } final CheckBox newCheckBox = buildCheckbox(checkBoxValue); checkBoxes.put(checkBoxValue, newCheckBox); }
Source:
<code>public Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); SavedState ss = new SavedState( superState ); ss.scale = getScale(); <START> ss.savedCenterX = getScrollX() + getHalfWidth(); <END> ss.savedCenterY = getScrollY() + getHalfHeight(); return ss; }</code><technical_language>i need save offsets here, setting scale anyway, save restore scrollX/Y..</technical_language>

Target:
public Parcelable onSaveInstanceState() { Parcelable superState = super.onSaveInstanceState(); SavedState ss = new SavedState( superState ); ss.mScale = getScale(); ss.mSavedCenterX = getScrollX() + getHalfWidth(); ss.mSavedCenterY = getScrollY() + getHalfHeight(); return ss; }
Source:
<code>private IASTTranslationUnit getAST() { if (fTranslationUnit != null) return fTranslationUnit; IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) return null; IWorkbenchPage page = window.getActivePage(); if (page == null) return null; IEditorPart editor = page.getActiveEditor(); if (editor == null) return null; IWorkingCopyManager manager = CUIPlugin.getDefault().getWorkingCopyManager(); ITranslationUnit unit = manager.getWorkingCopy(editor.getEditorInput()); if (unit == null) return null; try { fTranslationUnit = <START> unit.getAST(null, ITranslationUnit.AST_SKIP_ALL_HEADERS); <END> return fTranslationUnit; } catch (CoreException e) { CUIPlugin.log(e); } return null; }</code><technical_language>need index-based AST</technical_language>

Target:
private IASTTranslationUnit getAST() { if (fTranslationUnit != null) return fTranslationUnit; IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window == null) return null; IWorkbenchPage page = window.getActivePage(); if (page == null) return null; IEditorPart editor = page.getActiveEditor(); if (editor == null) return null; IWorkingCopyManager manager = CUIPlugin.getDefault().getWorkingCopyManager(); ITranslationUnit unit = manager.getWorkingCopy(editor.getEditorInput()); if (unit == null) return null; try { fTranslationUnit = unit.getAST(CCorePlugin.getIndexManager().getIndex(unit.getCProject()), ITranslationUnit.AST_SKIP_ALL_HEADERS); return fTranslationUnit; } catch (CoreException e) { CUIPlugin.log(e); } return null; }
Source:
<code><START> public Pipe(LogTailer tailer, FileTailerSink sink, FileTailerMetricsProcessor metricsProcessor) { <END> this.logTailer = tailer; this.sink = sink; this.metricsProcessor = metricsProcessor; }</code><technical_language>Empty line field method</technical_language>

Target:
public Pipe(LogTailer tailer, FileTailerSink sink, FileTailerMetricsProcessor metricsProcessor) { serviceManager = new ServiceManager(Arrays.asList(metricsProcessor, tailer, sink)); }
Source:
<code><START> public void writeTo(AssetCursor cursor, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, <END> OutputStream entityStream) throws IOException { MAPPER.writeValue(entityStream, cursor); }</code><technical_language>checking mediatype here. this point, do assume jax-rs called method is giving sensible</technical_language>

Target:
public void writeTo(AssetCursor cursor, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException { try (AssetCursor cursorToBeClosed = cursor) { MAPPER.writeValue(entityStream, cursorToBeClosed); } }
Source:
<code>public String readFileContent(String filePath, int startFrom, int limit) throws MachineException { if (limit < 0) { throw new MachineException("Impossible to read " + limit + " lines"); } FormattedLineConsumer fileContent = new FormattedLineConsumer(); InstanceProcess process; String command; try { if (startFrom > 0) { command = String.format("sed -n \'%1$2s, %2$2sp\' %3$2s", startFrom, startFrom + limit, filePath); } else { command = "cat " + filePath; } <START> process = createProcess(command); <END> process.start(fileContent); } catch (ConflictException | MachineException e) { throw new MachineException("Impossible to read file content ", e); } String content = fileContent.getText(); if (content.contains("sed: can't read " + filePath + ": No such file or directory") || content.contains("cat: " + filePath + ": No such file or directory")) { throw new MachineException("File with path " + filePath + " not found"); } return content; }</code><technical_language>I prefer usage of docker exec instead of DockerProcess. In case presented in list of processes, need workaround in 100-102 lines of DockerProcess</technical_language>

Target:
public String readFileContent(String filePath, int startFrom, int limit) throws MachineException { if (limit <= 0 || startFrom <= 0) { throw new MachineException("Impossible to read file " + limit + " lines from " + startFrom + " line"); } String bashCommand = String.format("sed -n \'%1$2s, %2$2sp\' %3$2s", startFrom, startFrom + limit, filePath); final String[] command = {"/bin/bash", "-c", bashCommand}; ListLineConsumer lines = new ListLineConsumer(); try { Exec exec = docker.createExec(container, false, command); docker.startExec(exec.getId(), new LogMessagePrinter(lines, LogMessage::getContent)); } catch (IOException e) { throw new MachineException(String.format("Error occurs while initializing command %s in docker container %s: %s", Arrays.toString(command), container, e.getLocalizedMessage()), e); } String content = lines.getText(); if (content.contains("sed: can't read " + filePath + ": No such file or directory") || content.contains("cat: " + filePath + ": No such file or directory")) { throw new MachineException("File with path " + filePath + " not found"); } return content; }
Source:
<code><START> public static Vector3d getAllWeatherZenith(float thetaSunAngle, float turbidity) { <END> float thetaSun = (float) Math.acos(thetaSunAngle); Vector4f cx1 = new Vector4f(0.0f, 0.00209f, -0.00375f, 0.00165f); Vector4f cx2 = new Vector4f(0.00394f, -0.03202f, 0.06377f, -0.02903f); Vector4f cx3 = new Vector4f(0.25886f, 0.06052f, -0.21196f, 0.11693f); Vector4f cy1 = new Vector4f(0.0f, 0.00317f, -0.00610f, 0.00275f); Vector4f cy2 = new Vector4f(0.00516f, -0.04153f, 0.08970f, -0.04214f); Vector4f cy3 = new Vector4f(0.26688f, 0.06670f, -0.26756f, 0.15346f); float t2 = turbidity * turbidity; float chi = (4.0f / 9.0f - turbidity / 120.0f) * ((float) Math.PI - 2.0f * thetaSun); Vector4f theta = new Vector4f(1, thetaSun, thetaSun * thetaSun, thetaSun * thetaSun * thetaSun); float why = (4.0453f * turbidity - 4.9710f) * (float) Math.tan(chi) - 0.2155f * turbidity + 2.4192f; float x = t2 * cx1.dot(theta) + turbidity * cx2.dot(theta) + cx3.dot(theta); float y = t2 * cy1.dot(theta) + turbidity * cy2.dot(theta) + cy3.dot(theta); return new Vector3d(why, x, y); }</code><technical_language>Ah! I noticed of parameters, in nodes, shader</technical_language>

Target:
static Vector3f getAllWeatherZenith(float thetaSunAngle, float turbidity) { float thetaSun = (float) Math.acos(thetaSunAngle); Vector4f cx1 = new Vector4f(0.0f, 0.00209f, -0.00375f, 0.00165f); Vector4f cx2 = new Vector4f(0.00394f, -0.03202f, 0.06377f, -0.02903f); Vector4f cx3 = new Vector4f(0.25886f, 0.06052f, -0.21196f, 0.11693f); Vector4f cy1 = new Vector4f(0.0f, 0.00317f, -0.00610f, 0.00275f); Vector4f cy2 = new Vector4f(0.00516f, -0.04153f, 0.08970f, -0.04214f); Vector4f cy3 = new Vector4f(0.26688f, 0.06670f, -0.26756f, 0.15346f); float t2 = turbidity * turbidity; float chi = (4.0f / 9.0f - turbidity / 120.0f) * ((float) Math.PI - 2.0f * thetaSun); Vector4f theta = new Vector4f(1, thetaSun, thetaSun * thetaSun, thetaSun * thetaSun * thetaSun); float why = (4.0453f * turbidity - 4.9710f) * (float) Math.tan(chi) - 0.2155f * turbidity + 2.4192f; float x = t2 * cx1.dot(theta) + turbidity * cx2.dot(theta) + cx3.dot(theta); float y = t2 * cy1.dot(theta) + turbidity * cy2.dot(theta) + cy3.dot(theta); return new Vector3f(why, x, y); }
Source:
<code><START> public void addPatientUserDoesNotHaveAccess() throws XWikiRestException { <END> WebApplicationException exception = new WebApplicationException(); doReturn(false).when(this.access).hasAccess(eq(Right.EDIT), any(DocumentReference.class), any(EntityReference.class)); try { Response response = this.patientsResource.addPatient(""); } catch (WebApplicationException ex){ exception = ex; } Assert.assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), exception.getResponse().getStatus()); }</code><technical_language>throws XWikiRestException removed Class/Interface testing, remove</technical_language>

Target:
public void addPatientUserDoesNotHaveAccess() { WebApplicationException exception = null; doReturn(false).when(this.access).hasAccess(eq(Right.EDIT), any(DocumentReference.class), any(EntityReference.class)); try { Response response = this.patientsResource.addPatient(""); } catch (WebApplicationException ex){ exception = ex; } Assert.assertNotNull(exception); Assert.assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), exception.getResponse().getStatus()); }
Source:
<code>private void export() { form.disableUI(); terminationFuture.reset(); forms.getSelectedForms() .parallelStream() .peek(FormStatus::clearStatusHistory) .forEach(form -> { String formId = form.getFormDefinition().getFormId(); ExportConfiguration configuration = forms.getConfiguration(formId); if (configuration.resolvePullBefore()) forms.getTransferSettings(formId).ifPresent(sci -> NewTransferAction.transferServerToBriefcase( sci, terminationFuture, Collections.singletonList(form) )); ExportAction.export( (BriefcaseFormDefinition) form.getFormDefinition(), configuration, terminationFuture ); }); form.enableUI(); <START> form.hideExporting(); <END> }</code><technical_language>remove this call here. Exporting asynchronously this get executed export process ends</technical_language>

Target:
private void export() { form.disableUI(); terminationFuture.reset(); forms.getSelectedForms() .parallelStream() .peek(FormStatus::clearStatusHistory) .forEach(form -> { String formId = form.getFormDefinition().getFormId(); ExportConfiguration configuration = forms.getConfiguration(formId); if (configuration.resolvePullBefore()) forms.getTransferSettings(formId).ifPresent(sci -> NewTransferAction.transferServerToBriefcase( sci, terminationFuture, Collections.singletonList(form) )); ExportAction.export( (BriefcaseFormDefinition) form.getFormDefinition(), configuration, terminationFuture ); }); form.enableUI(); }
Source:
<code>public UpdateVmCommand(T parameters, CommandContext commandContext) { super(parameters, commandContext); if (getVdsGroup() != null) { setStoragePoolId(getVdsGroup().getStoragePoolId()); } if (isVmExist()) { <START> Version compaVersion = getEffectiveCompatibilityVersion(); <END> getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined(compaVersion, parameters.getVmStaticData()); getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined(compaVersion, getVm().getStaticData()); } VmHandler.updateDefaultTimeZone(parameters.getVmStaticData()); VmHandler.autoSelectUsbPolicy(getParameters().getVmStaticData(), getVdsGroup()); VmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getVmStaticData(), getVdsGroup(), getParameters().getGraphicsDevices()); updateParametersVmFromInstanceType(); }</code><technical_language>NIT: want call 'compatVersion'? :-) in subsequent patches I letter adds more clarity :-)</technical_language>

Target:
public UpdateVmCommand(T parameters, CommandContext commandContext) { super(parameters, commandContext); if (getVdsGroup() != null) { setStoragePoolId(getVdsGroup().getStoragePoolId()); } if (isVmExist()) { Version compatibilityVersion = getEffectiveCompatibilityVersion(); getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined(compatibilityVersion, parameters.getVmStaticData()); getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined(compatibilityVersion, getVm().getStaticData()); } VmHandler.updateDefaultTimeZone(parameters.getVmStaticData()); VmHandler.autoSelectUsbPolicy(getParameters().getVmStaticData(), getVdsGroup()); VmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getVmStaticData(), getVdsGroup(), getParameters().getGraphicsDevices()); updateParametersVmFromInstanceType(); }
Source:
<code>void destroyLocked() { if (sVerbose) Slog.v(TAG, "destroyLocked()"); final int numSessions = mSessions.size(); final ArraySet<RemoteFillService> remoteFillServices = new ArraySet<>(numSessions); for (int i = 0; i < numSessions; i++) { final RemoteFillService remoteFillService = mSessions.valueAt(i).destroyLocked(); if (remoteFillService != null) { remoteFillServices.add(remoteFillService); } } mSessions.clear(); for (int i = 0; i < remoteFillServices.size(); i++) { remoteFillServices.valueAt(i).destroy(); } sendStateToClients(true); if (mClients != null) { <START> mClients.kill(); <END> } }</code><technical_language>I set mClients null here, in unusable state (it fine ServiceImpl is destroyed, I guess hurt cautions)</technical_language>

Target:
void destroyLocked() { if (sVerbose) Slog.v(TAG, "destroyLocked()"); final int numSessions = mSessions.size(); final ArraySet<RemoteFillService> remoteFillServices = new ArraySet<>(numSessions); for (int i = 0; i < numSessions; i++) { final RemoteFillService remoteFillService = mSessions.valueAt(i).destroyLocked(); if (remoteFillService != null) { remoteFillServices.add(remoteFillService); } } mSessions.clear(); for (int i = 0; i < remoteFillServices.size(); i++) { remoteFillServices.valueAt(i).destroy(); } sendStateToClients(true); if (mClients != null) { mClients.kill(); mClients = null; } }
Source:
<code>public IHost createHost(String hostName, String sysType, String[] configurationIds) throws AssertionFailedError { String profileName = getSystemProfileName(); IRSESystemType systemType = findSystemType(sysType); ArrayList<ISubSystemConfigurator> configuratorList = new ArrayList<ISubSystemConfigurator>(); for( int i = 0; i < configurationIds.length; i++ ) { configuratorList.add(createSubsystemConfigurator(configurationIds[i])); } ISubSystemConfigurator[] configurators = (ISubSystemConfigurator[]) configuratorList .toArray(new ISubSystemConfigurator[configuratorList.size()]); ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); try { <START> IHost host = sr.createHost(profileName, systemType, hostName, hostName, "test host", "", 0, configurators); <END> return host; } catch(Exception e) { fail(e.getMessage()); } return null; }</code><technical_language>systemType return null - is this method ok is a missing assert</technical_language>

Target:
public IHost createHost(String hostName, String sysType, String[] configurationIds) throws AssertionFailedError { String profileName = getOrCreateSystemProfileName(); IRSESystemType systemType = findSystemType(sysType); assertNotNull("System type not found: " + sysType); ArrayList<ISubSystemConfigurator> configuratorList = new ArrayList<ISubSystemConfigurator>(); for( int i = 0; i < configurationIds.length; i++ ) { configuratorList.add(createSubsystemConfigurator(configurationIds[i])); } ISubSystemConfigurator[] configurators = (ISubSystemConfigurator[]) configuratorList .toArray(new ISubSystemConfigurator[configuratorList.size()]); ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); try { IHost host = sr.createHost(profileName, systemType, hostName, hostName, "test host", "", 0, configurators); return host; } catch(Exception e) { fail("Failed to create host: " + e.getMessage()); } return null; }
Source:
<code><START> public String getType() <END> { return type; }</code><technical_language>methods private</technical_language>

Target:
private String getType() { return type; }
Source:
<code>public Comparable next() { if (!hasNext()) { return null; <START> } <END> fetchNextIfNeeded(); isNextFetched = false; return next; }</code><technical_language>a NoSuchElementException instead of returning null</technical_language>

Target:
public Comparable next() { if (!hasNext()) { throw new NoSuchElementException(); } fetchNextIfNeeded(); isNextFetched = false; return next; }
Source:
<code>public boolean apply(Game game, Ability source) { Player activePlayer = game.getPlayer(game.getActivePlayerId()); <START> return activePlayer != null && game.getPlayer(game.getActivePlayerId()).hasOpponent(source.getControllerId(), game) && game.getPhase().getStep().getType().getIndex() < 5; <END> }</code><technical_language>activePlayer object instead of retrieving</technical_language>

Target:
public boolean apply(Game game, Ability source) { Player activePlayer = game.getPlayer(game.getActivePlayerId()); return activePlayer != null && activePlayer.hasOpponent(source.getControllerId(), game) && game.getPhase().getStep().getType().getIndex() < 5; }
Source:
<code>public SolrExplicitDateRange(String description, String startDate, String endDate) throws IOException { this.description = description; Calendar startCal = Calendar.getInstance(); Calendar endCal = Calendar.getInstance(); startCal.setTimeZone(TimeZone.getTimeZone("UTC")); endCal.setTimeZone(TimeZone.getTimeZone("UTC")); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.US); try { startCal.setTime(simpleDateFormat.parse(startDate)); endCal.setTime(simpleDateFormat.parse(endDate)); } catch (ParseException e) { <START> throw new IOException(e); <END> } this.startDate = startCal; this.endDate = endCal; }</code><technical_language>I throw a RuntimeException instead, this do I/O. remove IOException method signature RuntimeException checked</technical_language>

Target:
public SolrExplicitDateRange(String description, String startDate, String endDate) { this.description = description; Calendar startCal = Calendar.getInstance(); Calendar endCal = Calendar.getInstance(); startCal.setTimeZone(TimeZone.getTimeZone("UTC")); endCal.setTimeZone(TimeZone.getTimeZone("UTC")); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.US); try { startCal.setTime(simpleDateFormat.parse(startDate)); endCal.setTime(simpleDateFormat.parse(endDate)); } catch (ParseException e) { throw new RuntimeException(e); } this.startDate = startCal; this.endDate = endCal; }
Source:
<code>private List<ValidationResult> validateConfig(Xpp3Dom current) { if (current.getChildCount() > 0) { return Arrays.stream(current.getChildren()) .filter(child -> CONFIG_OPTION_TO_VALIDATE.equals(child.getName())) .map(this::validateConfig) .flatMap(Collection::stream) .collect(Collectors.toList()); } <START> if (CONFIG_OPTION_TO_VALIDATE.equals(current.getName())) { <END> List<ValidationResult> results = validateImports(current.getValue()); if (results.isEmpty()) { return Collections.singletonList(new ValidationResult("No Packages Imported", true)); } return results; } else { return Collections.emptyList(); } }</code><technical_language>reverse this predicate early return empty collection? This collapse level of if/else here</technical_language>

Target:
private List<ValidationResult> validateConfig(Xpp3Dom current) { if (current.getChildCount() > 0) { return Arrays.stream(current.getChildren()) .filter(child -> CONFIG_OPTION_TO_VALIDATE.equals(child.getName())) .map(this::validateConfig) .flatMap(Collection::stream) .collect(Collectors.toList()); } if (!CONFIG_OPTION_TO_VALIDATE.equals(current.getName())) { return Collections.emptyList(); } List<ValidationResult> results = validateImports(current.getValue()); if (results.isEmpty()) { return Collections.singletonList(new ValidationResult("No Packages Imported", true)); } return results; }
Source:
<code>public void testMarkingAcl_emptyAcl_allowConstraintMask() throws Exception { <START> Permissions testPerms = new Permissions(perms); <END> Permissions.Acl acl = testPerms.getMarkingAcl(~VIEW_ACCESS_RIGHTS); assertEquals(ImmutableSet.<String>of(AUTHENTICATED_USERS), acl.getAllowGroups(PermissionSource.MARKING)); assertEquals(ImmutableSet.<String>of(AUTHENTICATED_USERS), acl.getAllowGroups()); assertTrue(acl.getAllowUsers().toString(), acl.getAllowUsers().isEmpty()); assertTrue(acl.getDenyUsers().toString(), acl.getDenyUsers().isEmpty()); assertTrue(acl.getDenyGroups().toString(), acl.getDenyGroups().isEmpty()); }</code><technical_language>s/perms/new AccessPermissionListMock()/ need empty list</technical_language>

Target:
public void testMarkingAcl_emptyAcl_allowConstraintMask() throws Exception { Permissions testPerms = new Permissions(new AccessPermissionListMock()); Permissions.Acl acl = testPerms.getMarkingAcl(~VIEW_ACCESS_RIGHTS); assertEquals(ImmutableSet.of(AUTHENTICATED_USERS), acl.getAllowGroups(PermissionSource.MARKING)); assertEquals(ImmutableSet.of(AUTHENTICATED_USERS), acl.getAllowGroups()); assertEquals(ImmutableSet.of(), acl.getAllowUsers()); assertEquals(ImmutableSet.of(), acl.getDenyUsers()); assertEquals(ImmutableSet.of(), acl.getDenyGroups()); }