auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void endVmCommand() { Snapshot createdSnapshot = getSnapshotDao().get(getVmId(), getParameters().getSnapshotType(), SnapshotStatus.LOCKED); boolean taskGroupSucceeded = createdSnapshot != null && getParameters().getTaskGroupSuccess(); boolean liveSnapshotRequired = isLiveSnapshotApplicable(); boolean liveSnapshotSucceeded = false; if (taskGroupSucceeded) { getSnapshotDao().updateStatus(createdSnapshot.getId(), SnapshotStatus.OK); if (liveSnapshotRequired) { liveSnapshotSucceeded = performLiveSnapshot(createdSnapshot); } else { if (getParameters().isSaveMemory() && createdSnapshot.containsMemory()) { logMemorySavingFailed(); getSnapshotDao().removeMemoryFromSnapshot(createdSnapshot.getId()); removeMemoryVolumesOfSnapshot(createdSnapshot); } } } else { if (createdSnapshot != null) { revertToActiveSnapshot(createdSnapshot.getId()); if (getParameters().isSaveMemory() && createdSnapshot.containsMemory()) { removeMemoryVolumesOfSnapshot(createdSnapshot); } } else { log.warnFormat("No snapshot was created for VM {0} which is in LOCKED status", getVmId()); } } if (getParameters().isSaveMemory() && !isMemorySnapshotSupported()) { <START> log.warnFormat("A memory snapshot was required but not created, since VM architecture does not support it."); <END> } incrementVmGeneration(); endActionOnDisks(); setSucceeded(taskGroupSucceeded && (!liveSnapshotRequired || liveSnapshotSucceeded)); getReturnValue().setEndActionTryAgain(false); }</code><technical_language>This line executed - if statement in method evaluate true, a NullableMemoryImageBuilder returned. Moreover, in a situation I log discrepancy, fail canDoAction() - requested impossible command run</technical_language>

Target:
protected void endVmCommand() { Snapshot createdSnapshot = getSnapshotDao().get(getVmId(), getParameters().getSnapshotType(), SnapshotStatus.LOCKED); boolean taskGroupSucceeded = createdSnapshot != null && getParameters().getTaskGroupSuccess(); boolean liveSnapshotRequired = isLiveSnapshotApplicable(); boolean liveSnapshotSucceeded = false; if (taskGroupSucceeded) { getSnapshotDao().updateStatus(createdSnapshot.getId(), SnapshotStatus.OK); if (liveSnapshotRequired) { liveSnapshotSucceeded = performLiveSnapshot(createdSnapshot); } else { if (getParameters().isSaveMemory() && createdSnapshot.containsMemory()) { logMemorySavingFailed(); getSnapshotDao().removeMemoryFromSnapshot(createdSnapshot.getId()); removeMemoryVolumesOfSnapshot(createdSnapshot); } } } else { if (createdSnapshot != null) { revertToActiveSnapshot(createdSnapshot.getId()); if (getParameters().isSaveMemory() && createdSnapshot.containsMemory()) { removeMemoryVolumesOfSnapshot(createdSnapshot); } } else { log.warnFormat("No snapshot was created for VM {0} which is in LOCKED status", getVmId()); } } incrementVmGeneration(); endActionOnDisks(); setSucceeded(taskGroupSucceeded && (!liveSnapshotRequired || liveSnapshotSucceeded)); getReturnValue().setEndActionTryAgain(false); }
Source:
<code>public void testLoadBundleWithExecFileVersion074() throws IOException { ExecutionFileLoader loader = new ExecutionFileLoader(); assertTrue("This test requires that a jacoco.exec file exists in the target-directory", new File("target/jacoco.exec").exists()); loader.setClassDir(new FilePath(new File("target/classes"))); loader.setExcludes("excludme.test"); <START> loader.addExecFile(new FilePath(new File("src/test/jacoco_074.exec"))); <END> loader.addExecFile(new FilePath(new File("somenonexistingfile"))); IBundleCoverage coverage = loader.loadBundleCoverage(); assertNotNull(coverage); assertTrue("Expect to have at least some lines found, but had: " + coverage.getClassCounter(), coverage.getClassCounter().getMissedCount() > 0 || coverage.getClassCounter().getCoveredCount() > 0); }</code><technical_language>checked out yet, is a "resources" missing here</technical_language>

Target:
public void testLoadBundleWithExecFileVersion074() throws IOException { ExecutionFileLoader loader = new ExecutionFileLoader(); assertTrue("This test requires that a jacoco.exec file exists in the target-directory", new File("src/test/resources/jacoco_074.exec").exists()); loader.setClassDir(new FilePath(new File("target/classes"))); loader.setExcludes("excludme.test"); loader.addExecFile(new FilePath(new File("src/test/resources/jacoco_074.exec"))); loader.addExecFile(new FilePath(new File("somenonexistingfile"))); IBundleCoverage coverage = loader.loadBundleCoverage(); assertNotNull(coverage); assertTrue("Expect to have at least some lines found, but had: " + coverage.getClassCounter(), coverage.getClassCounter().getMissedCount() > 0 || coverage.getClassCounter().getCoveredCount() > 0); }
Source:
<code>private CorfuRuntime(@Nonnull CorfuRuntimeParameters parameters) { this.parameters = parameters; bootstrapLayoutServers = parameters.getLayoutServers().stream() .map(NodeLocator::toString) .collect(Collectors.toList()); layoutServers = new ArrayList<>(bootstrapLayoutServers); clusterId = parameters.getClusterId(); nettyEventLoop = parameters.nettyEventLoop == null ? getNewEventLoopGroup() : parameters.nettyEventLoop; nodeRouterPool = new NodeRouterPool(getRouterFunction); MetricsUtils.metricsReportingSetup(defaultMetrics); if (parameters.getPrometheusMetricsPort() != MetricsUtils.NO_METRICS_PORT) { MetricsUtils.metricsReportingSetup( defaultMetrics, parameters.getPrometheusMetricsPort()); } CorfuRuntimeParameters.MicroMeterRuntimeConfig microMeterRuntimeConfig = this.parameters.getMicroMeterRuntimeConfig(); if (microMeterRuntimeConfig.metricsEnabled) { Logger logger = LoggerFactory.getLogger(microMeterRuntimeConfig.configuredLoggerName); registry = Optional.of(MeterRegistryInitializer.newInstance(logger, microMeterRuntimeConfig.loggingInterval, parameters.clientId)); <START> } else { registry = Optional.empty(); <END> } fetchLayoutTimer = registry.map(r -> Timer.builder("runtime.fetch_layout.timer") .publishPercentileHistogram(true).publishPercentiles(0.50, 0.95, 0.99).register(r)); log.info("Corfu runtime version initialized.", getVersionString()); }</code><technical_language>check if a logger defined Logger::isInfoEnabled</technical_language>

Target:
private CorfuRuntime(@Nonnull CorfuRuntimeParameters parameters) { this.parameters = parameters; bootstrapLayoutServers = parameters.getLayoutServers().stream() .map(NodeLocator::toString) .collect(Collectors.toList()); layoutServers = new ArrayList<>(bootstrapLayoutServers); clusterId = parameters.getClusterId(); nettyEventLoop = parameters.nettyEventLoop == null ? getNewEventLoopGroup() : parameters.nettyEventLoop; nodeRouterPool = new NodeRouterPool(getRouterFunction); MetricsUtils.metricsReportingSetup(defaultMetrics); if (parameters.getPrometheusMetricsPort() != MetricsUtils.NO_METRICS_PORT) { MetricsUtils.metricsReportingSetup( defaultMetrics, parameters.getPrometheusMetricsPort()); } CorfuRuntimeParameters.MicroMeterRuntimeConfig microMeterRuntimeConfig = this.parameters.getMicroMeterRuntimeConfig(); if (microMeterRuntimeConfig.metricsEnabled) { Logger logger = LoggerFactory.getLogger(microMeterRuntimeConfig.configuredLoggerName); if (logger.isDebugEnabled()) { registry = Optional.of(MeterRegistryInitializer.newInstance(logger, microMeterRuntimeConfig.loggingInterval, parameters.clientId)); } else { registry = Optional.empty(); log.warn("No registered metrics logger provided."); } } else { registry = Optional.empty(); } fetchLayoutTimer = registry.map(r -> Timer.builder("runtime.fetch_layout.timer") .publishPercentileHistogram(true).publishPercentiles(0.50, 0.95, 0.99).register(r)); log.info("Corfu runtime version initialized.", getVersionString()); }
Source:
<code>protected TrustManager[] engineGetTrustManagers() { <START> ObjectUtil.checkNotNull(tm, "TrustManagerFactoryWrapper is created with null TrustManager value"); <END> return new TrustManager[] {tm}; }</code><technical_language>remove this move constructor fail fast</technical_language>

Target:
protected TrustManager[] engineGetTrustManagers() { return new TrustManager[] {tm}; }
Source:
<code>public void testSerialization() { final Repository repository = Repository.builder() .name("bigtop") .addEntry("deb <LINK_0> bigtop contrib") .key("-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + "Version: GnuPG v1.4.10 (GNU/Linux)\n" + "\n" + "[....]") .createRepository(); Software software = Software.builder() <START> .imageId("ubuntu-10.04") <END> .repository(repository) .packages("vim", "git-core", "bigtop-utils") .file("<LINK_1>", "/root/something.tar.gz") .option("provider", "specific") .createSoftware(); assertThat(software.getImageId()).isEqualTo("ubuntu-10.04"); assertThat(software.toBuilder().createSoftware()).isEqualTo(software); assertSerializable(software, Software.class); }</code><technical_language>change string default AMI ID intention clear</technical_language>

Target:
public void testSerialization() { final Repository repository = Repository.builder() .name("bigtop") .addEntry("deb <LINK_0> bigtop contrib") .key("-----BEGIN PGP PUBLIC KEY BLOCK-----\n" + "Version: GnuPG v1.4.10 (GNU/Linux)\n" + "\n" + "[....]") .createRepository(); Software software = Software.builder() .imageId("default") .repository(repository) .packages("vim", "git-core", "bigtop-utils") .file("<LINK_1>", "/root/something.tar.gz") .option("provider", "specific") .createSoftware(); assertThat(software.getImageId()).isEqualTo("default"); assertThat(software.toBuilder().createSoftware()).isEqualTo(software); assertSerializable(software, Software.class); }
Source:
<code>private void processCallStackElement(ICallStackElement element, Builder<FlameChartEntryModel> builder, FlameChartEntryModel parentEntry) { long elementId = getEntryId(element); FlameChartEntryModel entry = new FlameChartEntryModel(elementId, parentEntry.getId(), element, element.getName(), parentEntry.getStartTime(), parentEntry.getEndTime(), FlameChartEntryModel.EntryType.LEVEL, IHostModel.UNKNOWN_TID); builder.add(entry); if ((element instanceof InstrumentedCallStackElement) && element.isLeaf()) { InstrumentedCallStackElement finalElement = (InstrumentedCallStackElement) element; CallStack callStack = finalElement.getCallStack(); for (int <START> i = <END> 0; i < callStack.getMaxDepth(); i++) { FlameChartEntryModel flameChartEntry = new FlameChartEntryModel(getEntryId(new CallStackDepth(callStack, i + 1)), entry.getId(), element, element.getName(), parentEntry.getStartTime(), parentEntry.getEndTime(), FlameChartEntryModel.EntryType.FUNCTION, IHostModel.UNKNOWN_TID); builder.add(flameChartEntry); if (i == 0 && callStack.hasKernelStatuses()) { builder.add(new FlameChartEntryModel(getKernelEntryId(flameChartEntry.getId()), entry.getId(), element, "Kernel statuses", parentEntry.getStartTime(), parentEntry.getEndTime(), FlameChartEntryModel.EntryType.KERNEL, IHostModel.UNKNOWN_TID)); } } return; } element.getChildren().stream().forEach(e -> processCallStackElement(e, builder, entry)); }</code><technical_language>depth</technical_language>

Target:
private void processCallStackElement(ICallStackElement element, Builder<FlameChartEntryModel> builder, FlameChartEntryModel parentEntry) { long elementId = getEntryId(element); FlameChartEntryModel entry = new FlameChartEntryModel(elementId, parentEntry.getId(), element, element.getName(), parentEntry.getStartTime(), parentEntry.getEndTime(), FlameChartEntryModel.EntryType.LEVEL, IHostModel.UNKNOWN_TID); builder.add(entry); if ((element instanceof InstrumentedCallStackElement) && element.isLeaf()) { InstrumentedCallStackElement finalElement = (InstrumentedCallStackElement) element; CallStack callStack = finalElement.getCallStack(); for (int depth = 0; depth < callStack.getMaxDepth(); depth++) { FlameChartEntryModel flameChartEntry = new FlameChartEntryModel(getEntryId(new CallStackDepth(callStack, depth + 1)), entry.getId(), element, element.getName(), parentEntry.getStartTime(), parentEntry.getEndTime(), FlameChartEntryModel.EntryType.FUNCTION, IHostModel.UNKNOWN_TID); builder.add(flameChartEntry); if (depth == 0 && callStack.hasKernelStatuses()) { builder.add(new FlameChartEntryModel(getKernelEntryId(flameChartEntry.getId()), entry.getId(), element, String.valueOf(Messages.FlameChartDataProvider_KernelStatusTitle), parentEntry.getStartTime(), parentEntry.getEndTime(), FlameChartEntryModel.EntryType.KERNEL, IHostModel.UNKNOWN_TID)); } } return; } for (ICallStackElement child : element.getChildren()) { processCallStackElement(child, builder, entry); } }
Source:
<code>public boolean catalogAlreadyExists(Connection conn) throws CatalogException { boolean result = false; try { <START> result = checkExistence(conn, DatabaseObjectType.TABLE, CatalogConstants.TB_META); <END> } catch (SQLException e) { throw new CatalogException(e.getMessage(), e); } return result; }</code><technical_language>I database object checked</technical_language>

Target:
public boolean catalogAlreadyExists(Connection conn) throws CatalogException { boolean result = false; try { List<String> constants = TUtil.newList(); constants.add(CatalogConstants.TB_META); constants.add(CatalogConstants.TB_SPACES); constants.add(CatalogConstants.TB_DATABASES); constants.add(CatalogConstants.TB_TABLES); constants.add(CatalogConstants.TB_COLUMNS); constants.add(CatalogConstants.TB_OPTIONS); constants.add(CatalogConstants.TB_INDEXES); constants.add(CatalogConstants.TB_STATISTICS); constants.add(CatalogConstants.TB_PARTITION_METHODS); constants.add(CatalogConstants.TB_PARTTIONS); constants.add(CatalogConstants.TB_PARTTION_KEYS); for (String constant : constants) { if (checkExistence(conn, DatabaseObjectType.TABLE, constant)) { return true; } } } catch (SQLException e) { throw new CatalogException(e.getMessage(), e); } return result; }
Source:
<code>protected void executeCommand() { getParameters().setImageGroupID(Guid.newGuid()); getParameters().setDestinationImageId(Guid.newGuid()); persistCommand(getParameters().getParentCommand(), true); getParameters().setEntityInfo( <START> new EntityInfo(VdcObjectType.Disk, getParameters().getImageGroupID())); <END> Backend.getInstance().runInternalAction(VdcActionType.AddDisk, createAddDiskParameters(), ExecutionHandler.createDefaultContextForTasks(getContext())); getParameters().setNextPhase(ImportRepoImageParameters.Phase.DOWNLOAD); persistCommand(getParameters().getParentCommand(), true); setSucceeded(true); }</code><technical_language>lets export this a method</technical_language>

Target:
protected void executeCommand() { setupParameters(); persistCommand(getParameters().getParentCommand(), true); Backend.getInstance().runInternalAction(VdcActionType.AddDisk, createAddDiskParameters(), ExecutionHandler.createDefaultContextForTasks(getContext())); getParameters().setNextPhase(ImportRepoImageParameters.Phase.DOWNLOAD); persistCommand(getParameters().getParentCommand(), true); setSucceeded(true); }
Source:
<code>public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null) { <START> switch (intent.getAction()) { <END> case ACTION_START: startForegroundService(); break; case ACTION_STOP: stopForegroundService(); break; } } return super.onStartCommand(intent, flags, startId); }</code><technical_language>[nits] intent.getAction() null</technical_language>

Target:
public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null && intent.getAction() != null) { switch (intent.getAction()) { case ACTION_START: startForegroundService(); break; case ACTION_STOP: stopForegroundService(); break; } } return super.onStartCommand(intent, flags, startId); }
Source:
<code>private KeyValueCollectionPermission isPermitted( CollectionPermission s, KeyValueCollectionPermission match, KeyValueCollectionPermission allPerms) { Map<String, Set<String>> subject = getPermissions(s.getPermissionList()); Map<String, Set<String>> metacard = getPermissions(allPerms.getPermissionList()); if (Collections.disjoint(metacard.keySet(), ACCESS_CONTROL_IMPLIED)) { return match; } SecurityPredicate readPermsImplied = (sub, mc) -> <START> hasAccessAdministrators.apply(subject, metacard) <END> || hasAccessIndividuals.apply(subject, metacard) || hasAccessGroups.apply(subject, metacard) || hasAccessGroupsReadOnly.apply(subject, metacard) || hasAccessIndividualsReadOnly.apply(subject, metacard); Supplier<Set<String>> impliedPermissions = () -> { if (isSystem.test(subject) || isOwner.apply(subject, metacard)) { return metacard.keySet(); } else if (readPermsImplied.apply(subject, metacard)) { return ACCESS_CONTROL_IMPLIED; } else { return Collections.emptySet(); } }; Function<Set<String>, KeyValueCollectionPermission> filterPermissions = (implied) -> { List<KeyValuePermission> values = match .getPermissionList() .stream() .map(p -> (KeyValuePermission) p) .filter((permission) -> !implied.contains((permission).getKey())) .collect(Collectors.toList()); return new KeyValueCollectionPermission(match.getAction(), values); }; return filterPermissions.apply(impliedPermissions.get()); }</code><technical_language>mc</technical_language>

Target:
private KeyValueCollectionPermission isPermitted( CollectionPermission s, KeyValueCollectionPermission match, KeyValueCollectionPermission allPerms) { Map<String, Set<String>> subject = getPermissions(s.getPermissionList()); Map<String, Set<String>> metacard = getPermissions(allPerms.getPermissionList()); if (Collections.disjoint(metacard.keySet(), ACCESS_CONTROL_IMPLIED)) { return match; } SecurityPredicate subjectImpliesACL = (sub, mc) -> hasAccessAdministrators.apply(sub, mc) || hasAccessIndividuals.apply(sub, mc) || hasAccessGroups.apply(sub, mc) || (READ_ACTION.equals(allPerms.getAction()) && (hasAccessGroupsReadOnly.apply(sub, mc) || hasAccessIndividualsReadOnly.apply(sub, mc))); Supplier<Set<String>> impliedPermissions = () -> { if (isSystem.test(subject) || isOwner.apply(subject, metacard)) { return metacard.keySet(); } else if (subjectImpliesACL.apply(subject, metacard)) { return ACCESS_CONTROL_IMPLIED; } else { return Collections.emptySet(); } }; Function<Set<String>, KeyValueCollectionPermission> filterPermissions = (implied) -> { List<KeyValuePermission> values = match .getPermissionList() .stream() .map(p -> (KeyValuePermission) p) .filter((permission) -> !implied.contains((permission).getKey())) .collect(Collectors.toList()); return new KeyValueCollectionPermission(match.getAction(), values); }; return filterPermissions.apply(impliedPermissions.get()); }
Source:
<code><START> public static List<Trade> createSwapTrades() { <END> return ImmutableList.of( createVanillaFixedVsLibor3mSwap(), createBasisLibor3mVsLibor6mWithSpreadSwap(), createOvernightAveragedWithSpreadVsLibor3mSwap(), createFixedVsLibor3mWithFixingSwap(), createFixedVsOvernightWithFixingSwap(), createStub3mFixedVsLibor3mSwap(), createStub1mFixedVsLibor3mSwap(), createInterpolatedStub3mFixedVsLibor6mSwap(), createInterpolatedStub4mFixedVsLibor6mSwap(), createZeroCouponFixedVsLibor3mSwap(), createCompoundingFixedVsFedFundsSwap(), createCompoundingFedFundsVsLibor3mSwap(), createCompoundingLibor6mVsLibor3mSwap(), createXCcyGbpLibor3mVsUsdLibor3mSwap(), createXCcyUsdFixedVsGbpLibor3mSwap(), createNotionalExchangeSwap()); }</code><technical_language>public. Needs docs if is</technical_language>

Target:
private static List<Trade> createSwapTrades() { return ImmutableList.of( createVanillaFixedVsLibor3mSwap(), createBasisLibor3mVsLibor6mWithSpreadSwap(), createOvernightAveragedWithSpreadVsLibor3mSwap(), createFixedVsLibor3mWithFixingSwap(), createFixedVsOvernightWithFixingSwap(), createStub3mFixedVsLibor3mSwap(), createStub1mFixedVsLibor3mSwap(), createInterpolatedStub3mFixedVsLibor6mSwap(), createInterpolatedStub4mFixedVsLibor6mSwap(), createZeroCouponFixedVsLibor3mSwap(), createCompoundingFixedVsFedFundsSwap(), createCompoundingFedFundsVsLibor3mSwap(), createCompoundingLibor6mVsLibor3mSwap(), createXCcyGbpLibor3mVsUsdLibor3mSwap(), createXCcyUsdFixedVsGbpLibor3mSwap(), createNotionalExchangeSwap()); }
Source:
<code>public SqlParameterSource createParameterSource(final Object input) { AbstractSqlParameterSource sqlParameterSource = new ExpressionEvaluatingSqlParameterSource(input, this.staticParameters, this.parameterExpressions, true); <START> enrichSqlParametersType(sqlParameterSource); <END> return sqlParameterSource; }</code><technical_language>I registerSqlTypes reflect existing AbstractSqlParameterSource.registerSqlType()</technical_language>

Target:
public SqlParameterSource createParameterSource(final Object input) { AbstractSqlParameterSource sqlParameterSource = new ExpressionEvaluatingSqlParameterSource(input, this.staticParameters, this.parameterExpressions, true); registerSqlTypes(sqlParameterSource); return sqlParameterSource; }
Source:
<code>public boolean verified(Payload payload, SessionWrapper session) { try { return this.checkRoles(SessionWrapper.class.cast(session).getUser(), (String) payload.getVisibilityId()); } catch (DotDataException e) { <START> throw new BaseRuntimeInternationalizationException(e); <END> } }</code><technical_language>a more meaningful exception</technical_language>

Target:
public boolean verified(Payload payload, SessionWrapper session) { try { return this.checkRoles(SessionWrapper.class.cast(session).getUser(), (String) payload.getVisibilityId()); } catch (DotDataException e) { throw new VerifierException(e); } }
Source:
<code><START> private Void handleConfiguration(Peer peer, VersionMessage versionMessage) { <END> var wellConfigured = isWellConfigured(versionMessage); if (wellConfigured) { log.info("Peer well configured: {}", peer); } else { log.error("Peer _badly_ configured (pruning and/or bloom filters disabled): {}", peer); var usingLocalNode = localBitcoinNode.shouldBeUsed(); var usingCustomNodes = BtcNodes.BitcoinNodesOption.CUSTOM.ordinal() == preferences.getBitcoinNodesOptionOrdinal(); if (usingLocalNode || usingCustomNodes) { displayUserBtcNodeMisconfigurationHandler.accept(peer.toString()); } } return null; }</code><technical_language>uppercase Void is a leftover previous code. void</technical_language>

Target:
private void handleConfiguration(Peer peer, VersionMessage versionMessage) { var wellConfigured = isWellConfigured(versionMessage); if (wellConfigured) { log.info("Peer well configured: {}", peer); } else { log.error("Peer _badly_ configured (pruning and/or bloom filters disabled): {}", peer); var usingLocalNode = localBitcoinNode.shouldBeUsed(); var usingCustomNodes = BtcNodes.BitcoinNodesOption.CUSTOM.ordinal() == preferences.getBitcoinNodesOptionOrdinal(); if (usingLocalNode || usingCustomNodes) { displayUserBtcNodeMisconfigurationHandler.accept(peer.toString()); } } }
Source:
<code>private CredentialHandlerResourceDefinition(SimpleAttributeDefinition... attributes) { super(ModelElement.IDENTITY_STORE_CREDENTIAL_HANDLER, new IDMConfigAddStepHandler( <START> getModelValidators(), attributes), null, attributes); <END> }</code><technical_language>remove handler</technical_language>

Target:
private CredentialHandlerResourceDefinition(SimpleAttributeDefinition... attributes) { super(ModelElement.IDENTITY_STORE_CREDENTIAL_HANDLER, new IDMConfigAddStepHandler( getModelValidators(), attributes), attributes); }
Source:
<code>public void testInputValidation() { ______TS("client-side input validation"); EvaluationAttributes eval = newEval; WebDriverWait wait = new WebDriverWait(browser.driver, 15); <START> wait.until(presenceOfElementLocated(By.id("button_submit"))); <END> evalsPage.clickSubmitButton(); assertEquals(Const.StatusMessages.FIELDS_EMPTY, evalsPage.getStatus()); evalsPage.fillEvalName("Some value"); evalsPage.clickSubmitButton(); assertEquals(Const.StatusMessages.FIELDS_EMPTY, evalsPage.getStatus()); evalsPage.addEvaluation(eval.courseId, "", eval.startTime, eval.endTime, eval.p2pEnabled, eval.instructions.getValue(), eval.gracePeriod, eval.timeZone); assertEquals(Const.StatusMessages.FIELDS_EMPTY, evalsPage.getStatus()); evalsPage.addEvaluation(eval.courseId, eval.name, eval.startTime, eval.endTime, eval.p2pEnabled, "", eval.gracePeriod, eval.timeZone); assertEquals(Const.StatusMessages.FIELDS_EMPTY, evalsPage.getStatus()); evalsPage.addEvaluation(eval.courseId, eval.name+"!@#$%^&*()_+", eval.startTime, eval.endTime, eval.p2pEnabled, eval.instructions.getValue(), eval.gracePeriod, eval.timeZone); assertEquals(Const.StatusMessages.EVALUATION_NAMEINVALID, evalsPage.getStatus()); evalsPage.addEvaluation(eval.courseId, eval.name, eval.endTime, eval.startTime, eval.p2pEnabled, eval.instructions.getValue(), eval.gracePeriod, eval.timeZone); assertEquals(Const.StatusMessages.EVALUATION_SCHEDULEINVALID.replace("<br />", "\n"), evalsPage.getStatus()); }</code><technical_language>abstract this a method?. e.g. waitForElement(By.id("button_submit")),15)</technical_language>

Target:
public void testInputValidation() { ______TS("client-side input validation"); EvaluationAttributes eval = newEval; waitForElementPresent(browser.driver, By.id("button_submit"), 15); evalsPage.clickSubmitButton(); assertEquals(Const.StatusMessages.FIELDS_EMPTY, evalsPage.getStatus()); evalsPage.fillEvalName("Some value"); evalsPage.clickSubmitButton(); assertEquals(Const.StatusMessages.FIELDS_EMPTY, evalsPage.getStatus()); evalsPage.addEvaluation(eval.courseId, "", eval.startTime, eval.endTime, eval.p2pEnabled, eval.instructions.getValue(), eval.gracePeriod, eval.timeZone); assertEquals(Const.StatusMessages.FIELDS_EMPTY, evalsPage.getStatus()); evalsPage.addEvaluation(eval.courseId, eval.name, eval.startTime, eval.endTime, eval.p2pEnabled, "", eval.gracePeriod, eval.timeZone); assertEquals(Const.StatusMessages.FIELDS_EMPTY, evalsPage.getStatus()); evalsPage.addEvaluation(eval.courseId, eval.name+"!@#$%^&*()_+", eval.startTime, eval.endTime, eval.p2pEnabled, eval.instructions.getValue(), eval.gracePeriod, eval.timeZone); assertEquals(Const.StatusMessages.EVALUATION_NAMEINVALID, evalsPage.getStatus()); evalsPage.addEvaluation(eval.courseId, eval.name, eval.endTime, eval.startTime, eval.p2pEnabled, eval.instructions.getValue(), eval.gracePeriod, eval.timeZone); assertEquals(Const.StatusMessages.EVALUATION_SCHEDULEINVALID.replace("<br />", "\n"), evalsPage.getStatus()); }
Source:
<code>public TestOrder cloneForDiscontinuing() { TestOrder newOrder = new TestOrder(); newOrder.setCareSetting(getCareSetting()); newOrder.setConcept(getConcept()); newOrder.setAction(Action.DISCONTINUE); newOrder.setPreviousOrder(this); newOrder.setPatient(getPatient()); newOrder.setOrderType(getOrderType()); <START> newOrder.setOrderGroup(null); <END> newOrder.setSequenceNumber(null); return newOrder; }</code><technical_language>this orderGroup order cloned? is redundant setting null thy null</technical_language>

Target:
public TestOrder cloneForDiscontinuing() { TestOrder newOrder = new TestOrder(); newOrder.setCareSetting(getCareSetting()); newOrder.setConcept(getConcept()); newOrder.setAction(Action.DISCONTINUE); newOrder.setPreviousOrder(this); newOrder.setPatient(getPatient()); newOrder.setOrderType(getOrderType()); return newOrder; }
Source:
<code>public Map<String, String> getInstitutionLoginUrls(final String target) { final List<OpenScienceFrameworkInstitution> institutionList = openScienceFrameworkDao.findAllInstitutions(); final Map<String, String> institutionLogin = new HashMap<>(); for (final OpenScienceFrameworkInstitution institution: institutionList) { if (institution.getDelegationProtocol().equalsIgnoreCase( <START> OpenScienceFrameworkInstitution.DelegationProtocols.SAML_SHIB.name())) { <END> institutionLogin.put(institution.getLoginUrl() + "&target=" + target, institution.getName()); } else if (institution.getDelegationProtocol().equalsIgnoreCase( OpenScienceFrameworkInstitution.DelegationProtocols.CAS_PAC4J.name())) { institutionLogin.put(institution.getId(), institution.getName()); } } return institutionLogin; }</code><technical_language>in a future pr consider moving shibboleth url construction logic cas side</technical_language>

Target:
public Map<String, String> getInstitutionLoginUrls(final String target) { final List<OpenScienceFrameworkInstitution> institutionList = openScienceFrameworkDao.findAllInstitutions(); final Map<String, String> institutionLogin = new HashMap<>(); for (final OpenScienceFrameworkInstitution institution: institutionList) { final DelegationProtocol delegationProtocol = institution.getDelegationProtocol(); if (DelegationProtocol.SAML_SHIB.equals(delegationProtocol)) { institutionLogin.put(institution.getLoginUrl() + "&target=" + target, institution.getName()); } else if (DelegationProtocol.CAS_PAC4J.equals(delegationProtocol)) { institutionLogin.put(institution.getId(), institution.getName()); } } return institutionLogin; }
Source:
<code>private List<VmTemplate> filterOutBlank(List<VmTemplate> templates) { <START> final ArrayList<VmTemplate> result = new ArrayList<>(); <END> for (VmTemplate template : templates) { if (!template.isBlank()) { result.add(template); } } return result; }</code><technical_language>List<VmTemplate>..</technical_language>

Target:
private List<VmTemplate> filterOutBlank(List<VmTemplate> templates) { final List<VmTemplate> result = new ArrayList<>(); for (VmTemplate template : templates) { if (!template.isBlank()) { result.add(template); } } return result; }
Source:
<code>protected Integer doTaskBackground(Void... params) { Log.d(TAG, "Doing UnzipTask"); try { String zipPath = toBeZippedPath; File nf = new File(zipPath); if (nf.exists()) { nf.delete(); <START> } <END> zipParentFolder(nf, zipFilePath); File toBeZippedDir = new File(toBeZippedPath); FileUtil.deleteFileOrDir(toBeZippedDir); } catch (IOException ioe) { Log.d(TAG, "IOException: " + ioe.getMessage()); return RESULT_FAILURE; } return RESULT_SUCCESS; }</code><technical_language>replace this FileUtil.deleteFileOrDir(toBeZippedDir); below</technical_language>

Target:
protected ZipTaskResult doTaskBackground(Void... params) { Log.d(TAG, "Doing UnzipTask"); try { FileUtil.deleteFileOrDir(toBeZippedFile); zipParentFolder(toBeZippedFile, zipFilePath); FileUtil.deleteFileOrDir(toBeZippedFile); } catch (IOException ioe) { Log.d(TAG, "IOException: " + ioe.getMessage()); return ZipTaskResult.Failure; } return ZipTaskResult.Success; }
Source:
<code>protected void notifyOf(T newValue) { Observer<T>[] observersCopy; synchronized (this) { if (hasNotChanged()) { return; } <START> observersCopy = observers.toArray(new Observer[observers.size()]); <END> clearChanged(); } for (int i = observersCopy.length - 1; i >= 0; i--) { observersCopy[i].update(newValue); } }</code><technical_language>copy</technical_language>

Target:
protected synchronized void notifyOf(T newValue) { for (int i = observers.size() - 1; i >= 0; i--) { observers.get(i).update(newValue); } }
Source:
<code>public void process() { PerformanceMonitor.startActivity("rendering/applyDeferredLighting"); <START> FBO sceneOpaquePingPongFbo = displayResolutionDependentFBOs.get(new ResourceUrn("engine:sceneOpaquePingPong")); <END> sceneOpaquePingPongFbo.bind(); sceneOpaquePingPongFbo.setRenderBufferMask(true, true, true); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); displayResolutionDependentFBOs.swapReadWriteBuffers(); displayResolutionDependentFBOs.get(new ResourceUrn("engine:sceneOpaque")).attachDepthBufferTo(displayResolutionDependentFBOs.get(REFRACTIVE_REFLECTIVE)); PerformanceMonitor.endActivity(); }</code><technical_language>General game development rule: instantiated in main loop. Some argue compiler optimize sorts of things, hard optimize deep in main loop. So, please move FBO declaration elsewhere. for new ResourceUrn() statement</technical_language>

Target:
public void process() { PerformanceMonitor.startActivity("rendering/applyDeferredLighting"); sceneOpaquePingPongFbo.bind(); sceneOpaquePingPongFbo.setRenderBufferMask(true, true, true); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); renderFullscreenQuad(); displayResolutionDependentFBOs.swapReadWriteBuffers(); PerformanceMonitor.endActivity(); }
Source:
<code>private void writeAndFlush(final Channel channel, final CompletionKey key, final Object request) { if (channel == null) { errorOut(key); return; } try { final long startTime = MathUtils.nowInNano(); <START> ChannelFuture future = channel.writeAndFlush(request, channel.voidPromise()); <END> future.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (future.isSuccess()) { nettyOpLogger.registerSuccessfulEvent(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS); completionObjects.get(key).setOutstanding(); } else { nettyOpLogger.registerFailedEvent(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS); } } }); } catch (Throwable e) { LOG.warn("Operation failed", requestToString(request), e); errorOut(key); } }</code><technical_language>Is this working? voidPromise? @merlimat @ivankelly I voidPromise add allocation hot path</technical_language>

Target:
private void writeAndFlush(final Channel channel, final CompletionKey key, final Object request) { if (channel == null) { errorOut(key); return; } try { final long startTime = MathUtils.nowInNano(); ChannelFuture future = channel.writeAndFlush(request); future.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (future.isSuccess()) { nettyOpLogger.registerSuccessfulEvent(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS); completionObjects.get(key).setOutstanding(); } else { nettyOpLogger.registerFailedEvent(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS); } } }); } catch (Throwable e) { LOG.warn("Operation failed", requestToString(request), e); errorOut(key); } }
Source:
<code>public int getFlushInterval(Context context) { boolean isDebuggable = context != null && ( 0 != ( context.getApplicationInfo().flags &= ApplicationInfo.FLAG_INSTALLED ) ); if (isDebuggable) { <START> return 1000; <END> } else { return mFlushInterval; } }</code><technical_language>name this number a constant variable</technical_language>

Target:
public int getFlushInterval(Context context) { boolean isDebuggable = context != null && ( 0 != ( context.getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE ) ); if (isDebuggable) { return mDebugFlushInterval; } else { return mFlushInterval; } }
Source:
<code>public void edit(final IscsiStorageModel object) { driver.edit(object); initLists(object); object.getPropertyChangedEvent().addListener((ev, sender, args) -> { String propName = args.propertyName; if (propName.equals("IsValid")) { onIsValidPropertyChange(object); } else if (propName.equals("IsGrouppedByTarget")) { updateListByGropping(object); } }); iscsiTargetToLunView.edit(object); iscsiLunToTargetView.edit(object); targetsToLunTab.addClickHandler(event -> { iscsiLunToTargetView.disableItemsUpdate(); object.setIsGrouppedByTarget(true); }); lunToTargetsTab.addClickHandler(event -> { iscsiTargetToLunView.disableItemsUpdate(); object.setIsGrouppedByTarget(false); }); dialogTabPanel.switchTab(object.getIsGrouppedByTarget() ? targetsToLunTab : lunToTargetsTab); updateListByGropping(object); if (!object.getContainer().isNewStorage()) { <START> if (object.getContainer().getStorage().getStatus() == StorageDomainStatus.Maintenance) { <END> mainLabel.setText(constants.storageIscsiRemoveLUNsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsOnMaintenanceLabel()); } else if (object.getContainer().getStorage().getStatus() == StorageDomainStatus.Active) { mainLabel.setText(constants.storageIscsiActionsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsForActiveDomainsLabel()); } } }</code><technical_language>switch/case a bit clearer simplify future expansion</technical_language>

Target:
public void edit(final IscsiStorageModel object) { driver.edit(object); initLists(object); object.getPropertyChangedEvent().addListener((ev, sender, args) -> { String propName = args.propertyName; if (propName.equals("IsValid")) { onIsValidPropertyChange(object); } else if (propName.equals("IsGrouppedByTarget")) { updateListByGropping(object); } }); iscsiTargetToLunView.edit(object); iscsiLunToTargetView.edit(object); targetsToLunTab.addClickHandler(event -> { iscsiLunToTargetView.disableItemsUpdate(); object.setIsGrouppedByTarget(true); }); lunToTargetsTab.addClickHandler(event -> { iscsiTargetToLunView.disableItemsUpdate(); object.setIsGrouppedByTarget(false); }); dialogTabPanel.switchTab(object.getIsGrouppedByTarget() ? targetsToLunTab : lunToTargetsTab); updateListByGropping(object); if (!object.getContainer().isNewStorage()) { switch (object.getContainer().getStorage().getStatus()){ case Maintenance: mainLabel.setText(constants.storageIscsiRemoveLUNsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsOnMaintenanceLabel()); case Active: mainLabel.setText(constants.storageIscsiActionsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsForActiveDomainsLabel()); } } }
Source:
<code>public void schedule(Work work, Scheduling scheduling, boolean afterCommit) { String queueId = getStreamForCategory(work.getCategory()); if (log.isDebugEnabled()) { log.debug(String.format( "Scheduling: workId: %s, category: %s, queue: %s, scheduling: %s, afterCommit: %s, work: %s", work.getId(), work.getCategory(), queueId, scheduling, afterCommit, work)); } if (!isQueuingEnabled(queueId)) { log.info("Queue disabled, scheduling canceled: " + queueId); return; } if (CANCEL_SCHEDULED.equals(scheduling)) { log.warn("Canceling a work is not supported by this impl, skipping work: " + work); return; } if (afterCommit && scheduleAfterCommit(work, scheduling)) { return; } WorkSchedulePath.newInstance(work); LogAppender<Record> appender = logManager.getAppender(getStreamForCategory(work.getCategory())); if (appender == null) { log.error(String.format("Not scheduled work, unknown category: %s, mapped to %s", work.getCategory(), getStreamForCategory(work.getCategory()))); return; } String key = work.getPartitionKey(); appender.append(key, Record.of(key, WorkComputation.serialize(work))); KeyValueStore kvStore = Framework.getService(KeyValueService.class).getKeyValueStore(KV_NAME); <START> kvStore.put(work.getId() + STATE, Work.State.SCHEDULED.toString(), 60 * 60L); <END> }</code><technical_language>a constant STATE_TIMEOUT_S = 3600L; I afraid need a configurable value, all, handle long running work is subjective</technical_language>

Target:
public void schedule(Work work, Scheduling scheduling, boolean afterCommit) { String queueId = getStreamForCategory(work.getCategory()); if (log.isDebugEnabled()) { log.debug(String.format( "Scheduling: workId: %s, category: %s, queue: %s, scheduling: %s, afterCommit: %s, work: %s", work.getId(), work.getCategory(), queueId, scheduling, afterCommit, work)); } if (!isQueuingEnabled(queueId)) { log.info("Queue disabled, scheduling canceled: " + queueId); return; } if (CANCEL_SCHEDULED.equals(scheduling)) { log.warn("Canceling a work is not supported by this impl, skipping work: " + work); return; } if (afterCommit && scheduleAfterCommit(work, scheduling)) { return; } WorkSchedulePath.newInstance(work); LogAppender<Record> appender = logManager.getAppender(getStreamForCategory(work.getCategory())); if (appender == null) { log.error(String.format("Not scheduled work, unknown category: %s, mapped to %s", work.getCategory(), getStreamForCategory(work.getCategory()))); return; } String key = work.getPartitionKey(); appender.append(key, Record.of(key, WorkComputation.serialize(work))); if (storeState) { setState(work.getId(), Work.State.SCHEDULED.toString(), stateTTL); } }
Source:
<code>public Context(Query query, QueryBuilder qbuilder) { if (qbuilder == null) { <START> throw new IllegalArgumentException("`qbuilder' is null"); <END> } this.query = query; this.qbuilder = qbuilder; QueryMatchers qm = new QueryMatchers(); m = qm.getMatchers(query, TOKEN_FIELDS); if (m != null) { buildQueryAsURI(qbuilder.getQueries()); buffer = new char[MAXFILEREAD]; tokens = new PlainLineTokenizer((Reader) null); } }</code><technical_language>apostrophes? :)</technical_language>

Target:
public Context(Query query, QueryBuilder qbuilder) { if (qbuilder == null) { throw new IllegalArgumentException("qbuilder is null"); } this.query = query; this.qbuilder = qbuilder; QueryMatchers qm = new QueryMatchers(); m = qm.getMatchers(query, TOKEN_FIELDS); if (m != null) { buildQueryAsURI(qbuilder.getQueries()); buffer = new char[MAXFILEREAD]; tokens = new PlainLineTokenizer((Reader) null); } }
Source:
<code>public PagedIterable<ManagementLock> listForResource(String resourceId) { <START> return wrapList(this.manager().managementLockClient().getManagementLocks().listAtResourceLevel( <END> ResourceUtils.groupFromResourceId(resourceId), ResourceUtils.resourceProviderFromResourceId(resourceId), ResourceUtils.parentRelativePathFromResourceId(resourceId), ResourceUtils.resourceTypeFromResourceId(resourceId), ResourceUtils.nameFromResourceId(resourceId))); }</code><technical_language>listByScope is easier</technical_language>

Target:
public PagedIterable<ManagementLock> listForResource(String resourceId) { return wrapList(this.manager().managementLockClient().getManagementLocks().listByScope(resourceId)); }
Source:
<code>private void createIndex(Connection conn, String dataTable, String indexTable) <START> throws Exception { <END> conn.createStatement().execute("CREATE INDEX " + indexTable + " on " + dataTable + " (val1) include (val2, val3)"); conn.commit(); TestUtil.waitForIndexState(conn, indexTable, PIndexState.ACTIVE); }</code><technical_language>Is a function this another IT? If find one, please</technical_language>

Target:
private void createIndex(Connection conn, String dataTable, String indexTable) throws Exception { String ddl = "CREATE INDEX " + indexTable + " on " + dataTable + " (val1) include (val2, val3)"; conn.createStatement().execute(ddl); conn.commit(); TestUtil.waitForIndexState(conn, indexTable, PIndexState.ACTIVE); }
Source:
<code>private void setSelected(WebElement option, boolean select) { <START> if ((!option.isSelected() && select) || (option.isSelected() && !select)) { <END> option.click(); } }</code><technical_language>efficient remote call isSelected multiple times here. Please revert change this method store isSelected in a local variable</technical_language>

Target:
private void setSelected(WebElement option, boolean select) { boolean isSelected=option.isSelected(); if ((!isSelected && select) || (isSelected && !select)) { option.click(); } }
Source:
<code>public String printMatchingStats() { String stats = ""; final String cr = System.getProperty("line.separator"); stats += "Number of matches found: " + fMatches.getMatches().size() + cr; for (int i = 0; i<fTraces.length; i++) { stats += "" + <START> "Trace " + i + ":" + cr + <END> " " + countEvents(fUnmatchedIn[i]) + " unmatched incoming events" + cr + " " + countEvents(fUnmatchedOut[i]) + " unmatched outgoing events" + cr; } return stats; }</code><technical_language>ewww tabs :P Please spaces for indentation</technical_language>

Target:
public String printMatchingStats() { final String cr = System.getProperty("line.separator"); StringBuilder b = new StringBuilder(); b.append("Number of matches found: " + fMatches.getMatches().size() + cr); for (int i = 0; i < fTraces.length; i++) { b.append("" + "Trace " + i + ":" + cr + " " + countEvents(fUnmatchedIn[i]) + " unmatched incoming events" + cr + " " + countEvents(fUnmatchedOut[i]) + " unmatched outgoing events" + cr); } return b.toString(); }
Source:
<code>public void testParentRelationshipQuery() throws Exception { <START> final QueryRecordsContact queryRecords = template().requestBody("direct:parentRelationshipQuery", null, <END> QueryRecordsContact.class); Account account = queryRecords.getRecords().get(0).getAccount(); assertNotNull("Account was null", account); }</code><technical_language>missing bits create Contacts Accounts here, i.e. this test run other tests</technical_language>

Target:
public void testParentRelationshipQuery() throws Exception { try { createAccountAndContact(); final QueryRecordsContact queryRecords = template().requestBody("direct:parentRelationshipQuery", null, QueryRecordsContact.class); Account account = queryRecords.getRecords().get(0).getAccount(); assertNotNull("Account was null", account); } finally { deleteAccountAndContact(); } }
Source:
<code>public HttpMethod httpMethod() { <START> return HttpMethod.valueOf(request.method().toUpperCase(Locale.ENGLISH)); <END> }</code><technical_language>store this in a field avoid recomputing time call this method</technical_language>

Target:
public HttpMethod httpMethod() { return method; }
Source:
<code>private void addWatchdogModels(VersionCaps version, WatchdogModel[] values) { <START> if (VersionUtils.greaterOrEqual(version, VERSION_3_2)) { <END> version.setWatchdogModels(new WatchdogModels()); for (WatchdogModel watchdogModel : values) { version.getWatchdogModels().getWatchdogModels().add(watchdogModel.value()); } } }</code><technical_language>this is 3.3 feature, 3.2</technical_language>

Target:
private void addWatchdogModels(VersionCaps version, WatchdogModel[] values) { if (VersionUtils.greaterOrEqual(version, VERSION_3_3)) { version.setWatchdogModels(new WatchdogModels()); for (WatchdogModel watchdogModel : values) { version.getWatchdogModels().getWatchdogModels().add(watchdogModel.value()); } } }
Source:
<code>private void enablePhiro() { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); if (!sharedPreferences.getBoolean(Constants.PHIRO_INITIALIZED, false)) { <START> BaseSettingsActivity.setPhiroSharedPreferenceEnabled(this, true); <END> sharedPreferences.edit().putBoolean(Constants.PHIRO_INITIALIZED, true).apply(); } }</code><technical_language>is code present in SettingsActivity</technical_language>

Target:
private void enablePhiro() { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); if (!sharedPreferences.getBoolean(PHIRO_INITIALIZED, false)) { BaseSettingsActivity.setPhiroSharedPreferenceEnabled(this, true); sharedPreferences.edit().putBoolean(PHIRO_INITIALIZED, true).apply(); } }
Source:
<code>Builder networkPolicy(@NonNull NetworkPolicy policy, @NonNull NetworkPolicy... additional) { if (policy == null) { throw new IllegalArgumentException("Network policy cannot be null."); } this.networkPolicy |= policy.index; if (additional == null) { throw new IllegalArgumentException("Network policy cannot be null."); } <START> if (additional.length > 0) { <END> for (NetworkPolicy networkPolicy : additional) { if (networkPolicy == null) { throw new IllegalArgumentException("Network policy cannot be null."); } this.networkPolicy |= networkPolicy.index; } } return this; }</code><technical_language>nit: this if check is necessary</technical_language>

Target:
Builder networkPolicy(@NonNull NetworkPolicy policy, @NonNull NetworkPolicy... additional) { if (policy == null) { throw new NullPointerException("policy == null"); } if (additional == null) { throw new NullPointerException("additional == null"); } this.networkPolicy |= policy.index; for (NetworkPolicy networkPolicy : additional) { if (networkPolicy == null) { throw new NullPointerException("networkPolicy == null"); } this.networkPolicy |= networkPolicy.index; } return this; }
Source:
<code>public Date getDate() { <START> return Stream.of(this.getLastBuilt(), this.getDbCreateDate()).filter(Objects::nonNull).findFirst().orElse(null); <END> }</code><technical_language>technique before</technical_language>

Target:
public Date getDate() { return ObjectUtils.firstNonNull(this.getLastBuilt(), this.getDbCreateDate()); }
Source:
<code>public void setUp() throws Exception { IEclipseContext context = E4Application.createDefaultContext(); <START> modelService = context.get(EModelService.class); <END> editor = modelService.createModelElement(MPart.class); editor.setElementId(DUMMY_EDITOR_ID); editor.getTags().add("Editor"); }</code><technical_language>I need this, EModelService is injected WorkbenchContextRule</technical_language>

Target:
public void setUp() throws Exception { editor = modelService.createModelElement(MPart.class); editor.setElementId(DUMMY_EDITOR_ID); editor.getTags().add("Editor"); }