auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void executeAppliedStereotypeCommentDeletion(final TransactionalEditingDomain domain, final View commentNode) { if (null != commentNode) { <START> if (domain != null && TransactionUtil.getEditingDomain(commentNode) == domain) { <END> DeleteCommand command = new DeleteCommand(commentNode); try { GMFUnsafe.write(domain, command); } catch (Exception e) { Activator.log.error(e); } } } }</code><technical_language>constant variable operator</technical_language>

Target:
protected void executeAppliedStereotypeCommentDeletion(final TransactionalEditingDomain domain, final View commentNode) { if (null != commentNode) { if (null != domain && TransactionUtil.getEditingDomain(commentNode) == domain) { DeleteCommand command = new DeleteCommand(commentNode); try { GMFUnsafe.write(domain, command); } catch (Exception e) { Activator.log.error(e); } } } }
Source:
<code>private void onWPComEmailCheckError(boolean forceWordPressComDisplay) { if (!isAdded()) { return; } <START> if (forceWordPressComDisplay) { <END> showSelfHostedSignInForm(); return; } if (isUsernameEmail()) { showSelfHostedSignInForm(); } else { showPasswordFieldAndFocus(); } }</code><technical_language>Is this IF condition correct? guard force wpcom display, show hosted sign in form</technical_language>

Target:
private void onWPComEmailCheckError(boolean forceWordPressComDisplay) { if (!isAdded()) { return; } if (forceWordPressComDisplay) { showPasswordFieldAndFocus(); return; } if (isUsernameEmail()) { showSelfHostedSignInForm(); } else { showPasswordFieldAndFocus(); } }
Source:
<code>private void writeDescriptor(MetricDescriptor descriptor) throws IOException { int mask = calculateDescriptorMask(descriptor); <START> tmpDos.writeShort(mask); <END> if ((mask & MASK_PREFIX) == 0) { tmpDos.writeInt(getDictionaryId(descriptor.prefix())); } if ((mask & MASK_METRIC) == 0) { tmpDos.writeInt(getDictionaryId(descriptor.metric())); } if ((mask & MASK_DISCRIMINATOR) == 0) { tmpDos.writeInt(getDictionaryId(descriptor.discriminator())); } if ((mask & MASK_DISCRIMINATOR_VALUE) == 0) { tmpDos.writeInt(getDictionaryId(descriptor.discriminatorValue())); } if ((mask & MASK_UNIT) == 0) { ProbeUnit unit = descriptor.unit(); if (unit != null) { tmpDos.writeByte(unit.ordinal()); } else { tmpDos.writeByte(NULL_UNIT); } } if ((mask & MASK_EXCLUDED_TARGETS) == 0) { tmpDos.writeByte(MetricTarget.bitset(descriptor.excludedTargets())); } if ((mask & MASK_TAG_COUNT) == 0) { tmpDos.writeByte(descriptor.tagCount()); } descriptor.readTags((BiConsumerEx<String, String>) (tag, tagValue) -> { tmpDos.writeInt(getDictionaryId(tag)); tmpDos.writeInt(getDictionaryId(tagValue)); }); count++; lastDescriptor = copyDescriptor(descriptor, lastDescriptor); }</code><technical_language>#writeByte here? mask 7 bits moment. missing here</technical_language>

Target:
private void writeDescriptor(MetricDescriptor descriptor) throws IOException { int mask = calculateDescriptorMask(descriptor); tmpDos.writeByte(mask); if ((mask & MASK_PREFIX) == 0) { tmpDos.writeInt(getDictionaryId(descriptor.prefix())); } if ((mask & MASK_METRIC) == 0) { tmpDos.writeInt(getDictionaryId(descriptor.metric())); } if ((mask & MASK_DISCRIMINATOR) == 0) { tmpDos.writeInt(getDictionaryId(descriptor.discriminator())); } if ((mask & MASK_DISCRIMINATOR_VALUE) == 0) { tmpDos.writeInt(getDictionaryId(descriptor.discriminatorValue())); } if ((mask & MASK_UNIT) == 0) { ProbeUnit unit = descriptor.unit(); if (unit != null) { tmpDos.writeByte(unit.ordinal()); } else { tmpDos.writeByte(NULL_UNIT); } } if ((mask & MASK_EXCLUDED_TARGETS) == 0) { tmpDos.writeByte(MetricTarget.bitset(descriptor.excludedTargets())); } if ((mask & MASK_TAG_COUNT) == 0) { tmpDos.writeByte(descriptor.tagCount()); } descriptor.readTags((BiConsumerEx<String, String>) (tag, tagValue) -> { tmpDos.writeInt(getDictionaryId(tag)); tmpDos.writeInt(getDictionaryId(tagValue)); }); count++; lastDescriptor = copyDescriptor(descriptor, lastDescriptor); }
Source:
<code>private BitRateType generateBitRate(Encoding encoding) { Integer bitRate = encoding.getVideoBitRate(); if (bitRate == null) { <START> bitRate = DEFAULT_BIT_RATE; <END> } BitRateType bitRateType = new BitRateType(); bitRateType.setVariable(false); bitRateType.setValue(BigInteger.valueOf(bitRate)); return bitRateType; }</code><technical_language>This is another case "use field default value" pattern in useful</technical_language>

Target:
private BitRateType generateBitRate(Encoding encoding) { Integer bitRate = Objects.firstNonNull(encoding.getVideoBitRate(), DEFAULT_BIT_RATE); BitRateType bitRateType = new BitRateType(); bitRateType.setVariable(true); bitRateType.setValue(BigInteger.valueOf(bitRate)); return bitRateType; }
Source:
<code>public void linkingObjects_IllegalStateException_ifDeleted() { final Realm realm = looperThread.realm; realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { final BacklinksTarget target1 = realm.createObject(BacklinksTarget.class); target1.setId(1); final BacklinksSource source = realm.createObject(BacklinksSource.class); source.setChild(target1); } }); <START> final BacklinksTarget target = realm.where(BacklinksTarget.class) <END> .equalTo(BacklinksTarget.FIELD_ID, 1L).findFirst(); realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { target.deleteFromRealm(); } }); assertFalse(target.isValid()); thrown.expect(IllegalStateException.class); target.getParents(); fail(); }</code><technical_language>Oh. I this line. target1 target weird. names</technical_language>

Target:
public void linkingObjects_IllegalStateException_ifDeleted() { final Realm realm = looperThread.realm; realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { final BacklinksTarget target = realm.createObject(BacklinksTarget.class); target.setId(1); final BacklinksSource source = realm.createObject(BacklinksSource.class); source.setChild(target); } }); final BacklinksTarget target = realm.where(BacklinksTarget.class) .equalTo(BacklinksTarget.FIELD_ID, 1L).findFirst(); realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { target.deleteFromRealm(); } }); assertFalse(target.isValid()); thrown.expect(IllegalStateException.class); target.getParents(); fail(); }
Source:
<code>public void fetch() { <START> if (configService.getFeedConfigs().getFeeds().size() == 0) { <END> LOGGER.warn("No feeds to fetch."); } for (FeedConfig feedConfig : configService.getFeedConfigs().getFeeds()) { URL url; try { url = new URL(feedConfig.getUrl()); } catch (MalformedURLException e) { LOGGER.error("Invalid Atom feed URL {}", feedConfig.getUrl()); continue; } LOGGER.trace("Fetching {}", url); try { feedFetcher.retrieveFeed(url); } catch (FeedException | IOException | FetcherException e) { LOGGER.error("Error while fetching {}: {}", feedConfig.getUrl(), e.getMessage()); } } }</code><technical_language>isEmpty()</technical_language>

Target:
public void fetch() { if (configService.getFeedConfigs().getFeeds().isEmpty()) { LOGGER.warn("No feeds to fetch."); } for (FeedConfig feedConfig : configService.getFeedConfigs().getFeeds()) { URL url; try { url = new URL(feedConfig.getUrl()); } catch (MalformedURLException e) { LOGGER.error("Invalid Atom feed URL {}", feedConfig.getUrl()); continue; } LOGGER.trace("Fetching {}", url); try { feedFetcher.retrieveFeed(url); } catch (FeedException | IOException | FetcherException e) { LOGGER.error("Error while fetching {}: {}", feedConfig.getUrl(), e.getMessage()); } } }
Source:
<code>public void createWithPrimaryKeyField_integer() { realmSchema.createWithPrimaryKeyField("FooNonNull", "pkField", int.class); RealmObjectSchema objectSchema = realmSchema.getSchemaForClass("FooNonNull"); assertEquals("pkField", objectSchema.getPrimaryKey()); assertEquals(RealmFieldType.INTEGER, objectSchema.getFieldType("pkField")); assertFalse(objectSchema.isNullable("pkField")); realmSchema.createWithPrimaryKeyField("FooNull", "pkField", Integer.class); objectSchema = realmSchema.getSchemaForClass("FooNull"); assertEquals("pkField", objectSchema.getPrimaryKey()); assertEquals(RealmFieldType.INTEGER, objectSchema.getFieldType("pkField")); assertTrue(objectSchema.isNullable("pkField")); <START> } <END></code><technical_language>tests pass FieldAttribute.PRIMARY_KEY FieldAttribute.INDEXED</technical_language>

Target:
public void createWithPrimaryKeyField_integer() { realmSchema.createWithPrimaryKeyField("FooNonNull", "pkField", int.class); RealmObjectSchema objectSchema = realmSchema.getSchemaForClass("FooNonNull"); assertEquals("pkField", objectSchema.getPrimaryKey()); assertEquals(RealmFieldType.INTEGER, objectSchema.getFieldType("pkField")); assertFalse(objectSchema.isNullable("pkField")); assertTrue(objectSchema.hasIndex("pkField")); realmSchema.createWithPrimaryKeyField("FooNull", "pkField", Integer.class); objectSchema = realmSchema.getSchemaForClass("FooNull"); assertEquals("pkField", objectSchema.getPrimaryKey()); assertEquals(RealmFieldType.INTEGER, objectSchema.getFieldType("pkField")); assertTrue(objectSchema.isNullable("pkField")); assertTrue(objectSchema.hasIndex("pkField")); }
Source:
<code>private void showStat(ILaunchConfiguration config, ILaunch launch) throws CoreException { IPath exePath = CDebugUtils.verifyProgramPath( config ); String arguments[] = getProgramArgumentsArray(config); IPath workingDir = PerfPlugin.getDefault().getWorkingDir(); File wd = workingDir.toFile(); int runCount = config.getAttribute(PerfPlugin.ATTR_StatRunCount, PerfPlugin.ATTR_StatRunCount_default); StringBuffer args = new StringBuffer(); for (String arg : arguments) { args.append(arg); args.append(" "); } String title = renderProcessLabel("Performance counter stats for " <START> + exePath.toOSString() <END> + " " + args.toString() + " (" + runCount + " runs)" ); @SuppressWarnings("unchecked") List<String> configEvents = config.getAttribute(PerfPlugin.ATTR_SelectedEvents, PerfPlugin.ATTR_SelectedEvents_default); String[] statEvents = new String {}; if(!config.getAttribute(PerfPlugin.ATTR_DefaultEvent, PerfPlugin.ATTR_DefaultEvent_default)){ statEvents = (configEvents == null) ? statEvents : configEvents.toArray(new String[]{}); } StatData sd = new StatData(title, wd, exePath.toOSString(), arguments, runCount, statEvents); sd.setLaunch(launch); sd.parse(); PerfPlugin.getDefault().setStatData(sd); sd.updateStatData(); StatView.refreshView(); }</code><technical_language>this translateable/externalized string</technical_language>

Target:
private void showStat(ILaunchConfiguration config, ILaunch launch) throws CoreException { IPath exePath = CDebugUtils.verifyProgramPath( config ); String arguments[] = getProgramArgumentsArray(config); IPath workingDir = PerfPlugin.getDefault().getWorkingDir(); File wd = workingDir.toFile(); int runCount = config.getAttribute(PerfPlugin.ATTR_StatRunCount, PerfPlugin.ATTR_StatRunCount_default); StringBuffer args = new StringBuffer(); for (String arg : arguments) { args.append(arg); args.append(" "); } Object[] titleArgs = new Object[]{exePath.toOSString(), args.toString(), String.valueOf(runCount)}; String title = MessageFormat.format(Messages.PerfLaunchConfigDelegate_stat_title, titleArgs); @SuppressWarnings("unchecked") List<String> configEvents = config.getAttribute(PerfPlugin.ATTR_SelectedEvents, PerfPlugin.ATTR_SelectedEvents_default); String[] statEvents = new String {}; if(!config.getAttribute(PerfPlugin.ATTR_DefaultEvent, PerfPlugin.ATTR_DefaultEvent_default)){ statEvents = (configEvents == null) ? statEvents : configEvents.toArray(new String[]{}); } StatData sd = new StatData(title, wd, exePath.toOSString(), arguments, runCount, statEvents); sd.setLaunch(launch); sd.parse(); PerfPlugin.getDefault().setStatData(sd); sd.updateStatData(); StatView.refreshView(); }
Source:
<code>public boolean canBePloted(World world, int x, int y, int z) { for (GhostGroupElement element : elementList) { <START> if (!Eln.ghostManager.canCreateGhostAt(world, new BlockPos( + element.x, y + element.y, z + element.z))) <END> return false; } return true; }</code><technical_language>This is a syntax error</technical_language>

Target:
public boolean canBePloted(World world, int x, int y, int z) { for (GhostGroupElement element : elementList) { if (!Eln.ghostManager.canCreateGhostAt(world, new BlockPos( x + element.x, y + element.y, z + element.z))) return false; } return true; }
Source:
<code>RubricStatistics(List<FeedbackResponseAttributes> responses, FeedbackRubricQuestionDetails questionDetails) { int numOfRubricSubQuestions = questionDetails.numOfRubricSubQuestions; int numOfRubricChoices = questionDetails.numOfRubricChoices; int responseTotalIndex = numOfRubricChoices; responseFrequency = new int[numOfRubricSubQuestions][numOfRubricChoices + 1]; percentageFrequencyAndAverage = new float[numOfRubricSubQuestions][numOfRubricChoices + 1]; for (FeedbackResponseAttributes response : responses) { FeedbackRubricResponseDetails frd = (FeedbackRubricResponseDetails) response.getResponseDetails(); for (int i = 0; i < numOfRubricSubQuestions; i++) { int chosenChoice = frd.getAnswer(i); if (chosenChoice != -1) { responseFrequency[i][chosenChoice] += 1; responseFrequency[i][responseTotalIndex] += 1; } } <START> } <END> for (int i = 0; i < percentageFrequencyAndAverage.length; i++) { int totalForSubQuestion = responseFrequency[i][responseTotalIndex]; if (totalForSubQuestion == 0) { continue; } for (int j = 0; j < numOfRubricChoices; j++) { percentageFrequencyAndAverage[i][j] = (float) responseFrequency[i][j] / totalForSubQuestion; } if (questionDetails.hasAssignedWeights) { for (int j = 0; j < numOfRubricChoices; j++) { float choiceWeight = (float) (questionDetails.rubricWeights.get(j) * percentageFrequencyAndAverage[i][j]); percentageFrequencyAndAverage[i][numOfRubricChoices] += choiceWeight; } } } }</code><technical_language>Consider extracting this for loop a separate method</technical_language>

Target:
RubricStatistics(List<FeedbackResponseAttributes> responses, FeedbackRubricQuestionDetails questionDetails) { this.responses = responses; this.questionDetails = questionDetails; this.numOfRubricSubQuestions = questionDetails.numOfRubricSubQuestions; this.numOfRubricChoices = questionDetails.numOfRubricChoices; this.responseTotalIndex = numOfRubricChoices; calculateResponseFrequency(); calculatePercentageFrequencyAndAverage(); }
Source:
<code>public void spec104_mustSignalOnErrorWhenFails_shouldBeSkippedWhenNoErrorPublisherGiven() throws Throwable { requireTestSkip(new ThrowingRunnable() { @Override public void run() throws Throwable { noopPublisherVerification().spec104_mustSignalOnErrorWhenFails(); } <START> }, "Skipping because no error state Publisher provided, and the test requires it. Please implement PublisherVerification#createErrorStatePublisher to run this test."); <END> }</code><technical_language>Put this string in a final static updated in a single location</technical_language>

Target:
public void spec104_mustSignalOnErrorWhenFails_shouldBeSkippedWhenNoErrorPublisherGiven() throws Throwable { requireTestSkip(new ThrowingRunnable() { @Override public void run() throws Throwable { noopPublisherVerification().spec104_mustSignalOnErrorWhenFails(); } }, PublisherVerification.SKIPPING_NO_ERROR_PUBLISHER_AVAILABLE); }
Source:
<code>private NetcdfFileWriteable createFileWith2DCharVariable(String[] data) throws IOException, InvalidRangeException { File tempFile = File.createTempFile("test", ".nc"); try { NetcdfFileWriteable ncfile = NetcdfFileWriteable.createNew(tempFile.getAbsolutePath(), false); Dimension dim1 = ncfile.addDimension("dim1", data.length); Dimension dim2 = ncfile.addDimension("dim2", calcMaxLength(data)); ArrayList<Dimension> dimensions = new ArrayList<Dimension>(); dimensions.add(dim1); dimensions.add(dim2); ncfile.addVariable("variable", DataType.CHAR, dimensions); ncfile.create(); ArrayChar dataArray = new ArrayChar.D2(dim1.getLength(), dim2.getLength()); for (int i=0; i<data.length; i++) { dataArray.setString(i, data[i]); } ncfile.write("variable", dataArray); ncfile.flush(); return ncfile; } finally { <START> ; <END> } }</code><technical_language>finally block required</technical_language>

Target:
private NetcdfFileWriteable createFileWith2DCharVariable(String[] data) throws IOException { File tempFile = File.createTempFile("test", ".nc"); try { NetcdfFileWriteable ncfile = NetcdfFileWriteable.createNew(tempFile.getAbsolutePath(), false); Dimension dim1 = ncfile.addDimension("dim1", data.length); Dimension dim2 = ncfile.addDimension("dim2", calcMaxLength(data)); ArrayList<Dimension> dimensions = new ArrayList<Dimension>(); dimensions.add(dim1); dimensions.add(dim2); ncfile.addVariable("variable", DataType.CHAR, dimensions); ncfile.create(); ArrayChar dataArray = new ArrayChar.D2(dim1.getLength(), dim2.getLength()); for (int i=0; i < data.length; i++) { dataArray.setString(i, data[i]); } ncfile.write("variable", dataArray); ncfile.flush(); return ncfile; } catch (Exception e) { tempFile.delete(); throw new RuntimeException(e); } }
Source:
<code>protected void createCacheManagers() throws Throwable { createCluster(new ConfigurationBuilder(), 2); timeService = new ControlledTimeService(); ConfigurationBuilder replConfig = new ConfigurationBuilder(); <START> replConfig.clustering().cacheMode(CacheMode.REPL_SYNC).hash().numSegments(4); <END> for (EmbeddedCacheManager manager : managers()) { TestingUtil.replaceComponent(manager, TimeService.class, timeService, true); manager.defineConfiguration(CACHE_NAME, replConfig.build()); } }</code><technical_language>testing Scattered then</technical_language>

Target:
protected void createCacheManagers() throws Throwable { createCluster(new ConfigurationBuilder(), 2); timeService = new ControlledTimeService(); ConfigurationBuilder replConfig = new ConfigurationBuilder(); replConfig.clustering().cacheMode(cacheMode).hash().numSegments(4); for (EmbeddedCacheManager manager : managers()) { TestingUtil.replaceComponent(manager, TimeService.class, timeService, true); manager.defineConfiguration(CACHE_NAME, replConfig.build()); } }
Source:
<code><START> public MongoDbMetadataStore(MongoTemplate template) { <END> this(template, null); }</code><technical_language>I additional MongoDbFactory ctor useful too</technical_language>

Target:
public MongoDbMetadataStore(MongoTemplate template) { this(template, DEFAULT_COLLECTION_NAME); }
Source:
<code>public void upgradeClusterRuntime(Set<ClusterComponent> components, boolean patchUpgrade) throws CloudbreakException { try { ClustersResourceApi clustersResourceApi = clouderaManagerApiFactory.getClustersResourceApi(apiClient); ParcelResourceApi parcelResourceApi = clouderaManagerApiFactory.getParcelResourceApi(apiClient); MgmtServiceResourceApi mgmtServiceResourceApi = clouderaManagerApiFactory.getMgmtServiceResourceApi(apiClient); ClouderaManagerResourceApi clouderaManagerResourceApi = clouderaManagerApiFactory.getClouderaManagerResourceApi(apiClient); startClouderaManager(); checkParcelApiAvailability(); Set<ClouderaManagerProduct> services = getServices(components); <START> ClouderaManagerProduct cdhService = getCdhService(services); <END> setParcelRepo(services, clouderaManagerResourceApi); refreshParcelRepos(clouderaManagerResourceApi); if (patchUpgrade) { installServices(services, parcelResourceApi); restartServices(clustersResourceApi); } else { upgradeNonCdhServices(services, cdhService.getName(), parcelResourceApi); upgradeCdh(clustersResourceApi, parcelResourceApi, cdhService); restartStaleServices(mgmtServiceResourceApi, clustersResourceApi); } removeUnusedParcels(components); configService.enableKnoxAutorestartIfCmVersionAtLeast(CLOUDERAMANAGER_VERSION_7_1_0, apiClient, stack.getName()); } catch (ApiException e) { LOGGER.info("Could not upgrade Cloudera Runtime services", e); throw new ClouderaManagerOperationFailedException(e.getMessage(), e); } }</code><technical_language>This line moved else branch there</technical_language>

Target:
public void upgradeClusterRuntime(Set<ClusterComponent> components, boolean patchUpgrade) throws CloudbreakException { try { LOGGER.info("Starting to upgrade cluster runtimes. Patch upgrade: {}", patchUpgrade); ClustersResourceApi clustersResourceApi = clouderaManagerApiFactory.getClustersResourceApi(apiClient); ParcelResourceApi parcelResourceApi = clouderaManagerApiFactory.getParcelResourceApi(apiClient); ClouderaManagerResourceApi clouderaManagerResourceApi = clouderaManagerApiFactory.getClouderaManagerResourceApi(apiClient); startClouderaManager(); checkParcelApiAvailability(); Set<ClouderaManagerProduct> products = getProducts(components); setParcelRepo(products, clouderaManagerResourceApi); refreshParcelRepos(clouderaManagerResourceApi); if (patchUpgrade) { downloadAndActivateParcels(products, parcelResourceApi); restartServices(clustersResourceApi); } else { ClouderaManagerProduct cdhProduct = getCdhProducts(products); upgradeNonCdhProducts(products, cdhProduct.getName(), parcelResourceApi); upgradeCdh(clustersResourceApi, parcelResourceApi, cdhProduct); restartStaleServices(clustersResourceApi); } removeUnusedParcelVersions(parcelResourceApi, products); configService.enableKnoxAutorestartIfCmVersionAtLeast(CLOUDERAMANAGER_VERSION_7_1_0, apiClient, stack.getName()); LOGGER.info("Cluster runtime upgrade finished"); } catch (ApiException e) { LOGGER.info("Could not upgrade Cloudera Runtime services", e); throw new ClouderaManagerOperationFailedException(e.getMessage(), e); } }
Source:
<code>protected void syncSearch() { if (getEntity() == null) { return; } super.syncSearch(); IdQueryParameters tempVar = new IdQueryParameters(getEntity().getId()); tempVar.setRefresh(getIsQueryFirstTime()); Frontend.getInstance().runQuery(QueryType.GetAllNetworksByClusterId, tempVar, new AsyncQuery<>((AsyncCallback<QueryReturnValue>) returnValue -> { final List<Network> newItems = returnValue.getReturnValue(); Collections.sort(newItems, Comparator.comparing((Network n) -> n.getCluster().isManagement()).reversed() .thenComparing(Network::getName, new LexoNumericComparator()) ); for (Network network : newItems) { network.getCluster().setId(new <START> NetworkClusterId(tempVar.getId(), <END> network.getId())); } setItems(newItems); })); }</code><technical_language>tempVar.getId() == getEntity().getId() IdQueryParameters tempVar = new IdQueryParameters(getEntity().getId());</technical_language>

Target:
protected void syncSearch() { if (getEntity() == null) { return; } super.syncSearch(); Guid clusterId = getEntity().getId(); IdQueryParameters tempVar = new IdQueryParameters(clusterId); tempVar.setRefresh(getIsQueryFirstTime()); Frontend.getInstance().runQuery(QueryType.GetAllNetworksByClusterId, tempVar, new AsyncQuery<>((AsyncCallback<QueryReturnValue>) returnValue -> { final List<Network> newItems = returnValue.getReturnValue(); Collections.sort(newItems, Comparator.comparing((Network n) -> n.getCluster().isManagement()).reversed() .thenComparing(Network::getName, new LexoNumericComparator()) ); for (Network network : newItems) { network.getCluster().setId(new NetworkClusterId(clusterId, network.getId())); } setItems(newItems); })); }
Source:
<code>public BootstrapEvent next() { if (!databaseEventProcessed) { FSDatabaseEvent event = new FSDatabaseEvent(hiveConf, next.toString()); databaseEventProcessed = true; return postProcessing(event); } if (replicationState != null) { return eventForReplicationState(); } String currentPath = next.toString(); <START> if (currentPath.contains(Path.SEPARATOR + FUNCTIONS_ROOT_DIR_NAME)) { <END> LOG.debug("functions directory: {}", next.toString()); return postProcessing(new FSFunctionEvent(next)); } return postProcessing(new FSTableEvent(hiveConf, next.toString())); }</code><technical_language>append Path.SEPARATOR _functions for check</technical_language>

Target:
public BootstrapEvent next() { if (!databaseEventProcessed) { FSDatabaseEvent event = new FSDatabaseEvent(hiveConf, next.toString()); databaseEventProcessed = true; return postProcessing(event); } if (replicationState != null) { return eventForReplicationState(); } String currentPath = next.toString(); if (currentPath.contains(Path.SEPARATOR + FUNCTIONS_ROOT_DIR_NAME + Path.SEPARATOR)) { LOG.debug("functions directory: {}", next.toString()); return postProcessing(new FSFunctionEvent(next)); } return postProcessing(new FSTableEvent(hiveConf, next.toString())); }
Source:
<code>protected Service createService(GatewayServices gatewayServices, ServiceType serviceType, GatewayConfig gatewayConfig, Map<String, String> options, String implementation) throws ServiceLifecycleException { Service service = null; if (shouldCreateService(implementation)) { final AliasService defaultAliasService = new DefaultAliasService(); ((DefaultAliasService) defaultAliasService).setMasterService(getMasterService(gatewayServices)); ((DefaultAliasService) defaultAliasService).setKeystoreService(getKeystoreService(gatewayServices)); defaultAliasService.init(gatewayConfig, options); cacheService(serviceType, EMPTY_DEFAULT_IMPLEMENTATION, defaultAliasService); if (matchesImplementation(implementation, DefaultAliasService.class, true)) { service = defaultAliasService; } else if (matchesImplementation(implementation, HashicorpVaultAliasService.class)) { service = new HashicorpVaultAliasService(defaultAliasService); } else if (matchesImplementation(implementation, RemoteAliasService.class)) { service = new RemoteAliasService(defaultAliasService, getMasterService(gatewayServices)); } else if (matchesImplementation(implementation, ZookeeperRemoteAliasService.class)) { final boolean useLocalAliasService = options == null ? true : Boolean.valueOf(options.getOrDefault(USE_LOCAL_ALIAS_IN_ZK_IMPL_PARAM_NAME, "true")); <START> service = new ZookeeperRemoteAliasServiceProvider().newInstance(useLocalAliasService ? defaultAliasService : null, getMasterService(gatewayServices)); <END> } logServiceUsage(implementation, serviceType); } return service; }</code><technical_language>this default behavior is store tokens in ZK</technical_language>

Target:
protected Service createService(GatewayServices gatewayServices, ServiceType serviceType, GatewayConfig gatewayConfig, Map<String, String> options, String implementation) throws ServiceLifecycleException { Service service = null; if (shouldCreateService(implementation)) { final AliasService defaultAliasService = new DefaultAliasService(); ((DefaultAliasService) defaultAliasService).setMasterService(getMasterService(gatewayServices)); ((DefaultAliasService) defaultAliasService).setKeystoreService(getKeystoreService(gatewayServices)); defaultAliasService.init(gatewayConfig, options); if (matchesImplementation(implementation, DefaultAliasService.class, true)) { service = defaultAliasService; } else if (matchesImplementation(implementation, HashicorpVaultAliasService.class)) { service = new HashicorpVaultAliasService(defaultAliasService); } else if (matchesImplementation(implementation, RemoteAliasService.class)) { service = new RemoteAliasService(defaultAliasService, getMasterService(gatewayServices)); } else if (matchesImplementation(implementation, ZookeeperRemoteAliasService.class)) { service = new ZookeeperRemoteAliasServiceProvider().newInstance(gatewayServices, defaultAliasService, getMasterService(gatewayServices)); } logServiceUsage(implementation, serviceType); } return service; }
Source:
<code>private int parseDetails(BufferedReader in, GCModel model, ParseInformation pos, int lineNumber, GCEvent event, String beginningOfLine) throws IOException { <START> <END> Matcher memoryMatcher = PATTERN_MEMORY.matcher(""); pos.setIndex(0); boolean isInDetailedEvent = true; String line; while (isInDetailedEvent && (line = in.readLine()) != null) { ++lineNumber; pos.setLineNumber(lineNumber); pos.setIndex(0); if (line.length() == 0) { continue; } if (beginningOfLine != null) { line = beginningOfLine + line; beginningOfLine = null; model.add(parseLine(line, pos)); continue; } if (line.indexOf("Eden") >= 0) { parseMemoryDetails(event, line, pos); } else if (line.charAt(0) != ' ' && !hasTimes && (nextIsDatestamp(line, pos) || nextIsTimestamp(line, pos))) { model.add(parseLine(line, pos)); isInDetailedEvent = false; } else if (line.indexOf(INCOMPLETE_CONCURRENT_EVENT_INDICATOR) >= 0) { parseIncompleteConcurrentEvent(model, event, line, pos); } else { memoryMatcher.reset(line); if (memoryMatcher.matches()) { setMemoryExtended(event, line, pos); } } if (line.indexOf(TIMES) >= 0) { isInDetailedEvent = false; hasTimes = true; } } if (event.getTotal() == 0) { if (LOG.isLoggable(Level.FINE)) LOG.fine("line " + lineNumber + ": no memory information found (" + event.toString() + ")"); } model.add(event); return lineNumber; }</code><technical_language>ParseException present AbstractDataReaderSun#parseDatestamp()</technical_language>

Target:
private int parseDetails(BufferedReader in, GCModel model, ParseInformation pos, int lineNumber, GCEvent event, String beginningOfLine) throws ParseException, IOException { Matcher memoryMatcher = PATTERN_MEMORY.matcher(""); pos.setIndex(0); boolean isInDetailedEvent = true; String line; while (isInDetailedEvent && (line = in.readLine()) != null) { ++lineNumber; pos.setLineNumber(lineNumber); pos.setIndex(0); if (line.length() == 0) { continue; } if (beginningOfLine != null) { line = beginningOfLine + line; beginningOfLine = null; model.add(parseLine(line, pos)); continue; } if (line.indexOf("Eden") >= 0) { parseMemoryDetails(event, line, pos); } else if (line.charAt(0) != ' ' && !hasTimes && (nextIsDatestamp(line, pos) || nextIsTimestamp(line, pos))) { model.add(parseLine(line, pos)); isInDetailedEvent = false; } else if (line.indexOf(INCOMPLETE_CONCURRENT_EVENT_INDICATOR) >= 0) { parseIncompleteConcurrentEvent(model, event, line, pos); } else { memoryMatcher.reset(line); if (memoryMatcher.matches()) { setMemoryExtended(event, line, pos); } } if (line.indexOf(TIMES) >= 0) { isInDetailedEvent = false; hasTimes = true; } } if (event.getTotal() == 0) { if (LOG.isLoggable(Level.FINE)) LOG.fine("line " + lineNumber + ": no memory information found (" + event.toString() + ")"); } model.add(event); return lineNumber; }
Source:
<code>public UMLDiffExtensionPostProcessor() { <START> super(null, null); <END> }</code><technical_language>A post-processor NsURI resourceURI is totally useless; this constructor a misleading implementation. basically create a post-processor is occupy memory time (when loop it). This is "UML" post-processor, a default contribution hard-coded URI in plugin.xml. set a more default NsURI that. Change call super(Pattern.compile("<LINK_0>\d.0.0/UML"), null) ... remove this constructor altogether</technical_language>

Target:
public UMLDiffExtensionPostProcessor() { super(Pattern.compile("<LINK_0>\\d.\\d.\\d/UML"), null); }
Source:
<code>public int onStartCommand(Intent intent, int flags, int startId) { <START> if (intent != null) { <END> if (intent.getExtras() != null) { if (null != intent.getExtras().getString(EXTRA_GEOCODE)) { int listId = intent.getIntExtra(EXTRA_LIST_ID, StoredList.STANDARD_LIST_ID); QueueItem item = new QueueItem(intent.getExtras().getString(EXTRA_GEOCODE), startId, listId, intent.getExtras().containsKey(EXTRA_REFRESH) ? OperationType.REFRESH : OperationType.STORE); try { if (!queue.contains(item)) { queue.put(item); ActivityMixin.showShortToast(this, (getString(R.string.download_service_queued_cache, item.geocode))); notifyChanges(); } } catch (InterruptedException e) { e.printStackTrace(); } if (!downloadTaskRunning) { downloadTaskRunning = true; new DownloadCachesTask().execute(); } } } } return START_STICKY; }</code><technical_language>try "guard style" pattern in c:geo. Basically is avoid nested if conditions instead multiple return statements in beginning: if (intent.getExtras()==null) { return default; } if (intent.getExtras().getString(EXTRA_GEOCODE)== null) { return default; } ..</technical_language>

Target:
public int onStartCommand(Intent intent, int flags, int startId) { if (intent == null) { return START_NOT_STICKY; } if (!intent.hasExtra(EXTRA_GEOCODE)) { return START_NOT_STICKY; } int listId = intent.getIntExtra(EXTRA_LIST_ID, StoredList.STANDARD_LIST_ID); QueueItem item = new QueueItem(intent.getStringExtra(EXTRA_GEOCODE), startId, listId, intent.hasExtra(EXTRA_REFRESH) ? OperationType.REFRESH : OperationType.STORE); if (intent.hasExtra(EXTRA_PRIORITY)) { item.setMaxPriority(); } synchronized (queue) { if (!queue.contains(item)) { queue.put(item); if (item.priority) { queue.put(item.getGhostInstance()); } if (lastCacheAdded + 1000 < System.currentTimeMillis()) { ActivityMixin.showShortToast(this, (getString(R.string.download_service_queued_cache, item.geocode))); lastCacheAdded = System.currentTimeMillis(); } notifyChanges(); } if (!downloadTaskRunning) { downloadTaskRunning = true; new DownloadCachesTask().execute(); } } return START_STICKY; }
Source:
<code>public Observable<List<Product>> getProducts(final int page, final Long collectionId, final Set<String> tags, final Collection.SortOrder sortOrder) { if (page < 1) { throw new IllegalArgumentException("page is a 1-based index, value cannot be less than 1"); } if (collectionId == null) { throw new NullPointerException("collectionId cannot be null"); } final String sortOrderStr = sortOrder != null ? sortOrder.toString() : Collection.SortOrder.COLLECTION_DEFAULT.toString(); <START> final String tagsQueryStr = tags != null && !tags.isEmpty() ? TextUtils.join(",", tags.toArray()) : null; <END> return retrofitService .getProducts(appId, collectionId, tagsQueryStr, sortOrderStr, page, pageSize) .retryWhen(networkRetryPolicyProvider.provide()) .doOnNext(new RetrofitSuccessHttpStatusCodeHandler<>()) .compose(new UnwrapRetrofitBodyTransformer<ProductListings, List<Product>>()) .onErrorResumeNext(new BuyClientExceptionHandler<List<Product>>()) .observeOn(callbackScheduler); }</code><technical_language>do ternary operator - breaking this out a seperate function</technical_language>

Target:
public Observable<List<Product>> getProducts(final int page, final Long collectionId, final Set<String> tags, final Collection.SortOrder sortOrder) { if (page < 1) { throw new IllegalArgumentException("page is a 1-based index, value cannot be less than 1"); } if (collectionId == null) { throw new NullPointerException("collectionId cannot be null"); } final String sortOrderStr = sortOrder != null ? sortOrder.toString() : Collection.SortOrder.COLLECTION_DEFAULT.toString(); final String tagsQueryStr = formatQueryString(tags); return retrofitService .getProducts(appId, collectionId, tagsQueryStr, sortOrderStr, page, pageSize) .retryWhen(networkRetryPolicyProvider.provide()) .doOnNext(new RetrofitSuccessHttpStatusCodeHandler<>()) .compose(new UnwrapRetrofitBodyTransformer<ProductListings, List<Product>>()) .onErrorResumeNext(new BuyClientExceptionHandler<List<Product>>()) .observeOn(callbackScheduler); }
Source:
<code>public DatabaseStack(Network network, DatabaseServer databaseServer, Tags tags, String template) { this.network = network; this.databaseServer = databaseServer; <START> this.tags = tags; <END> this.template = template; }</code><technical_language>copy of tags copy constructor</technical_language>

Target:
public DatabaseStack(Network network, DatabaseServer databaseServer, Tags tags, String template) { this.network = network; this.databaseServer = databaseServer; this.tags = new Tags(tags); this.template = template; }
Source:
<code>protected void updateNetworkChangability() { super.updateNetworkChangability(); if (!getNetwork().getIsChangable()) { return; } boolean isPlugged = isPluggedBeforeAndAfterEdit(); boolean isPortMirroring = (Boolean) getPortMirroring().getEntity(); if (isVmUp() && isPlugged) { if (!hotUpdateSupported) { getNetwork().setChangeProhibitionReason(ConstantsManager.getInstance() .getMessages() .hotNetworkUpdateNotSupported(getClusterCompatibilityVersion().toString())); } else if (selectedNetworkExternal()) { getNetwork().setChangeProhibitionReason(ConstantsManager.getInstance() .getConstants() .hotNetworkUpdateNotSupportedExternalNetworks()); } else if (isPortMirroring) { getNetwork().setChangeProhibitionReason(ConstantsManager.getInstance() .getConstants() .hotNetworkUpdateNotSupportedWithPortMirroring()); } else { return; } <START> getNetwork().setIsChangable(false); <END> } }</code><technical_language>initSelectedNetwork()? In case network changed is changeable rollbacked. remove initSelectedNetwork() happen</technical_language>

Target:
protected void updateNetworkChangability() { super.updateNetworkChangability(); if (!getNetwork().getIsChangable()) { return; } boolean isPlugged = isPluggedBeforeAndAfterEdit(); boolean isPortMirroring = (Boolean) getPortMirroring().getEntity(); if (isVmUp() && isPlugged) { if (!hotUpdateSupported) { getNetwork().setChangeProhibitionReason(ConstantsManager.getInstance() .getMessages() .hotNetworkUpdateNotSupported(getClusterCompatibilityVersion().toString())); } else if (selectedNetworkExternal()) { getNetwork().setChangeProhibitionReason(ConstantsManager.getInstance() .getConstants() .hotNetworkUpdateNotSupportedExternalNetworks()); } else if (isPortMirroring) { getNetwork().setChangeProhibitionReason(ConstantsManager.getInstance() .getConstants() .hotNetworkUpdateNotSupportedWithPortMirroring()); } else { return; } getNetwork().setIsChangable(false); getNetworkBehavior().initSelectedNetwork(getNetwork(), getNic()); } }
Source:
<code>boolean replaceQuerySource(QueryTaskSource taskSource) throws Exception { QueryTaskSourceOption option = taskSource.getSelectedSource(); taskSource.reset(); <START> if (option == null) { <END> return false; } QueryTaskSourceOption newOption = meshQueryMaster.getReplacementQueryTaskOption(option.queryReference); for (int i = 0; i < taskSource.options.length; i++) { if (taskSource.options[i] == option) { taskSource.options[i] = newOption; } } return newOption.tryActivate(meshy, queryOptions); }</code><technical_language>allowing option null here? invalid code path visible subsequent NPE. illusion of handled correctly this pretend return checked anywhere</technical_language>

Target:
boolean replaceQuerySource(QueryTaskSource taskSource) throws Exception { QueryTaskSourceOption option = taskSource.getSelectedSource(); taskSource.reset(); QueryTaskSourceOption newOption = meshQueryMaster.getReplacementQueryTaskOption(option.queryReference); for (int i = 0; i < taskSource.options.length; i++) { if (taskSource.options[i] == option) { taskSource.options[i] = newOption; } } return newOption.tryActivate(meshy, queryOptions); }
Source:
<code>public static long binToLong(String bits, boolean unsignd) throws IrregularStringOfBitsException { if ((bits.length() > 64) || (unsignd && bits.length() == 64 && bits.charAt(0) == '1') || !isBinaryString(bits)) { throw new IrregularStringOfBitsException(); } if (!unsignd && bits.length() == 64 && isOverflow(bits)) { <START> return (long)(-Math.pow(2.0, 63.0)); <END> } if (bits.length() == 0) { return 0; } if (unsignd) { return getUnsignedLongValue(bits); } else { if (bits.charAt(0) == '0') { return Converter.binToLong(bits.substring(1), true); } else { String s = Converter.twoComplement(bits); return -1 * Converter.binToLong(s, true); } } }</code><technical_language>here, please a constant</technical_language>

Target:
public static long binToLong(String bits, boolean unsignd) throws IrregularStringOfBitsException { if ((bits.length() > 64) || (unsignd && bits.length() == 64 && bits.charAt(0) == '1') || !isBinaryString(bits)) { throw new IrregularStringOfBitsException(); } if (!unsignd && bits.length() == 64 && isOverflow(bits)) { return OVERFLOW_64; } if (bits.length() == 0) { return 0; } if (unsignd) { return getUnsignedLongValue(bits); } else { if (bits.charAt(0) == '0') { return Converter.binToLong(bits.substring(1), true); } else { String s = Converter.twoComplement(bits); return -1 * Converter.binToLong(s, true); } } }
Source:
<code>public Builder error(GraphQLError error) { <START> return errors(Collections.singletonList(assertNotNull(error))); <END> }</code><technical_language>call this.errror.add</technical_language>

Target:
public Builder error(GraphQLError error) { errors.add(assertNotNull(error)); return this; }
Source:
<code>public boolean prepareConnectHostToStoragePoolServers(ConnectHostToStoragePoolServersParameters parameters, List<StorageServerConnections> connections) { List<StorageServerConnections> res = updateIfaces(connections, parameters.getVds().getId()); connections.clear(); connections.addAll(res); <START> return true; <END> }</code><technical_language>point of this return if true</technical_language>

Target:
public void prepareConnectHostToStoragePoolServers(ConnectHostToStoragePoolServersParameters parameters, List<StorageServerConnections> connections) { List<StorageServerConnections> res = updateIfaces(connections, parameters.getVds().getId()); connections.clear(); connections.addAll(res); }
Source:
<code>public void authenticateWhenInvalidDestinationThenThrowAuthenticationException() { this.exception.expect(authenticationMatcher(Saml2ErrorCodes.INVALID_DESTINATION)); Response response = TestOpenSamlObjects.response(DESTINATION + "invalid", ASSERTING_PARTY_ENTITY_ID); response.getAssertions().add(TestOpenSamlObjects.assertion()); TestOpenSamlObjects.signed(response, TestSaml2X509Credentials.assertingPartySigningCredential(), <START> RELYING_PARTY_ENTITY_ID, SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA256); <END> Saml2AuthenticationToken token = token(response, TestSaml2X509Credentials.relyingPartyVerifyingCredential()); this.provider.authenticate(token); }</code><technical_language>Ideally, tests unrelated change changed. introduce a new method TestOpenSamlObjects</technical_language>

Target:
public void authenticateWhenInvalidDestinationThenThrowAuthenticationException() { Response response = TestOpenSamlObjects.response(DESTINATION + "invalid", ASSERTING_PARTY_ENTITY_ID); response.getAssertions().add(TestOpenSamlObjects.assertion()); TestOpenSamlObjects.signed(response, TestSaml2X509Credentials.assertingPartySigningCredential(), RELYING_PARTY_ENTITY_ID); Saml2AuthenticationToken token = token(response, verifying(registration())); assertThatExceptionOfType(Saml2AuthenticationException.class) .isThrownBy(() -> this.provider.authenticate(token)) .satisfies(errorOf(Saml2ErrorCodes.INVALID_DESTINATION)); }
Source:
<code>private boolean sendMessageIfNeeded(Message message, Optional<Topic> topic, String contextName) { if (topic.isPresent() && isNotStale(message)) { sendMessage(message, topic.get()); return true; } else { logger.warn("Not stale message {}", contextName, message.getId(), topic.get().getQualifiedName(), new String(message.getData(), Charset.defaultCharset())); <START> return true; <END> } }</code><technical_language>want return true here, log message is misleading distinct scenario stale message topic info</technical_language>

Target:
private boolean sendMessageIfNeeded(Message message, Optional<Topic> topic, String contextName) { if (topic.isPresent() && isNotStale(message)) { sendMessage(message, topic.get()); return true; } else { logger.warn("Not stale message {}", contextName, message.getId(), topic.get().getQualifiedName(), new String(message.getData(), Charset.defaultCharset())); return false; } }
Source:
<code><START> @Test public void configRoundtrip() throws Exception { <END> Folder d = r.jenkins.createProject(Folder.class, "d"); r.configRoundtrip(d); assertNull(d.getProperties().get(JiraFolderProperty.class)); List<JiraSite> list = new ArrayList<>(); list.add(new JiraSite("<LINK_1>")); JiraFolderProperty foo = new JiraFolderProperty(); foo.setSites(list); foo.setSites(new JiraSite("<LINK_0>")); d.getProperties().add(foo); r.configRoundtrip(d); JiraFolderProperty prop = d.getProperties().get(JiraFolderProperty.class); assertNotNull(prop); List<JiraSite> actual = prop.getSites(); r.assertEqualDataBoundBeans(list, actual); }</code><technical_language>annotation a separate line</technical_language>

Target:
public void configRoundtrip() throws Exception { Folder d = r.jenkins.createProject(Folder.class, "d"); r.configRoundtrip(d); assertNull(d.getProperties().get(JiraFolderProperty.class)); List<JiraSite> list = new ArrayList<>(); list.add(new JiraSite("<LINK_1>")); JiraFolderProperty foo = new JiraFolderProperty(); foo.setSites(list); foo.setSites(new JiraSite("<LINK_0>")); d.getProperties().add(foo); r.configRoundtrip(d); JiraFolderProperty prop = d.getProperties().get(JiraFolderProperty.class); assertNotNull(prop); List<JiraSite> actual = Arrays.asList(prop.getSites()); r.assertEqualDataBoundBeans(list, actual); }
Source:
<code>public boolean hasDelayedMetrics(long ingestTime) { <START> if ( getDelayTime(ingestTime) > TRACKER_DELAYED_METRICS_MILLIS ) { <END> return true; } else { return false; } }</code><technical_language>a matter of preference, do return getDelayTime(ingestTime) > TRACKER_DELAYED_METRICS_MILLIS</technical_language>

Target:
public boolean hasDelayedMetrics(long ingestTime) { return getDelayTime(ingestTime) > TRACKER_DELAYED_METRICS_MILLIS; }
Source:
<code>protected boolean set(TileEntityFurnace container, Integer value) { <START> if (container.getStackInSlot(0) == null) { <END> return false; } container.setField(3, value); return true; }</code><technical_language>this</technical_language>

Target:
protected boolean set(TileEntityFurnace container, Integer value) { if(container.getStackInSlot(0) == null) return false; container.setField(3, value); return true; }
Source:
<code>private void initIncludedInAction(ChangeInfo info) { <START> if (info.status().isClosed()) { <END> includedInAction = new IncludedInAction( info.legacy_id(), style, headerLine, includedIn); includedIn.setVisible(true); } }</code><technical_language>This be: if (info.status() == Status.MERGED) {</technical_language>

Target:
private void initIncludedInAction(ChangeInfo info) { if (info.status() == Status.MERGED) { includedInAction = new IncludedInAction( info.legacy_id(), style, headerLine, includedIn); includedIn.setVisible(true); } }
Source:
<code>public void start(final StartContext context) throws StartException { <START> if (runOnce.get()) { <END> return; } runOnce.set(true); StabilityMonitor monitor = new StabilityMonitor(); for (ServiceController controller : serviceControllers) { monitor.addController(controller); } try { monitor.awaitStability(); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new RuntimeException(ex); } finally { monitor.clear(); } ClassLoader oldTccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); bootstrap.getValue().getBootstrap().endInitialization(); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl); } }</code><technical_language>If need atomicity like: if (!runOnce.compareAndSet(false,true)) { return; } StabilityMonitor monitor = ..</technical_language>

Target:
public void start(final StartContext context) throws StartException { if (!runOnce.compareAndSet(false, true)) { return; } final ExecutorService executor = executorService.getValue(); final Runnable task = new Runnable() { @Override public void run() { StabilityMonitor monitor = new StabilityMonitor(); for (ServiceController controller : serviceControllers) { monitor.addController(controller); } try { monitor.awaitStability(); } catch (InterruptedException ex) { context.failed(new StartException(ex)); Thread.currentThread().interrupt(); throw new RuntimeException(ex); } finally { monitor.clear(); } ClassLoader oldTccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); bootstrap.getValue().getBootstrap().endInitialization(); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl); context.complete(); } } }; try { executor.execute(task); } catch (RejectedExecutionException e) { task.run(); } finally { context.asynchronous(); } }