auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Optional<Map<DecoderColumnHandle, FieldValueProvider>> decodeRow(byte[] data, Map<String, String> dataMap) { GenericRecord avroRecord; try { <START> DataFileStream<GenericRecord> dataFileReader = new DataFileStream<>(new ByteArrayInputStream(data), avroRecordReader); <END> if (!dataFileReader.hasNext()) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "No avro record found"); } avroRecord = dataFileReader.next(); if (dataFileReader.hasNext()) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Unexpected extra record found"); } } catch (Exception e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Decoding AVRO record failed.", e); } return Optional.of(columnDecoders.entrySet().stream() .collect(toImmutableMap( Map.Entry::getKey, entry -> entry.getValue().decodeField(avroRecord)))); }</code><technical_language>DataFileStream is closeable, I guess close it</technical_language>

Target:
public Optional<Map<DecoderColumnHandle, FieldValueProvider>> decodeRow(byte[] data, Map<String, String> dataMap) { GenericRecord avroRecord; DataFileStream<GenericRecord> dataFileReader = null; try { dataFileReader = new DataFileStream<>(new ByteArrayInputStream(data), avroRecordReader); if (!dataFileReader.hasNext()) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "No avro record found"); } avroRecord = dataFileReader.next(); if (dataFileReader.hasNext()) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Unexpected extra record found"); } } catch (Exception e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Decoding AVRO record failed.", e); } finally { closeQuietly(dataFileReader); } return Optional.of(columnDecoders.entrySet().stream() .collect(toImmutableMap( Map.Entry::getKey, entry -> entry.getValue().decodeField(avroRecord)))); }
Source:
<code>public SwaggerParseResult readLocation(String url, List<AuthorizationValue> auth, ParseOptions options) { SwaggerParseResult result = new SwaggerParseResult(); try { JsonNode node = YAML_MAPPER.readValue(new URL(url), JsonNode.class); if(node != null && node.get("openapi") != null) { JsonNode version = node.get("openapi"); if(version.asText() != null && version.asText().startsWith("3.0")) { <START> result.setOpenAPI(new OpenAPIResolver(new OpenAPIDeserializer().deserialize(node).getOpenAPI(),null,null).resolve()); <END> } } } catch (Exception e) { result.setMessages(Arrays.asList(e.getMessage())); } return result; }</code><technical_language>need pass auth option resolving, consider options in call</technical_language>

Target:
public SwaggerParseResult readLocation(String url, List<AuthorizationValue> auth, ParseOptions options) { SwaggerParseResult result = new SwaggerParseResult(); try { JsonNode node = YAML_MAPPER.readValue(new URL(url), JsonNode.class); if(node != null && node.get("openapi") != null) { JsonNode version = node.get("openapi"); if(auth == null) { auth = new ArrayList<>(); } if(version.asText() != null && version.asText().startsWith("3.0")) { if (options != null) { if (options.isResolve()) { result.setOpenAPI(new OpenAPIResolver(new OpenAPIDeserializer().deserialize(node).getOpenAPI(), auth, null).resolve()); }else{ result = new OpenAPIDeserializer().deserialize(node); } }else{ result = new OpenAPIDeserializer().deserialize(node); } } } } catch (Exception e) { result.setMessages(Arrays.asList(e.getMessage())); } return result; }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); RelativeLayout insertPoint = (RelativeLayout) findViewById(R.id.fragment_container); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.view_course_unit_pager, null); insertPoint.addView(v, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); pager2 = findViewById(R.id.pager2); pagerAdapter = new CourseUnitPagerAdapter(this, environment.getConfig(), unitList, courseData, courseUpgradeData, this); pager2.setAdapter(pagerAdapter); pager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { <START> private boolean firstPageLoad = true; <END> @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { invalidateOptionsMenu(); } @Override public void onPageSelected(int position) { } @Override public void onPageScrollStateChanged(int state) { if (state == ViewPager2.SCROLL_STATE_IDLE) { tryToUpdateForEndOfSequential(); } } }); findViewById(R.id.course_unit_nav_bar).setVisibility(View.VISIBLE); mPreviousBtn.setOnClickListener(view -> navigatePreviousComponent()); mNextBtn.setOnClickListener(view -> navigateNextComponent()); }</code><technical_language>Please remove unused parameter</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); RelativeLayout insertPoint = (RelativeLayout) findViewById(R.id.fragment_container); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.view_course_unit_pager, null); insertPoint.addView(v, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); pager2 = findViewById(R.id.pager2); pagerAdapter = new CourseUnitPagerAdapter(this, environment.getConfig(), unitList, courseData, courseUpgradeData, this); pager2.setAdapter(pagerAdapter); pager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { invalidateOptionsMenu(); } @Override public void onPageSelected(int position) { } @Override public void onPageScrollStateChanged(int state) { if (state == ViewPager2.SCROLL_STATE_IDLE) { tryToUpdateForEndOfSequential(); } } }); UiUtil.enforceSingleScrollDirection(pager2); findViewById(R.id.course_unit_nav_bar).setVisibility(View.VISIBLE); mPreviousBtn.setOnClickListener(view -> navigatePreviousComponent()); mNextBtn.setOnClickListener(view -> navigateNextComponent()); }
Source:
<code>private void doConnect(String host, int port) throws IOException { Stream stream; streamLock.lock(); stream = this.stream; streamLock.unlock(); if (stream != null) throw new SocketException("Already connected"); try { <START> stream = torClient.openExitStreamTo(host, port); <END> } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new SocketException("connect() interrupted"); } catch (TimeoutException e) { throw new SocketTimeoutException(); } catch (OpenFailedException e) { throw new ConnectException(e.getMessage()); } streamLock.lock(); this.stream = stream; streamLock.unlock(); }</code><technical_language>Comparing code, is a race condition threads create streams assign stream field. of streams dangling. questions is this is a significant issue contract for this class disallows concurrent calls connect(). If decide this is significant, wrap this function in additional lock</technical_language>

Target:
private void doConnect(String host, int port) throws IOException { Stream stream; streamLock.lock(); stream = this.stream; streamLock.unlock(); if (stream != null) throw new SocketException("Already connected"); try { stream = torClient.openExitStreamTo(host, port); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new SocketException("connect() interrupted"); } catch (TimeoutException e) { throw new SocketTimeoutException(); } catch (OpenFailedException e) { throw new ConnectException(e.getMessage()); } streamLock.lock(); if (this.stream != null) { streamLock.unlock(); stream.close(); } else { this.stream = stream; streamLock.unlock(); } }
Source:
<code>public static Thread runInNewDaemonThread(final Runnable runnable) { if (!isDaemonThread()) { throw new APIAuthenticationException("Only daemon threads can spawn new daemon threads"); } DaemonThread thread = new DaemonThread() { @Override public void run() { isDaemonThread.set(true); try { Context.openSession(); <START> new Thread(runnable).start(); <END> } finally { Context.closeSession(); } } }; thread.start(); return thread; }</code><technical_language>This is intended start method is called in line 189: thread.start() please revert it. need annotate run method (line 177) with: @SuppressWarnings("squid:3AS1217") //We intentionally do start a new thread yet, wrap run call in a session</technical_language>

Target:
public static Thread runInNewDaemonThread(final Runnable runnable) { if (!isDaemonThread()) { throw new APIAuthenticationException("Only daemon threads can spawn new daemon threads"); } DaemonThread thread = new DaemonThread() { @Override public void run() { isDaemonThread.set(true); try { Context.openSession(); runnable.run(); } finally { Context.closeSession(); } } }; thread.start(); return thread; }
Source:
<code>public void testSimpleSync() throws Exception { queue.enqueueAck(getDummyLogEventBuilder().setId("123").setConsistencyLevel(Timber.ConsistencyLevel.SYNC).build()); assertEquals(0, queue.size()); assertNotNull(mockChannel.getWriteObject()); <START> assertEquals("123", ((Timber.AckEvent) mockChannel.getWriteObject()).getId(0)); <END> }</code><technical_language>getWriteObject() is a funny name (contains conflicting imperatives). get a clearer name</technical_language>

Target:
public void testSimpleSync() throws Exception { queue.enqueueAck(newDummyLogEventBuilder().setId("123").setConsistencyLevel(Timber.ConsistencyLevel.SYNC).build()); assertEquals(0, queue.size()); assertNotNull(mockChannel.getWrittenObject()); assertEquals("123", ((Timber.AckEvent) mockChannel.getWrittenObject()).getId(0)); }
Source:
<code>private void updateAPAIArtifactsForAccessControl() throws APIMigrationException { log.info("Updating API artifacts for Publisher Access Control started."); for (Tenant tenant : getTenantsArray()) { try { registryService.startTenantFlow(tenant); <START> log.info("Updating APIs for tenant " + tenant.getId() + '(' + tenant.getDomain() + ')'); <END> GenericArtifact[] artifacts = registryService.getGenericAPIArtifacts(); for (GenericArtifact artifact : artifacts) { String path = artifact.getPath(); if (registryService.isGovernanceRegistryResourceExists(path)) { Object apiResource = registryService.getGovernanceRegistryResource(path); if (apiResource == null) { continue; } registryService.updateGenericAPIArtifactsForAccessControl(path, artifact); } } log.info("End Updating API artifacts tenant " + tenant.getId() + '(' + tenant.getDomain() + ')'); } catch (GovernanceException e) { log.error("Error when accessing API artifact in registry for tenant " + tenant.getId() + '(' + tenant.getDomain() + ')', e); } catch (RegistryException e) { log.error("Error while updating API artifact in the registry for tenant " + tenant.getId() + '(' + tenant.getDomain() + ')', e); } catch (UserStoreException e) { log.error("Error while updating the API artifact in the registry for tenant " + tenant.getId() + '(' + tenant.getDomain() + ')', e); } finally { registryService.endTenantFlow(); } } log.info("Updating API artifacts done for all the tenants for Publisher Access Control feature."); }</code><technical_language>this log a debug log</technical_language>

Target:
private void updateAPAIArtifactsForAccessControl() throws APIMigrationException { log.info("Updating API artifacts for Publisher Access Control started."); for (Tenant tenant : getTenantsArray()) { try { registryService.startTenantFlow(tenant); log.debug("Updating APIs for tenant " + tenant.getId() + '(' + tenant.getDomain() + ')'); GenericArtifact[] artifacts = registryService.getGenericAPIArtifacts(); for (GenericArtifact artifact : artifacts) { String path = artifact.getPath(); if (registryService.isGovernanceRegistryResourceExists(path)) { Object apiResource = registryService.getGovernanceRegistryResource(path); if (apiResource == null) { continue; } registryService.updateGenericAPIArtifactsForAccessControl(path, artifact); } } log.info("End Updating API artifacts tenant " + tenant.getId() + '(' + tenant.getDomain() + ')'); } catch (GovernanceException e) { log.error("Error when accessing API artifact in registry for tenant " + tenant.getId() + '(' + tenant.getDomain() + ')', e); } catch (RegistryException e) { log.error("Error while updating API artifact in the registry for tenant " + tenant.getId() + '(' + tenant.getDomain() + ')', e); } catch (UserStoreException e) { log.error("Error while updating the API artifact in the registry for tenant " + tenant.getId() + '(' + tenant.getDomain() + ')', e); } finally { registryService.endTenantFlow(); } } log.info("Updating API artifacts done for all the tenants for Publisher Access Control feature."); }
Source:
<code>public void testConfLinkRegexNamedGroupMapping() throws Exception { conf.setBoolean(CONFIG_VIEWFS_ENABLE_INNER_CACHE, false); URI viewFsUri = new URI(FsConstants.VIEWFS_SCHEME, CLUSTER_NAME, "/", null, null); String regexStr = "^/(?<firstDir>\\w+)"; String dstPathStr = targetTestRoot + "$firstDir"; Path srcPath = new Path("/testConfLinkRegexNamedGroupMapping1"); Path expectedResolveResult = new Path( dstPathStr.replace("$firstDir", "testConfLinkRegexNamedGroupMapping1")); <START> FSDataOutputStream outputStream = fsTarget.create((expectedResolveResult)); <END> fsTarget.listStatus(expectedResolveResult); outputStream.close(); ConfigUtil.addLinkRegex(conf, CLUSTER_NAME, regexStr, dstPathStr, null); FileSystem vfs = FileSystem.get(viewFsUri, conf); Assert.assertTrue(expectedResolveResult.equals(vfs.resolvePath(srcPath))); Assert.assertEquals(0L, vfs.getFileStatus(srcPath).getLen()); dstPathStr = targetTestRoot + "${firstDir}"; srcPath = new Path("/testConfLinkRegexNamedGroupMapping2"); expectedResolveResult = new Path(dstPathStr .replace("${firstDir}", "testConfLinkRegexNamedGroupMapping2")); outputStream = fsTarget.create(expectedResolveResult); fsTarget.listStatus(expectedResolveResult); outputStream.close(); ConfigUtil.addLinkRegex(conf, CLUSTER_NAME, regexStr, dstPathStr, null); vfs = FileSystem.get(viewFsUri, conf); Assert.assertTrue(expectedResolveResult.equals(vfs.resolvePath(srcPath))); Assert.assertEquals(0L, vfs.getFileStatus(srcPath).getLen()); }</code><technical_language>above...please care of other similar places</technical_language>

Target:
public void testConfLinkRegexNamedGroupMapping() throws Exception { URI viewFsUri = new URI( FsConstants.VIEWFS_SCHEME, CLUSTER_NAME, "/", null, null); String regexStr = "^/(?<firstDir>\\w+)"; String dstPathStr = targetTestRoot + "$firstDir"; Path srcPath = new Path("/testConfLinkRegexNamedGroupMapping1"); Path expectedResolveResult = new Path( dstPathStr.replace("$firstDir", "testConfLinkRegexNamedGroupMapping1")); testRegexMountpoint( new Configuration(conf), regexStr, dstPathStr, null, srcPath, expectedResolveResult, 3); dstPathStr = targetTestRoot + "${firstDir}"; srcPath = new Path("/testConfLinkRegexNamedGroupMapping2"); expectedResolveResult = new Path( dstPathStr.replace( "${firstDir}", "testConfLinkRegexNamedGroupMapping2")); testRegexMountpoint( new Configuration(conf), regexStr, dstPathStr, null, srcPath, expectedResolveResult, 5); }
Source:
<code>public Collection<SmeltingRecipe> getRecipes() { ImmutableList.Builder<SmeltingRecipe> builder = ImmutableList.builder(); <START> for (Map.Entry<ItemStack, ItemStack> smeltingEntry : smeltingList.entrySet()) { <END> ItemStack nativeIngredient = smeltingEntry.getKey(); if (!nativeIngredientToCustomRecipe.containsKey(nativeIngredient)) { ItemStack nativeExemplaryResult = smeltingEntry.getValue(); ItemStackSnapshot exemplaryResult = ItemStackUtil.snapshotOf(nativeExemplaryResult); ItemStackSnapshot exemplaryIngredient = ItemStackUtil.snapshotOf(nativeIngredient); Predicate<ItemStackSnapshot> ingredientPredicate = new MatchSmeltingVanillaItemStack(exemplaryIngredient); double experience = (double) experienceList.get(nativeExemplaryResult); builder.add(new SpongeSmeltingRecipe(exemplaryResult, exemplaryIngredient, ingredientPredicate, experience)); } } builder.addAll(customRecipes); return builder.build(); }</code><technical_language>this</technical_language>

Target:
public Collection<SmeltingRecipe> getRecipes() { ImmutableList.Builder<SmeltingRecipe> builder = ImmutableList.builder(); for (Map.Entry<ItemStack, ItemStack> smeltingEntry : this.smeltingList.entrySet()) { ItemStack nativeIngredient = smeltingEntry.getKey(); if (!this.nativeIngredientToCustomRecipe.containsKey(nativeIngredient)) { ItemStack nativeExemplaryResult = smeltingEntry.getValue(); ItemStackSnapshot exemplaryResult = ItemStackUtil.snapshotOf(nativeExemplaryResult); ItemStackSnapshot exemplaryIngredient = ItemStackUtil.snapshotOf(nativeIngredient); Predicate<ItemStackSnapshot> ingredientPredicate = new MatchSmeltingVanillaItemStack(exemplaryIngredient); double experience = (double) this.experienceList.get(nativeExemplaryResult); builder.add(new SpongeSmeltingRecipe(exemplaryResult, exemplaryIngredient, ingredientPredicate, experience)); } } builder.addAll(this.customRecipes); return builder.build(); }
Source:
<code>Result okResult(ObjectWriter writer, Object object) throws JsonGenerationException, JsonMappingException, IOException { String jsonString = writer.writeValueAsString(object); return okResult(BridgeObjectMapper.get().readTree(jsonString)); <START> } <END></code><technical_language>cleaner do this: <LINK_0></technical_language>

Target:
Result okResult(ObjectWriter writer, Object object) throws JsonGenerationException, JsonMappingException, IOException { return ok( writer.writeValueAsString(object) ).as(BridgeConstants.JSON_MIME_TYPE); }
Source:
<code>protected void handleIdle() { <START> if (streams.isEmpty()) { <END> return; } super.handleIdle(); }</code><technical_language>test synchronized in Http1xClientConnection.java</technical_language>

Target:
protected void handleIdle() { synchronized (this) { if (streams.isEmpty()) { return; } } super.handleIdle(); }
Source:
<code>public String createFunctionDefinitionSignature(IProgressMonitor monitor) { try { ModificationCollector collector = new ModificationCollector(); ImplementMethodRefactoring implementMethodRefactoring = (ImplementMethodRefactoring) wizard .getRefactoring(); CCompositeChange finalChange = null; synchronized (implementMethodRefactoring) { <START> implementMethodRefactoring.createDefinition(collector, config, monitor, -1); <END> finalChange = collector.createFinalChange(); } InsertEdit insertEdit = getInsertEdit(finalChange); if (insertEdit == null) { return Messages.ImplementMethodRefactoringPage_PreviewGenerationNotPossible; } return insertEdit.getText().trim(); } catch (OperationCanceledException e) { return Messages.ImplementMethodRefactoringPage_PreviewCanceled; } catch (CoreException e) { return Messages.ImplementMethodRefactoringPage_PreviewGenerationNotPossible; } }</code><technical_language>versions of createDefinition, offset. In order hide this not-so-obvious parameter</technical_language>

Target:
public String createFunctionDefinitionSignature(IProgressMonitor monitor) { try { ModificationCollector collector = new ModificationCollector(); ImplementMethodRefactoring implementMethodRefactoring = (ImplementMethodRefactoring) wizard .getRefactoring(); CCompositeChange finalChange = null; synchronized (implementMethodRefactoring) { implementMethodRefactoring.createDefinition(collector, config, monitor); finalChange = collector.createFinalChange(); } InsertEdit insertEdit = getInsertEdit(finalChange); if (insertEdit == null) { return Messages.ImplementMethodRefactoringPage_PreviewGenerationNotPossible; } return insertEdit.getText().trim(); } catch (OperationCanceledException e) { return Messages.ImplementMethodRefactoringPage_PreviewCanceled; } catch (CoreException e) { return Messages.ImplementMethodRefactoringPage_PreviewGenerationNotPossible; } }
Source:
<code>public void validation() throws JSONException { JSONObject jsonObject; ClusterMapConfig clusterMapConfig = new ClusterMapConfig(new VerifiableProperties(new Properties())); try { jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 7666, HardwareState.AVAILABLE, getDisks()); new DataNode(null, jsonObject, clusterMapConfig); fail("Should have failed validation."); } catch (IllegalStateException e) { } jsonObject = TestUtils.getJsonDataNode("", 6666, 7666, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode("hostname.invalid", 6666, 7666, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), -1, 7666, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, -1, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 100 * 1000, 7666, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 100* 1000, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); <START> } <END></code><technical_language>Another nice-to-have test case is providing port for ssl plain-text; I feel is easier mistake configuring some of other test cases</technical_language>

Target:
public void validation() throws JSONException { JSONObject jsonObject; ClusterMapConfig clusterMapConfig = new ClusterMapConfig(new VerifiableProperties(new Properties())); try { jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 7666, HardwareState.AVAILABLE, getDisks()); new DataNode(null, jsonObject, clusterMapConfig); fail("Should have failed validation."); } catch (IllegalStateException e) { } jsonObject = TestUtils.getJsonDataNode("", 6666, 7666, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode("hostname.invalid", 6666, 7666, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), -1, 7666, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, -1, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 100 * 1000, 7666, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 100 * 1000, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 6666, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); }
Source:
<code>public void destroy() throws Exception { super.destroy(); <START> server.shutdown(); <END> logger.info(this.getName() + " destroyed..."); }</code><technical_language>wrapped try-catch good</technical_language>

Target:
public void destroy() throws Exception { try { super.destroy(); server.shutdown(); logger.info(this.getName() + " destroyed..."); }catch(Exception e) { logger.error("failed to cleanup RestAPI command processor", e); throw e; } }
Source:
<code>public void testEmailAction() throws Exception { ETLStage action = new ETLStage( "email", new ETLPlugin("Email", PostAction.PLUGIN_TYPE, ImmutableMap.of("recipientEmailAddress", "to@test.com", "senderEmailAddress", "from@test.com", "message", "testing body", "subject", "Test", "port", Integer.toString(port)), null)); ETLStage source = new ETLStage("source", new ETLPlugin("KVTable", BatchSource.PLUGIN_TYPE, ImmutableMap.of("name", "emailTestSource"), null)); ETLStage sink = new ETLStage("sink", new ETLPlugin("KVTable", BatchSink.PLUGIN_TYPE, ImmutableMap.of("name", "emailTestSink"), null)); ETLBatchConfig etlConfig = ETLBatchConfig.builder("* * * * *") .addStage(source) .addStage(sink) .addPostAction(action) .addConnection(source.getName(), sink.getName()) .build(); AppRequest<ETLBatchConfig> appRequest = new AppRequest<>(ETLBATCH_ARTIFACT, etlConfig); Id.Application appId = Id.Application.from(Id.Namespace.DEFAULT, "actionTest"); ApplicationManager appManager = deployApplication(appId, appRequest); WorkflowManager manager = appManager.getWorkflowManager("ETLWorkflow"); manager.start(); manager.waitForFinish(5, TimeUnit.MINUTES); server.stop(); <START> Assert.assertEquals(1, server.getReceivedEmailSize()); <END> Iterator emailIter = server.getReceivedEmail(); SmtpMessage email = (SmtpMessage) emailIter.next(); Assert.assertEquals("Test", email.getHeaderValue("Subject")); Assert.assertTrue(email.getBody().startsWith("testing body")); Assert.assertFalse(emailIter.hasNext()); }</code><technical_language>work server stop</technical_language>

Target:
public void testEmailAction() throws Exception { ETLStage action = new ETLStage( "email", new ETLPlugin("Email", PostAction.PLUGIN_TYPE, ImmutableMap.of("recipients", "to@test.com", "sender", "from@test.com", "message", "testing body", "subject", "Test", "port", Integer.toString(port)), null)); ETLStage source = new ETLStage("source", new ETLPlugin("KVTable", BatchSource.PLUGIN_TYPE, ImmutableMap.of("name", "emailTestSource"), null)); ETLStage sink = new ETLStage("sink", new ETLPlugin("KVTable", BatchSink.PLUGIN_TYPE, ImmutableMap.of("name", "emailTestSink"), null)); ETLBatchConfig etlConfig = ETLBatchConfig.builder("* * * * *") .addStage(source) .addStage(sink) .addPostAction(action) .addConnection(source.getName(), sink.getName()) .build(); AppRequest<ETLBatchConfig> appRequest = new AppRequest<>(ETLBATCH_ARTIFACT, etlConfig); Id.Application appId = Id.Application.from(Id.Namespace.DEFAULT, "actionTest"); ApplicationManager appManager = deployApplication(appId, appRequest); WorkflowManager manager = appManager.getWorkflowManager("ETLWorkflow"); manager.start(); manager.waitForFinish(5, TimeUnit.MINUTES); server.stop(); Assert.assertEquals(1, server.getReceivedEmailSize()); Iterator emailIter = server.getReceivedEmail(); SmtpMessage email = (SmtpMessage) emailIter.next(); Assert.assertEquals("Test", email.getHeaderValue("Subject")); Assert.assertTrue(email.getBody().startsWith("testing body")); Assert.assertFalse(emailIter.hasNext()); }
Source:
<code>public Stream<Datastream> getAllDatastreams() { <START> return _zkClient.getChildren(_rootPath).stream().sorted().map(this::getDatastream).filter(stream -> stream != null); <END> }</code><technical_language>This is problematic if zookeeper for paging call. need cache this</technical_language>

Target:
public Stream<String> getAllDatastreams() { return _datastreamList.stream().sorted(); }
Source:
<code>public synchronized void remove(int n) throws IOException { if (isEmpty()) { throw new NoSuchElementException(); } if (n < 0) { throw new IllegalArgumentException("Cannot remove negative (" + n + ") number of elements."); } if (n == 0) { return; } if (n == elementCount) { clear(); return; } if (n > elementCount) { throw new IllegalArgumentException( "Cannot remove more elements (" + n + ") than present in queue (" + elementCount + ")."); } final int eraseStartPosition = first.position; int eraseTotalLength = 0; int newFirstPosition = first.position; int newFirstLength = first.length; for (int i = 0; i < n; i++) { eraseTotalLength += Element.HEADER_LENGTH + newFirstLength; newFirstPosition = wrapPosition(newFirstPosition + Element.HEADER_LENGTH + newFirstLength); ringRead(newFirstPosition, buffer, 0, Element.HEADER_LENGTH); newFirstLength = readInt(buffer, 0); } writeHeader(fileLength, elementCount - n, newFirstPosition, last.position); elementCount -= n; <START> modCount += n; <END> first = new Element(newFirstPosition, newFirstLength); ringErase(eraseStartPosition, eraseTotalLength); }</code><technical_language>I need ++ here. meaningless, right</technical_language>

Target:
public synchronized void remove(int n) throws IOException { if (isEmpty()) { throw new NoSuchElementException(); } if (n < 0) { throw new IllegalArgumentException("Cannot remove negative (" + n + ") number of elements."); } if (n == 0) { return; } if (n == elementCount) { clear(); return; } if (n > elementCount) { throw new IllegalArgumentException( "Cannot remove more elements (" + n + ") than present in queue (" + elementCount + ")."); } final int eraseStartPosition = first.position; int eraseTotalLength = 0; int newFirstPosition = first.position; int newFirstLength = first.length; for (int i = 0; i < n; i++) { eraseTotalLength += Element.HEADER_LENGTH + newFirstLength; newFirstPosition = wrapPosition(newFirstPosition + Element.HEADER_LENGTH + newFirstLength); ringRead(newFirstPosition, buffer, 0, Element.HEADER_LENGTH); newFirstLength = readInt(buffer, 0); } writeHeader(fileLength, elementCount - n, newFirstPosition, last.position); elementCount -= n; modCount++; first = new Element(newFirstPosition, newFirstLength); ringErase(eraseStartPosition, eraseTotalLength); }
Source:
<code>private int getNumberOfManagedClusteredFileSystemsInComputeCluster(long zoneId, long clusterId) { int numberOfManagedClusteredFileSystemsInComputeCluster = 0; List<VolumeVO> volumes = volumeDao.findByDc(zoneId); if (volumes == null || volumes.size() == 0) { return numberOfManagedClusteredFileSystemsInComputeCluster; } for (VolumeVO volume : volumes) { Long instanceId = volume.getInstanceId(); if (instanceId != null) { VMInstanceVO vmInstanceVO = vmInstanceDao.findById(instanceId); if (vmInstanceVO != null) { Long vmHostId = vmInstanceVO.getHostId(); if (vmHostId == null) { vmHostId = vmInstanceVO.getLastHostId(); } if (vmHostId != null) { HostVO vmHostVO = hostDao.findById(vmHostId); if (vmHostVO != null) { Long vmHostClusterId = vmHostVO.getClusterId(); <START> if (vmHostClusterId != null && vmHostClusterId == clusterId) { <END> StoragePoolVO storagePoolVO = storagePoolDao.findById(volume.getPoolId()); if (storagePoolVO != null && storagePoolVO.isManaged()) { numberOfManagedClusteredFileSystemsInComputeCluster++; } } } } } } } return numberOfManagedClusteredFileSystemsInComputeCluster; }</code><technical_language>@mike-tutkowski reduce a bit of nesting here, inverting logic continue key word</technical_language>

Target:
private int getNumberOfManagedClusteredFileSystemsInComputeCluster(long zoneId, long clusterId) { int numberOfManagedClusteredFileSystemsInComputeCluster = 0; List<VolumeVO> volumes = volumeDao.findByDc(zoneId); if (CollectionUtils.isEmpty(volumes)) { return numberOfManagedClusteredFileSystemsInComputeCluster; } for (VolumeVO volume : volumes) { Long instanceId = volume.getInstanceId(); if (instanceId == null) { continue; } VMInstanceVO vmInstanceVO = vmInstanceDao.findById(instanceId); if (vmInstanceVO == null) { continue; } Long vmHostId = vmInstanceVO.getHostId(); if (vmHostId == null) { vmHostId = vmInstanceVO.getLastHostId(); } if (vmHostId == null) { continue; } HostVO vmHostVO = hostDao.findById(vmHostId); if (vmHostVO == null) { continue; } Long vmHostClusterId = vmHostVO.getClusterId(); if (vmHostClusterId != null && vmHostClusterId == clusterId) { StoragePoolVO storagePoolVO = storagePoolDao.findById(volume.getPoolId()); if (storagePoolVO != null && storagePoolVO.isManaged()) { numberOfManagedClusteredFileSystemsInComputeCluster++; } } } return numberOfManagedClusteredFileSystemsInComputeCluster; }
Source:
<code>private Map<String, Set<String>> getIndividualPermission( ShareableMetacardImpl shareableMetacard) { return ImmutableMap.of( Security.ACCESS_INDIVIDUALS, Optional.of(shareableMetacard) .map(w -> w.getAttribute(Security.ACCESS_INDIVIDUALS)) <START> .map(Attribute::getValues) <END> .orElseGet(Collections::emptyList) .stream() .map(Object::toString) .collect(Collectors.toSet())); }</code><technical_language>replaced with: .map(s -> s.getAccessIndividuals()) reduced a method reference</technical_language>

Target:
private Map<String, Set<String>> getIndividualPermission( ShareableMetacardImpl shareableMetacard) { return ImmutableMap.of(Security.ACCESS_INDIVIDUALS, shareableMetacard.getAccessIndividuals()); }
Source:
<code>public void visitToken(DetailAST ast) { switch (ast.getType()) { case TokenTypes.METHOD_DEF: if (isVerifiable(ast)) { visitMethodDef(ast); } break; case TokenTypes.TYPE_UPPER_BOUNDS: case TokenTypes.TYPE_ARGUMENT: visitGenericArgumentDef(ast); break; <START> case TokenTypes.VARIABLE_DEF: <END> if (isVerifiable(ast)) { visitVariableDef(ast); } break; case TokenTypes.PARAMETER_DEF: visitParameterDef(ast); break; case TokenTypes.IMPORT: visitImport(ast); break; default: throw new IllegalStateException(ast.toString()); } }</code><technical_language>I suspect this result in violation message duplication in a case Foo<? extends Foo>. Please add this case input</technical_language>

Target:
public void visitToken(DetailAST ast) { switch (ast.getType()) { case TokenTypes.METHOD_DEF: if (isVerifiable(ast)) { visitMethodDef(ast); } break; case TokenTypes.VARIABLE_DEF: if (isVerifiable(ast)) { visitVariableDef(ast); } break; case TokenTypes.PARAMETER_DEF: visitParameterDef(ast); break; case TokenTypes.IMPORT: visitImport(ast); break; default: throw new IllegalStateException(ast.toString()); } }
Source:
<code>protected List<ExecutionErrorInfo> findErrorsToAck(EntityManager em) { List<ExecutionErrorInfo> errorsToAck = new ArrayList<>(); em.getTransaction().begin(); try { String findTaskErrorsQuery = "select error from ExecutionErrorInfo error " + "where error.type = :type " + "and error.acknowledged =:acknowledged " + "and error.activityId in (select at.taskId from AuditTaskImpl at where status in (:status))"; <START> errorsToAck = em.createQuery(findTaskErrorsQuery) <END> .setParameter("type", TaskExecutionErrorFilter.TYPE) .setParameter("acknowledged", new Short("0")) .setParameter("status", Arrays.asList(Status.Completed.toString(), Status.Exited.toString(), Status.Failed.toString(), Status.Obsolete.toString(), Status.Error.toString())) .getResultList(); em.getTransaction().commit(); } catch (Exception e) { logger.error("Execution error in command TaskAutoAckErrorCommand", e); em.getTransaction().rollback(); } return errorsToAck; }</code><technical_language>suggestion errorsToAck = em.createQuery(findTaskErrorsQuery, ExecutionErrorInfo.class)</technical_language>

Target:
protected List<ExecutionErrorInfo> findErrorsToAck(EntityManager em) { List<ExecutionErrorInfo> errorsToAck = new ArrayList<>(); TransactionManager txm = TransactionManagerFactory.get().newTransactionManager(); boolean txOwner = txm.begin(); try { String findTaskErrorsQuery = "select error from ExecutionErrorInfo error " + "where error.type = :type " + "and error.acknowledged =:acknowledged " + "and error.activityId in (select at.taskId from AuditTaskImpl at where status in (:status))"; errorsToAck = em.createQuery(findTaskErrorsQuery, ExecutionErrorInfo.class) .setParameter("type", TaskExecutionErrorFilter.TYPE) .setParameter("acknowledged", new Short("0")) .setParameter("status", Arrays.asList(Status.Completed.toString(), Status.Exited.toString(), Status.Failed.toString(), Status.Obsolete.toString(), Status.Error.toString())) .getResultList(); txm.commit(txOwner); } catch (Exception e) { logger.error("Execution error in command TaskAutoAckErrorCommand", e); txm.rollback(txOwner); } return errorsToAck; }
Source:
<code>protected String getProgressText(T object) { Integer progressValue = getProgressValue(object); if (progressValue != null && progressValue >= 100) { <START> return "Exceeded"; END> } if (progressValue != null && progressValue < 0) { return "Unlimited"; } return progressValue != null ? progressValue + "%" : "0%"; }</code><technical_language>localize</technical_language>

Target:
protected String getProgressText(T object) { Integer progressValue = getProgressValue(object); if (progressValue != null && progressValue >= 100) { return getaApplicationConstants().exceeded(); } if (progressValue != null && progressValue < 0) { return getaApplicationConstants().unlimited(); } return progressValue != null ? progressValue + "%" : "0%"; }
Source:
<code>public static void refreshEntity(Object obj) { <START> log.trace("clearing session"); <END> getContextDAO().refreshEntity(obj); }</code><technical_language>this refreshing object clearing</technical_language>

Target:
public static void refreshEntity(Object obj) { log.trace("refreshing object: "+obj); getContextDAO().refreshEntity(obj); }
Source:
<code>protected static String generateMetricsPrefix(String connectorName, String simpleClassName) { <START> return StringUtils.isBlank(connectorName) ? simpleClassName : connectorName + "_" + simpleClassName; <END> }</code><technical_language>for transport provider metrics prefix, format "tpName.className". convention instead of underscore</technical_language>

Target:
protected static String generateMetricsPrefix(String connectorName, String simpleClassName) { return StringUtils.isBlank(connectorName) ? simpleClassName : connectorName + "." + simpleClassName; }
Source:
<code>public Collection<Artifact> performSearch(boolean exactMatch) throws OseeCoreException { List<Artifact> results = new ArrayList<Artifact>(); if (values != null && values.size() > 0) { for (String value : values) { List<Artifact> searchResult = ArtifactQuery.getArtifactListFromAttributeKeywords(AtsUtil.getAtsBranch(), value, false, EXCLUDE_DELETED, false, attributeType); if (exactMatch) { List<Artifact> removeArts = new ArrayList<Artifact>(); for (Artifact artifact : searchResult) { boolean found = false; for (String value2 : values) { if (artifact.getAttributesToStringList(attributeType).contains(value2)) { found = true; break; } } if (found) { results.add(artifact); } else { removeArts.add(artifact); } } <START> searchResult.removeAll(removeArts); <END> } else { results.addAll(searchResult); } } } return results; }</code><technical_language>keeping track of removals performing line searchResult is added results this logical block</technical_language>

Target:
public Collection<Artifact> performSearch(boolean exactMatch) throws OseeCoreException { List<Artifact> results = new ArrayList<Artifact>(); if (values != null && values.size() > 0) { for (String value : values) { List<Artifact> searchResult = ArtifactQuery.getArtifactListFromAttributeKeywords(AtsUtil.getAtsBranch(), value, false, EXCLUDE_DELETED, false, attributeType); if (exactMatch) { for (Artifact artifact : searchResult) { boolean found = false; for (String value2 : values) { if (artifact.getAttributesToStringList(attributeType).contains(value2)) { found = true; break; } } if (found) { results.add(artifact); } } } else { results.addAll(searchResult); } } } return results; }
Source:
<code>private static String getBuildRevision(Run<?, ?> build) { BuildData action = build.getAction(BuildData.class); try { Field lastBuildField = action.getClass().getDeclaredField("lastBuild"); lastBuildField.setAccessible(true); Build lastBuild = (Build) lastBuildField.get(action); return lastBuild.getMarked().getSha1String(); } catch (NoSuchFieldException | IllegalAccessException e) { return null; } <START> } <END></code><technical_language>try method getLastBuild(ObjectId sha1) of BuildData pass result of getLastBuildRevision().getSha1(). If this works get rid of ugly reflection stuff</technical_language>

Target:
private static String getBuildRevision(Run<?, ?> build) { BuildData action = build.getAction(BuildData.class); return action.getLastBuild(action.getLastBuiltRevision().getSha1()).getMarked().getSha1String(); }
Source:
<code>public void playerOnPlay(PlayerType.GetActivePlayersReturnType getActivePlayerResult, PlayerType.PropertyValue getPropertiesResult, ListType.ItemsAll getItemResult) { playerState = PLAYER_STATE.PLAYING; lastGetItemResult = getItemResult; lastGetActivePlayerResult = getActivePlayerResult; <START> refreshPlaylist(lastGetActivePlayerResult.type); <END> if (! userSelectedTab) { playlistsBar.selectTab(getActivePlayerResult.type); } playlistsBar.setIsPlaying(getActivePlayerResult.type, true); }</code><technical_language>playlistsNotifications do need this? calling Kodi get playlists receive a onPlay notification, if receiving Playlists notification result already</technical_language>

Target:
public void playerOnPlay(PlayerType.GetActivePlayersReturnType getActivePlayerResult, PlayerType.PropertyValue getPropertiesResult, ListType.ItemsAll getItemResult) { playerState = PLAYER_STATE.PLAYING; lastGetItemResult = getItemResult; lastGetActivePlayerResult = getActivePlayerResult; if (! userSelectedTab) { playlistsBar.selectTab(getActivePlayerResult.type); } playlistsBar.setIsPlaying(getActivePlayerResult.type, true); displayPlaylist(); PlaylistHolder playlistHolder = playlists.get(getActivePlayerResult.type); if (playlistHolder != null && isPlaying(playlistHolder.getPlaylistResult)) { highlightCurrentlyPlayingItem(); } else { playlistListView.clearChoices(); } }
Source:
<code>private static boolean requiresReturnNull(MethodTree methodTree) { <START> return isOverriding(methodTree) && REQUIRES_RETURN_NULL.stream().anyMatch(methodTree.symbol().owner().type()::isSubtypeOf); <END> }</code><technical_language>methodTree a foo() method overriding another foo() owner of this foo() method implements ItemProcessor, this imply foo() method override ItemProcessor#process</technical_language>

Target:
private static boolean requiresReturnNull(MethodTree methodTree) { return isOverriding(methodTree) && REQUIRES_RETURN_NULL.stream().anyMatch(methodTree.symbol().owner().type()::isSubtypeOf) && ITEM_PROCESSOR_PROCESS_METHOD.matches(methodTree); }
Source:
<code>public static int indexOfChangeId(String message, String delimiter) { String[] lines = message.split(delimiter); int indexOfChangeIdLine = lines.length; for (int i = lines.length - 1; i > 0; --i) { if (changeIdPattern.matcher(lines[i].trim()).matches()) { indexOfChangeIdLine = i; <START> break; <END> } } int indexOfChangeIdLineinString = 0; for (int i = 0; i < indexOfChangeIdLine; ++i) indexOfChangeIdLineinString += lines[i].length() + delimiter.length(); return message.indexOf(CHANGE_ID, indexOfChangeIdLineinString); }</code><technical_language>if end result -1 footers in paragraph need stop searching soon find blank line</technical_language>

Target:
public static int indexOfChangeId(String message, String delimiter) { String[] lines = message.split(delimiter); int indexOfChangeIdLine = lines.length; boolean inFooter = false; for (int i = lines.length - 1; i > 0; --i) { if (!inFooter && lines[i].trim().length() == 0) continue; inFooter = true; if (changeIdPattern.matcher(lines[i].trim()).matches()) { indexOfChangeIdLine = i; break; } else if (lines[i].trim().length() == 0) { return -1; } } int indexOfChangeIdLineinString = 0; for (int i = 0; i < indexOfChangeIdLine; ++i) indexOfChangeIdLineinString += lines[i].length() + delimiter.length(); return message.indexOf(CHANGE_ID, indexOfChangeIdLineinString); }
Source:
<code>private JsonObject getAccessTokenJson(HttpResponse postResponse) throws UnsupportedEncodingException, IOException { JsonElement accessTokenJson = gson.fromJson(new InputStreamReader(postResponse.getEntity() .getContent(), <START> "UTF-8"), <END> JsonElement.class); if(accessTokenJson.isJsonObject()) { return accessTokenJson.getAsJsonObject(); } else { return null; } }</code><technical_language>constant: Charsets.UTF_8 line 111 above</technical_language>

Target:
private JsonObject getAccessTokenJson(HttpResponse postResponse) throws UnsupportedEncodingException, IOException { JsonElement accessTokenJson = gson.fromJson(new InputStreamReader(postResponse.getEntity() .getContent(), Charsets.UTF_8), JsonElement.class); if (accessTokenJson.isJsonObject()) { return accessTokenJson.getAsJsonObject(); } else { return null; } }
Source:
<code>public final ResultIterator iterator() throws SQLException { <START> return iterator(null); <END> }</code><technical_language>Minor, Collections.<SQLCloseable>emptyList() instead worry null</technical_language>

Target:
public final ResultIterator iterator() throws SQLException { return iterator(Collections.<SQLCloseable>emptyList()); }
Source:
<code>public boolean execute(String sql) throws SQLException { sqlQuery = sql; <START> System.out.println("ECLPREPSTMT execute(" + sql + ")"); <END> processQuery(); return execute(); }</code><technical_language>Is this needed</technical_language>

Target:
public boolean execute(String sql) throws SQLException { sqlQuery = sql; processQuery(); return execute(); }
Source:
<code>public double getRuntime(){ Measurement first = getFirstMeasurement(); Measurement last = getLastMeasurement(); if (first == null || last == null) <START> return 0; <END> long diffInMs = last.start_time.getTime() - first.start_time.getTime(); long diffInSec = TimeUnit.MILLISECONDS.toSeconds(diffInMs); return diffInSec + last.runtime; }</code><technical_language>for iOS, please handle this exception, a valid runtime value</technical_language>

Target:
public double getRuntime(){ Measurement first = getFirstMeasurement(); Measurement last = getLastMeasurement(); long diffInMs = last.start_time.getTime() - first.start_time.getTime(); long diffInSec = TimeUnit.MILLISECONDS.toSeconds(diffInMs); return diffInSec + last.runtime; }
Source:
<code>public String getMessage(String version, String os, HttpHeaders headers) { String message = null; String hostAddress = getHostAddress(headers); for (DiscountSetting setting : settings.getDiscountSettings()) { <START> if (handleCondition(setting.getDiscountCondition(), version, hostAddress)) { <END> return chooseFileByPlatform(setting, os); } } return message; }</code><technical_language>cleanner refactor setting. isConditionTrue(version, hostAddress, os)</technical_language>

Target:
public MotdMessage getMessage(String version, String os, HttpHeaders headers) throws IOException, ParseException { Date now = new Date(); MotdMessage message = null; String hostAddress = getHostAddress(headers); for (DiscountSetting setting : settings.getDiscountSettings()) { if (setting.getDiscountCondition().checkCondition(now, hostAddress, version)) { String filename = setting.getMotdFileByPlatform(os); message = parseMotdMessageFile(websiteLocation.concat("api/messages/").concat(filename)); message = modifyMessageIfNeeded(setting, message); break; } } return message; }
Source:
<code>private void startCgroupWatcher(final SingularityExecutorTask task) { SingularityTaskExecutorData taskExecutorData = (SingularityTaskExecutorData) task.getExecutorData(); if (taskExecutorData.getCpuHardLimit().isPresent()) { cgroupCfsWatcherService.submit(() -> { try { SingularityExecutorCgroupCfsChecker cfsChecker = new SingularityExecutorCgroupCfsChecker(task, taskExecutorData.getCpuHardLimit().get(), configuration.getDefaultCfsPeriod()); cfsChecker.watch(); cgroupCheckers.put(task.getTaskId(), cfsChecker); } catch (Throwable t) { <START> LOG.error("Could not start cgorup checker for task {}", task.getTaskId(), t); <END> } }); } }</code><technical_language>minor typo</technical_language>

Target:
private void startCgroupWatcher(final SingularityExecutorTask task) { SingularityTaskExecutorData taskExecutorData = (SingularityTaskExecutorData) task.getExecutorData(); if (taskExecutorData.getCpuHardLimit().isPresent()) { cgroupCfsWatcherService.submit(() -> { try { SingularityExecutorCgroupCfsChecker cfsChecker = new SingularityExecutorCgroupCfsChecker(task, taskExecutorData.getCpuHardLimit().get(), configuration.getDefaultCfsPeriod()); cfsChecker.watch(); cgroupCheckers.put(task.getTaskId(), cfsChecker); } catch (Throwable t) { LOG.error("Could not start cgroup checker for task {}", task.getTaskId(), t); } }); } }