auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void reset() { uID = new UniqueID(); nick = PokemonInfo.name(uID); item = 0; ability = 0; nature = 0; <START> hiddenPowerType = 16; <END> gender = 1; gen = new Gen(); shiny = false; happiness = 0; isHackmon = false; level = 100; moves[0] = new TeamMove(0); moves[1] = new TeamMove(0); moves[2] = new TeamMove(0); moves[3] = new TeamMove(0); DVs[0] = DVs[1] = DVs[2] = DVs[3] = DVs[4] = DVs[5] = 31; EVs[0] = EVs[1] = EVs[2] = EVs[3] = EVs[4] = EVs[5] = 0; }</code><technical_language>enum Dark..</technical_language>

Target:
public void reset() { uID = new UniqueID(); nick = PokemonInfo.name(uID); item = 0; ability = 0; nature = 0; hiddenPowerType = (byte)TypeInfo.Type.Dark.ordinal(); gender = 1; gen = new Gen(); shiny = false; happiness = 0; isHackmon = false; level = 100; moves[0] = new TeamMove(0); moves[1] = new TeamMove(0); moves[2] = new TeamMove(0); moves[3] = new TeamMove(0); DVs[0] = DVs[1] = DVs[2] = DVs[3] = DVs[4] = DVs[5] = 31; EVs[0] = EVs[1] = EVs[2] = EVs[3] = EVs[4] = EVs[5] = 0; }
Source:
<code>protected ButtonAttributes getPositiveButtonAttributes() { return new ButtonAttributes() { <START> <END> @NonNull @Override public String getMessage() { return getContext().getResources().getString(R.string.label_ok); } @Nullable @Override public DialogInterface.OnClickListener getOnClickListener() { return null; } }; }</code><technical_language>Extra newline</technical_language>

Target:
protected ButtonAttributes getPositiveButtonAttributes() { return new ButtonAttributes() { @NonNull @Override public String getMessage() { return getContext().getResources().getString(R.string.label_ok); } @Nullable @Override public DialogInterface.OnClickListener getOnClickListener() { return mOnPositiveClick; } }; }
Source:
<code>public Diagnostics(Configuration config) { this.config = config; <START> hostData = new JSONObject(); <END> appData = new JSONObject(); }</code><technical_language>initialize (outside constructor)</technical_language>

Target:
public Diagnostics(Configuration config) { this.config = config; JSONUtils.safePutOpt(deviceData, "osName", System.getProperty("os.name")); }
Source:
<code>public void onEntityKill(EntityDeathEvent e) { if (e.getEntity().getKiller() != null) { Player p = e.getEntity().getKiller(); ItemStack item = p.getInventory().getItemInMainHand(); Set<ItemStack> customDrops = SlimefunPlugin.getRegistry().getMobDrops(e.getEntityType()); if (customDrops != null && !customDrops.isEmpty()) { for(ItemStack is:customDrops) { SlimefunItem sfi = SlimefunItem.getByItem(is); if(sfi != null && sfi instanceof ChanceDrop) { <START> if(((ChanceDrop)sfi).getChance() <= ThreadLocalRandom.current().nextInt(0,100)) <END> continue; else addDrops(p, customDrops, e.getDrops()); } } } if (item.getType() != Material.AIR) { SlimefunItem sfItem = SlimefunItem.getByItem(item); if (sfItem != null && Slimefun.hasUnlocked(p, sfItem, true)) { sfItem.callItemHandler(EntityKillHandler.class, handler -> handler.onKill(e, e.getEntity(), p, item)); } } } }</code><technical_language>a variable for random called multiple times this expensive in world</technical_language>

Target:
public void onEntityKill(EntityDeathEvent e) { if (e.getEntity().getKiller() != null) { Player p = e.getEntity().getKiller(); ItemStack item = p.getInventory().getItemInMainHand(); Set<ItemStack> customDrops = SlimefunPlugin.getRegistry().getMobDrops(e.getEntityType()); if (customDrops != null && !customDrops.isEmpty()) addDrops(p, customDrops, e.getDrops()); if (item.getType() != Material.AIR) { SlimefunItem sfItem = SlimefunItem.getByItem(item); if (sfItem != null && Slimefun.hasUnlocked(p, sfItem, true)) { sfItem.callItemHandler(EntityKillHandler.class, handler -> handler.onKill(e, e.getEntity(), p, item)); } } } }
Source:
<code>private Config loadConfig( Optional<Path> additionalConfig ) throws CommandFailed { return withAdditionalConfig( additionalConfig, <START> Config.fromFile( configDir.resolve( "neo4j.conf" ) ).withHome( homeDir ) <END> .withConnectorsDisabled().build() ); }</code><technical_language>Config class constant defined for default config file name</technical_language>

Target:
private Config loadConfig( Optional<Path> additionalConfig ) throws CommandFailed { return withAdditionalConfig( additionalConfig, Config.fromFile( configDir.resolve( Config.DEFAULT_CONFIG_FILE_NAME ) ).withHome( homeDir ) .withConnectorsDisabled().build() ); }
Source:
<code>public PaymentWorksBatchReportVendorItem createBatchReportVendorItem(PaymentWorksVendor pmwVendorProcessed) { <START> return new PaymentWorksBatchReportVendorItem(pmwVendorProcessed.getPmwVendorRequestId(), <END> pmwVendorProcessed.getProcessTimestamp(), pmwVendorProcessed.getVendorType(), pmwVendorProcessed.getRequestingCompanyLegalName(), pmwVendorProcessed.getRequestingCompanyLegalFirstName(), pmwVendorProcessed.getRequestingCompanyLegalLastName(), pmwVendorProcessed.getRequestingCompanyTinType(), pmwVendorProcessed.getRequestingCompanyCorporateEmail(), pmwVendorProcessed.getInitiatorNetId(), null); }</code><technical_language>simplify this method, call two-arg variant takes error message list input pass in a null list. cut repetitive calls this constructor</technical_language>

Target:
public PaymentWorksBatchReportVendorItem createBatchReportVendorItem(PaymentWorksVendor pmwVendorProcessed) { return createBatchReportVendorItem(pmwVendorProcessed, (List<String>) null); }
Source:
<code>public static void assertIndex(IndexDescriptor expected, String keyspace, Session session) { TableMetadata tableMetadata = session.getCluster().getMetadata().getKeyspace(keyspace.toLowerCase()) .getTable(expected.getTableName().toCql()); IndexMetadata imd = tableMetadata.getIndex(expected.getName().toCql()); <START> assertEquals(expected.getName(), imd == null ? null : imd.getName()); <END> }</code><technical_language>assertThat(imd != null ? imd.getName() : null, is(equalTo(expected.getName())));</technical_language>

Target:
public static void assertIndex(IndexDescriptor expected, String keyspace, Session session) { TableMetadata tableMetadata = session.getCluster().getMetadata().getKeyspace(keyspace.toLowerCase()) .getTable(expected.getTableName().toCql()); IndexMetadata indexMetadata = tableMetadata.getIndex(expected.getName().toCql()); assertThat(indexMetadata, is(not(nullValue()))); assertThat(indexMetadata.getName(), is(equalTo(expected.getName().toCql()))); }
Source:
<code>private String checkDockerCertPath(String dockerCertPath) { if (StringUtils.isEmpty(dockerCertPath)) { throw new DockerClientException( "Enabled TLS verification (DOCKER_TLS_VERIFY=1) but certifate path (DOCKER_CERT_PATH) is not defined."); } else { File certPath = new File(dockerCertPath); if (!certPath.exists()) { throw new DockerClientException( "Enabled TLS verification (DOCKER_TLS_VERIFY=1) but certificate path (DOCKER_CERT_PATH) '" + dockerCertPath + "' doesn't exist."); } <START> if (certPath.isDirectory()) { <END> return dockerCertPath; } else { throw new DockerClientException( "Enabled TLS verification (DOCKER_TLS_VERIFY=1) but certificate path (DOCKER_CERT_PATH) '" + dockerCertPath + "' doesn't point to a directory."); } } }</code><technical_language>do else if operations certPath</technical_language>

Target:
private String checkDockerCertPath(String dockerCertPath) { if (StringUtils.isEmpty(dockerCertPath)) { throw new DockerClientException( "Enabled TLS verification (DOCKER_TLS_VERIFY=1) but certifate path (DOCKER_CERT_PATH) is not defined."); } File certPath = new File(dockerCertPath); if (!certPath.exists()) { throw new DockerClientException( "Enabled TLS verification (DOCKER_TLS_VERIFY=1) but certificate path (DOCKER_CERT_PATH) '" + dockerCertPath + "' doesn't exist."); } else if (!certPath.isDirectory()) { throw new DockerClientException( "Enabled TLS verification (DOCKER_TLS_VERIFY=1) but certificate path (DOCKER_CERT_PATH) '" + dockerCertPath + "' doesn't point to a directory."); } return dockerCertPath; }
Source:
<code>public Object getData(String key, boolean refresh) { return getData(ThreadLocalParamsContainer.getHttpSessionId(), key, refresh); <START> } <END></code><technical_language>put getData() place</technical_language>

Target:
public final Object getData(String key, boolean refresh) { return getData(ThreadLocalParamsContainer.getHttpSessionId(), key, refresh); }
Source:
<code>public Description matchClass(ClassTree tree, VisitorState state) { <START> List<Tree> types = new ArrayList<>(); <END> types.add(tree.getExtendsClause()); types.addAll(tree.getImplementsClause()); return testTypes(types); }</code><technical_language>nit: try avoid array allocations this invoked for class/interface/enum/etc. A large internal project benefit avoiding this. lines? java checkType(tree.getExtendsClause()); checkTypes(tree.getImplementsClause());</technical_language>

Target:
public Description matchClass(ClassTree tree, VisitorState state) { Description extendsResult = testType(tree.getExtendsClause()); if (extendsResult != Description.NO_MATCH) { return extendsResult; } return testTypes(tree.getImplementsClause()); }
Source:
<code>void getTrackFile() throws Exception { this.mockMvc.perform(get(BASELINE_URL_TEMPLATE.format(new Object[] {"E-MTAB-5423", "g391"}))) .andExpect(status().isOk()) <START> .andReturn(); <END> }</code><technical_language>Again, out of scope for this PR, I andReturn() statements needed</technical_language>

Target:
void getTrackFile() throws Exception { this.mockMvc.perform(get(BASELINE_URL_TEMPLATE.format(new Object[] {"E-MTAB-5423", "g391"}))) .andExpect(status().isOk()); }
Source:
<code><START> private String getResult(QueryResult result, String propertyName) throws RepositoryException { <END> StringBuilder buff = new StringBuilder(); RowIterator it = result.getRows(); while (it.hasNext()) { if (buff.length() > 0) { buff.append(", "); } buff.append(it.nextRow().getValue(propertyName).getString()); } return buff.toString(); }</code><technical_language>I this static... helper methods static please</technical_language>

Target:
private static String getResult(QueryResult result, String propertyName) throws RepositoryException { StringBuilder buff = new StringBuilder(); RowIterator it = result.getRows(); while (it.hasNext()) { if (buff.length() > 0) { buff.append(", "); } buff.append(it.nextRow().getValue(propertyName).getString()); } return buff.toString(); }
Source:
<code>protected void doStart() throws Exception { <START> if (this.processor instanceof ServiceSupport) { <END> ((ServiceSupport)this.processor).start(); } }</code><technical_language>ServiceHelper.startService / ditto for stop. need for instanceof check</technical_language>

Target:
protected void doStart() throws Exception { ServiceHelper.startService(this.processor); }
Source:
<code>public boolean isExcluded(File file) { boolean isMinified = new MinificationAssessor(getEncoding()).isMinified(file); if (isMinified) { <START> LOG.debug("File [" + file.getAbsolutePath() + "] is minified"); <END> } return isMinified; }</code><technical_language>@ivandalbosco Suggested message: file.getAbsolutePath() + " a minified file analyzed"</technical_language>

Target:
public boolean isExcluded(File file) { boolean isMinified = new MinificationAssessor(getEncoding()).isMinified(file); if (isMinified) { LOG.debug("File [" + file.getAbsolutePath() + "] looks like a minified file and will not be analyzed"); } return isMinified; }
Source:
<code>public void testLocaleIsSupported() { final String language = DEFAULT_LOCALE.getLanguage(); <START> if (!Locale.ROOT.getLanguage().equals(language) <END> && !Locale.ENGLISH.getLanguage().equals(language)) { final LocalizedMessage localizedMessage = createSampleLocalizedMessage(); assertThat("Unsupported language: " + DEFAULT_LOCALE, localizedMessage.getMessage(), not("Empty statement.")); } }</code><technical_language>I check for language.isEmpty() is , in other tests, a family</technical_language>

Target:
public void testLocaleIsSupported() { final String language = DEFAULT_LOCALE.getLanguage(); if (!language.isEmpty() && !Locale.ENGLISH.getLanguage().equals(language)) { final LocalizedMessage localizedMessage = createSampleLocalizedMessage(); assertThat("Unsupported language: " + DEFAULT_LOCALE, localizedMessage.getMessage(), not("Empty statement.")); } }
Source:
<code>public ResponseEntity setServerSettings(@RequestBody @Validated ServerSettingsForm serverSettingsForm, BindingResult bindingResult, @RequestHeader(HttpHeaders.ACCEPT) String acceptHeader) { if (bindingResult.hasErrors()) { throw new RequestBodyValidationException(FAILED_SAVE_SERVER_SETTINGS, bindingResult); } configurationManagementService.setBaseUrl(serverSettingsForm.getBaseUrl()); configurationManagementService.setPort(serverSettingsForm.getPort()); <START> return ResponseEntity.ok(getResponseEntityBody(SUCCESSFUL_SAVE_SERVER_SETTINGS, acceptHeader)); <END> }</code><technical_language>This return getSuccessfulResponseEntity(SUCCESSFUL_SAVE_SERVER_SETTINGS, acceptHeader) :)</technical_language>

Target:
public ResponseEntity setServerSettings(@RequestBody @Validated ServerSettingsForm serverSettingsForm, BindingResult bindingResult, @RequestHeader(HttpHeaders.ACCEPT) String acceptHeader) { if (bindingResult.hasErrors()) { throw new RequestBodyValidationException(FAILED_SAVE_SERVER_SETTINGS, bindingResult); } configurationManagementService.setBaseUrl(serverSettingsForm.getBaseUrl()); configurationManagementService.setPort(serverSettingsForm.getPort()); return getSuccessfulResponseEntity(SUCCESSFUL_SAVE_SERVER_SETTINGS, acceptHeader); }
Source:
<code>public static @Nullable Set<Integer> getActiveThreadsForRange(KernelAnalysisModule module, long rangeStart, long rangeEnd) { ITmfStateSystem ss = module.getStateSystem(); if (ss == null) { return null; } List<ITmfStateInterval> fullQueryAtStart; int threadsQuark; try { fullQueryAtStart = ss.queryFullState(rangeStart); threadsQuark = ss.getQuarkAbsolute(Attributes.THREADS); } catch (AttributeNotFoundException | StateSystemDisposedException e) { return null; } List<Integer> threadQuarks = ss.getSubAttributes(threadsQuark, false); return threadQuarks.stream() .filter(threadQuark -> { ITmfStateInterval intervalAtStart = fullQueryAtStart.get(threadQuark); if (IS_STATE_VALUE_ACTIVE.test(intervalAtStart.getStateValue())) { return true; } if (intervalAtStart.getEndTime() >= rangeEnd) { return false; } QuarkIterator it = new QuarkIterator(ss, threadQuark, rangeStart, rangeEnd); <START> while (it.hasNext()) { ITmfStateInterval interval = it.next(); if (IS_STATE_VALUE_ACTIVE.test(interval.getStateValue())) { return true; } } return false; <END> }) .map(ss::getAttributeName) .filter(attribName -> !attribName.startsWith(Attributes.THREAD_0_PREFIX)) .map(Integer::parseInt) .collect(Collectors.toSet()); }</code><technical_language>Iterators.any</technical_language>

Target:
public static @Nullable Set<Integer> getActiveThreadsForRange(KernelAnalysisModule module, long rangeStart, long rangeEnd) { ITmfStateSystem ss = module.getStateSystem(); if (ss == null) { return null; } List<ITmfStateInterval> fullQueryAtStart; int threadsQuark; try { fullQueryAtStart = ss.queryFullState(rangeStart); threadsQuark = ss.getQuarkAbsolute(Attributes.THREADS); } catch (AttributeNotFoundException | StateSystemDisposedException e) { return null; } List<Integer> threadQuarks = ss.getSubAttributes(threadsQuark, false); return threadQuarks.stream() .filter(threadQuark -> { ITmfStateInterval intervalAtStart = fullQueryAtStart.get(threadQuark); if (IS_STATE_VALUE_ACTIVE.test(intervalAtStart.getStateValue())) { return true; } if (intervalAtStart.getEndTime() >= rangeEnd) { return false; } Iterator<ITmfStateInterval> it = new QuarkIterator(ss, threadQuark, rangeStart, rangeEnd); return Iterators.any(it, interval -> IS_STATE_VALUE_ACTIVE.test(interval.getStateValue())); }) .map(ss::getAttributeName) .filter(attribName -> !attribName.startsWith(Attributes.THREAD_0_PREFIX)) .map(Integer::parseInt) .collect(Collectors.toSet()); }
Source:
<code>public void testDoesNotMarkBuildIfPromotionNotGoodEnough() throws Exception { FreeStyleProject upJob = createProject("up"); upJob.getBuildersList().add(successfulBuilder()); FreeStyleProject downJob = createProject("down"); downJob.getBuildersList().add(successfulBuilder()); PromotionProcess promotionJob = createDownstreamSuccessPromotion(upJob, downJob); promotionJob.getBuildSteps().add(new FixedResultBuilder(Result.FAILURE)); promotionJob.getBuildSteps().add(new KeepBuildForeverAction()); <START> for (ItemListener l : ItemListener.all()) { <END> l.onLoaded(); } FreeStyleBuild upBuild = assertBuildStatusSuccess(upJob.scheduleBuild2(0).get()); assertFalse(upBuild.isKeepLog()); assertBuildStatusSuccess(downJob.scheduleBuild2(0).get()); waitForBuild(promotionJob, 1); assertFalse(upBuild.isKeepLog()); }</code><technical_language>crappy. is reason of call</technical_language>

Target:
public void testDoesNotMarkBuildIfPromotionNotGoodEnough() throws Exception { FreeStyleProject upJob = createProject("up"); upJob.getBuildersList().add(successfulBuilder()); FreeStyleProject downJob = createProject("down"); downJob.getBuildersList().add(successfulBuilder()); PromotionProcess promotionJob = createDownstreamSuccessPromotion(upJob, downJob); promotionJob.getBuildSteps().add(new FixedResultBuilder(Result.FAILURE)); promotionJob.getBuildSteps().add(new KeepBuildForeverAction()); fireItemListeners(); FreeStyleBuild upBuild = assertBuildStatusSuccess(upJob.scheduleBuild2(0).get()); assertFalse(upBuild.isKeepLog()); assertBuildStatusSuccess(downJob.scheduleBuild2(0).get()); waitForBuild(promotionJob, 1); assertFalse(upBuild.isKeepLog()); }
Source:
<code>protected String getSource(String geneId) { if (!geneId.startsWith("ENS")) { <START> return "refseq"; <END> } return "ensembl"; }</code><technical_language>a centralised enum for source? This is stable (actually change), ensure consistency in parts of code (WS, Managers, Adaptors, ...)</technical_language>

Target:
protected String getSource(String geneId) { if (!geneId.startsWith("ENS")) { return VariantDBAdaptor.QueryParams.REFSEQ.key(); } return VariantDBAdaptor.QueryParams.ENSEMBL.key(); }
Source:
<code>public void setUp() throws InjectionException { final Injector injector1 = Tang.Factory.getTang().newInjector(); final String masterHostname = injector1.getNamedInstance(MasterHostname.class); final int taskToMasterPort = injector1.getNamedInstance(TaskToMasterPort.class); final TaskToMasterMessage message = new MockTaskToMasterServer(); <START> mockMasterServer = AvroUtils.createAvroServer(TaskToMasterMessage.class, message, <END> new InetSocketAddress(masterHostname, taskToMasterPort)); final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder(); jcb.bindNamedParameter(DefaultNumEventProcessors.class, Integer.toString(DEFAULT_NUM_THREADS)); jcb.bindNamedParameter(EventProcessorUpperBound.class, Integer.toString(MAX_NUM_THREADS)); jcb.bindNamedParameter(EventProcessorLowerBound.class, Integer.toString(MIN_NUM_THREADS)); jcb.bindNamedParameter(GracePeriod.class, Integer.toString(0)); jcb.bindImplementation(EventProcessorFactory.class, TestEventProcessorFactory.class); groupRebalancer = mock(GroupRebalancer.class); groupBalancer = new TestGroupAssigner(); final Injector injector2 = Tang.Factory.getTang().newInjector(jcb.build()); injector2.bindVolatileInstance(GroupRebalancer.class, groupRebalancer); injector2.bindVolatileInstance(GroupAssigner.class, groupBalancer); eventProcessorManager = injector2.getInstance(DefaultEventProcessorManager.class); groupAllocationTableModifier = injector2.getInstance(GroupAllocationTableModifier.class); }</code><technical_language>do need this</technical_language>

Target:
public void setUp() throws InjectionException { final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder(); jcb.bindNamedParameter(DefaultNumEventProcessors.class, Integer.toString(DEFAULT_NUM_THREADS)); jcb.bindNamedParameter(EventProcessorUpperBound.class, Integer.toString(MAX_NUM_THREADS)); jcb.bindNamedParameter(EventProcessorLowerBound.class, Integer.toString(MIN_NUM_THREADS)); jcb.bindNamedParameter(GracePeriod.class, Integer.toString(0)); jcb.bindImplementation(EventProcessorFactory.class, TestEventProcessorFactory.class); groupRebalancer = mock(GroupRebalancer.class); groupBalancer = new TestGroupAssigner(); groupIdRequestor = mock(GroupIdRequestor.class); final Injector injector = Tang.Factory.getTang().newInjector(jcb.build()); injector.bindVolatileInstance(GroupRebalancer.class, groupRebalancer); injector.bindVolatileInstance(GroupAssigner.class, groupBalancer); injector.bindVolatileInstance(GroupIdRequestor.class, groupIdRequestor); eventProcessorManager = injector.getInstance(DefaultEventProcessorManager.class); groupAllocationTableModifier = injector.getInstance(GroupAllocationTableModifier.class); }
Source:
<code>public static LicenseInformation getLicenseInformation(GitHub gitHub, String repositoryName) { LicenseInformation licenseInformation = new LicenseInformation(); try { GHRepository repository = gitHub.getRepository(repositoryName); GHLicense license = repository.getLicense(); if (license == null) { <START> return new LicenseInformation(); <END> } licenseInformation.setLicenseName(license.getName()); return licenseInformation; } catch (IOException e) { return new LicenseInformation(); } }</code><technical_language>empty LicenseInformation line 99</technical_language>

Target:
public static LicenseInformation getLicenseInformation(GitHub gitHub, String repositoryName) { try { GHRepository repository = gitHub.getRepository(repositoryName); GHLicense license = repository.getLicense(); if (license == null) { return new LicenseInformation(); } LicenseInformation licenseInformation = new LicenseInformation(); licenseInformation.setLicenseName(license.getName()); return licenseInformation; } catch (IOException e) { LOG.info("Could not get license information from GitHub for repository: " + repositoryName, e); return new LicenseInformation(); } }
Source:
<code>private void addPendingData(Collection<Data> data) { Collection<Data> filteredData = data; if (distributed) { filteredData = new ArrayList<>(data); for (Iterator<Data> i = filteredData.iterator(); i.hasNext(); ) { Data d = i.next(); if (!alertsEngineCache.isDataIdActive(d.getId())) { i.remove(); } } <START> } else <END> synchronized (pendingData) { pendingData.addAll(filteredData); } }</code><technical_language>This "else" created a nice debugging session :-)</technical_language>

Target:
private void addPendingData(Collection<Data> data) { Collection<Data> filteredData = data; if (distributed) { filteredData = new ArrayList<>(data); for (Iterator<Data> i = filteredData.iterator(); i.hasNext(); ) { Data d = i.next(); if (!alertsEngineCache.isDataIdActive(d.getId())) { i.remove(); } } } synchronized (pendingData) { pendingData.addAll(filteredData); } }
Source:
<code>protected String retrieveResponseFromServer(final URL validationUrl, final String ticket) { final String request = String.format( SAML_REQUEST_TEMPLATE, generateId(), CommonUtils.formatForUtcTime(new Date()), ticket); HttpURLConnection conn = null; try { conn = this.getURLConnectionFactory().buildHttpURLConnection(validationUrl.openConnection()); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "text/xml"); <START> conn.setRequestProperty("Content-Type", "text/xml"); <END> conn.setRequestProperty("Content-Length", Integer.toString(request.length())); conn.setRequestProperty("SOAPAction", "<LINK_0>"); conn.setUseCaches(false); conn.setDoInput(true); conn.setDoOutput(true); final Charset charset = CommonUtils.isNotBlank(getEncoding()) ? Charset.forName(getEncoding()) : IOUtils.UTF8; conn.getOutputStream().write(request.getBytes(charset)); conn.getOutputStream().flush(); return IOUtils.readString(conn.getInputStream(), charset); } catch (final IOException e) { throw new RuntimeException("IO error sending HTTP request to /samlValidate", e); } finally { if (conn != null) { conn.disconnect(); } } }</code><technical_language>This line is one</technical_language>

Target:
protected String retrieveResponseFromServer(final URL validationUrl, final String ticket) { final String request = String.format( SAML_REQUEST_TEMPLATE, generateId(), SamlUtils.formatForUtcTime(new Date()), ticket); HttpURLConnection conn = null; try { conn = this.getURLConnectionFactory().buildHttpURLConnection(validationUrl.openConnection()); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "text/xml"); conn.setRequestProperty("Content-Length", Integer.toString(request.length())); conn.setRequestProperty("SOAPAction", "<LINK_0>"); conn.setUseCaches(false); conn.setDoInput(true); conn.setDoOutput(true); final Charset charset = CommonUtils.isNotBlank(getEncoding()) ? Charset.forName(getEncoding()) : IOUtils.UTF8; conn.getOutputStream().write(request.getBytes(charset)); conn.getOutputStream().flush(); return IOUtils.readString(conn.getInputStream(), charset); } catch (final IOException e) { throw new RuntimeException("IO error sending HTTP request to /samlValidate", e); } finally { if (conn != null) { conn.disconnect(); } } }
Source:
<code>private void fillReferencePointManager( IReferencePointManager referencePointManager, IProject project) { referencePointManager.putIfAbsent(project.getReferencePoint(), project); intelliJReferencePointManager.putIfAbsent( <START> project.getReferencePoint(), ((IntelliJProjectImpl) project).getModule()); <END> }</code><technical_language>IResource.adaptTo(Class)</technical_language>

Target:
private void fillReferencePointManager( IReferencePointManager referencePointManager, IProject project) { referencePointManager.putIfAbsent(project.getReferencePoint(), project); intelliJReferencePointManager.putIfAbsent( project.getReferencePoint(), project.adaptTo(IntelliJProjectImpl.class).getModule()); }
Source:
<code>static Settings filter(Settings originalSettings) { Settings.Builder settings = Settings.builder().put(originalSettings); settings.remove(CcrSettings.CCR_FOLLOWING_INDEX_SETTING.getKey()); settings.remove(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey()); settings.remove(IndexMetadata.SETTING_INDEX_VERSION_CREATED.getKey()); settings.remove(IndexMetadata.SETTING_INDEX_UUID); <START> settings.remove(IndexMetadata.SETTING_RESTORE_UUID); <END> settings.remove(IndexMetadata.SETTING_INDEX_PROVIDED_NAME); settings.remove(IndexMetadata.SETTING_CREATION_DATE); settings.remove(IndexMetadata.SETTING_VERSION_UPGRADED); settings.remove(IndexMetadata.SETTING_VERSION_UPGRADED_STRING); Iterator<String> iterator = settings.keys().iterator(); while (iterator.hasNext()) { String key = iterator.next(); for (Setting<?> whitelistedSetting : NON_REPLICATED_SETTINGS) { if (whitelistedSetting.match(key)) { iterator.remove(); break; } } } return settings.build(); }</code><technical_language>remove this setting clone/split/shrink well</technical_language>

Target:
static Settings filter(Settings originalSettings) { Settings.Builder settings = Settings.builder().put(originalSettings); settings.remove(CcrSettings.CCR_FOLLOWING_INDEX_SETTING.getKey()); settings.remove(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey()); settings.remove(IndexMetadata.SETTING_INDEX_VERSION_CREATED.getKey()); settings.remove(IndexMetadata.SETTING_INDEX_UUID); settings.remove(IndexMetadata.SETTING_HISTORY_UUID); settings.remove(IndexMetadata.SETTING_INDEX_PROVIDED_NAME); settings.remove(IndexMetadata.SETTING_CREATION_DATE); settings.remove(IndexMetadata.SETTING_VERSION_UPGRADED); settings.remove(IndexMetadata.SETTING_VERSION_UPGRADED_STRING); Iterator<String> iterator = settings.keys().iterator(); while (iterator.hasNext()) { String key = iterator.next(); for (Setting<?> whitelistedSetting : NON_REPLICATED_SETTINGS) { if (whitelistedSetting.match(key)) { iterator.remove(); break; } } } return settings.build(); }
Source:
<code>public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey("<replace-with-your-text-analytics-key-here>") <START> .endpoint("<replace-with-your-text-analytics-endpoint-here>") <END> .buildClient(); String text = "The hotel was dark and unclean."; final AnalyzeSentimentResult sentimentResult = client.analyzeSentiment(text); final TextSentiment documentSentiment = sentimentResult.getDocumentSentiment(); System.out.printf( "Recognized sentiment: %s, positive score: %s, neutral score: %s, negative score: %s.%n", documentSentiment.getTextSentimentClass(), documentSentiment.getPositiveScore(), documentSentiment.getNeutralScore(), documentSentiment.getNegativeScore()); final List<TextSentiment> sentiments = sentimentResult.getSentenceSentiments(); for (TextSentiment textSentiment : sentiments) { System.out.printf( "Recognized sentence sentiment: %s, positive score: %s, neutral score: %s, negative score: %s.%n", textSentiment.getTextSentimentClass(), textSentiment.getPositiveScore(), textSentiment.getNeutralScore(), textSentiment.getNegativeScore()); } }</code><technical_language>I other better. shows example of look</technical_language>

Target:
public static void main(String[] args) { TextAnalyticsClient client = new TextAnalyticsClientBuilder() .subscriptionKey("{subscription_key}") .endpoint("https://{servicename}.cognitiveservices.azure.com/") .buildClient(); String text = "The hotel was dark and unclean."; final AnalyzeSentimentResult sentimentResult = client.analyzeSentiment(text); final TextSentiment documentSentiment = sentimentResult.getDocumentSentiment(); System.out.printf( "Recognized sentiment: %s, positive score: %s, neutral score: %s, negative score: %s.%n", documentSentiment.getTextSentimentClass(), documentSentiment.getPositiveScore(), documentSentiment.getNeutralScore(), documentSentiment.getNegativeScore()); for (TextSentiment textSentiment : sentimentResult.getSentenceSentiments()) { System.out.printf( "Recognized sentence sentiment: %s, positive score: %s, neutral score: %s, negative score: %s.%n", textSentiment.getTextSentimentClass(), textSentiment.getPositiveScore(), textSentiment.getNeutralScore(), textSentiment.getNegativeScore()); } }
Source:
<code>public static void purgeExpiredJobs(String workflow, Set<String> expiredJobs, HelixManager manager, RebalanceScheduler rebalanceScheduler) { Set<String> failedJobRemovals = new HashSet<>(); for (String job : expiredJobs) { if (!TaskUtil .removeJob(manager.getHelixDataAccessor(), manager.getHelixPropertyStore(), job)) { failedJobRemovals.add(job); LOG.warn("Failed to clean up expired and completed jobs from workflow " + workflow); } rebalanceScheduler.removeScheduledRebalance(job); } expiredJobs.removeAll(failedJobRemovals); if (!TaskUtil.removeJobsFromDag(manager.getHelixDataAccessor(), workflow, expiredJobs, true)) { LOG.warn("Error occurred while trying to remove jobs + " + expiredJobs + " from the workflow " + workflow); } <START> if (expiredJobs.size() > 0) { <END> HelixDataAccessor accessor = manager.getHelixDataAccessor(); List<String> resourceConfigs = accessor.getChildNames(accessor.keyBuilder().resourceConfigs()); if (resourceConfigs.size() > 0) { RebalanceUtil.scheduleOnDemandPipeline(manager.getClusterName(), 0L); } else { LOG.warn("No resource config to trigger rebalance for clean up contexts for" + expiredJobs); } } }</code><technical_language>concern is if move logic function stage. clean logic dedicated pipeline. some want call purge REST do a job purge. able do it</technical_language>

Target:
public static void purgeExpiredJobs(String workflow, Set<String> expiredJobs, HelixManager manager, RebalanceScheduler rebalanceScheduler) { Set<String> failedJobRemovals = new HashSet<>(); for (String job : expiredJobs) { if (!TaskUtil .removeJob(manager.getHelixDataAccessor(), manager.getHelixPropertyStore(), job)) { failedJobRemovals.add(job); LOG.warn("Failed to clean up expired and completed jobs from workflow {}!", workflow); } rebalanceScheduler.removeScheduledRebalance(job); } expiredJobs.removeAll(failedJobRemovals); if (!TaskUtil.removeJobsFromDag(manager.getHelixDataAccessor(), workflow, expiredJobs, true)) { LOG.warn("Error occurred while trying to remove jobs from the workflow {}!", expiredJobs, workflow); } if (expiredJobs.size() > 0) { HelixDataAccessor accessor = manager.getHelixDataAccessor(); List<String> resourceConfigs = accessor.getChildNames(accessor.keyBuilder().resourceConfigs()); if (resourceConfigs.size() > 0) { RebalanceUtil.scheduleOnDemandPipeline(manager.getClusterName(), 0L); } else { LOG.warn("No resource config to trigger rebalance for clean up contexts for {}!", expiredJobs); } } }
Source:
<code>public synchronized void close() throws IOException { if (closed) { return; } closeData(); <START> BCFile.Writer.BlockAppender mba = fileWriter.prepareMetaBlock("RFile.index"); <END> mba.writeInt(RINDEX_MAGIC); mba.writeInt(RINDEX_VER_8); if (currentLocalityGroup != null) { localityGroups.add(currentLocalityGroup); sampleGroups.add(sampleLocalityGroup); } mba.writeInt(localityGroups.size()); for (LocalityGroupMetadata lc : localityGroups) { lc.write(mba); } if (samplerConfig == null) { mba.writeBoolean(false); } else { mba.writeBoolean(true); for (LocalityGroupMetadata lc : sampleGroups) { lc.write(mba); } samplerConfig.write(mba); } mba.close(); fileWriter.close(); length = fileWriter.getLength(); closed = true; }</code><technical_language>BlockAppender import</technical_language>

Target:
public synchronized void close() throws IOException { if (closed) { return; } closeData(); BlockAppender mba = fileWriter.prepareMetaBlock("RFile.index"); mba.writeInt(RINDEX_MAGIC); mba.writeInt(RINDEX_VER_8); if (currentLocalityGroup != null) { localityGroups.add(currentLocalityGroup); sampleGroups.add(sampleLocalityGroup); } mba.writeInt(localityGroups.size()); for (LocalityGroupMetadata lc : localityGroups) { lc.write(mba); } if (samplerConfig == null) { mba.writeBoolean(false); } else { mba.writeBoolean(true); for (LocalityGroupMetadata lc : sampleGroups) { lc.write(mba); } samplerConfig.write(mba); } mba.close(); fileWriter.close(); length = fileWriter.getLength(); closed = true; }
Source:
<code>public void testIllegalClassessRegularExpression() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(IllegalImportCheck.class); <START> checkConfig.addAttribute("illegalClasses", "^java\\.util\\.(List|Arrays).*"); <END> checkConfig.addAttribute("regexp", "true"); final String[] expected = { "12:1: " + getCheckMessage(MSG_KEY, "java.util.List"), "13:1: " + getCheckMessage(MSG_KEY, "java.util.List"), "17:1: " + getCheckMessage(MSG_KEY, "java.util.Arrays"), }; verify(checkConfig, getPath("InputIllegalImport.java"), expected); }</code><technical_language>is .* needed? of violations pick .* is needed</technical_language>

Target:
public void testIllegalClassessRegularExpression() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(IllegalImportCheck.class); checkConfig.addAttribute("illegalPkgs", ""); checkConfig.addAttribute("illegalClasses", "^java\\.util\\.(List|Arrays)"); checkConfig.addAttribute("regexp", "true"); final String[] expected = { "12:1: " + getCheckMessage(MSG_KEY, "java.util.List"), "13:1: " + getCheckMessage(MSG_KEY, "java.util.List"), "17:1: " + getCheckMessage(MSG_KEY, "java.util.Arrays"), }; verify(checkConfig, getPath("InputIllegalImport.java"), expected); }
Source:
<code>DruidErrorCode(int code, ErrorType type) { <START> errorCode = new ErrorCode(code + 0x0100_0000, name(), type); <END> }</code><technical_language>0x0100 is right error code. Check for PinotErrorCode other connectors' error code. greater 0x0505</technical_language>

Target:
DruidErrorCode(int code, ErrorType type) { errorCode = new ErrorCode(code + 0x0506_0000, name(), type); }
Source:
<code>public List<PartitionDescProto> getPartitionsByAlgebra(PartitionsByAlgebraProto request) throws <START> UndefinedDatabaseException, UndefinedTableException, UndefinedPartitionMethodException, <END> UndefinedOperatorException { try { final BlockingInterface stub = getStub(); GetPartitionsResponse response = stub.getPartitionsByAlgebra(null, request); ensureOk(response.getState()); return response.getPartitionList(); } catch (ServiceException e) { LOG.error(e.getMessage(), e); return null; } }</code><technical_language>handle exceptions, put throwsIfThisError method for exceptions. Please refer <LINK_0></technical_language>

Target:
public List<PartitionDescProto> getPartitionsByAlgebra(PartitionsByAlgebraProto request) throws UndefinedDatabaseException, UndefinedTableException, UndefinedPartitionMethodException { try { final BlockingInterface stub = getStub(); GetPartitionsResponse response = stub.getPartitionsByAlgebra(null, request); throwsIfThisError(response.getState(), UndefinedDatabaseException.class); throwsIfThisError(response.getState(), UndefinedTableException.class); throwsIfThisError(response.getState(), UndefinedPartitionMethodException.class); ensureOk(response.getState()); return response.getPartitionList(); } catch (ServiceException e) { LOG.error(e.getMessage(), e); return null; } }
Source:
<code>public void requestBegin(HttpClientRequest request) { if (!isEnabled()) return; <START> timings.put(request, time(null, null)); <END> }</code><technical_language>called (null, null) - method URI is account</technical_language>

Target:
public void requestBegin(HttpClientRequest request) { if (!isEnabled()) return; timings.put(request, time(request.method(), request.uri())); }
Source:
<code>private void handleMessageWaiting(EslEvent event) { logger.debug(String.format("MWI event\\n %s", event.toString())); for(String key : event.getEventHeaders().keySet()){ logger.debug(String.format("MWI Message header %s : %s", key,event.getEventHeaders().get(key))); } String account = null; try { account = URLDecoder.decode(getHeader(event, FS_MWI_ACCOUNT), "UTF-8"); } catch (UnsupportedEncodingException e) { logger.error("Could not decode account", e); return; } <START> boolean waiting = "yes".equalsIgnoreCase(getHeader(event, FS_MWI_WAITING)); <END> String messagesString = getHeader(event, FS_MWI_MESSAGE); logger.debug(String.format("Message header: %s", messagesString)); if(StringUtils.isBlank(messagesString)){ logger.warn("Invalid message string, aborting"); return; } Pattern pattern = Pattern.compile("([0-9]+)/([0-9]+)\\s\\([0-9]+\\/[0-9]+\\)"); Matcher matcher = pattern.matcher(messagesString); int messages = 0; if(matcher.matches()){ logger.debug("trying to parse message number"); try { messages = Integer.parseInt(matcher.group(1)); } catch (Exception e) { logger.warn("Could not parse message number", e); } } logger.debug(String.format("Updating MWI to %d VMs", messages)); mwiCache.put(account, new MWIModel(waiting, messages)); updateMessageWaitingItems(); }</code><technical_language>"yes" keyword. create a constant (if more keywords provided) add enumeration class</technical_language>

Target:
private void handleMessageWaiting(EslEvent event) { logger.debug("MWI event\\n {}", event.toString()); for(String key : event.getEventHeaders().keySet()){ logger.debug("MWI Message header : {}", key,event.getEventHeaders().get(key)); } String account = null; try { account = URLDecoder.decode(getHeader(event, MWI_ACCOUNT), "UTF-8"); } catch (UnsupportedEncodingException e) { logger.error("Could not decode account for event : {}", event, e); return; } boolean waiting = "yes".equalsIgnoreCase(getHeader(event, MWI_WAITING)); String messagesString = getHeader(event, MWI_MESSAGE); logger.debug("Message header: {}", messagesString); if(StringUtils.isBlank(messagesString)){ logger.debug("message is not for us."); return; } Pattern pattern = Pattern.compile("([0-9]+)/([0-9]+)\\s\\([0-9]+\\/[0-9]+\\)"); Matcher matcher = pattern.matcher(messagesString); int messages = 0; if(matcher.matches()){ logger.debug("trying to parse message number ", matcher.group(1)); try { messages = Integer.parseInt(matcher.group(1)); } catch (Exception e) { logger.warn("Could not parse message number from message : {}", messagesString, e); } } logger.debug("Updating MWI to VMs", messages); mwiCache.put(account, new MWIModel(waiting, messages)); updateMessageWaitingItems(); }
Source:
<code>public IContext2D toContext2D(final AbstractCanvasHandler canvasHandler, final CanvasExportSettings settings) { <START> final LienzoLayer layer = getLayer(canvasHandler); <END> final com.ait.lienzo.client.core.shape.Layer lienzoLayer = layer.getLienzoLayer(); final int[] bounds = boundsProvider.compute(layer, settings); final IContext2D svgContext2D = Context2DFactory.create(new SvgExportSettings(bounds[0], bounds[1], lienzoLayer.getContext())); lienzoLayer.draw(); lienzoLayer.draw(new Context2D(new DelegateNativeContext2D(svgContext2D, canvasHandler))); lienzoLayer.draw(); return svgContext2D; }</code><technical_language>Method is covered</technical_language>

Target:
public IContext2D toContext2D(final AbstractCanvasHandler canvasHandler, final CanvasExportSettings settings) { final LienzoLayer layer = getLayer(canvasHandler); final com.ait.lienzo.client.core.shape.Layer lienzoLayer = layer.getLienzoLayer(); final Viewport viewport = lienzoLayer.getViewport(); final int[] bounds = boundsProvider.compute(layer, settings); final IContext2D svgContext2D = Context2DFactory.create(new SvgExportSettings(bounds[2], bounds[3], lienzoLayer.getContext())); final Transform transform = viewport.getTransform(); viewport.setTransform(new Transform()); lienzoLayer.draw(new Context2D(new DelegateNativeContext2D(svgContext2D, canvasHandler))); viewport.setTransform(transform); return svgContext2D; }
Source:
<code>public StoredProcExecutor(DataSource dataSource) { Assert.notNull(dataSource, "dataSource must not be null."); this.dataSource = dataSource; if (!guavaPresent) { <START> this.jdbcCallOperationsMap = new LinkedHashMap<String, SimpleJdbcCallOperations>() { <END> @Override protected boolean removeEldestEntry(Entry<String, SimpleJdbcCallOperations> eldest) { return size() > jdbcCallOperationsCacheSize; } }; } else { this.jdbcCallOperationsMap = null; } }</code><technical_language>SuppressWarnings("serial") Also, need new LinkedHashMap<String, SimpleJdbcCallOperations>(this.jdbcCallOperationsCacheSize + 1, 0.75f, true) {...} enable LRU processing</technical_language>

Target:
public StoredProcExecutor(DataSource dataSource) { Assert.notNull(dataSource, "dataSource must not be null."); this.dataSource = dataSource; }
Source:
<code>private void postError(final ObjectServerError error) { if (callback != null) { handler.post(new Runnable() { @Override public void run() { try { callback.onError(error); } catch (Exception e) { <START> RealmLog.debug("onError has thrown an exception that is being ignored: %s", Util.getStackTrace(e)); <END> } } }); } }</code><technical_language>RealmLog.debug(e, "onError thrown exception is ignored");</technical_language>

Target:
private void postError(final ObjectServerError error) { boolean errorHandled = false; if (callback != null) { Runnable action = new Runnable() { @Override public void run() { callback.onError(error); } }; errorHandled = handler.post(action); } if (!errorHandled) { RealmLog.error(error, "An error was thrown, but could not be handled."); } }
Source:
<code>private Flavor getFlavor() { <START> return flavorApi.list().iterator().next(); <END> }</code><technical_language>Iterables.getFirst() instead</technical_language>

Target:
private Flavor getFlavor() { return Iterables.getFirst(flavorApi.list(), null); }
Source:
<code>public boolean isOpened() { switchToAuthModalHandle(); <START> boolean isOpenedResult = registerAuthModal.isDisplayed(); <END> switchToMainWindowHandle(); return isOpenedResult; }</code><technical_language>I potential risk false, displayed YET... suggest adding try for waiting for element visible, switching main window handle returning true (or registerAuthModal.isDisplayed() ) catching NoSuchElementException - switching main window returning false. do think</technical_language>

Target:
public boolean isOpened() { switchToAuthModalHandle(); try { wait.forElementVisible(registerAuthModal); } catch (NoSuchElementException e) { PageObjectLogging.logInfo("Register Auth Modal is not displayed"); return false; } switchToMainWindowHandle(); return true; }
Source:
<code>public void afterAdded(@NotNull RangeHighlighterEx rangeHighlighterEx) { if (rangeHighlighterEx.getLayer() == HighlighterLayer.WARNING) { <START> addCreatedWarning(StaticAnalysisType.UNKNOWN); <END> } }</code><technical_language>discussed handle this in a meeting</technical_language>

Target:
public void afterAdded(@NotNull RangeHighlighterEx rangeHighlighterEx) { if (rangeHighlighterEx.getLayer() == HighlighterLayer.WARNING) { this.generatedWarnings.add(rangeHighlighterEx); } }
Source:
<code>private Boolean hasJoinedCluster() { <START> return Optional.fromNullable(entity.getAttribute(RiakNode.RIAK_NODE_HAS_JOINED_CLUSTER)).or(Boolean.FALSE); <END> }</code><technical_language>call getEntity().hasJoinedCluster() moving code RiakNode mentioned</technical_language>

Target:
private Boolean hasJoinedCluster() { return ((RiakNode) entity).hasJoinedCluster(); }
Source:
<code>private void prepareDnsTlsMeasurement(String hostname, InetAddress target) { <START> if (!mDnsTlsChecks.containsKey(target) <END> || !TextUtils.isEmpty(hostname)) { Measurement measurement = new Measurement(); measurement.thread = new Thread(new DnsTlsCheck(hostname, target, measurement)); mDnsTlsChecks.put(target, measurement); } }</code><technical_language>Style : prefer write code in a return-fast style. if (mDnsTlsChecks.containsKey(target) && TextUtils.isEmpty(hostname)) return; Note in this case clearer reversed check a bizarre test. want overwrite, if hostname is empty ?</technical_language>

Target:
private void prepareDnsTlsMeasurement(String hostname, InetAddress target) { if (mDnsTlsChecks.containsKey(target) && TextUtils.isEmpty(hostname)) return; Measurement measurement = new Measurement(); measurement.thread = new Thread(new DnsTlsCheck(hostname, target, measurement)); mDnsTlsChecks.put(target, measurement); }
Source:
<code>public void testScheduleWork() throws WorkException, InterruptedException { <START> log.info("Running testScheduleWork()"); <END> long startTime = System.currentTimeMillis(); int scheduleWorkAcceptedServer1 = server1Proxy.getScheduleWorkAccepted(); int scheduleWorkAcceptedServer2 = server2Proxy.getScheduleWorkAccepted(); int distributedScheduleWorkAccepted = server2Proxy.getDistributedScheduleWorkAccepted(); for (int i = 0; i < SRT_MAX_THREADS + 1; i++) { server1Proxy.scheduleWork(new LongWork().setName("testScheduleWork-work" + (i + 1))); } Assert.assertTrue("Expected time < " + (startTime + LongWork.WORK_TIMEOUT) + ", actual: " + System.currentTimeMillis(), startTime + LongWork.WORK_TIMEOUT > System.currentTimeMillis()); Thread.sleep(LongWork.WORK_TIMEOUT * 2 + 100); logWorkStats(); Assert.assertTrue("Expected scheduleWorkAccepted = " + (scheduleWorkAcceptedServer1 + SRT_MAX_THREADS + 1) + " but was: " + server1Proxy.getScheduleWorkAccepted(), (server1Proxy.getScheduleWorkAccepted() == scheduleWorkAcceptedServer1 + SRT_MAX_THREADS + 1) && (server2Proxy.getScheduleWorkAccepted() == scheduleWorkAcceptedServer2)); }</code><technical_language>remove others</technical_language>

Target:
public void testScheduleWork() throws WorkException, InterruptedException { int scheduleWorkAcceptedServer1 = server1Proxy.getScheduleWorkAccepted(); int distributedScheduleWorkAccepted = server2Proxy.getDistributedScheduleWorkAccepted(); for (int i = 0; i < SRT_MAX_THREADS + 1; i++) { server1Proxy.scheduleWork(new LongWork()); } Assert.assertTrue("Work did not finish in the expected time on the expected node", waitForScheduleWork(server1Proxy, scheduleWorkAcceptedServer1 + SRT_MAX_THREADS + 1, TimeoutUtil.adjust(WORK_FINISH_MAX_TIMEOUT))); Assert.assertTrue("Expected distributedScheduleWorkAccepted = " + (distributedScheduleWorkAccepted + SRT_MAX_THREADS + 1) + " but was: " + server2Proxy.getDistributedScheduleWorkAccepted(), server2Proxy.getDistributedScheduleWorkAccepted() == distributedScheduleWorkAccepted + SRT_MAX_THREADS + 1); }