auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void should_select_from_materialized_view() { String table = TestUtils.generateIdentifier("table"); final String mv = TestUtils.generateIdentifier("mv"); execute( String.format("CREATE TABLE %s (pk int, cc int, v int, PRIMARY KEY (pk, cc))", table), String.format("INSERT INTO %s (pk, cc, v) VALUES (0,0,0)", table), String.format("INSERT INTO %s (pk, cc, v) VALUES (0,1,1)", table), String.format("INSERT INTO %s (pk, cc, v) VALUES (0,2,2)", table), String.format( "CREATE MATERIALIZED VIEW %s AS SELECT cc FROM %s WHERE cc IS NOT NULL PRIMARY KEY (pk, cc)", mv, table)); ConditionChecker.check() .that( new Callable<Boolean>() { @Override public Boolean call() { return session().execute("SELECT * FROM " + mv).all().size() == 3; } }) .before(1, MINUTES) .becomesTrue(); assertThat(session().execute(select().column("cc").as("mycc").from(mv))) <START> .containsExactly(row(0), row(1), row(2)); <END> }</code><technical_language>this row(n) syntax is validating fact row exists? content of a row</technical_language>

Target:
public void should_select_from_materialized_view() { String table = TestUtils.generateIdentifier("table"); final String mv = TestUtils.generateIdentifier("mv"); execute( String.format("CREATE TABLE %s (pk int, cc int, v int, PRIMARY KEY (pk, cc))", table), String.format("INSERT INTO %s (pk, cc, v) VALUES (0,0,0)", table), String.format("INSERT INTO %s (pk, cc, v) VALUES (0,1,1)", table), String.format("INSERT INTO %s (pk, cc, v) VALUES (0,2,2)", table), String.format( "CREATE MATERIALIZED VIEW %s AS SELECT cc FROM %s WHERE cc IS NOT NULL PRIMARY KEY (pk, cc)", mv, table)); ConditionChecker.check() .that( new Callable<Boolean>() { @Override public Boolean call() { return session().execute("SELECT * FROM " + mv).all().size() == 3; } }) .before(1, MINUTES) .becomesTrue(); MaterializedViewMetadata materializedView = session().getCluster().getMetadata().getKeyspace(keyspace).getMaterializedView(mv); assertThat(session().execute(select().column("cc").as("mycc").from(materializedView))) .containsExactly(row(0), row(1), row(2)); }
Source:
<code><START> public void shutdown(IMediaStream stream, String msg){ <END> logger.error(msg); IClient client = stream.getClient(); if (client != null){ sendClientOnStatusError((IClient)client, "NetStream.Play.Failed", msg); client.setShutdownClient(true); DiagnosticsProvider.addRejectedStreamFromClient(msg, client); } if (stream.getRTPStream() != null && stream.getRTPStream().getSession() !=null){ String sessionId = stream.getRTPStream().getSession().getSessionId(); Ivhost.killRTSPSession(sessionId); RTPSession rtpSession = stream.getRTPStream().getSession(); DiagnosticsProvider.addRejectedStreamFromRTSP(msg, rtpSession); } }</code><technical_language>function private. call class</technical_language>

Target:
private void shutdown(IMediaStream stream, String msg){ logger.error(msg); IClient client = stream.getClient(); KalturaStreamType streamType = Utils.getStreamType(stream, stream.getName()); switch(streamType) { case RTMP: sendClientOnStatusError((IClient)client, "NetStream.Play.Failed", msg); client.setShutdownClient(true); DiagnosticsProvider.addRejectedRTMPStream(client, msg); break; case RTSP: sendStreamOnStatusError(stream, "NetStream.Play.Failed", msg); RTPSession rtpSession = stream.getRTPStream().getSession(); appInstance.getVHost().getRTPContext().shutdownRTPSession(rtpSession); DiagnosticsProvider.addRejectedRTSPStream(rtpSession, msg); break; default: sendStreamOnStatusError(stream, "NetStream.Play.Failed", msg); logger.error("Critical, " + streamType + " stream type! failed to play stream. " + msg); break; } }
Source:
<code>public PIDChassisController(ChassisController controller, IMU imu, MotionController motionController, double maxDegreesPerSecond) { this.controller = controller; this.maxDegreesPerSecond = maxDegreesPerSecond; this.imu = imu; this.imu.reset(); this.imu.setPIDSourceType(PIDSourceType.kDisplacement); this.motionController = motionController; motionController.setInputRange(-180.0f, 180.0f); motionController.setOutputRange(-1.0f, 1.0f); motionController.setContinuous(true); try { motionController.reset(); } catch (InvalidSensorException e) { <START> LogKitten.ex(e); <END> } motionController.enable(); targetYaw = imu.getYaw(); lastUpdate = System.currentTimeMillis() / 1000.0; }</code><technical_language>I versions, get (which catches LogKitten.exes exception) getSafe throws exception. simple code need worry this stuff complicated code can. (get a call getSafe a catch)</technical_language>

Target:
public PIDChassisController(ChassisController controller, IMU imu, MotionController motionController, double maxDegreesPerSecond) { this.controller = controller; this.maxDegreesPerSecond = maxDegreesPerSecond; this.imu = imu; this.imu.reset(); this.imu.setPIDSourceType(PIDSourceType.kDisplacement); this.motionController = motionController; motionController.setInputRange(-180.0f, 180.0f); motionController.setOutputRange(-1.0f, 1.0f); motionController.setContinuous(true); motionController.reset(); motionController.enable(); targetYaw = imu.getYaw(); lastUpdate = System.currentTimeMillis() / 1000.0; }
Source:
<code>protected String getAlias(String field) { String alias = null; Filter include = getMatchingConf().getInclude(); LinkedHashMap<String, Object> conf = getMatchingConf().getConf(); String fullAttributeName =(field!=null)?(getAttribute().getName() + "." + field):(getAttribute().getName()); if (include.getAttribute() instanceof LinkedHashMap<?, ?>) { LinkedHashMap<String, LinkedHashMap<String, String>> attribute = (LinkedHashMap<String, LinkedHashMap<String, String>>) (include.getAttribute()); if (attribute.get(fullAttributeName).get("alias_match") != null) { Pattern p = Pattern.compile(attribute.get(fullAttributeName).get("alias_match")); <START> Matcher m = p.matcher(getBeanName().getCanonicalName() + "." + fullAttributeName); <END> if (m.find()) { alias = m.replaceFirst(attribute.get(fullAttributeName).get(ALIAS)); } } else { alias = attribute.get(fullAttributeName).get(ALIAS); } } else if (conf.get("metric_prefix") != null) { alias = conf.get("metric_prefix") + "." + getDomain() + "." + fullAttributeName; } else if (getDomain().startsWith("org.apache.cassandra")) { alias = getCassandraAlias(); } if (alias == null) { alias = "jmx." + getDomain() + "." + fullAttributeName; } alias = convertMetricName(alias); return alias; }</code><technical_language>thinking alias_match defined attribute yaml config include in match statement, removed some extra duplicity append ".#attribute#" end of alias config line reproduce full metric name. Of this method if want attribute name add alias_match regex, a similar issue way</technical_language>

Target:
protected String getAlias(String field) { String alias = null; Filter include = getMatchingConf().getInclude(); LinkedHashMap<String, Object> conf = getMatchingConf().getConf(); String fullAttributeName =(field!=null)?(getAttribute().getName() + "." + field):(getAttribute().getName()); if (include.getAttribute() instanceof LinkedHashMap<?, ?>) { LinkedHashMap<String, LinkedHashMap<String, String>> attribute = (LinkedHashMap<String, LinkedHashMap<String, String>>) (include.getAttribute()); alias = getUserAlias(attribute, fullAttributeName); } else if (conf.get("metric_prefix") != null) { alias = conf.get("metric_prefix") + "." + getDomain() + "." + fullAttributeName; } else if (getDomain().startsWith("org.apache.cassandra")) { alias = getCassandraAlias(); } if (alias == null) { alias = "jmx." + getDomain() + "." + fullAttributeName; } alias = convertMetricName(alias); return alias; }
Source:
<code>private NumberToStringConverter(NumberFormat numberFormat, Class<?> fromType) { super(fromType, String.class); <START> Objects.requireNonNull(numberFormat, "numberFormat cannot be null"); END> this.numberFormat = numberFormat; this.fromType = fromType; if (Integer.class.equals(fromType) || Integer.TYPE.equals(fromType) || Long.class.equals(fromType) || Long.TYPE.equals(fromType) || Short.class.equals(fromType) || Short.TYPE.equals(fromType) || Byte.class.equals(fromType) || Byte.TYPE.equals(fromType)) { fromTypeFitsLong = true; } else if (Float.class.equals(fromType) || Float.TYPE.equals(fromType) || Double.class.equals(fromType) || Double.TYPE.equals(fromType)) { fromTypeIsDecimalType = true; } else if (BigInteger.class.equals(fromType)) { fromTypeIsBigInteger = true; } else if (BigDecimal.class.equals(fromType)) { fromTypeIsBigDecimal = true; } }</code><technical_language>Subjective (but pretty clear) style issue: reason for a message all. this: this.numberFormat = Objects.requireNonNull(numberFormat); This is noisy, line number in exception variable is null</technical_language>

Target:
private NumberToStringConverter(NumberFormat numberFormat, Class<?> fromType) { super(fromType, String.class); Objects.requireNonNull(numberFormat, "numberFormat must not be null"); this.numberFormat = numberFormat; this.fromType = fromType; if (Integer.class.equals(fromType) || Integer.TYPE.equals(fromType) || Long.class.equals(fromType) || Long.TYPE.equals(fromType) || Short.class.equals(fromType) || Short.TYPE.equals(fromType) || Byte.class.equals(fromType) || Byte.TYPE.equals(fromType)) { fromTypeFitsLong = true; } else if (Float.class.equals(fromType) || Float.TYPE.equals(fromType) || Double.class.equals(fromType) || Double.TYPE.equals(fromType)) { fromTypeIsDecimalType = true; } else if (BigInteger.class.equals(fromType)) { fromTypeIsBigInteger = true; } else if (BigDecimal.class.equals(fromType)) { fromTypeIsBigDecimal = true; } }
Source:
<code>public void buildHeaders(long objectSize, String etag) throws InvalidArgumentException { if (offset != null && offset >= objectSize) { throw new InvalidArgumentException("source " + bucketName + "/" + objectName + ": offset " + offset + " is beyond object size " + objectSize); } if (length != null) { if (length >= objectSize) { throw new InvalidArgumentException("source " + bucketName + "/" + objectName + ": length " + length + " is beyond object size " + objectSize); } if (offset + length > objectSize) { <START> throw new InvalidArgumentException("source " + bucketName + "/" + objectName + ": compose size " <END> + (offset + length) + " is beyond object size " + objectSize); } } Map<String, String> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); headers.put("x-amz-copy-source", S3Escaper.encodePath(bucketName + "/" + objectName)); headers.put("x-amz-copy-source-if-match", etag); if (headerMap != null) { headers.putAll(headerMap); } if (copyConditions != null) { headers.putAll(copyConditions.getConditions()); } if (sse != null) { headers = sse.headers(); } this.objectSize = objectSize; this.headers = headers; }</code><technical_language>clearer if "(length + offset)" is instead of "compose size"</technical_language>

Target:
public void buildHeaders(long objectSize, String etag) throws InvalidArgumentException { if (offset != null && offset >= objectSize) { throw new InvalidArgumentException("source " + bucketName + "/" + objectName + ": offset " + offset + " is beyond object size " + objectSize); } if (length != null) { if (length > objectSize) { throw new InvalidArgumentException("source " + bucketName + "/" + objectName + ": length " + length + " is beyond object size " + objectSize); } if (offset + length > objectSize) { throw new InvalidArgumentException("source " + bucketName + "/" + objectName + ": compose size " + (offset + length) + " is beyond object size " + objectSize); } } Map<String, String> headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); headers.put("x-amz-copy-source", S3Escaper.encodePath(bucketName + "/" + objectName)); headers.put("x-amz-copy-source-if-match", etag); if (headerMap != null) { headers.putAll(headerMap); } if (copyConditions != null) { headers.putAll(copyConditions.getConditions()); } if (sse != null) { headers.putAll(sse.copySourceHeaders()); } this.objectSize = objectSize; this.headers = headers; }
Source:
<code>public void testNoArgumentFactoryRegisteredForProperty() { handle.execute("create table beans (id integer, value_type varchar)"); assertThatThrownBy(() -> handle.attach(BeanDao.class).insert(new Bean(1, ValueType.valueOf("foo")))) .hasMessageContaining("No argument factory registered"); <START> handle.registerArgument(new ValueTypeArgumentFactory()); <END> BeanDao dao = handle.attach(BeanDao.class); dao.insert(new Bean(1, ValueType.valueOf("foo"))); assertThat(dao.getById(1)).extracting(Bean::getId, Bean::getValueType) .containsExactly(1, ValueType.valueOf("foo")); }</code><technical_language>I split this test two: for checking error message other for successful execution registered mapper</technical_language>

Target:
public void testNoArgumentFactoryRegisteredForProperty() { handle.execute("create table beans (id integer, value_type varchar)"); assertThatThrownBy(() -> handle.attach(BeanDao.class).insert(new Bean(1, ValueType.valueOf("foo")))) .hasMessageContaining("No argument factory registered"); }
Source:
<code>protected void validateRootGroups(ManagerSpec managerSpec) { Queue<ResourceGroupSpec> groups = new LinkedList<>(managerSpec.getRootGroups()); while (!groups.isEmpty()) { ResourceGroupSpec group = groups.poll(); groups.addAll(group.getSubGroups()); if (group.getSoftCpuLimit().isPresent() || group.getHardCpuLimit().isPresent()) { checkArgument(managerSpec.getCpuQuotaPeriod().isPresent(), "cpuQuotaPeriod must be specified to use cpu limits on group: %s", group.getName()); } if (group.getSoftCpuLimit().isPresent()) { checkArgument(group.getHardCpuLimit().isPresent(), "Must specify hard CPU limit in addition to soft limit"); checkArgument(group.getSoftCpuLimit().get().compareTo(group.getHardCpuLimit().get()) <= 0, "Soft CPU limit cannot be greater than hard CPU limit"); } if (group.getSchedulingPolicy().isPresent()) { switch (group.getSchedulingPolicy().get()) { case WEIGHTED: <START> case WEIGHTED_FAIR: <END> break; case QUERY_PRIORITY: case FAIR: for (ResourceGroupSpec subGroup : group.getSubGroups()) { checkArgument(!subGroup.getSchedulingWeight().isPresent(), "Must use \"weighted\" or \"weighted_fair\" scheduling policy when using scheduling weight"); } break; default: throw new UnsupportedOperationException(); } } } }</code><technical_language>This check fail long a default of 1 in config. this check is necessary. If some day people changed config default this useful</technical_language>

Target:
protected void validateRootGroups(ManagerSpec managerSpec) { Queue<ResourceGroupSpec> groups = new LinkedList<>(managerSpec.getRootGroups()); while (!groups.isEmpty()) { ResourceGroupSpec group = groups.poll(); List<ResourceGroupSpec> subGroups = group.getSubGroups(); groups.addAll(subGroups); if (group.getSoftCpuLimit().isPresent() || group.getHardCpuLimit().isPresent()) { checkArgument(managerSpec.getCpuQuotaPeriod().isPresent(), "cpuQuotaPeriod must be specified to use cpu limits on group: %s", group.getName()); } if (group.getSoftCpuLimit().isPresent()) { checkArgument(group.getHardCpuLimit().isPresent(), "Must specify hard CPU limit in addition to soft limit"); checkArgument(group.getSoftCpuLimit().get().compareTo(group.getHardCpuLimit().get()) <= 0, "Soft CPU limit cannot be greater than hard CPU limit"); } if (group.getSchedulingPolicy().isPresent()) { switch (group.getSchedulingPolicy().get()) { case WEIGHTED: case WEIGHTED_FAIR: checkArgument( subGroups.stream().allMatch(t -> t.getSchedulingWeight().isPresent()) || subGroups.stream().noneMatch(t -> t.getSchedulingWeight().isPresent()), format("Must specify scheduling weight for all sub-groups of '%s' or none of them", group.getName())); break; case QUERY_PRIORITY: case FAIR: for (ResourceGroupSpec subGroup : subGroups) { checkArgument(!subGroup.getSchedulingWeight().isPresent(), String.format("Must use 'weighted' or 'weighted_fair' scheduling policy if specifying scheduling weight for '%s'", group.getName())); } break; default: throw new UnsupportedOperationException(); } } } }
Source:
<code>private LeafNode getOrCreateLeafNodeProsodyWorkaround(final String id) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException { try { return createNode(id); } catch (XMPPErrorException e1) { if (e1.getXMPPError().getCondition() == Condition.conflict || <START> e1.getXMPPError().getCondition() == Condition.service_unavailable) { <END> Constructor<?> constructor = LeafNode.class.getDeclaredConstructors()[0]; constructor.setAccessible(true); LeafNode res; try { res = (LeafNode) constructor.newInstance(this, id); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e2) { throw new AssertionError(e2); } return res; } throw e1; } }</code><technical_language>Do need service-service unavailable check here? expect prosody servers create node throw a conflict error</technical_language>

Target:
private LeafNode getOrCreateLeafNodeProsodyWorkaround(final String id) throws XMPPErrorException, NoResponseException, NotConnectedException, InterruptedException { try { return createNode(id); } catch (XMPPErrorException e1) { if (e1.getXMPPError().getCondition() == Condition.conflict) { Constructor<?> constructor = LeafNode.class.getDeclaredConstructors()[0]; constructor.setAccessible(true); LeafNode res; try { res = (LeafNode) constructor.newInstance(this, id); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e2) { throw new AssertionError(e2); } return res; } throw e1; } }
Source:
<code>void checkPartialDisconnectivity(long timestamp) { if (!partialDisconnectionDetectionEnabled) { return; } else if (!clusterService.isMaster()) { logger.severe("Cannot check disconnected members since I am not the master."); return; } try { <START> clusterServiceLock.lock(); <END> if (partialDisconnectionHandler.shouldResolvePartialDisconnections(timestamp)) { Map<MemberImpl, Set<MemberImpl>> disconnections = partialDisconnectionHandler.reset(); nodeEngine.getExecutionService().execute(ASYNC_EXECUTOR, new ResolvePartialDisconnectionsTask(disconnections)); } } finally { clusterServiceLock.unlock(); } }</code><technical_language>move lock() of try { block..</technical_language>

Target:
void checkPartialDisconnectivity(long timestamp) { if (!partialDisconnectionDetectionEnabled) { return; } else if (!clusterService.isMaster()) { logger.severe("Cannot check disconnected members since I am not the master."); return; } clusterServiceLock.lock(); try { if (partialDisconnectionHandler.shouldResolvePartialDisconnections(timestamp)) { Map<MemberImpl, Set<MemberImpl>> disconnections = partialDisconnectionHandler.reset(); nodeEngine.getExecutionService().execute(ASYNC_EXECUTOR, new ResolvePartialDisconnectionsTask(disconnections)); } } finally { clusterServiceLock.unlock(); } }
Source:
<code><START> public CreateAdvBuilder makeAdv() { <END> if(advBuilder == null) { advBuilder = new CreateAdvBuilderImpl(this); } return advBuilder; }</code><technical_language>do need separate advbuilder? cannt assume / implement logic if is advbuilder if ledger id is provided</technical_language>

Target:
public CreateAdvBuilder makeAdv() { return new CreateAdvBuilderImpl(this); }
Source:
<code>public void execute() { ListResponse<HostResponse> response = null; if (getVirtualMachineId() == null) { response = _queryService.searchForServers(this); } else { Pair<List<? extends Host>, Integer> result; Ternary<Pair<List<? extends Host>, Integer>, List<? extends Host>, Map<Host, Boolean>> hostsForMigration = <START> _mgr.listHostsForMigrationOfVM(getVirtualMachineId(), this.getStartIndex(), this.getPageSizeVal(), null); <END> result = hostsForMigration.first(); List<? extends Host> hostsWithCapacity = hostsForMigration.second(); response = new ListResponse<HostResponse>(); List<HostResponse> hostResponses = new ArrayList<HostResponse>(); for (Host host : result.first()) { HostResponse hostResponse = _responseGenerator.createHostResponse(host, getDetails()); Boolean suitableForMigration = false; if (hostsWithCapacity.contains(host)) { suitableForMigration = true; } hostResponse.setSuitableForMigration(suitableForMigration); hostResponse.setObjectName("host"); hostResponses.add(hostResponse); } response.setResponses(hostResponses, result.second()); } response.setResponseName(getCommandName()); this.setResponseObject(response); }</code><technical_language>keyword is here? API commands derived BaseListCmd keyword</technical_language>

Target:
public void execute() { ListResponse<HostResponse> response = getHostResponses(); response.setResponseName(getCommandName()); this.setResponseObject(response); }
Source:
<code>public SafeHtml getTooltip(GlusterBrickEntity brick) { GlusterStatus status = brick.getStatus(); String tooltip = null; switch (status) { case DOWN: tooltip = constants.down(); break; case UP: tooltip = constants.up(); break; case UNKNOWN: tooltip = constants.unknown(); break; default: tooltip = constants.down(); } if (brick.getStatus() != GlusterStatus.DOWN && brick.getUnSyncedEntries() != null <START> && brick.getUnSyncedEntries() > 0) { <END> tooltip += ", " + brick.getUnSyncedEntries() + constants.unSyncedEntriesPresent(); } return SafeHtmlUtils.fromSafeConstant(tooltip); }</code><technical_language>isEmpty instead of > 0 check</technical_language>

Target:
public SafeHtml getTooltip(GlusterBrickEntity brick) { GlusterStatus status = brick.getStatus(); String tooltip = null; switch (status) { case DOWN: tooltip = constants.down(); break; case UP: tooltip = constants.up(); break; case UNKNOWN: tooltip = constants.unknown(); break; default: tooltip = constants.down(); } if (brick.getStatus() != GlusterStatus.DOWN && brick.getUnSyncedEntries() > 0) { tooltip = messages.brickStatusWithUnSyncedEntriesPresent(tooltip, brick.getUnSyncedEntries()); } return SafeHtmlUtils.fromSafeConstant(tooltip); }
Source:
<code>protected Integer getIdentifierLengthLimit(JdbcEnvironment context) { String dialectName = context.getDialect().getClass().getSimpleName(); if (dialectName.startsWith("Oracle")) { return LENGTH_LIMIT_ORACLE; <START> } if (context.getDialect() instanceof Shogun2OracleDialect) { <END> return LENGTH_LIMIT_ORACLE; } else if (dialectName.startsWith("PostgreSQL")) { return LENGTH_LIMIT_POSTGRESQL; } return null; }</code><technical_language>I this else if instead of if, right</technical_language>

Target:
protected Integer getIdentifierLengthLimit(JdbcEnvironment context) { String dialectName = context.getDialect().getClass().getSimpleName(); if (dialectName.startsWith("Oracle")) { return LENGTH_LIMIT_ORACLE; } else if (context.getDialect() instanceof Shogun2OracleDialect) { return LENGTH_LIMIT_ORACLE; } else if (dialectName.startsWith("PostgreSQL")) { return LENGTH_LIMIT_POSTGRESQL; } return null; }
Source:
<code>public static boolean updateDiskStats(HWDiskStore diskStore) { List<String> output = ExecutingCommand.runNative("iostat -Ix " + diskStore.getName()); long timeStamp = System.currentTimeMillis(); boolean diskFound = false; for (String line : output) { String[] split = ParseUtil.whitespaces.split(line); if (split.length < 7 || !split[0].equals(diskStore.getName())) { continue; } diskFound = true; diskStore.setReads((long) ParseUtil.parseDoubleOrDefault(split[1], 0d)); diskStore.setWrites((long) ParseUtil.parseDoubleOrDefault(split[2], 0d)); diskStore.setReadBytes((long) (ParseUtil.parseDoubleOrDefault(split[3], 0d) * 1024)); diskStore.setWriteBytes((long) (ParseUtil.parseDoubleOrDefault(split[4], 0d) * 1024)); <START> diskStore.setQueueLength((long) (ParseUtil.parseDoubleOrDefault(split[5], 0d))); <END> diskStore.setTransferTime((long) (ParseUtil.parseDoubleOrDefault(split[6], 0d) * 1000)); diskStore.setTimeStamp(timeStamp); } return diskFound; }</code><technical_language>Dug source code. format headers for FreeBSD: "device r/s w/s kr/s kw/s qlen svc_t %%b " "%-8.8s %5.1Lf %5.1Lf %7.1Lf %7.1Lf %4" PRIu64 " %5.1Lf %3.0Lf " outputs floating point except: - qlen is %4" PRIu64 " is unsigned 64 bit long... - %b (busy) is truncated 0 decimals parsed int</technical_language>

Target:
public static boolean updateDiskStats(HWDiskStore diskStore) { List<String> output = ExecutingCommand.runNative("iostat -Ix " + diskStore.getName()); long timeStamp = System.currentTimeMillis(); boolean diskFound = false; for (String line : output) { String[] split = ParseUtil.whitespaces.split(line); if (split.length < 7 || !split[0].equals(diskStore.getName())) { continue; } diskFound = true; diskStore.setReads((long) ParseUtil.parseDoubleOrDefault(split[1], 0d)); diskStore.setWrites((long) ParseUtil.parseDoubleOrDefault(split[2], 0d)); diskStore.setReadBytes((long) (ParseUtil.parseDoubleOrDefault(split[3], 0d) * 1024)); diskStore.setWriteBytes((long) (ParseUtil.parseDoubleOrDefault(split[4], 0d) * 1024)); diskStore.setCurrentQueueLength(ParseUtil.parseLongOrDefault(split[5], 0L)); diskStore.setTransferTime((long) (ParseUtil.parseDoubleOrDefault(split[6], 0d) * 1000)); diskStore.setTimeStamp(timeStamp); } return diskFound; }
Source:
<code>private String getPropertiesFile(Path path) { return AccessUtils.doPrivileged( () -> { try { <START> return new String(Files.readAllBytes(path)); <END> } catch (IOException e) { throw new MigrationException(Messages.EXPORT_SYSTEM_PROPERTIES_ERROR, e); } }); }</code><technical_language>account for encoding reading bytes a String. i.e. pass Charsets.UTF_8 String constructor parameter</technical_language>

Target:
private String getPropertiesFile(Path path) { return AccessUtils.doPrivileged( () -> { try { return new String(Files.readAllBytes(path), Charsets.UTF_8); } catch (IOException e) { throw new MigrationException(Messages.EXPORT_SYSTEM_PROPERTIES_ERROR, e); } }); }
Source:
<code>private long getValue(CuratorFramework curatorClient, String basePath, String childrenPath) { <START> Long sum = 0L; <END> try { for (String child : curatorClient.getChildren().forPath(basePath)) { try { sum += Longs.fromByteArray(curatorClient.getData().forPath(basePath + "/" + child + childrenPath)); } catch (KeeperException.NoNodeException e) { logger.trace("Someone removed node " + basePath + "/" + child + childrenPath + " while we were iterating", e); } } } catch (Exception e) { logger.warn("Error while reading value for base path: and child path: {}; {}", basePath, childrenPath, getRootCauseMessage(e)); } finally { return sum; } }</code><technical_language>do Long instead of long here</technical_language>

Target:
private long getValue(CuratorFramework curatorClient, String basePath, String childrenPath) { try { return curatorClient.getChildren().forPath(basePath).stream() .map(child -> getValueForChild(curatorClient, basePath, childrenPath, child)) .reduce(0L, (a, b) -> a + b); } catch (Exception e) { logger.warn("Error while reading value for base path: and child path: {}; {}", basePath, childrenPath, getRootCauseMessage(e)); } return 0; }
Source:
<code>public void unsubscribe(URL url, NotifyListener listener) { for (Registry registry : referenceRegistries.values()) { <START> registry.unsubscribe(url, listener); <END> } MultipleNotifyListenerWrapper notifyListener = multipleNotifyListenerMap.remove(listener); if (notifyListener != null) { super.unsubscribe(url, notifyListener); notifyListener.destroy(); } }</code><technical_language>SingleNotifyListener in MultipleNotifyListenerWrapper.registryMap unsubscribe registry. pls check this</technical_language>

Target:
public void unsubscribe(URL url, NotifyListener listener) { MultipleNotifyListenerWrapper notifyListener = multipleNotifyListenerMap.remove(listener); for (Registry registry : referenceRegistries.values()) { SingleNotifyListener singleNotifyListener = notifyListener.registryMap.get(registry.getUrl()); registry.unsubscribe(url, singleNotifyListener); } if (notifyListener != null) { super.unsubscribe(url, notifyListener); notifyListener.destroy(); } }
Source:
<code>private boolean isCompatibleWithDevice(int fps) { <START> ArrayList<int[]> validValues = (ArrayList<int[]>) mCameraParameters.getSupportedPreviewFpsRange(); <END> for(int[] row : validValues) { boolean is_included = fps >= row[0] && fps <= row[1]; if (is_included) return true; } Log.w("CAMERA_1::", "fps (framePerSecond) received an unsupported value and will be ignored."); return false; }</code><technical_language>expose valid fps for user</technical_language>

Target:
private boolean isCompatibleWithDevice(int fps) { ArrayList<int[]> validValues; validValues = getSupportedPreviewFpsRange(); int accurate_fps = fps * 1000; for(int[] row : validValues) { boolean is_included = accurate_fps >= row[0] && accurate_fps <= row[1]; boolean greater_then_zero = accurate_fps > 0; boolean compatible_with_device = is_included && greater_then_zero; if (compatible_with_device) return true; } Log.w("CAMERA_1::", "fps (framePerSecond) received an unsupported value and will be ignored."); return false; }
Source:
<code>public static boolean canShare(Metacard metacard) { return metacard != null && metacard .getMetacardType() .getAttributeDescriptors() .stream() .map(AttributeDescriptor::getName) <START> .anyMatch(attr -> Objects.equals(SecurityAttributes.ACCESS_GROUPS, attr)) <END> && metacard .getMetacardType() .getAttributeDescriptors() .stream() .map(AttributeDescriptor::getName) .anyMatch(attr -> Objects.equals(SecurityAttributes.ACCESS_INDIVIDUALS, attr)); }</code><technical_language>Woah. this removed accident? resource metacards get processed this class, is want</technical_language>

Target:
public static boolean canShare(Metacard metacard) { return metacard != null && isSharingCapable(metacard) && metacard .getMetacardType() .getAttributeDescriptors() .stream() .map(AttributeDescriptor::getName) .anyMatch(attr -> Objects.equals(SecurityAttributes.ACCESS_GROUPS, attr)) && metacard .getMetacardType() .getAttributeDescriptors() .stream() .map(AttributeDescriptor::getName) .anyMatch(attr -> Objects.equals(SecurityAttributes.ACCESS_INDIVIDUALS, attr)); }
Source:
<code>public Builder ttl(int ttl) { <START> checkArgument(ttl >= getInteger(TTL_MIN_IN_SEC), "ttl must be >= %s", getInteger(TTL_MIN_IN_SEC)); <END> checkArgument(ttl <= getInteger(TTL_MAX_IN_SEC), "ttl must be <= %s", getInteger(TTL_MAX_IN_SEC)); this.ttl = ttl; return self(); }</code><technical_language>"...but was: %d:"</technical_language>

Target:
public Builder ttl(int ttl) { this.ttl = ttl; return self(); }
Source:
<code>public void loadGeppettoProject(String requestID, IGeppettoProject geppettoProject, long experimentId) { try { geppettoManager.loadProject(requestID, geppettoProject); Gson gson = new Gson(); String projectJSON = gson.toJson(geppettoProject); setConnectionProject(geppettoProject); websocketConnection.sendMessage(requestID, OutboundMessages.PROJECT_LOADED, projectJSON); boolean persisted = !geppettoProject.isVolatile(); <START> String update = "{\"persisted\":" + persisted + ",\"projectId\":" + geppettoProject.getId() +"}"; <END> websocketConnection.sendMessage(requestID, OutboundMessages.PROJECT_PERSISTENCE_STATE, update); String geppettoModelJSON = GeppettoSerializer.serializeToJSON(((GeppettoManager) geppettoManager).getRuntimeProject(geppettoProject).getGeppettoModel(), true); websocketConnection.sendMessage(requestID, OutboundMessages.GEPPETTO_MODEL_LOADED, geppettoModelJSON); if(experimentId != -1) { loadExperiment(requestID, experimentId, geppettoProject.getId()); } else if(geppettoProject.getActiveExperimentId() != -1) { loadExperiment(requestID, geppettoProject.getActiveExperimentId(), geppettoProject.getId()); } } catch(GeppettoInitializationException | GeppettoExecutionException | GeppettoAccessException | IOException e) { error(e, "Could not load geppetto project"); } }</code><technical_language>I notice building update message string manipulation. Is object calling methods do this instead</technical_language>

Target:
public void loadGeppettoProject(String requestID, IGeppettoProject geppettoProject, long experimentId) { try { geppettoManager.loadProject(requestID, geppettoProject); Gson gson = new Gson(); String projectJSON = gson.toJson(geppettoProject); boolean persisted = geppettoProject.isVolatile(); String update = "{\"persisted\":" + !persisted + ",\"project\":" + projectJSON +"}"; setConnectionProject(geppettoProject); websocketConnection.sendMessage(requestID, OutboundMessages.PROJECT_LOADED, update); String geppettoModelJSON = GeppettoSerializer.serializeToJSON(((GeppettoManager) geppettoManager).getRuntimeProject(geppettoProject).getGeppettoModel(), true); websocketConnection.sendMessage(requestID, OutboundMessages.GEPPETTO_MODEL_LOADED, geppettoModelJSON); if(experimentId != -1) { loadExperiment(requestID, experimentId, geppettoProject.getId()); } else if(geppettoProject.getActiveExperimentId() != -1) { loadExperiment(requestID, geppettoProject.getActiveExperimentId(), geppettoProject.getId()); } } catch(GeppettoInitializationException | GeppettoExecutionException | GeppettoAccessException | IOException e) { error(e, "Could not load geppetto project"); } }
Source:
<code>public List<ChooserTarget> onGetChooserTargets(ComponentName targetActivityName, IntentFilter matchedFilter) { final List<ChooserTarget> targets = new ArrayList<>(); HostManager hostManager = HostManager.getInstance(this); final Icon icon = Icon.createWithResource(this, R.mipmap.ic_launcher); final float score = 0; final ComponentName componentName = new ComponentName(getPackageName(), "org.xbmc.kore.ui.sections.remote.RemoteActivity"); for (HostInfo host : hostManager.getHosts()) { String title = host.getName(); Bundle intentExtras = new Bundle(); <START> intentExtras.putString("host.name", title); <END> targets.add(new ChooserTarget(title, icon, score, componentName, intentExtras)); } return targets; }</code><technical_language>Please host.id instead of name is guaranteed unique</technical_language>

Target:
public List<ChooserTarget> onGetChooserTargets(ComponentName targetActivityName, IntentFilter matchedFilter) { final List<ChooserTarget> targets = new ArrayList<>(); HostManager hostManager = HostManager.getInstance(this); final Icon icon = Icon.createWithResource(this, R.mipmap.ic_launcher); final float score = 0; final ComponentName componentName = new ComponentName(getPackageName(), "org.xbmc.kore.ui.sections.remote.RemoteActivity"); for (HostInfo host : hostManager.getHosts()) { Bundle intentExtras = new Bundle(); intentExtras.putInt("hostId", host.getId()); targets.add(new ChooserTarget(host.getName(), icon, score, componentName, intentExtras)); } return targets; }
Source:
<code>public File generateMultipleDockets(Collection<DocketData> docketData, URI xslFileUri) throws IOException { ExportDocket exportDocket = new ExportDocket(); File file = new File("docket_multipage.pdf"); FileOutputStream fileOutputStream = new FileOutputStream(file); <START> try { <END> exportDocket.startExport(docketData, fileOutputStream, new File(xslFileUri)); } catch (IOException e) { throw new IOException(e.getMessage()); } finally { fileOutputStream.flush(); fileOutputStream.close(); } return file; }</code><technical_language>Please [try-with-resources](<LINK_0> statement instead of handling this manually</technical_language>

Target:
public File generateMultipleDockets(Collection<DocketData> docketData, URI xslFileUri) throws IOException { ExportDocket exportDocket = new ExportDocket(); File file = new File("docket_multipage.pdf"); try (FileOutputStream fileOutputStream = new FileOutputStream(file)) { exportDocket.startExport(docketData, fileOutputStream, new File(xslFileUri)); } catch (IOException e) { throw new IOException(e.getMessage()); } return file; }
Source:
<code>public LiveMigrateDiskCommand(T parameters) { super(parameters); <START> if (VMStatus.Up != getVm().getstatus()) { <END> internalEndFailure(); return; } setVdsId(getVm().getrun_on_vds().getValue()); getParameters().setVdsId(getVdsId()); setStoragePoolId(getVm().getstorage_pool_id()); getParameters().setStoragePoolId(getStoragePoolId().getValue()); getParameters().setDiskAlias(getDiskAlias()); getParameters().setImageGroupID(getImageGroupId()); getParameters().setCommandType(getActionType()); }</code><technical_language>I add condition VMStatus.Up != getVm().getstatus()), for setting parameters. call internalEndFailure endSuccesfully. I Calling logic constructor is wrong</technical_language>

Target:
public LiveMigrateDiskCommand(T parameters) { super(parameters); if (VMStatus.Up != getVm().getstatus()) { log.infoFormat("Rollback LiveMigrateDiskCommand - VM {0} is not UP", getVm().getvm_name()); handleVmNotUp(); return; } setVdsId(getVm().getrun_on_vds().getValue()); getParameters().setVdsId(getVdsId()); setStoragePoolId(getVm().getstorage_pool_id()); getParameters().setStoragePoolId(getStoragePoolId().getValue()); getParameters().setDiskAlias(getDiskAlias()); getParameters().setImageGroupID(getImageGroupId()); getParameters().setCommandType(getActionType()); }
Source:
<code>public void testAddFolder() throws Exception { <START> assertTrue(new File(db.getWorkTree(), "sub").mkdir()); <END> File file = new File(db.getWorkTree(), "sub/a.txt"); FileUtils.createNewFile(file); PrintWriter writer = new PrintWriter(file); writer.print("content"); writer.close(); File file2 = new File(db.getWorkTree(), "sub/b.txt"); FileUtils.createNewFile(file2); writer = new PrintWriter(file2); writer.print("content b"); writer.close(); Git git = new Git(db); git.add().addFilepattern("sub").call(); assertEquals( "[sub/a.txt, mode:100644, content:content]" + "[sub/b.txt, mode:100644, content:content b]", indexState(CONTENT)); }</code><technical_language>FileUtils.mkdirs</technical_language>

Target:
public void testAddFolder() throws Exception { FileUtils.mkdir(new File(db.getWorkTree(), "sub")); File file = new File(db.getWorkTree(), "sub/a.txt"); FileUtils.createNewFile(file); PrintWriter writer = new PrintWriter(file); writer.print("content"); writer.close(); File file2 = new File(db.getWorkTree(), "sub/b.txt"); FileUtils.createNewFile(file2); writer = new PrintWriter(file2); writer.print("content b"); writer.close(); Git git = new Git(db); git.add().addFilepattern("sub").call(); assertEquals( "[sub/a.txt, mode:100644, content:content]" + "[sub/b.txt, mode:100644, content:content b]", indexState(CONTENT)); }
Source:
<code>protected Class<? extends BiFunction<Key,Value,String>> getFormatter(String formatterClazz) { try { if (formatterClazz != null) { return (Class<? extends BiFunction<Key,Value,String>>) this.getClass().getClassLoader() .loadClass(formatterClazz).asSubclass(BiFunction.class); } } catch (ClassNotFoundException e) { <START> System.err.println("Could not find formatter class: " + formatterClazz); <END> } return null; }</code><technical_language>If user's command-line satisfied (probably a typo in class name), hard-fail letting this exception fall through, returning null effetively wasting time dumping a file in a format user want</technical_language>

Target:
protected Class<? extends BiFunction<Key,Value,String>> getFormatter(String formatterClazz) throws ClassNotFoundException { @SuppressWarnings("unchecked") Class<? extends BiFunction<Key,Value,String>> clazz = (Class<? extends BiFunction<Key,Value,String>>) this.getClass().getClassLoader() .loadClass(formatterClazz).asSubclass(BiFunction.class); return clazz; }
Source:
<code>public void scan(String resource, Path filePath, Charset encoding) throws IOException { LOG.debug("Scanning {}", resource); init(); int lineIndex = 0; try (BufferedReader br = Files.newBufferedReader(filePath)) { String line; while ((line = br.readLine()) != null) { lineIndex++; if (line.trim().length() == 0) { continue; } for (java.util.regex.Pattern pattern : allFilePatterns) { if (pattern.matcher(line).find()) { exclusionPatternInitializer.getPatternMatcher().addPatternToExcludeResource(resource); <START> LOG.debug("- Exclusion pattern '{}': every violation in this file will be ignored.", pattern); <END> return; } } checkDoubleRegexps(line, lineIndex); } } if (currentMatcher != null && !currentMatcher.hasSecondPattern()) { endExclusion(lineIndex + 1); } fileLength = lineIndex; if (!lineExclusions.isEmpty()) { Set<LineRange> lineRanges = convertLineExclusionsToLineRanges(); LOG.debug("- Line exclusions found: {}", lineRanges); exclusionPatternInitializer.getPatternMatcher().addPatternToExcludeLines(resource, lineRanges); } }</code><technical_language>s/violation/issues</technical_language>

Target:
public void scan(String resource, Path filePath, Charset encoding) throws IOException { LOG.debug("Scanning {}", resource); init(); int lineIndex = 0; try (BufferedReader br = Files.newBufferedReader(filePath, encoding)) { String line; while ((line = br.readLine()) != null) { lineIndex++; if (line.trim().length() == 0) { continue; } for (java.util.regex.Pattern pattern : allFilePatterns) { if (pattern.matcher(line).find()) { exclusionPatternInitializer.getPatternMatcher().addPatternToExcludeResource(resource); LOG.debug("- Exclusion pattern '{}': every issue in this file will be ignored.", pattern); return; } } checkDoubleRegexps(line, lineIndex); } } if (currentMatcher != null && !currentMatcher.hasSecondPattern()) { endExclusion(lineIndex + 1); } fileLength = lineIndex; if (!lineExclusions.isEmpty()) { Set<LineRange> lineRanges = convertLineExclusionsToLineRanges(); LOG.debug("- Line exclusions found: {}", lineRanges); exclusionPatternInitializer.getPatternMatcher().addPatternToExcludeLines(resource, lineRanges); } }
Source:
<code>public void save(Table table) throws TableManagerException { validateTableParams(table); try { if (metadataManager.exists(table.getName())) { throw new TableManagerException(TableManagerException.ErrorCode.BAD_REQUEST, "table already exists"); } queryStore.init(table.getName()); dataStore.init(table); metadataManager.save(table); } catch (DataStoreException e) { switch (e.getErrorCode()) { case TABLE_NOT_FOUND: throw new TableManagerException(TableManagerException.ErrorCode.BAD_REQUEST, e); <START> case STORE_CONNECTION: <END> throw new TableManagerException(TableManagerException.ErrorCode.INTERNAL_ERROR, e); default: throw new TableManagerException(TableManagerException.ErrorCode.INTERNAL_ERROR, e); } } catch (TableManagerException e) { throw e; } catch (Exception e) { throw new TableManagerException(TableManagerException.ErrorCode.INTERNAL_ERROR, e); } }</code><technical_language>This next case merged</technical_language>

Target:
public void save(Table table) throws TableManagerException { validateTableParams(table); try { if (metadataManager.exists(table.getName())) { throw new TableManagerException(TableManagerException.ErrorCode.BAD_REQUEST, "table already exists"); } queryStore.initializeTable(table.getName()); dataStore.initializeTable(table); metadataManager.save(table); } catch (DataStoreException e) { switch (e.getErrorCode()) { case TABLE_NOT_FOUND: throw new TableManagerException(TableManagerException.ErrorCode.BAD_REQUEST, e); default: throw new TableManagerException(TableManagerException.ErrorCode.INTERNAL_ERROR, e); } } catch (TableManagerException e) { throw e; } catch (Exception e) { throw new TableManagerException(TableManagerException.ErrorCode.INTERNAL_ERROR, e); } }
Source:
<code>public void testStackUnstack() { SymbolicValue sv1 = new SymbolicValue(1); ProgramState state = ProgramState.EMPTY_STATE.stackValue(sv1); assertThat(state.peekValue()).isSameAs(sv1); SymbolicValue sv2 = new SymbolicValue(2); state = state.stackValue(sv2); List<SymbolicValue> values = state.peekValues(2); assertThat(values).hasSize(2); assertThat(values.get(0)).isSameAs(sv2); <START> assertThat(values.get(1)).isSameAs(sv1); <END> try { state.peekValues(3); Assert.fail("Able to retrieve more values than there are actually on the stack!"); } catch (IllegalStateException e) { } Pop unstack = state.unstackValue(1); state = unstack.state; values = unstack.values; assertThat(values).hasSize(1); assertThat(values.get(0)).isSameAs(sv2); assertThat(state.peekValue()).isSameAs(sv1); }</code><technical_language>for :assertThat(values).hasSize(2).containsSequence(sv2, sv1);</technical_language>

Target:
public void testStackUnstack() { SymbolicValue sv1 = new SymbolicValue(1); ProgramState state = ProgramState.EMPTY_STATE.stackValue(sv1); assertThat(state.peekValue()).isSameAs(sv1); SymbolicValue sv2 = new SymbolicValue(2); state = state.stackValue(sv2); List<SymbolicValue> values = state.peekValues(2); assertThat(values).hasSize(2).containsSequence(sv2, sv1); try { state.peekValues(3); Assert.fail("Able to retrieve more values than there are actually on the stack!"); } catch (IllegalStateException e) { } Pop unstack = state.unstackValue(1); state = unstack.state; values = unstack.values; assertThat(values).hasSize(1); assertThat(values.get(0)).isSameAs(sv2); assertThat(state.peekValue()).isSameAs(sv1); }
Source:
<code>public void addMethodSelector(String className, int priority) { <START> if (className != null && !className.trim().isEmpty()) { <END> m_methodDescriptors.put(className, priority); } }</code><technical_language>Is trim useful? a util method boolean isEmpty(String s) helpful (a method exist)</technical_language>

Target:
public void addMethodSelector(String className, int priority) { if (Strings.isNotNullAndNotEmpty(className)) { m_methodDescriptors.put(className, priority); } }
Source:
<code>private void animate() { final AnimationTimer timer = new AnimationTimer() { @Override public void handle(long nowInNanoSeconds) { if (texts!=null && !texts.isEmpty()) { for(Text text: texts) { shapesGroup.getChildren().add(text); } texts=null; } gradientFactor = Math.pow(2,slider.getValue()); for(GradientParamShape input: allGradientParamShapes) { input.applyUpdatesToShapesAndRefresh(); } shapesGroup.requestLayout(); if (captureScreenImages && nowInNanoSeconds-startTime> FIVE_SECOND_IN_NANO_SECONDS && frameCount<FRAME_COUNT_TO_COLLECT) { if (frameCount==0) { initializeCapture(); System.out.println("Starting capture"); } capture(); if (frameCount==100) { System.out.println("Ending capture"); } } <START> if (selectedGradientParamShape!=null) { <END> String g=numberFormatLonger.format(selectedGradientParamShape.getGradient()); String p=numberFormatLonger.format(selectedGradientParamShape.getParam()); textForSelectedGradientParam.setText("param = " + p + ", gradient = " + g); } } }; timer.start(); }</code><technical_language>Mind running formatter pushing? I merge that</technical_language>

Target:
private void animate() { final AnimationTimer timer = new AnimationTimer() { @Override public void handle(long nowInNanoSeconds) { doPauseLogicInUIThread(); if (texts != null && !texts.isEmpty()) { for (Text text : texts) { shapesGroup.getChildren().add(text); } texts = null; } gradientFactor = Math.pow(2, slider.getValue()); for (GradientParamShape input : allGradientParamShapes) { input.applyUpdatesToShapesAndRefresh(); } shapesGroup.requestLayout(); if (captureScreenImages && nowInNanoSeconds - startTime > FIVE_SECOND_IN_NANO_SECONDS && frameCount < FRAME_COUNT_TO_COLLECT) { if (frameCount == 0) { initializeCapture(); System.out.println("Starting capture"); } capture(); if (frameCount == 100) { System.out.println("Ending capture"); } } if (selectedGradientParamShape != null) { String g = format(selectedGradientParamShape.getGradient()); String p = format(selectedGradientParamShape.getParam()); textForSelectedGradientParam.setText("param = " + p + ", gradient = " + g); } } }; timer.start(); }
Source:
<code>private void logOpenLocks(LockWatchRequest request) { RangeSet<LockDescriptor> requestAsRangeSet = TreeRangeSet.create(toRanges(request)); heldLocksCollection.locksHeld().forEach(locksHeld -> { Set<LockDescriptor> descriptors = locksHeld.getLocks().stream() .map(AsyncLock::getDescriptor) .filter(requestAsRangeSet::contains) .collect(Collectors.toSet()); <START> lockEventLog.logOpenLocks(descriptors); <END> } ); }</code><technical_language>discussed offline: want combine descriptors call logOpenLocks end</technical_language>

Target:
private void logOpenLocks(LockWatchRequest request) { RangeSet<LockDescriptor> requestAsRangeSet = TreeRangeSet.create(toRanges(request)); Set<LockDescriptor> openLocks = heldLocksCollection.locksHeld().stream() .flatMap(locksHeld -> locksHeld.getLocks().stream().map(AsyncLock::getDescriptor)) .filter(requestAsRangeSet::contains) .collect(Collectors.toSet()); lockEventLog.logOpenLocks(openLocks); }