auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void createVolume() { populateDiskSnapshotsInfoFromStorage(); CreateVolumeContainerCommandParameters parameters = new CreateVolumeContainerCommandParameters( getParameters().getStoragePoolId(), getParameters().getDestDomain(), getParameters().getDestImageGroupId(), getParameters().getDestinationImageId(), getParameters().getImageGroupID(), <START> getParameters().getImageId(), <END> getParameters().getDestinationFormat(), getParameters().getDescription(), getDiskImage().getSize(), ImagesHandler.determineImageInitialSize(getDiskImage().getImage(), getParameters().getDestinationFormat(), getParameters().getStoragePoolId(), getParameters() .getSrcDomain(), getParameters().getDestDomain(), getParameters().getImageGroupID())); parameters.setCreateImage(true); parameters.setParentCommand(getActionType()); parameters.setParentParameters(getParameters()); parameters.setEndProcedure(EndProcedure.COMMAND_MANAGED); runInternalAction(VdcActionType.CreateVolumeContainer, parameters); }</code><technical_language>change order in ctor - clearer source is dest :)</technical_language>

Target:
private void createVolume() { populateDiskSnapshotsInfoFromStorage(); CreateVolumeContainerCommandParameters parameters = new CreateVolumeContainerCommandParameters( getParameters().getStoragePoolId(), getParameters().getDestDomain(), getParameters().getImageGroupID(), getParameters().getImageId(), getParameters().getDestImageGroupId(), getParameters().getDestinationImageId(), getParameters().getDestinationFormat(), getParameters().getDescription(), getDiskImage().getSize(), ImagesHandler.determineImageInitialSize(getDiskImage().getImage(), getParameters().getDestinationFormat(), getParameters().getStoragePoolId(), getParameters() .getSrcDomain(), getParameters().getDestDomain(), getParameters().getImageGroupID())); parameters.setParentCommand(getActionType()); parameters.setParentParameters(getParameters()); parameters.setEndProcedure(EndProcedure.COMMAND_MANAGED); runInternalAction(VdcActionType.CreateVolumeContainer, parameters); }
Source:
<code>public void testBootstrapFromFile() throws IOException { <START> LookupExtractorFactory lookupExtractorFactory = new LookupExtractorFactoryMock("data"); <END> mapper.registerSubtypes(LookupExtractorFactoryMock.class); lookupReferencesManager.put("testMockForBootstrap",lookupExtractorFactory); lookupReferencesManager.stop(); lookupReferencesManager.start(); Assert.assertEquals(lookupExtractorFactory, lookupReferencesManager.get("testMockForBootstrap")); }</code><technical_language>this simply EasyMock</technical_language>

Target:
public void testBootstrapFromFile() throws IOException { LookupExtractorFactory lookupExtractorFactory = new LookupExtractorFactoryMock("data"); lookupReferencesManager.put("testMockForBootstrap",lookupExtractorFactory); lookupReferencesManager.stop(); lookupReferencesManager.start(); Assert.assertEquals(lookupExtractorFactory, lookupReferencesManager.get("testMockForBootstrap")); }
Source:
<code>public LatLngBounds getBounds() { if (_map == null) { LatLng center = _initialCamera.build().target; return new LatLngBounds.Builder() .include(center) <START> .include(center) <END> .build(); } return _map.getProjection().getVisibleRegion().latLngBounds; }</code><technical_language>include(center) is here</technical_language>

Target:
public LatLngBounds getBounds() { if (_map == null) { throw new JSApplicationIllegalArgumentException( "Calling getBounds is not allowed until map is ready. " + "Pass function as onFinishLoadingMap prop to get notified " + "when map is ready."); } return _map.getProjection().getVisibleRegion().latLngBounds; }
Source:
<code>public void startup(Application application, ComponentStartupStatus ss) { Properties properties = new Properties(); properties.put("java.naming.factory.initial", factoryInitial); properties.put("java.naming.provider.url", providerURL); String[] destinationParts = brokerDestination.split("/"); String destinationBinding = String.format("%s.%s", destinationParts[0], brokerDestination); String destinationName = destinationParts[1]; properties.put(destinationBinding, destinationName); try { InitialContext ic = new InitialContext(properties); ConnectionFactory cf = (ConnectionFactory) ic.lookup(connectionFactory); destination = (Destination) ic.lookup(brokerDestination); connection = cf.createConnection(brokerUsername, brokerPassword); session = connection.createSession(Session.AUTO_ACKNOWLEDGE); producer = session.createProducer(destination); <START> log.info(String.format("Message producer connected to %s at %s", brokerDestination, providerURL)); <END> } catch (NamingException | JMSException e) { log.error(e, e); } }</code><technical_language>In order hook startup status framework, this be: ss.info() instead of log.info(). for log.error() below</technical_language>

Target:
public void startup(Application application, ComponentStartupStatus ss) { Properties properties = new Properties(); properties.put("java.naming.factory.initial", factoryInitial); properties.put("java.naming.provider.url", providerURL); String[] destinationParts = brokerDestination.split("/"); String destinationBinding = String.format("%s.%s", destinationParts[0], brokerDestination); String destinationName = destinationParts[1]; properties.put(destinationBinding, destinationName); try { InitialContext ic = new InitialContext(properties); ConnectionFactory cf = (ConnectionFactory) ic.lookup(connectionFactory); Destination destination = (Destination) ic.lookup(brokerDestination); Connection connection = cf.createConnection(brokerUsername, brokerPassword); session = connection.createSession(Session.AUTO_ACKNOWLEDGE); producer = session.createProducer(destination); ss.info(String.format("Message producer connected to %s at %s", brokerDestination, providerURL)); } catch (NamingException | JMSException e) { ss.warning(e.getMessage(), e); } }
Source:
<code>public Integer map(Tuple3<Integer, Long, Integer> element) throws Exception { int addedInteger = element.f0 * producerParallelism + element.f2; <START> System.out.println("<" + element.f0 + "," + element.f2 + "> " + addedInteger); <END> return addedInteger; }</code><technical_language>Remove translate LOG.debug</technical_language>

Target:
public Integer map(Tuple3<Integer, Long, Integer> element) throws Exception { return element.f0 * producerParallelism + element.f2; }
Source:
<code>public byte[] getCacheKey() { byte[] fieldNameBytes = StringUtils.toUtf8(fieldName); return ByteBuffer.allocate(2 + fieldNameBytes.length) .put(CACHE_TYPE_ID) .put(variancePop ? (byte)1 : 0) <START> .put(fieldNameBytes).array(); <END> }</code><technical_language>suggest putting 0xFF byte a string a terminating indicator</technical_language>

Target:
public byte[] getCacheKey() { byte[] fieldNameBytes = StringUtils.toUtf8(fieldName); byte[] inputTypeBytes = StringUtils.toUtf8(inputType); return ByteBuffer.allocate(2 + fieldNameBytes.length + 1 + inputTypeBytes.length) .put(CACHE_TYPE_ID) .put(isVariancePop ? (byte) 1 : 0) .put(fieldNameBytes) .put((byte) 0xFF) .put(inputTypeBytes) .array(); }
Source:
<code>public ExpectedIssueCollector(File expectedIssuesFile) throws IOException { <START> this.writer = new FileWriter(expectedIssuesFile); <END> this.expectedIssuesFile = expectedIssuesFile; }</code><technical_language>@inverno This issue fixed. Basically, means behavior broken systems UTF-8 default charset</technical_language>

Target:
public ExpectedIssueCollector(File expectedIssuesFile) throws IOException { this.writer = new OutputStreamWriter(new FileOutputStream(expectedIssuesFile), "UTF-8"); this.expectedIssuesFile = expectedIssuesFile; }
Source:
<code>protected boolean post_default_network_rules(final Connect conn, final String vmName, final NicTO nic, final Long vmId, final InetAddress dhcpServerIp, final String hostIp, final String hostMacAddr) { if (!_canBridgeFirewall) { return false; } final List<InterfaceDef> intfs = getInterfaces(conn, vmName); if (intfs.size() < nic.getDeviceId()) { return false; } final InterfaceDef intf = intfs.get(nic.getDeviceId()); final String brname = intf.getBrName(); final String vif = intf.getDevName(); <START> final Script cmd = new Script(_securityGroupPath, _timeout.getMillis(), s_logger); <END> cmd.add("post_default_network_rules"); cmd.add("--vmname", vmName); cmd.add("--vmid", vmId.toString()); cmd.add("--vmip", nic.getIp()); cmd.add("--vmmac", nic.getMac()); cmd.add("--vif", vif); cmd.add("--brname", brname); if (dhcpServerIp != null) { cmd.add("--dhcpSvr", dhcpServerIp.getHostAddress()); } cmd.add("--hostIp", hostIp); cmd.add("--hostMacAddr", hostMacAddr); final String result = cmd.execute(); if (result != null) { return false; } return true; }</code><technical_language>Please consider adding overridden version of Script(String, int, Logger) constructor accepts Duration encapsulate this type conversion</technical_language>

Target:
protected boolean post_default_network_rules(final Connect conn, final String vmName, final NicTO nic, final Long vmId, final InetAddress dhcpServerIp, final String hostIp, final String hostMacAddr) { if (!_canBridgeFirewall) { return false; } final List<InterfaceDef> intfs = getInterfaces(conn, vmName); if (intfs.size() < nic.getDeviceId()) { return false; } final InterfaceDef intf = intfs.get(nic.getDeviceId()); final String brname = intf.getBrName(); final String vif = intf.getDevName(); final Script cmd = new Script(_securityGroupPath, _timeout, s_logger); cmd.add("post_default_network_rules"); cmd.add("--vmname", vmName); cmd.add("--vmid", vmId.toString()); cmd.add("--vmip", nic.getIp()); cmd.add("--vmmac", nic.getMac()); cmd.add("--vif", vif); cmd.add("--brname", brname); if (dhcpServerIp != null) { cmd.add("--dhcpSvr", dhcpServerIp.getHostAddress()); } cmd.add("--hostIp", hostIp); cmd.add("--hostMacAddr", hostMacAddr); final String result = cmd.execute(); if (result != null) { return false; } return true; }
Source:
<code>public Object compute(final Map<String, Object> combinedAggregators) { <START> final ArrayOfDoublesSketch[] sketches = new ArrayOfDoublesSketch[getFields().size()]; <END> for (int i = 0; i < sketches.length; i++) { sketches[i] = (ArrayOfDoublesSketch) getFields().get(i).compute(combinedAggregators); } final ArrayOfDoublesSketch sketch1 = (ArrayOfDoublesSketch) getFields().get(0).compute(combinedAggregators); final ArrayOfDoublesSketch sketch2 = (ArrayOfDoublesSketch) getFields().get(1).compute(combinedAggregators); if (sketch1.getNumValues() != sketch2.getNumValues()) { throw new IAE("Sketches have different number of values: " + sketch1.getNumValues() + " and " + sketch2.getNumValues()); } final SummaryStatistics[] stats1 = getStats(sketch1); final SummaryStatistics[] stats2 = getStats(sketch2); final int numberOfValues = sketch1.getNumValues(); final double[] pValues = new double[numberOfValues]; final TTest test = new TTest(); for (int i = 0; i < pValues.length; i++) { pValues[i] = test.tTest(stats1[i], stats2[i]); } return pValues; }</code><technical_language>need this array, local variables</technical_language>

Target:
public double[] compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch1 = (ArrayOfDoublesSketch) getFields().get(0).compute(combinedAggregators); final ArrayOfDoublesSketch sketch2 = (ArrayOfDoublesSketch) getFields().get(1).compute(combinedAggregators); if (sketch1.getNumValues() != sketch2.getNumValues()) { throw new IAE( "Sketches have different number of values: %d and %d", sketch1.getNumValues(), sketch2.getNumValues() ); } final SummaryStatistics[] stats1 = getStats(sketch1); final SummaryStatistics[] stats2 = getStats(sketch2); final int numberOfValues = sketch1.getNumValues(); final double[] pValues = new double[numberOfValues]; final TTest test = new TTest(); for (int i = 0; i < pValues.length; i++) { pValues[i] = test.tTest(stats1[i], stats2[i]); } return pValues; }
Source:
<code>public @ResponseBody boolean setAcceptFreeAgents( @PathVariable int id, @RequestParam(value = "acceptFreeAgents") boolean acceptFreeAgents) { TeamDao teamDao = new TeamDao(); Team team = teamDao.getTeamById(id, false, false, false); team.setAcceptFreeAgents(acceptFreeAgents); teamDao.saveTeam(team); <START> return false; <END> }</code><technical_language>this false true</technical_language>

Target:
public @ResponseBody boolean setAcceptFreeAgents( @PathVariable int id, @RequestParam(value = "acceptFreeAgents") boolean acceptFreeAgents) { TeamDao teamDao = new TeamDao(); Team team = teamDao.getTeamById(id, false, false, false); team.setAcceptFreeAgents(acceptFreeAgents); teamDao.saveTeam(team); return true; }
Source:
<code>private void handleTransferring(final StateContext context) { if (context.iterationTimestamp >= getParameters().getSessionExpiration() - getHostTicketRefreshAllowance()) { log.info("Renewing transfer ticket for {}", getTransferDescription()); boolean extendSucceeded = extendImageTransferSession(context.entity); if (!extendSucceeded) { <START> log.info("Failed <END> to renew transfer ticket for {}", getTransferDescription()); if (getParameters().isExtendTicketFailed()) { updateEntityPhase(ImageTransferPhase.PAUSED_SYSTEM); getParameters().setExtendTicketFailed(false); } else { getParameters().setExtendTicketFailed(true); } } } else { log.debug("Not yet renewing transfer ticket for {}", getTransferDescription()); } resetPeriodicPauseLogTime(0); }</code><technical_language>error warn</technical_language>

Target:
private void handleTransferring(final StateContext context) { if (context.iterationTimestamp >= getParameters().getSessionExpiration() - getHostTicketRefreshAllowance()) { log.info("Renewing transfer ticket for {}", getTransferDescription()); boolean extendSucceeded = extendImageTransferSession(context.entity); if (!extendSucceeded) { log.warn("Failed to renew transfer ticket for {}", getTransferDescription()); if (!getParameters().isRetryExtendTicket()) { updateEntityPhase(ImageTransferPhase.PAUSED_SYSTEM); getParameters().setRetryExtendTicket(true); } else { getParameters().setRetryExtendTicket(false); } } } else { log.debug("Not yet renewing transfer ticket for {}", getTransferDescription()); } resetPeriodicPauseLogTime(0); }
Source:
<code>protected Type _deserialize(String value, DeserializationContext context) { Type type = metadata.getType(parseTypeSignature(value)); if (type == null) { <START> throw new IllegalArgumentException(String.valueOf("Unknown type " + value)); <END> } return type; }</code><technical_language>throw new IllegalArgumentException("Unknown type " + value);</technical_language>

Target:
protected Type _deserialize(String value, DeserializationContext context) { Type type = metadata.getType(parseTypeSignature(value)); if (type == null) { throw new IllegalArgumentException("Unknown type: " + value); } return type; }
Source:
<code>public DBObject convert(Variant variant) { Assert.notNull(variant, "Variant should not be null. Please provide a valid Variant object"); <START> logger.trace("Convert variant into mongo object", variant); <END> variant.setAnnotation(null); VariantSourceEntry variantSourceEntry = variant.getSourceEntries().entrySet().iterator().next().getValue(); BasicDBObject addToSet = new BasicDBObject().append(DBObjectToVariantConverter.FILES_FIELD, sourceEntryConverter.convertToStorageType(variantSourceEntry)); if (includeStats) { List<DBObject> sourceEntryStats = statsConverter.convertCohortsToStorageType(variantSourceEntry.getCohortStats(), variantSourceEntry.getStudyId(), variantSourceEntry.getFileId()); addToSet.put(DBObjectToVariantConverter.STATS_FIELD, new BasicDBObject("$each", sourceEntryStats)); } if (variant.getIds() != null && !variant.getIds().isEmpty()) { addToSet.put(DBObjectToVariantConverter.IDS_FIELD, new BasicDBObject("$each", variant.getIds())); } BasicDBObject update = new BasicDBObject(); update.append("$addToSet", addToSet).append("$setOnInsert", variantConverter.convertToStorageType(variant)); return update; }</code><technical_language>"debug" level anymore</technical_language>

Target:
public DBObject convert(Variant variant) { Assert.notNull(variant, "Variant should not be null. Please provide a valid Variant object"); logger.trace("Convert variant into mongo object", variant); variant.setAnnotation(null); VariantSourceEntry variantSourceEntry = variant.getSourceEntries().values().iterator().next(); BasicDBObject addToSet = new BasicDBObject().append(VariantToDBObjectConverter.FILES_FIELD, sourceEntryConverter.convert(variantSourceEntry)); if (includeStats) { List<DBObject> sourceEntryStats = statsConverter.convert(variantSourceEntry); addToSet.put(VariantToDBObjectConverter.STATS_FIELD, new BasicDBObject("$each", sourceEntryStats)); } if (variant.getIds() != null && !variant.getIds().isEmpty()) { addToSet.put(VariantToDBObjectConverter.IDS_FIELD, new BasicDBObject("$each", variant.getIds())); } BasicDBObject update = new BasicDBObject(); update.append("$addToSet", addToSet).append("$setOnInsert", variantConverter.convert(variant)); return update; }
Source:
<code>private Response toOkhttpResponse(org.asynchttpclient.Response asyncHttpClientResponse) { val rspBuilder = new Response.Builder() .request(request()) .protocol(Protocol.HTTP_1_1) .code(asyncHttpClientResponse.getStatusCode()) .message(asyncHttpClientResponse.getStatusText()); if (asyncHttpClientResponse.hasResponseHeaders()) { asyncHttpClientResponse.getHeaders().forEach(e -> rspBuilder.header(e.getKey(), e.getValue())); } if (asyncHttpClientResponse.hasResponseBody()) { val contentType = asyncHttpClientResponse.getContentType() == null ? null : MediaType.parse(asyncHttpClientResponse.getContentType()); val okHttpBody = ResponseBody.create(contentType, asyncHttpClientResponse.getResponseBodyAsBytes()); rspBuilder.body(okHttpBody); } else { <START> rspBuilder.body(ResponseBody.create(null, "")); <END> } return rspBuilder.build(); }</code><technical_language>Please ResponseBody.create(null, "") a constant</technical_language>

Target:
private Response toOkhttpResponse(org.asynchttpclient.Response asyncHttpClientResponse) { val rspBuilder = new Response.Builder() .request(request()) .protocol(Protocol.HTTP_1_1) .code(asyncHttpClientResponse.getStatusCode()) .message(asyncHttpClientResponse.getStatusText()); if (asyncHttpClientResponse.hasResponseHeaders()) { asyncHttpClientResponse.getHeaders().forEach(e -> rspBuilder.header(e.getKey(), e.getValue())); } if (asyncHttpClientResponse.hasResponseBody()) { val contentType = asyncHttpClientResponse.getContentType() == null ? null : MediaType.parse(asyncHttpClientResponse.getContentType()); val okHttpBody = ResponseBody.create(contentType, asyncHttpClientResponse.getResponseBodyAsBytes()); rspBuilder.body(okHttpBody); } else { rspBuilder.body(EMPTY_BODY); } return rspBuilder.build(); }
Source:
<code>public <T> T retryWithHandle( HandleCallback<T> callback, Predicate<Throwable> myShouldRetry ) { try { return RetryUtils.retry(() -> getDBI().withHandle(callback), myShouldRetry, MAX_RETRIES); } catch (Exception e) { <START> throw Throwables.propagate(e); <END> } }</code><technical_language>Please change new RuntimeException(e) (<LINK_0></technical_language>

Target:
public <T> T retryWithHandle( HandleCallback<T> callback, Predicate<Throwable> myShouldRetry ) { try { return RetryUtils.retry(() -> getDBI().withHandle(callback), myShouldRetry, MAX_RETRIES); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>public TexParserResult parse(List<Path> texFiles) { List<Path> referencedFiles = new ArrayList<>(); if (result.getFileList().isEmpty()) { result.getFileList().addAll(texFiles); } else { result.getNestedFiles().addAll(texFiles); } <START> for (int fileIndex = 0; fileIndex < texFiles.size(); fileIndex++) { <END> Path file = texFiles.get(fileIndex); try (LineNumberReader lnr = new LineNumberReader(Files.newBufferedReader(file))) { for (String line = lnr.readLine(); line != null; line = lnr.readLine()) { if (line.startsWith("%")) { continue; } matchCitation(file, lnr.getLineNumber(), line); matchNestedFile(file, texFiles, referencedFiles, line); } } catch (IOException e) { LOGGER.warn("Error opening the TEX file", e); } } if (!referencedFiles.isEmpty()) { parse(referencedFiles); } return result; }</code><technical_language>I this converted "normal" advanced for. eg. for(Path file: textFiles) do need index(position information somewhere? advanced for, "for each" effectively reduces problem of IndexOutOfBounds exceptions</technical_language>

Target:
public TexParserResult parse(List<Path> texFiles) { List<Path> referencedFiles = new ArrayList<>(); result.addFiles(texFiles); for (Path file : texFiles) { try (LineNumberReader lnr = new LineNumberReader(Files.newBufferedReader(file))) { for (String line = lnr.readLine(); line != null; line = lnr.readLine()) { if (line.isEmpty() || line.charAt(0) == '%') { continue; } matchCitation(file, lnr.getLineNumber(), line); matchNestedFile(file, texFiles, referencedFiles, line); } } catch (IOException e) { LOGGER.warn("Error opening the TEX file", e); } } if (!referencedFiles.isEmpty()) { parse(referencedFiles); } return result; }
Source:
<code><START> public DeleteResult performDelete(@NonNull StorIOSQLite storIOSQLite, @NonNull Person person) { <END> storIOSQLite.internal().beginTransaction(); storIOSQLite .internal() .delete(DeleteQuery.builder() .table(PersonsTable.TABLE) .where(PersonsTable.COLUMN_ID + " = ?") .whereArgs(person.getId()) .build()); storIOSQLite .delete() .objects(person.getCars()) .prepare() .executeAsBlocking(); storIOSQLite.internal().endTransaction(); final Set<String> affectedTables = new HashSet<String>(2); affectedTables.add(PersonsTable.TABLE); affectedTables.add(CarsTable.TABLE); return DeleteResult.newInstance(2, affectedTables); }</code><technical_language>correct! :+1:</technical_language>

Target:
public DeleteResult performDelete(@NonNull StorIOSQLite storIOSQLite, @NonNull Person person) { storIOSQLite.internal().beginTransaction(); try { storIOSQLite .internal() .delete(DeleteQuery.builder() .table(PersonsTable.TABLE_NAME) .where(PersonsTable.COLUMN_UUID) .whereArgs(person.uuid()) .build() ); final Set<String> affectedTables = new HashSet<>(2); affectedTables.add(PersonsTable.TABLE_NAME); if (!person.cars().isEmpty()) { storIOSQLite .delete() .objects(person.cars()) .prepare() .executeAsBlocking(); affectedTables.add(CarsTable.TABLE_NAME); } storIOSQLite.internal().setTransactionSuccessful(); return DeleteResult.newInstance(1, affectedTables); } finally { storIOSQLite.internal().endTransaction(); } }
Source:
<code>public void binderDied() { if (DBG) { Slog.d(TAG, "Binder is dead - unregister " + mPackageName); } for (Map.Entry<IBinder, ClientDeathRecipient> entry : mBleApps.entrySet()) { IBinder token = entry.getKey(); ClientDeathRecipient deathRec = entry.getValue(); if (deathRec.equals(this)) { if (DBG) { Slog.d(TAG, <START> "Remove this BLE app " <END> + mPackageName); } mBleApps.remove(token); break; } } if (isBleAppPresent()) { return; } if (DBG) { Slog.d(TAG, "Disabling LE only mode after application crash"); } try { mBluetoothLock.readLock().lock(); if (mBluetooth != null && mBluetooth.getState() == BluetoothAdapter.STATE_BLE_ON) { mEnable = false; mBluetooth.onBrEdrDown(); } } catch (RemoteException e) { Slog.e(TAG, "Unable to call onBrEdrDown", e); } finally { mBluetoothLock.readLock().unlock(); } }</code><technical_language>Nit: "Removing BLE application ..." similar</technical_language>

Target:
public void binderDied() { if (DBG) { Slog.d(TAG, "Binder is dead - unregister " + mPackageName); } for (Map.Entry<IBinder, ClientDeathRecipient> entry : mBleApps.entrySet()) { IBinder token = entry.getKey(); ClientDeathRecipient deathRec = entry.getValue(); if (deathRec.equals(this)) { if (DBG) { Slog.d(TAG, "Removing BLE application " + mPackageName); } mBleApps.remove(token); break; } } if (isBleAppPresent()) { return; } if (DBG) { Slog.d(TAG, "Disabling LE only mode after application crash"); } try { mBluetoothLock.readLock().lock(); if (mBluetooth != null && mBluetooth.getState() == BluetoothAdapter.STATE_BLE_ON) { mEnable = false; mBluetooth.onBrEdrDown(); } } catch (RemoteException e) { Slog.e(TAG, "Unable to call onBrEdrDown", e); } finally { mBluetoothLock.readLock().unlock(); } }
Source:
<code>protected void init() { super.init(); if (getCluster() != null) { setStoragePoolId(getCluster().getStoragePoolId()); } if (isVmExist() && isCompatibilityVersionSupportedByCluster(getEffectiveCompatibilityVersion())) { Version compatibilityVersion = getEffectiveCompatibilityVersion(); getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined( compatibilityVersion, getParameters().getVmStaticData()); getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined( compatibilityVersion, getVm().getStaticData()); } vmHandler.updateDefaultTimeZone(getParameters().getVmStaticData()); vmHandler.autoSelectUsbPolicy(getParameters().getVmStaticData()); <START> vmHandler.autoSelectResumeBehavior(getParameters().getVmStaticData(), getCluster().getCompatibilityVersion()); <END> vmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getVmStaticData(), getCluster(), getParameters().getGraphicsDevices()); updateParametersVmFromInstanceType(); if (!getParameters().isUpdateNuma()) { getParameters().getVm().setvNumaNodeList(vmNumaNodeDao.getAllVmNumaNodeByVmId(getParameters().getVmId())); } if (getParameters().getVmStaticData().getDefaultDisplayType() == DisplayType.none && !getParameters().isConsoleEnabled()) { getParameters().getVmStaticData().setUsbPolicy(UsbPolicy.DISABLED); } }</code><technical_language>missing null check</technical_language>

Target:
protected void init() { super.init(); if (getCluster() != null) { setStoragePoolId(getCluster().getStoragePoolId()); } if (isVmExist() && isCompatibilityVersionSupportedByCluster(getEffectiveCompatibilityVersion())) { Version compatibilityVersion = getEffectiveCompatibilityVersion(); getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined( compatibilityVersion, getParameters().getVmStaticData()); getVmPropertiesUtils().separateCustomPropertiesToUserAndPredefined( compatibilityVersion, getVm().getStaticData()); } vmHandler.updateDefaultTimeZone(getParameters().getVmStaticData()); vmHandler.autoSelectUsbPolicy(getParameters().getVmStaticData()); vmHandler.autoSelectResumeBehavior(getParameters().getVmStaticData(), getCluster()); vmHandler.autoSelectDefaultDisplayType(getVmId(), getParameters().getVmStaticData(), getCluster(), getParameters().getGraphicsDevices()); updateParametersVmFromInstanceType(); if (!getParameters().isUpdateNuma()) { getParameters().getVm().setvNumaNodeList(vmNumaNodeDao.getAllVmNumaNodeByVmId(getParameters().getVmId())); } if (getParameters().getVmStaticData().getDefaultDisplayType() == DisplayType.none && !getParameters().isConsoleEnabled()) { getParameters().getVmStaticData().setUsbPolicy(UsbPolicy.DISABLED); } }
Source:
<code>private synchronized FileState getFileState(final File fileToWriteTo, boolean isString) throws FileNotFoundException { String absolutePath = fileToWriteTo.getAbsolutePath(); FileState state; boolean appendNoFlush = FileExistsMode.APPEND_NO_FLUSH.equals(this.fileExistsMode); if (appendNoFlush) { state = this.fileStates.get(absolutePath); if (state != null && ((isString && state.stream != null) || (!isString && state.writer != null))) { state.close(); state = null; <START> this.fileStates.remove(fileToWriteTo); <END> } if (state == null) { if (isString) { state = new FileState(createWriter(fileToWriteTo, true)); } else { state = new FileState(createOutputStream(fileToWriteTo, true)); } this.fileStates.put(absolutePath, state); } state.lastWrite = Long.MAX_VALUE; } else { state = null; } return state; }</code><technical_language>this.fileStates.remove(absolutePath); is correct</technical_language>

Target:
private synchronized FileState getFileState(final File fileToWriteTo, boolean isString) throws FileNotFoundException { String absolutePath = fileToWriteTo.getAbsolutePath(); FileState state; boolean appendNoFlush = FileExistsMode.APPEND_NO_FLUSH.equals(this.fileExistsMode); if (appendNoFlush) { state = this.fileStates.get(absolutePath); if (state != null && ((isString && state.stream != null) || (!isString && state.writer != null))) { state.close(); state = null; this.fileStates.remove(absolutePath); } if (state == null) { if (isString) { state = new FileState(createWriter(fileToWriteTo, true)); } else { state = new FileState(createOutputStream(fileToWriteTo, true)); } this.fileStates.put(absolutePath, state); } state.lastWrite = Long.MAX_VALUE; } else { state = null; } return state; }
Source:
<code>public void testActions() { final Command okCommand = mock(Command.class); final Command overrideCommand = mock(Command.class); final GAV gav = mock(GAV.class); final Set<MavenRepositoryMetadata> metadata = new HashSet<MavenRepositoryMetadata>(); <START> final Set<Role> roles = new HashSet<Role>() {{ <END> add(new RoleImpl(AppRoles.ADMIN.getName())); }}; when(user.getRoles()).thenReturn(roles); presenter.setContent(gav, metadata, okCommand, overrideCommand); presenter.override(); verify(view).hide(); verify(overrideCommand).execute(); presenter.hide(); verify(view, times(2)).hide(); verify(okCommand).execute(); }</code><technical_language>nitpick: Java 8 do Java final Set<Role> roles = Collections.singleton(new RoleImpl(AppRoles.ADMIN.getName())); save a keystrokes (and extra anonymous class)</technical_language>

Target:
public void testActions() { final Command okCommand = mock(Command.class); final Command overrideCommand = mock(Command.class); final GAV gav = mock(GAV.class); final Set<MavenRepositoryMetadata> metadata = new HashSet<MavenRepositoryMetadata>(); final Set<Role> roles = Collections.singleton(new RoleImpl(AppRoles.ADMIN.getName())); when(user.getRoles()).thenReturn(roles); presenter.setContent(gav, metadata, okCommand, overrideCommand); presenter.override(); verify(view).hide(); verify(overrideCommand).execute(); presenter.hide(); verify(view, times(2)).hide(); verify(okCommand).execute(); }
Source:
<code>public void showReviewImageInfo() { DialogUtil.showAlertDialog(ReviewActivity.this, getString(R.string.review_image), getString(R.string.review_image_explanation), <START> getString(R.string.about_translate_proceed), <END> getString(R.string.go_back_button_text), null, () -> onBackPressed()); }</code><technical_language>android.R.string.ok, 'proceed' a bit formal sounds action confuse users - I feel 'ok' is more done reading explanation</technical_language>

Target:
public void showReviewImageInfo() { DialogUtil.showAlertDialog(ReviewActivity.this, getString(R.string.title_activity_review), getString(R.string.review_image_explanation), getString(android.R.string.ok), "", null, null); }
Source:
<code>public RevCommit tryFastForward(RevCommit newCommit) throws IOException, <START> JGitInternalException, GitAPIException { <END> Ref head = repo.getRef(Constants.HEAD); if (head == null || head.getObjectId() == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, Constants.HEAD)); ObjectId headId = head.getObjectId(); if (headId == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, Constants.HEAD)); RevCommit headCommit = walk.lookupCommit(headId); if (walk.isMergedInto(newCommit, headCommit)) return newCommit; String headName; if (head.isSymbolic()) headName = head.getTarget().getName(); else headName = "detached HEAD"; return tryFastForward(headName, headCommit, newCommit); }</code><technical_language>declare JGitInternalException</technical_language>

Target:
public RevCommit tryFastForward(RevCommit newCommit) throws IOException, GitAPIException { Ref head = repo.getRef(Constants.HEAD); if (head == null || head.getObjectId() == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, Constants.HEAD)); ObjectId headId = head.getObjectId(); if (headId == null) throw new RefNotFoundException(MessageFormat.format( JGitText.get().refNotResolved, Constants.HEAD)); RevCommit headCommit = walk.lookupCommit(headId); if (walk.isMergedInto(newCommit, headCommit)) return newCommit; String headName; if (head.isSymbolic()) headName = head.getTarget().getName(); else headName = "detached HEAD"; return tryFastForward(headName, headCommit, newCommit); }
Source:
<code><START> protected static Date calculateFilterDate(int calendarUnit, int amount) { <END> Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.add(calendarUnit, -(amount)); Date filterDate = cal.getTime(); log.debug("FilterDateFormatted = {}", filterDate); return filterDate; }</code><technical_language>reason this public</technical_language>

Target:
public Date calculateFilterDate(int calendarUnit, int amount) { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.add(calendarUnit, -(amount)); Date filterDate = cal.getTime(); log.debug("FilterDateFormatted = {}", filterDate); return filterDate; }
Source:
<code>public void testUserWithNoAccessToDocument() { String username = "foo"; DocumentModelResolver resolver = new DocumentModelResolver(); Map<String, String> params = new LinkedHashMap<>(); params.put(PARAM_STORE, STORE_ID_REF); resolver.configure(params); DocumentModel adminDoc = resolver.fetch(DocumentModel.class, idRef); assertNotNull(adminDoc); ClientLoginModule.getThreadLocalLogin().push(new UserPrincipal(username, Collections.emptyList(), false, false), null, null); DocumentModel doc = resolver.fetch(DocumentModel.class, idRef); assertNull(doc); <START> <END> ClientLoginModule.getThreadLocalLogin().pop(); }</code><technical_language>empty lines (I mentioned this times before)</technical_language>

Target:
public void testUserWithNoAccessToDocument() { String username = "foo"; DocumentModelResolver resolver = new DocumentModelResolver(); Map<String, String> params = Collections.singletonMap(PARAM_STORE, STORE_ID_REF); resolver.configure(params); DocumentModel adminDoc = resolver.fetch(DocumentModel.class, idRef); assertNotNull(adminDoc); try { ClientLoginModule.getThreadLocalLogin().push(new UserPrincipal(username, Collections.emptyList(), false, false), null, null); DocumentModel doc = resolver.fetch(DocumentModel.class, idRef); assertNull(doc); } finally { ClientLoginModule.getThreadLocalLogin().pop(); } }
Source:
<code>final int drainTasks() { int numTasks = 0; for (;;) { Runnable runnable = taskQueue.poll(); if (runnable == null) { break; } <START> if (AbstractScheduledEventExecutor.WAKEUP_TASK != runnable) { <END> numTasks++; } } return numTasks; }</code><technical_language>nit: WAKEUP_TASK AbstractScheduledEventExecutor is a superclass</technical_language>

Target:
final int drainTasks() { int numTasks = 0; for (;;) { Runnable runnable = taskQueue.poll(); if (runnable == null) { break; } if (WAKEUP_TASK != runnable) { numTasks++; } } return numTasks; }
Source:
<code>private boolean checkCompatibility() { String wdName = workingDirText.getText().trim(); String progName = fProgText.getText().trim(); URI wdURI; URI progURI; try { wdURI = new URI(wdName); progURI = new URI(progName); } catch (URISyntaxException e) { <START> System.err.println("internal error. URI syntax error in working directory or program"); END> return false; } String wdScheme = wdURI.getScheme(); String progScheme = progURI.getScheme(); if (wdScheme == null && progScheme == null) { setErrorMessage(null); return true; } if (!equal(wdScheme, progScheme)) { setErrorMessage(ProxyLaunchMessages.scheme_of_working_directory_and_program_do_not_match); return false; } String wdAuth = wdURI.getAuthority(); String progAuth = progURI.getAuthority(); if (!equal(wdAuth, progAuth)) { setErrorMessage(ProxyLaunchMessages.connection_of_working_directory_and_program_do_not_match); return false; } String wdQuery = wdURI.getQuery(); String progQuery = progURI.getQuery(); if (!equal(wdQuery, progQuery)) { setErrorMessage(ProxyLaunchMessages.connection_of_working_directory_and_program_do_not_match); return false; } setErrorMessage(null); return true; }</code><technical_language>this one</technical_language>

Target:
private boolean checkCompatibility() { String wdName = workingDirText.getText().trim(); String progName = fProgText.getText().trim(); URI wdURI; URI progURI; try { wdURI = new URI(wdName); progURI = new URI(progName); } catch (URISyntaxException e) { System.err.println(ProxyLaunchMessages.uri_syntax_error); return false; } String wdScheme = wdURI.getScheme(); String progScheme = progURI.getScheme(); if (wdScheme == null && progScheme == null) { setErrorMessage(null); return true; } if (!equal(wdScheme, progScheme)) { setErrorMessage(ProxyLaunchMessages.scheme_of_working_directory_and_program_do_not_match); return false; } String wdAuth = wdURI.getAuthority(); String progAuth = progURI.getAuthority(); if (!equal(wdAuth, progAuth)) { setErrorMessage(ProxyLaunchMessages.connection_of_working_directory_and_program_do_not_match); return false; } String wdQuery = wdURI.getQuery(); String progQuery = progURI.getQuery(); if (!equal(wdQuery, progQuery)) { setErrorMessage(ProxyLaunchMessages.connection_of_working_directory_and_program_do_not_match); return false; } setErrorMessage(null); return true; }
Source:
<code>public static List<ModuleInfo> getPage(int position) { int from = position * ITEMS_PER_PAGE; int to = Math.min((position + 1) * ITEMS_PER_PAGE, mModules.size()); <START> Log.d("msgRav", Integer.toString(from) + " " + Integer.toString(to) + " " + Integer.toString(position)); <END> if (!(from < to)) { return null; } return mModules.subList(from, to); }</code><technical_language>Please do hardcode strings. Add static field TAG class name</technical_language>

Target:
public static List<ModuleInfo> getPage(int position) { int from = position * ITEMS_PER_PAGE; int to = Math.min((position + 1) * ITEMS_PER_PAGE, mModules.size()); Log.d( ScreenSlidePagerAdapter.class.getCanonicalName() ,"getting page from: " + Integer.toString(from) + "to: " + Integer.toString(to) + "page number: " + Integer.toString(position)); if (!(from < to)) { return null; } return mModules.subList(from, to); }
Source:
<code>private Iterator<LocatedFileStatus> statusFromObjects(List<S3ObjectSummary> objects) { return objects.stream() .filter(object -> !object.getKey().endsWith(PATH_SEPARATOR) <START> && skipGlacierObjectsIfNeeded(object)) <END> .map(object -> new FileStatus( object.getSize(), false, 1, BLOCK_SIZE.toBytes(), object.getLastModified().getTime(), qualifiedPath(new Path(PATH_SEPARATOR + object.getKey())))) .map(this::createLocatedFileStatus) .iterator(); }</code><technical_language>I this cleaner if add a filter call. a method reference: java .filter(this::skipGlacierObjectsIfNeeded) However, this highlights method name inverted. filter() takes a predicate returns true if kept, I expect skipXXX return true if discarded. trouble thinking of a good name. if structure this: java .filter(object -> !skipGlacierObjects || !isGlacierObject(object)) Changing method java private static boolean isGlacierObject(S3ObjectSummary object) { return object.getStorageClass().equals(StorageClass.Glacier.toString())); }</technical_language>

Target:
private Iterator<LocatedFileStatus> statusFromObjects(List<S3ObjectSummary> objects) { return objects.stream() .filter(object -> !object.getKey().endsWith(PATH_SEPARATOR)) .filter(object -> !skipGlacierObjects || !isGlacierObject(object)) .map(object -> new FileStatus( object.getSize(), false, 1, BLOCK_SIZE.toBytes(), object.getLastModified().getTime(), qualifiedPath(new Path(PATH_SEPARATOR + object.getKey())))) .map(this::createLocatedFileStatus) .iterator(); }
Source:
<code>public void createControl(Composite parent) { initializeDialogUnits(parent); toolkit = new FormToolkit(TasksUiPlugin.getDefault().getFormColors(parent.getDisplay())); innerComposite = new SectionComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL); <START> GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).span(3, 1).applyTo(innerComposite); <END> innerComposite.setMinSize(40, 40); innerComposite.setExpandHorizontal(true); innerComposite.setExpandVertical(true); GridLayout layout = new GridLayout(3, false); innerComposite.getContent().setLayout(layout); createSettingControls(innerComposite.getContent()); createValidationControls(innerComposite.getContent()); if (needsValidateOnFinish()) { validateOnFinishButton = new Button(innerComposite, SWT.CHECK); validateOnFinishButton.setText(Messages.AbstractRepositorySettingsPage_Validate_on_Finish); validateOnFinishButton.setSelection(true); } Point p = innerComposite.getContent().computeSize(SWT.DEFAULT, SWT.DEFAULT, true); innerComposite.setMinSize(p); Dialog.applyDialogFont(innerComposite); setControl(innerComposite); }</code><technical_language>required section composite manages layout</technical_language>

Target:
public void createControl(Composite parent) { initializeDialogUnits(parent); toolkit = new FormToolkit(TasksUiPlugin.getDefault().getFormColors(parent.getDisplay())); innerComposite = new SectionComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL); createSettingControls(innerComposite.getContent()); createValidationControls(innerComposite.getContent()); if (needsValidateOnFinish()) { validateOnFinishButton = new Button(innerComposite, SWT.CHECK); validateOnFinishButton.setText(Messages.AbstractRepositorySettingsPage_Validate_on_Finish); validateOnFinishButton.setSelection(true); } Point p = innerComposite.getContent().computeSize(SWT.DEFAULT, SWT.DEFAULT, true); innerComposite.setMinSize(p); Dialog.applyDialogFont(innerComposite); setControl(innerComposite); }
Source:
<code>long estimateSize(Path directoryPath) { final AtomicLong size = new AtomicLong(0); try { Files.walkFileTree(directoryPath, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { size.addAndGet(attrs.size()); return FileVisitResult.CONTINUE; } @Override <START> public FileVisitResult visitFileFailed(Path file, IOException exc) <END> throws IOException { log.error("skipped: {}", file, exc); return FileVisitResult.CONTINUE; } }); return size.get(); } catch (IOException ioe) { throw new IllegalStateException(ioe); } }</code><technical_language>Files.size()</technical_language>

Target:
long estimateSize(Path directoryPath) { final AtomicLong size = new AtomicLong(0); try { Files.walkFileTree(directoryPath, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { size.addAndGet(attrs.size()); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) { log.error("skipped: {}", file, exc); return FileVisitResult.CONTINUE; } }); return size.get(); } catch (IOException ioe) { throw new IllegalStateException(ioe); } }
Source:
<code>public SoulBurnEffect() { super(Outcome.Damage); <START> staticText = "Soul Burn deals X damage to target creature or player for each black or red mana spent on X. You gain life equal to the damage dealt for each black mana spent; not more life than the player's life total before Soul Burn dealt damage, or the creature's toughness."; <END> }</code><technical_language>{this} instead of card name</technical_language>

Target:
public SoulBurnEffect() { super(Outcome.Damage); staticText = "{this} deals X damage to target creature or player for each black or red mana spent on X. You gain life equal to the damage dealt for each black mana spent; not more life than the player's life total before Soul Burn dealt damage, or the creature's toughness."; }
Source:
<code>private static String contentBetweenBrackets(StringTokenizer tokenizer, final String pattern) { StringBuilder bracketContent = new StringBuilder(); boolean foundClosingBracket = false; while (tokenizer.hasMoreTokens() && !foundClosingBracket) { String token = tokenizer.nextToken(); switch (token) { case "\"" -> appendQuote(bracketContent, tokenizer); case "]" -> foundClosingBracket = true; default -> bracketContent.append(token); } } if (!foundClosingBracket) { <START> LOGGER.warn("Missing closing bracket ']' in '" + pattern + "'"); <END> } else if (bracketContent.length() == 0) { LOGGER.warn("Found empty brackets \"[]\" in '" + pattern + "'"); } return bracketContent.toString(); }</code><technical_language>suggestion LOGGER.warn("Missing closing bracket ']' in '{}'", pattern);</technical_language>

Target:
private static String contentBetweenBrackets(StringTokenizer tokenizer, final String pattern) { StringBuilder bracketContent = new StringBuilder(); boolean foundClosingBracket = false; while (tokenizer.hasMoreTokens() && !foundClosingBracket) { String token = tokenizer.nextToken(); switch (token) { case "\"" -> appendQuote(bracketContent, tokenizer); case "]" -> foundClosingBracket = true; default -> bracketContent.append(token); } } if (!foundClosingBracket) { LOGGER.warn("Missing closing bracket ']' in '{}'", pattern); } else if (bracketContent.length() == 0) { LOGGER.warn("Found empty brackets \"[]\" in '{}'", pattern); } return bracketContent.toString(); }
Source:
<code>public void stop(Duration timeout) { Objects.requireNonNull(timeout); <START> LOG.warning("Stopping " + getId()); <END> String seconds = String.valueOf(timeout.toMillis() / 1000); HttpRequest request = new HttpRequest(POST, String.format("/containers/%s/stop", id)) .addQueryParameter("t", seconds); HttpResponse res = client.execute(request); if (!res.isSuccessful()) { throw new WebDriverException("Unable to stop container: " + Contents.string(res)); } }</code><technical_language>a warning. informational message</technical_language>

Target:
public void stop(Duration timeout) { Objects.requireNonNull(timeout); LOG.info("Stopping " + getId()); String seconds = String.valueOf(timeout.toMillis() / 1000); HttpRequest request = new HttpRequest(POST, String.format("/containers/%s/stop", id)) .addQueryParameter("t", seconds); HttpResponse res = client.execute(request); if (!res.isSuccessful()) { throw new WebDriverException("Unable to stop container: " + Contents.string(res)); } }
Source:
<code>public HDPath extend(List<ChildNumber> path2) { List<ChildNumber> mutable = new ArrayList<>(this.unmodifiableList); mutable.addAll(path2); <START> return new HDPath(mutable); <END> }</code><technical_language>question: hasPrivateKey field ends false in HDPaths produced extend() operations, preserved a introduce true values</technical_language>

Target:
public HDPath extend(List<ChildNumber> path2) { return this.extend(HDPath.of(path2)); }
Source:
<code>public void addUser(String username, String password) { <START> throw new RuntimeException("Adding a user is not supporting in LDAP"); <END> }</code><technical_language>UnsupportedOperationException instead of a generic RuntimeException</technical_language>

Target:
public void addUser(String username, String password) { throw new UnsupportedOperationException("Adding a user is not supporting in LDAP"); }
Source:
<code>public CompletableFuture<Boolean> processStatusUpdateAsync(Protos.TaskStatus status) { return statusUpdatesSemaphore.call(() -> CompletableFuture.supplyAsync(() -> { long insideLock = 0; final String taskId = status.getTaskId().getValue(); final Optional<SingularityTaskId> maybeTaskId = getTaskId(taskId); if (!maybeTaskId.isPresent()) { return false; } final long start = schedulerLock.lock(maybeTaskId.get().getRequestId(), "statusUpdate"); <START> try { <END> insideLock = System.currentTimeMillis(); unsafeProcessStatusUpdate(status, maybeTaskId.get()); } finally { schedulerLock.unlock(maybeTaskId.get().getRequestId(), "statusUpdate", start); LOG.info("Processed status update for ({}) in (waited for lock)", status.getTaskId() .getValue(), status.getState(), JavaUtils.duration(start), JavaUtils.durationFromMillis(insideLock - start)); } return true; }, statusUpdatesExecutor) ); }</code><technical_language>sense callWithRequestLock() well, SingularitySchedulerLock#(lock|unlock) private</technical_language>

Target:
public CompletableFuture<Boolean> processStatusUpdateAsync(Protos.TaskStatus status) { return statusUpdatesSemaphore.call(() -> CompletableFuture.supplyAsync(() -> { final String taskId = status.getTaskId().getValue(); final Optional<SingularityTaskId> maybeTaskId = getTaskId(taskId); if (!maybeTaskId.isPresent()) { return false; } schedulerLock.runWithRequestLock( () -> unsafeProcessStatusUpdate(status, maybeTaskId.get()), maybeTaskId.get().getRequestId(), getClass().getSimpleName()); unsafeProcessStatusUpdate(status, maybeTaskId.get()); return true; }, statusUpdatesExecutor) ); }