auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public EventTypeValidator build(final EventType eventType) { <START> final List<Function<JSONObject, Optional<ValidationError>>> validators = new ArrayList<>(); <END> final Schema schema = SchemaLoader.builder() .schemaJson(loader.effectiveSchema(eventType)) .addFormatValidator(new RFC3339DateTimeValidator()) .build() .load() .build(); validators.add((evt) -> validateSchemaConformance(schema, evt)); if (eventType.getCategory() == EventCategory.DATA || eventType.getCategory() == EventCategory.BUSINESS) { validators.add(this::validateOccurredAt); } return (event) -> validators .stream() .map(validator -> validator.apply(event)) .filter(Optional::isPresent) .findFirst() .orElse(Optional.empty()); }</code><technical_language>I prefer array list all, create stream 2 elements, if do so, please, set initial array size</technical_language>

Target:
public EventTypeValidator build(final EventType eventType) { final List<Function<JSONObject, Optional<ValidationError>>> validators = new ArrayList<>(2); final Schema schema = SchemaLoader.builder() .schemaJson(loader.effectiveSchema(eventType)) .addFormatValidator(new RFC3339DateTimeValidator()) .build() .load() .build(); validators.add((evt) -> validateSchemaConformance(schema, evt)); if (eventType.getCategory() == EventCategory.DATA || eventType.getCategory() == EventCategory.BUSINESS) { validators.add(this::validateOccurredAt); } return (event) -> validators .stream() .map(validator -> validator.apply(event)) .filter(Optional::isPresent) .findFirst() .orElse(Optional.empty()); }
Source:
<code>public BytecodeNode visitCall(CallExpression call, Context context) { BytecodeGeneratorContext generatorContext = new BytecodeGeneratorContext( RowExpressionCompiler.this, context.getScope(), callSiteBinder, cachedInstanceBinder, functionManager); if (call.getSignature().getName().equals(CAST)) { return (new CastCodeGenerator()).generateExpression(generatorContext, call.getType(), call.getArguments(), context.getOutputBlockVariable()); <START> } <END> else { return (new FunctionCallCodeGenerator()).generateCall(call.getSignature(), generatorContext, call.getType(), call.getArguments(), context.getOutputBlockVariable()); } }</code><technical_language>yes, refactor CAST well..</technical_language>

Target:
public BytecodeNode visitCall(CallExpression call, Context context) { BytecodeGeneratorContext generatorContext = new BytecodeGeneratorContext( RowExpressionCompiler.this, context.getScope(), callSiteBinder, cachedInstanceBinder, functionManager); return (new FunctionCallCodeGenerator()).generateCall(call.getFunctionHandle().getSignature(), generatorContext, call.getType(), call.getArguments(), context.getOutputBlockVariable()); }
Source:
<code>public void shouldAutoDeployScriptAndForms() throws IOException { InputStream formFile = AutoDeploymentIT.class.getClassLoader().getResourceAsStream("deployment/form.html"); InputStream scriptFile = AutoDeploymentIT.class.getClassLoader().getResourceAsStream("deployment/script.js"); File resourcesDirectory = Paths.get(baseDirectory, "configuration", "resources").toFile(); resourcesDirectory.mkdirs(); Files.copy(formFile, Paths.get(resourcesDirectory.getAbsolutePath(), "form.html")); Files.copy(scriptFile, Paths.get(resourcesDirectory.getAbsolutePath(), "script.js")); runStartScript(); Response definitionResponse = when().get(container.getBaseUrl() + DEPLOYMENT_ENDPOINT); definitionResponse.then() .body("size()", is(1)); String deploymentId = definitionResponse.then().extract().path("[0].id"); Response resourcesResponse = when().get(container.getBaseUrl() + DEPLOYMENT_ENDPOINT + "/" + deploymentId + "/resources"); List<String> resourceNames = extractResourceNames(resourcesResponse); <START> assertThat(resourceNames, contains("/form.html", "/script.js")); <END> }</code><technical_language>I (only vaguely, honest) remember issue in EE repo this test assertj dependency present somehow. Miklas "by accident" fine hamcrest classpath already. build easier, I say. investigate work in EE repo I worth effort for assertion right now. Thoughts this</technical_language>

Target:
public void shouldAutoDeployScriptAndForms() throws IOException { InputStream formFile = AutoDeploymentIT.class.getClassLoader().getResourceAsStream("deployment/form.html"); InputStream scriptFile = AutoDeploymentIT.class.getClassLoader().getResourceAsStream("deployment/script.js"); File resourcesDirectory = Paths.get(baseDirectory, "configuration", "resources").toFile(); resourcesDirectory.mkdirs(); Files.copy(formFile, Paths.get(resourcesDirectory.getAbsolutePath(), "form.html")); Files.copy(scriptFile, Paths.get(resourcesDirectory.getAbsolutePath(), "script.js")); runStartScript(); Response definitionResponse = when().get(container.getBaseUrl() + DEPLOYMENT_ENDPOINT); definitionResponse.then() .body("size()", is(1)); String deploymentId = definitionResponse.then().extract().path("[0].id"); Response resourcesResponse = when().get(container.getBaseUrl() + DEPLOYMENT_ENDPOINT + "/" + deploymentId + "/resources"); List<String> resourceNames = extractResourceNames(resourcesResponse); assertThat(resourceNames).contains("/form.html", "/script.js"); }
Source:
<code>protected BaseRuleTest() { <START> this(TpchConnectorFactory.DEFAULT_PREDICATE_PUSHDOWN_ENABLED); <END> }</code><technical_language>testing point of view, explicit false (or this is) better. i.e., if tpch connector decides change default, presto tests change behavior coverage</technical_language>

Target:
protected BaseRuleTest() { this(false); }
Source:
<code>private FilePath createSshKeyFile(SSHUserPrivateKey sshUser) throws IOException, InterruptedException { FilePath key = workspace.createTempFile("ssh", "key"); List<String> privateKeys = sshUser.getPrivateKeys(); <START> key.write(StringUtils.join(privateKeys, "\n"), null); <END> key.chmod(0400); return key; }</code><technical_language>smells a bug OS windows '\n' '\r\n'</technical_language>

Target:
private FilePath createSshKeyFile(SSHUserPrivateKey sshUser) throws IOException, InterruptedException { List<String> privateKeys = sshUser.getPrivateKeys(); FilePath key = workspace.createTextTempFile("ssh", "key", StringUtils.join(privateKeys, "\n"), false); key.chmod(0400); return key; }
Source:
<code>protected boolean validate() { if (getParameters().getSchedule() == null || (getParameters().getSchedule().getFrequency() != StorageSyncSchedule.Frequency.NONE && <START> getParameters().getSchedule().getCronExpression().isEmpty())) <END> { return failValidation(EngineMessage.VALIDATION_INVALID_SCHEDULE); } if (getParameters().getStorageDomainId() == null || getStorageDomain() == null) { return failValidation(EngineMessage.STORAGE_DOMAIN_DOES_NOT_EXIST); } if (getParameters().getGeoRepSessionId() == null || getGeoRepSession() == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_GEOREP_SESSION_INVALID); } return super.validate(); }</code><technical_language>validation cron expression correctness</technical_language>

Target:
protected boolean validate() { if (getParameters().getSchedule() == null || (getParameters().getSchedule().getFrequency() != StorageSyncSchedule.Frequency.NONE && StringUtils.isEmpty(getParameters().getSchedule().getCronExpression()))) { return failValidation(EngineMessage.VALIDATION_INVALID_SCHEDULE); } if (getStorageDomainId() == null || getStorageDomain() == null) { return failValidation(EngineMessage.STORAGE_DOMAIN_DOES_NOT_EXIST); } if (getGeoRepSession() == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_GEOREP_SESSION_INVALID); } return super.validate(); }
Source:
<code>public ResultScanner<FlatRow> readFlatRows(ReadRowsRequest request) { if (shouldOverrideAppProfile(request.getAppProfileId())) { request = request.toBuilder().setAppProfileId(clientDefaultAppProfileId).build(); } final ResponseQueueReader reader = new ResponseQueueReader(retryOptions.getReadPartialRowTimeoutMillis()); final StreamObserver<ReadRowsResponse> responseObserver = new StreamObserver<ReadRowsResponse>() { @Override public void onNext(ReadRowsResponse value) { reader.addRequestResultMarker(); } @Override public void onError(Throwable t) { } @Override public void onCompleted() { } }; <START> RetryingReadRowsOperation operation = createReadRowsRetryListener(request, reader, responseObserver); <END> operation.getAsyncResult(); return new ResumingStreamingResultScanner(reader, operation); }</code><technical_language>this need insert a listener in middle of callback chain? queue reader manage queue</technical_language>

Target:
public ResultScanner<FlatRow> readFlatRows(ReadRowsRequest request) { if (shouldOverrideAppProfile(request.getAppProfileId())) { request = request.toBuilder().setAppProfileId(clientDefaultAppProfileId).build(); } final ResponseQueueReader reader = new ResponseQueueReader(retryOptions.getReadPartialRowTimeoutMillis()); RetryingReadRowsOperation operation = createReadRowsOperation(request, reader); return new ResumingStreamingResultScanner(reader, operation); }
Source:
<code>public void setJwtValidator(OAuth2TokenValidator<Jwt> jwtValidator) { this.jwtValidator = jwtValidator; <START> } <END></code><technical_language>change this setValidator() Jwt is implied generic</technical_language>

Target:
public void setJwtValidator(OAuth2TokenValidator<Jwt> jwtValidator) { Assert.notNull(jwtValidator, "jwtValidator cannot be null"); this.jwtValidator = jwtValidator; }
Source:
<code>public static List<ScenarioResult> verifyConditions(SimulationDescriptor simulationDescriptor, List<ScenarioInput> inputData, List<ScenarioOutput> outputData) { List<ScenarioResult> scenarioResult = new ArrayList<>(); for (ScenarioInput input : inputData) { FactIdentifier factIdentifier = input.getFactIdentifier(); <START> List<ScenarioOutput> assertionOnFact = outputData.stream().filter(elem -> elem.getFactIdentifier().equals(factIdentifier)).collect(toList()); <END> if (assertionOnFact.size() < 1) { continue; } scenarioResult.addAll(getScenarioResults(simulationDescriptor, assertionOnFact, input)); } return scenarioResult; }</code><technical_language>is safer Objects.equals(elem.getFactIdentifier, factIdentifier)) throw NPE if of arguments is null</technical_language>

Target:
public static List<ScenarioResult> verifyConditions(SimulationDescriptor simulationDescriptor, List<ScenarioInput> inputData, List<ScenarioOutput> outputData) { List<ScenarioResult> scenarioResult = new ArrayList<>(); for (ScenarioInput input : inputData) { FactIdentifier factIdentifier = input.getFactIdentifier(); List<ScenarioOutput> assertionOnFact = outputData.stream().filter(elem -> Objects.equals(elem.getFactIdentifier(), factIdentifier)).collect(toList()); if (assertionOnFact.size() < 1) { continue; } scenarioResult.addAll(getScenarioResults(simulationDescriptor, assertionOnFact, input)); } return scenarioResult; }
Source:
<code>private void configureQueryParameters(Request request) { try { <START> Config queryParameters = params.parseNestedOrGetEmpty("query"); <END> for (String name : queryParameters.getKeys()) { request.param(name, queryParameters.get(name, String.class)); } } catch (ConfigException e) { Optional<String> query = params.getOptional("query", String.class); if (query.isPresent()) { List<NameValuePair> parameters = URLEncodedUtils.parse(query.get(), StandardCharsets.UTF_8); for (NameValuePair parameter : parameters) { request.param(parameter.getName(), parameter.getValue()); } } } }</code><technical_language>[minor] query sound SQL's me. query_string query_param? more explicit, a bit long though</technical_language>

Target:
private void configureQueryParameters(Request request) { try { Config queryParameters = params.parseNestedOrGetEmpty("query"); for (String name : queryParameters.getKeys()) { request.param(name, queryParameters.get(name, String.class)); } } catch (ConfigException e) { Optional<String> query = params.getOptional("query", String.class); if (query.isPresent()) { List<NameValuePair> parameters = URLEncodedUtils.parse(query.get(), UTF_8); for (NameValuePair parameter : parameters) { request.param(parameter.getName(), parameter.getValue()); } } } }
Source:
<code>private boolean restore(MigrationReport report, Optional<InputStream> ois) throws IOException { final InputStream is = ois.orElse(null); if (is == null) { throw new MigrationException("Import error: missing exported profile information."); } final JsonProfile jprofile = JsonUtils.fromJson(IOUtils.toString(is, StandardCharsets.UTF_8), JsonProfile.class); <START> for (int i = 1; i < ProfileMigratable.RETRY_COUNT; i++) { <END> LOGGER.debug( "importing system profile (attempt out of {})", i, ProfileMigratable.RETRY_COUNT); final Boolean result = restore(report, jprofile, false); if (result != null) { return result; } } LOGGER.debug( "verifying system profile", ProfileMigratable.RETRY_COUNT, ProfileMigratable.RETRY_COUNT); final Boolean result = restore(report, jprofile, true); if (result != null) { return result; } throw new IllegalStateException("too many attempts to import profile"); }</code><technical_language>this condition i <= ProfileMigratable.RETRY_COUNT? log message below, be</technical_language>

Target:
private boolean restore(MigrationReport report, Optional<InputStream> ois) throws IOException { final InputStream is = ois.orElse(null); if (is == null) { throw new MigrationException("Import error: missing exported profile information."); } final JsonProfile jprofile = JsonUtils.fromJson(IOUtils.toString(is, StandardCharsets.UTF_8), JsonProfile.class); for (int i = 1; i < ProfileMigratable.ATTEMPT_COUNT; i++) { LOGGER.debug( "importing system profile (attempt out of {})", i, ProfileMigratable.ATTEMPT_COUNT); final Boolean result = restore(report, jprofile, false); if (result != null) { return result; } } LOGGER.debug( "verifying system profile", ProfileMigratable.ATTEMPT_COUNT, ProfileMigratable.ATTEMPT_COUNT); final Boolean result = restore(report, jprofile, true); if (result != null) { return result; } throw new IllegalStateException("too many attempts to import profile"); }
Source:
<code>private ProtocolRequestMessage createProtocolRequestMessage(final Device device) { final String deviceIdentification = device.getDeviceIdentification(); <START> final String organisation = "LianderNetManagement"; <END> final String correlationUid = ""; final DeviceFunction deviceFunction = DeviceFunction.GET_STATUS; final String domain = "CORE"; final String domainVersion = "1.0"; final DeviceMessageMetadata deviceMessageMetadata = new DeviceMessageMetadata(deviceIdentification, organisation, correlationUid, deviceFunction.toString(), 0); String ipAddress = null; if (device.getNetworkAddress() == null) { LOGGER.warn("Unable to create protocol request message because the IP address is empty for device: {}", deviceIdentification); return null; } else { ipAddress = device.getNetworkAddress().getHostAddress(); } final RequestMessage requestMessage = new RequestMessage(correlationUid, organisation, deviceIdentification, null); return new ProtocolRequestMessage.Builder().deviceMessageMetadata(deviceMessageMetadata).domain(domain) .domainVersion(domainVersion).ipAddress(ipAddress).request(requestMessage).build(); }</code><technical_language>changes for a temporary solution. Do allow this hardcoded setting, temporary</technical_language>

Target:
private ProtocolRequestMessage createProtocolRequestMessage(final Device device) { final String deviceIdentification = device.getDeviceIdentification(); final String organisation = device.getOwner() == null ? "" : device.getOwner().getOrganisationIdentification(); final String correlationUid = ""; final DeviceFunction deviceFunction = DeviceFunction.GET_STATUS; final String domain = "CORE"; final String domainVersion = "1.0"; final DeviceMessageMetadata deviceMessageMetadata = new DeviceMessageMetadata(deviceIdentification, organisation, correlationUid, deviceFunction.toString(), 0); String ipAddress = null; if (device.getNetworkAddress() == null) { LOGGER.warn("Unable to create protocol request message because the IP address is empty for device: {}", deviceIdentification); return null; } else { ipAddress = device.getNetworkAddress().getHostAddress(); } final RequestMessage requestMessage = new RequestMessage(correlationUid, organisation, deviceIdentification, null); return new ProtocolRequestMessage.Builder().deviceMessageMetadata(deviceMessageMetadata).domain(domain) .domainVersion(domainVersion).ipAddress(ipAddress).request(requestMessage).build(); }
Source:
<code><START> private void parseCanonicalTranscriptPerHugoSymbolTSV() <END> { this.indexByHugoSymbol = new HashMap<>(); CsvParserSettings parserSettings = new CsvParserSettings(); parserSettings.setHeaderExtractionEnabled(true); parserSettings.getFormat().setDelimiter('\t'); parserSettings.setRowProcessor( new BeanProcessor<HugoSymbolRecord>(HugoSymbolRecord.class) { @Override public void beanProcessed(HugoSymbolRecord hugoSymbolRecord, ParsingContext context) { Map<String, List<EnsemblTranscript>> canonicalMap = indexByHugoSymbol.get(hugoSymbolRecord.getHugoSymbol()); if (canonicalMap == null) { canonicalMap = new HashMap(); } else { System.err.println("Hugo Symbols should be unique"); } canonicalMap.put("ensembl", indexByTranscript.get(hugoSymbolRecord.getEnsemblCanonicalTranscript())); canonicalMap.put("genomeNexus", indexByTranscript.get(hugoSymbolRecord.getGenomeNexusCanonicalTranscript())); canonicalMap.put("uniprot", indexByTranscript.get(hugoSymbolRecord.getUniprotCanonicalTranscript())); canonicalMap.put("mskcc", indexByTranscript.get(hugoSymbolRecord.getMskccCanonicalTranscript())); indexByHugoSymbol.put(hugoSymbolRecord.getHugoSymbol(), canonicalMap); } } ); CsvParser parser = new CsvParser(parserSettings); parser.parse(getReader(this.canonicalTranscriptPerHugoSymbolResourceURI)); }</code><technical_language>explicitly return a Map for clarity instead of implicitly populating global indexByHugoSymbol</technical_language>

Target:
private Map<String, Map<String, List<EnsemblTranscript>>> parseCanonicalTranscriptPerHugoSymbolTSV() { final Map<String, Map<String, List<EnsemblTranscript>>> indexByHugoSymbol = new HashMap<>(); CsvParserSettings parserSettings = new CsvParserSettings(); parserSettings.setHeaderExtractionEnabled(true); parserSettings.getFormat().setDelimiter('\t'); parserSettings.setRowProcessor( new BeanProcessor<HugoSymbolRecord>(HugoSymbolRecord.class) { @Override public void beanProcessed(HugoSymbolRecord hugoSymbolRecord, ParsingContext context) { Map<String, List<EnsemblTranscript>> canonicalMap = indexByHugoSymbol.get(hugoSymbolRecord.getHugoSymbol()); if (canonicalMap == null) { canonicalMap = new HashMap(); } else { System.err.println("Hugo Symbols should be unique"); } canonicalMap.put("ensembl", indexByTranscript.get(hugoSymbolRecord.getEnsemblCanonicalTranscript())); canonicalMap.put("genomeNexus", indexByTranscript.get(hugoSymbolRecord.getGenomeNexusCanonicalTranscript())); canonicalMap.put("uniprot", indexByTranscript.get(hugoSymbolRecord.getUniprotCanonicalTranscript())); canonicalMap.put("mskcc", indexByTranscript.get(hugoSymbolRecord.getMskccCanonicalTranscript())); indexByHugoSymbol.put(hugoSymbolRecord.getHugoSymbol(), canonicalMap); } } ); CsvParser parser = new CsvParser(parserSettings); parser.parse(getReader(this.canonicalTranscriptPerHugoSymbolResourceURI)); return indexByHugoSymbol; }
Source:
<code>boolean joinGroupIfNeeded(final Timer timer) { while (rejoinNeededOrPending()) { if (!ensureCoordinatorReady(timer)) { return false; } if (needsJoinPrepare) { needsJoinPrepare = false; onJoinPrepare(generation.generationId, generation.memberId); } final RequestFuture<ByteBuffer> future = initiateJoinGroup(); client.poll(future, timer); if (!future.isDone()) { return false; } if (future.succeeded()) { Generation generationSnapshot; synchronized (AbstractCoordinator.this) { generationSnapshot = this.generation; } if (generationSnapshot != Generation.NO_GENERATION) { ByteBuffer memberAssignment = future.value().duplicate(); onJoinComplete(generationSnapshot.generationId, generationSnapshot.memberId, generationSnapshot.protocol, memberAssignment); resetJoinGroupFuture(); needsJoinPrepare = true; } else { log.info("Generation data was cleared by heartbeat thread. Initiating rejoin."); <START> synchronized (AbstractCoordinator.this) { <END> resetStateAndRejoin(); } resetJoinGroupFuture(); return false; } } else { resetJoinGroupFuture(); final RuntimeException exception = future.exception(); if (exception instanceof UnknownMemberIdException || exception instanceof RebalanceInProgressException || exception instanceof IllegalGenerationException || exception instanceof MemberIdRequiredException) continue; else if (!future.isRetriable()) throw exception; timer.sleep(rebalanceConfig.retryBackoffMs); } } return true; }</code><technical_language>resetStateAndRejoin synchronized</technical_language>

Target:
boolean joinGroupIfNeeded(final Timer timer) { while (rejoinNeededOrPending()) { if (!ensureCoordinatorReady(timer)) { return false; } if (needsJoinPrepare) { needsJoinPrepare = false; onJoinPrepare(generation.generationId, generation.memberId); } final RequestFuture<ByteBuffer> future = initiateJoinGroup(); client.poll(future, timer); if (!future.isDone()) { return false; } if (future.succeeded()) { Generation generationSnapshot; synchronized (AbstractCoordinator.this) { generationSnapshot = this.generation; } if (generationSnapshot != Generation.NO_GENERATION) { ByteBuffer memberAssignment = future.value().duplicate(); onJoinComplete(generationSnapshot.generationId, generationSnapshot.memberId, generationSnapshot.protocol, memberAssignment); resetJoinGroupFuture(); needsJoinPrepare = true; } else { log.info("Generation data was cleared by heartbeat thread. Initiating rejoin."); resetStateAndRejoin(); resetJoinGroupFuture(); return false; } } else { resetJoinGroupFuture(); final RuntimeException exception = future.exception(); if (exception instanceof UnknownMemberIdException || exception instanceof RebalanceInProgressException || exception instanceof IllegalGenerationException || exception instanceof MemberIdRequiredException) continue; else if (!future.isRetriable()) throw exception; timer.sleep(rebalanceConfig.retryBackoffMs); } } return true; }
Source:
<code>public LocalMemoryManager(NodeMemoryConfig config) { requireNonNull(config, "config is null"); <START> configureMemoryPools(config, Runtime.getRuntime().maxMemory()); <END> }</code><technical_language>do a telescoping constructor is a prefix of other? @Inject public LocalMemoryManager(NodeMemoryConfig config) { this(config, Runtime.getRuntime().maxMemory()); }</technical_language>

Target:
public LocalMemoryManager(NodeMemoryConfig config) { this(config, Runtime.getRuntime().maxMemory()); }
Source:
<code>public void testHeaderVersion() throws Exception { final String oldVersionHeader = "@HD\tVN:1.3\tSO:unsorted"; final File inputSam = File.createTempFile("ViewSamTest.input.", ".sam"); inputSam.deleteOnExit(); final AsciiWriter writer = new AsciiWriter(new FileOutputStream(inputSam)); writer.write(oldVersionHeader); writer.write("\n"); writer.close(); final File viewSamOutputFile = File.createTempFile("ViewSamTest.output.", ".sam"); viewSamOutputFile.deleteOnExit(); final ViewSam viewSam = new ViewSam(); viewSam.INPUT = inputSam.getAbsolutePath(); final PrintStream viewSamPrintStream = new PrintStream(viewSamOutputFile); Assert.assertEquals(viewSam.writeSamText(viewSamPrintStream), 0); viewSamPrintStream.close(); <START> viewSamPrintStream.close(); <END> final LineReader viewSamInputReader = new BufferedLineReader(new FileInputStream(viewSamOutputFile)); Assert.assertEquals(viewSamInputReader.readLine(), oldVersionHeader); }</code><technical_language>this line a duplicate of L 72</technical_language>

Target:
public void testHeaderVersion() throws Exception { final String oldVersionHeader = "@HD\tVN:1.3\tSO:unsorted"; final File inputSam = File.createTempFile("ViewSamTest.input.", ".sam"); inputSam.deleteOnExit(); final AsciiWriter writer = new AsciiWriter(new FileOutputStream(inputSam)); writer.write(oldVersionHeader); writer.write("\n"); writer.close(); final File viewSamOutputFile = File.createTempFile("ViewSamTest.output.", ".sam"); viewSamOutputFile.deleteOnExit(); final ViewSam viewSam = new ViewSam(); viewSam.INPUT = inputSam.getAbsolutePath(); final PrintStream viewSamPrintStream = new PrintStream(viewSamOutputFile); Assert.assertEquals(viewSam.writeSamText(viewSamPrintStream), 0); viewSamPrintStream.close(); final LineReader viewSamInputReader = new BufferedLineReader(new FileInputStream(viewSamOutputFile)); Assert.assertEquals(viewSamInputReader.readLine(), oldVersionHeader); }
Source:
<code><START> public void snapViewIfNeeded(View child) { <END> mSwipeHelper.snapChildIfNeeded(child, mIsExpanded ); }</code><technical_language>This diverged internally. Mady, incorporate this</technical_language>

Target:
public void snapViewIfNeeded(View child) { boolean animate = mIsExpanded || isPinnedHeadsUp(child); mSwipeHelper.snapChildIfNeeded(child, animate); }
Source:
<code>default String getName() { <START> return getMetadata().getName(); <END> }</code><technical_language>This safer if rewrite in style: java return getMetadata() == null ? null : getMetadata().getName();</technical_language>

Target:
default String getName() { return getMetadata() == null ? null : getMetadata().getName(); }
Source:
<code>public void massClearNetworkFromNicsTest() { VdsNetworkInterface nic1 = dao.get(FixturesTool.VDS_NETWORK_INTERFACE); VdsNetworkInterface nic2 = dao.get(FixturesTool.VDS_NETWORK_INTERFACE_WITHOUT_QOS); VdsNetworkInterface nic3 = dao.get(FixturesTool.VDS_NETWORK_INTERFACE2); assertNotNull(nic1.getNetworkName()); assertNotNull(nic2.getNetworkName()); assertNotNull(nic3.getNetworkName()); <START> dao.massClearNetworkFromNics(new ArrayList<>(Arrays.asList(nic1.getId(), nic2.getId()))); <END> nic1 = dao.get(nic1.getId()); nic2 = dao.get(nic2.getId()); nic3 = dao.get(nic3.getId()); assertNull(nic1.getNetworkName()); assertNull(nic2.getNetworkName()); assertNotNull(nic3.getNetworkName()); }</code><technical_language>do need wrap "new ArrayList<>"</technical_language>

Target:
public void massClearNetworkFromNicsTest() { VdsNetworkInterface nic1 = dao.get(FixturesTool.VDS_NETWORK_INTERFACE); VdsNetworkInterface nic2 = dao.get(FixturesTool.VDS_NETWORK_INTERFACE_WITHOUT_QOS); VdsNetworkInterface nic3 = dao.get(FixturesTool.VDS_NETWORK_INTERFACE2); assertNotNull(nic1.getNetworkName()); assertNotNull(nic2.getNetworkName()); assertNotNull(nic3.getNetworkName()); dao.massClearNetworkFromNics(Arrays.asList(nic1.getId(), nic2.getId())); nic1 = dao.get(nic1.getId()); nic2 = dao.get(nic2.getId()); nic3 = dao.get(nic3.getId()); assertNull(nic1.getNetworkName()); assertNull(nic2.getNetworkName()); assertNotNull(nic3.getNetworkName()); }
Source:
<code>public void serialize(T object, Output output) { Class type = object.getClass(); <START> if (clazz == null) { <END> clazz = type; } Serde serde = getDefaultSerde(type); if (serde != null) { serde.serialize(object, output); return; } if (clazz == null) { kryo.writeClassAndObject(output, object); } else { kryo.writeObject(output, object); } }</code><technical_language>This is a problem clazz deserialize. clazz member variable, if null assumes class is deserialization</technical_language>

Target:
public void serialize(T object, Output output) { Class type = object.getClass(); Serde serde = null; if (clazz == type) { serde = getDefaultSerde(type); } if (serde != null) { serde.serialize(object, output); return; } if (clazz == null) { kryo.writeClassAndObject(output, object); } else { kryo.writeObject(output, object); } }
Source:
<code>void resolveColumnIndexesUsingSchema(NodeSchema inputSchema) { int difftor = 0; for (SchemaColumn col : m_outputSchema) { col.setDifferentiator(difftor); ++difftor; Collection<TupleValueExpression> allTves = ExpressionUtil.getTupleValueExpressions(col.getExpression()); for (TupleValueExpression tve : allTves) { tve.setColumnIndexUsingSchema(inputSchema); <START> assert (tve.getColumnIndex() >= 0 || tve.getColumnIndex() < inputSchema.size()); <END> } } }</code><technical_language>Is is for column index negative? be? this && a ||</technical_language>

Target:
void resolveColumnIndexesUsingSchema(NodeSchema inputSchema) { int difftor = 0; for (SchemaColumn col : m_outputSchema) { col.setDifferentiator(difftor); ++difftor; Collection<TupleValueExpression> allTves = ExpressionUtil.getTupleValueExpressions(col.getExpression()); for (TupleValueExpression tve : allTves) { tve.setColumnIndexUsingSchema(inputSchema); assert (tve.getColumnIndex() >= 0 && tve.getColumnIndex() < inputSchema.size()); } } }
Source:
<code>protected void displayTopControl() { if (null != preferenceStore && null != preferenceStore.getString(MultiplicityConstants.MULTIPLICITY_EDITOR_MODE)) { <START> stackLayout.topControl = preferenceStore.getString(MultiplicityConstants.MULTIPLICITY_EDITOR_MODE).equals(MultiplicityConstants.ADVANCED_MODE) ? doubleEditorsComposite : stringComboEditor; <END> } else { if (null == stackLayout.topControl) { stackLayout.topControl = stringComboEditor; } } if (!stackLayoutComposite.isDisposed()) { stackLayoutComposite.layout(); } setReadOnly(readOnly); updateLabels(); }</code><technical_language>I read is affected in variable. Sometimes, complete writing is simpler understand ternary operator</technical_language>

Target:
protected void displayTopControl() { final String multiplicityEditorMode = preferenceStore.getString(MultiplicityConstants.MULTIPLICITY_EDITOR_MODE); if (null != preferenceStore && null != multiplicityEditorMode) { stackLayout.topControl = multiplicityEditorMode.equals(MultiplicityConstants.ADVANCED_MODE) ? doubleEditorsComposite : stringComboEditor; } else { if (null == stackLayout.topControl) { stackLayout.topControl = stringComboEditor; } } if (!stackLayoutComposite.isDisposed()) { stackLayoutComposite.layout(); } setReadOnly(readOnly); updateLabels(); }
Source:
<code>boolean containsUpdate(TreePath path) { if (getElementPath().equals(path)) { return true; } else if (fBatchedRequests != null) { for (ViewerUpdateMonitor <START> fBatchedRequest : <END> fBatchedRequests) { if (fBatchedRequest.getElementPath().equals(path)) { return true; } } } return false; }</code><technical_language>rename request</technical_language>

Target:
boolean containsUpdate(TreePath path) { if (getElementPath().equals(path)) { return true; } else if (fBatchedRequests != null) { for (ViewerUpdateMonitor request : fBatchedRequests) { if (request.getElementPath().equals(path)) { return true; } } } return false; }
Source:
<code>private void handleResourceChange(GitResourceVariantTreeSubscriber subscriber, Repository which, Collection<IFile> resources) { for (GitSynchronizeData gsd : gsds) { if (which.equals(gsd.getRepository())) { <START> if (!resources.isEmpty()) <END> refreshResources(subscriber, resources); else refreshRepository(subscriber); } } }</code><technical_language>A null check is needed also. NPE thrown if reopening a large project. java.lang.NullPointerException org.eclipse.egit.core.synchronize.GitSubscriberMergeContext.handleResourceChange(GitSubscriberMergeContext.java:141) org.eclipse.egit.core.synchronize.GitSubscriberMergeContext.access$1(GitSubscriberMergeContext.java:137) org.eclipse.egit.core.synchronize.GitSubscriberMergeContext$2.indexDiffChanged(GitSubscriberMergeContext.java:69) org.eclipse.egit.core.internal.indexdiff.IndexDiffCache.notifyListeners(IndexDiffCache.java:94) org.eclipse.egit.core.internal.indexdiff.IndexDiffCache.access$0(IndexDiffCache.java:86) org.eclipse.egit.core.internal.indexdiff.IndexDiffCache$1.indexDiffChanged(IndexDiffCache.java:81) org.eclipse.egit.core.internal.indexdiff.IndexDiffCacheEntry.notifyListeners(IndexDiffCacheEntry.java:313) org.eclipse.egit.core.internal.indexdiff.IndexDiffCacheEntry.access$6(IndexDiffCacheEntry.java:306) org.eclipse.egit.core.internal.indexdiff.IndexDiffCacheEntry$3.run(IndexDiffCacheEntry.java:171) org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)</technical_language>

Target:
private void handleResourceChange(GitResourceVariantTreeSubscriber subscriber, Repository which, Collection<IFile> resources) { for (GitSynchronizeData gsd : gsds) { if (which.equals(gsd.getRepository()) && resources != null && !resources.isEmpty()) refreshResources(subscriber, resources); } }
Source:
<code>private ByteBuffer objectToBuffer(Object o, int estimatedSize) { if (o == null) return null; try { boolean wrapped = isPersistenceClass(o); <START> o = wrap(o, wrapped); <END> int size = estimatedSize < 0 ? sizeEstimate(o, true) : estimatedSize; ByteArrayOutputStream baos = new ByteArrayOutputStream(size); ProtobufUtil.toWrappedStream(serializationContext, baos, o, size); byte[] bytes = baos.toByteArray(); return new ByteBufferImpl(bytes, 0, bytes.length); } catch (Throwable t) { log.warnf(t, "Cannot marshall %s", o.getClass().getName()); throw new MarshallingException(t.getMessage(), t.getCause()); } }</code><technical_language>This is a bit confusing, I thought types *not* wrapped. name isPersistenceClass is kind of weird if return true for user types registered in serialization context</technical_language>

Target:
private ByteBuffer objectToBuffer(Object o, int estimatedSize) { if (o == null) return null; try { boolean requiresWrapping = !isPersistenceClass(o); if (requiresWrapping) o = wrapUserObject(o); int size = estimatedSize < 0 ? sizeEstimate(o, true) : estimatedSize; ByteArrayOutputStream baos = new ByteArrayOutputStream(size); ProtobufUtil.toWrappedStream(serializationContext, baos, o, size); byte[] bytes = baos.toByteArray(); return new ByteBufferImpl(bytes, 0, bytes.length); } catch (Throwable t) { log.warnf(t, "Cannot marshall %s", o.getClass().getName()); throw new MarshallingException(t.getMessage(), t.getCause()); } }
Source:
<code>private void saveProfiles(final String sessionId, final String taskId) throws IOException { String dir; dir = sessionId + "/" + taskId + "/" + MonitorProcess.PROFILER_MARKER; Set<String> fileNameList = fileStorage.getFileNameList(dir); if (fileNameList.isEmpty()) { log.debug("Directory is empty.", dir); return; } final TaskData taskData = getTaskData(taskId, sessionId); if (taskData == null) { <START> log.error("TaskData not found by taskId: {}", taskId); <END> return; } for (final String fileName : fileNameList) { LogReader.FileReader reader; try { reader = logReader.read(fileName, Object.class); } catch (IllegalArgumentException e) { log.warn(e.getMessage(), e); return; } final ProfileDTO profileDTO = SerializationUtils.fromString(reader.iterator().next().toString()); getHibernateTemplate().execute(new HibernateCallback<Void>() { @Override public Void doInHibernate(Session session) throws HibernateException, SQLException { String prefix = "Agent on (" + profileDTO.getHostAddress() + ") : "; for (Map.Entry<String, RuntimeGraph> runtimeGraphEntry : profileDTO.getRuntimeGraphs().entrySet()) { String context = SerializationUtils.toString(runtimeGraphEntry.getValue()); session.persist(new ProfilingSuT(prefix + runtimeGraphEntry.getKey(), sessionId, taskData, context)); } session.flush(); return null; } }); } }</code><technical_language>please, add sessionId error message</technical_language>

Target:
private void saveProfiles(final String sessionId, final String taskId) throws IOException { String dir; dir = sessionId + "/" + taskId + "/" + MonitorProcess.PROFILER_MARKER; Set<String> fileNameList = fileStorage.getFileNameList(dir); if (fileNameList.isEmpty()) { log.debug("Directory is empty.", dir); return; } final TaskData taskData = getTaskData(taskId, sessionId); if (taskData == null) { log.error("TaskData not found by sessionId: and taskId: {}", sessionId, taskId); return; } for (final String fileName : fileNameList) { LogReader.FileReader reader; try { reader = logReader.read(fileName, Object.class); } catch (IllegalArgumentException e) { log.warn(e.getMessage(), e); return; } final ProfileDTO profileDTO = SerializationUtils.fromString(reader.iterator().next().toString()); getHibernateTemplate().execute(new HibernateCallback<Void>() { @Override public Void doInHibernate(Session session) throws HibernateException, SQLException { String prefix = "Agent on (" + profileDTO.getHostAddress() + ") : "; for (Map.Entry<String, RuntimeGraph> runtimeGraphEntry : profileDTO.getRuntimeGraphs().entrySet()) { String context = SerializationUtils.toString(runtimeGraphEntry.getValue()); session.persist(new ProfilingSuT(prefix + runtimeGraphEntry.getKey(), sessionId, taskData, context)); } session.flush(); return null; } }); } }
Source:
<code><START> private Page replacePage(CursorPos path, Page replacement, IntValueHolder unsavedMemoryHolder) { <END> int unsavedMemory = replacement.getMemory(); while (path != null) { Page child = replacement; replacement = path.page.copy(); replacement.setChild(path.index, child); unsavedMemory += replacement.getMemory(); path = path.parent; } unsavedMemoryHolder.value += unsavedMemory; return replacement; }</code><technical_language>This method static</technical_language>

Target:
private static Page replacePage(CursorPos path, Page replacement, IntValueHolder unsavedMemoryHolder) { int unsavedMemory = replacement.getMemory(); while (path != null) { Page child = replacement; replacement = path.page.copy(); replacement.setChild(path.index, child); unsavedMemory += replacement.getMemory(); path = path.parent; } unsavedMemoryHolder.value += unsavedMemory; return replacement; }
Source:
<code>protected HookResult runHook() { Repository repo = null; HookResult result = null; try { final List<String> argv = new ArrayList<String>(1 + args.size()); argv.add(hook.getAbsolutePath()); argv.addAll(args); final ProcessBuilder pb = new ProcessBuilder(argv); pb.redirectErrorStream(true); <START> if(project != null) <END> repo = openRepository(project); if (repo != null) { pb.directory(repo.getDirectory()); final Map<String, String> env = pb.environment(); env.put("GIT_DIR", repo.getDirectory().getAbsolutePath()); } Process ps = pb.start(); ps.getOutputStream().close(); InputStream is = ps.getInputStream(); String output = null; try { output = readOutput(is); } finally { try { is.close(); } catch (IOException closeErr) { } ps.waitFor(); result = new HookResult(ps.exitValue(), output); } } catch (InterruptedException iex) { } catch (Throwable err) { log.error("Error running hook " + hook.getAbsolutePath(), err); } finally { if (repo != null) { repo.close(); } } log.info("hook[" + getName() + "] exitValue:" + result.getExitValue()); BufferedReader br = new BufferedReader(new StringReader(result.getOutput())); try { String line; while ((line = br.readLine()) != null) { log.info("hook[" + getName() + "] output: " + line); } } catch(IOException iox) { log.error("Error writing hook output", iox); } return result; }</code><technical_language>Style: spaces brackets</technical_language>

Target:
protected HookResult runHook() { Repository repo = null; HookResult result = null; try { final List<String> argv = new ArrayList<String>(1 + args.size()); argv.add(hook.getAbsolutePath()); argv.addAll(args); final ProcessBuilder pb = new ProcessBuilder(argv); pb.redirectErrorStream(true); if(project != null) { repo = openRepository(project); } if (repo != null) { pb.directory(repo.getDirectory()); final Map<String, String> env = pb.environment(); env.put("GIT_DIR", repo.getDirectory().getAbsolutePath()); } ps = pb.start(); ps.getOutputStream().close(); InputStream is = ps.getInputStream(); String output = null; try { output = readOutput(is); } finally { try { is.close(); } catch (IOException closeErr) { } ps.waitFor(); result = new HookResult(ps.exitValue(), output); } } catch (InterruptedException iex) { } catch (Throwable err) { log.error("Error running hook " + hook.getAbsolutePath(), err); } finally { if (repo != null) { repo.close(); } } log.info("hook[" + getName() + "] exitValue:" + result.getExitValue()); BufferedReader br = new BufferedReader(new StringReader(result.getOutput())); try { String line; while ((line = br.readLine()) != null) { log.info("hook[" + getName() + "] output: " + line); } } catch(IOException iox) { log.error("Error writing hook output", iox); } return result; }
Source:
<code>public void createContractFork() throws Exception { String contractSrc = "contract Child {" + " int a;" + " int b;" + " int public c;" + " function Child(int i) {" + " a = 333 + i;" + " b = 444 + i;" + " }" + " function sum() {" + " c = a + b;" + " }" + "}" + "contract Parent {" + " address public child;" + " function createChild(int a) returns (address) {" + " child = new Child(a);" + " return child;" + " }" + "}"; StandaloneBlockchain bc = new StandaloneBlockchain(); <START> SolidityContract parent = bc.submitNewContract(contractSrc, "<stdin>:Parent"); <END> Block b1 = bc.createBlock(); Block b2 = bc.createBlock(); parent.callFunction("createChild", 100); Block b3 = bc.createBlock(); byte[] childAddress = (byte[]) parent.callConstFunction("child")[0]; parent.callFunction("createChild", 200); Block b2_ = bc.createForkBlock(b1); SolidityContract child = bc.createExistingContractFromSrc(contractSrc, "<stdin>:Child", childAddress); child.callFunction("sum"); Block b4 = bc.createBlock(); Assert.assertEquals(BigInteger.valueOf(100 + 333 + 100 + 444), child.callConstFunction("c")[0]); }</code><technical_language>Ok, I suggest: 1) Adding public String path ContractMetadata. If is line :, saved (and removed contract name) 2) public Map<String, ContractMetadata> contracts public Map<String, List<ContractMetadata>> contracts in CompilationResult do think? braking compatibility I weird ways preserve it. remembering path is specific filesystem get contract compilation is a good thing, I think, need get over</technical_language>

Target:
public void createContractFork() throws Exception { String contractSrc = "contract Child {" + " int a;" + " int b;" + " int public c;" + " function Child(int i) {" + " a = 333 + i;" + " b = 444 + i;" + " }" + " function sum() {" + " c = a + b;" + " }" + "}" + "contract Parent {" + " address public child;" + " function createChild(int a) returns (address) {" + " child = new Child(a);" + " return child;" + " }" + "}"; StandaloneBlockchain bc = new StandaloneBlockchain(); SolidityContract parent = bc.submitNewContract(contractSrc, "Parent"); Block b1 = bc.createBlock(); Block b2 = bc.createBlock(); parent.callFunction("createChild", 100); Block b3 = bc.createBlock(); byte[] childAddress = (byte[]) parent.callConstFunction("child")[0]; parent.callFunction("createChild", 200); Block b2_ = bc.createForkBlock(b1); SolidityContract child = bc.createExistingContractFromSrc(contractSrc, "Child", childAddress); child.callFunction("sum"); Block b4 = bc.createBlock(); Assert.assertEquals(BigInteger.valueOf(100 + 333 + 100 + 444), child.callConstFunction("c")[0]); }
Source:
<code>public void testForValidProgramId() throws MiddlewareQueryException { final BindingResult bindingResult = new MapBindingResult(new HashMap<String, String>(), "Program"); <START> final Integer attributeById = 1; <END> final Attribute attribute = new Attribute(); attribute.setAid(1); Mockito.doReturn(attribute).when(this.germplasmDataManager).getAttributeById(attributeById); this.attributeValidator.validateAttributeIds(bindingResult, Lists.newArrayList(String.valueOf(attributeById))); Assert.assertFalse(bindingResult.hasErrors()); }</code><technical_language>@vmaletta random values</technical_language>

Target:
public void testForValidProgramId() throws MiddlewareQueryException { final BindingResult bindingResult = new MapBindingResult(new HashMap<String, String>(), "Program"); final Integer attributeById = Integer.valueOf(RandomStringUtils.randomNumeric(1)); final Attribute attribute = new Attribute(); attribute.setAid(attributeById); List<Attribute> attributeLists = Lists.newArrayList(attribute); Mockito.doReturn(attributeLists).when(this.germplasmDataManager).getAttributeByIds(Lists.newArrayList(attributeById)); this.attributeValidator.validateAttributeIds(bindingResult, Lists.newArrayList(String.valueOf(attributeById))); Assert.assertFalse(bindingResult.hasErrors()); }
Source:
<code>public ClusterServiceModule(Configuration configuration){ this.configuration = configuration; checkNotNull(configuration); String className = configuration.getString("provider.classname"); checkNotNull(className); <START> implClass = getImplClassForName(className); <END> checkNotNull(implClass); }</code><technical_language>Do need this level of flexibility here? a flag bind correct implementation? Do need multiple implementations</technical_language>

Target:
public ClusterServiceModule(Configuration configuration) throws ClassNotFoundException{ this.configuration = checkNotNull(configuration); implClass = Class.forName(configuration.getString("provider.classname")); }
Source:
<code>public final void test() throws EdisonException { log.debug("Corlex Feature Extractor"); TextAnnotation ta = tas.get(1); View TOKENS = ta.getView("TOKENS"); log.debug("Got tokens FROM TextAnnotation"); CorlexFeatureExtractor testInstance = new CorlexFeatureExtractor(true); Set<Feature> feats = testInstance.getWordFeatures(ta,1); String[] expected_outputs = {"atr"}; if (feats == null) { log.debug("Feats are returning NULL."); } log.debug("Printing Set of Features"); for (Feature f : feats) { log.debug(f.getName()); <START> assert (ArrayUtils.contains(expected_outputs, f.getName())); <END> } }</code><technical_language>assertTrue syntax. other tests examples</technical_language>

Target:
public final void test() throws EdisonException { log.debug("Corlex Feature Extractor"); TextAnnotation ta = tas.get(1); View TOKENS = ta.getView("TOKENS"); log.debug("Got tokens FROM TextAnnotation"); CorlexFeatureExtractor testInstance = new CorlexFeatureExtractor(true); Set<Feature> feats = testInstance.getWordFeatures(ta,1); String[] expected_outputs = {"atr"}; if (feats == null) { log.debug("Feats are returning NULL."); } log.debug("Printing Set of Features"); for (Feature f : feats) { log.debug(f.getName()); assertTrue(ArrayUtils.contains(expected_outputs, f.getName())); } }
Source:
<code>void startPeriodRebalance(long period, HelixManager manager) { if (period != _timerPeriod) { logger.info("Controller starting periodical rebalance timer at period " + period); ScheduledFuture lastScheduledFuture = null; synchronized (_lock) { <START> if (_periodicRebalancerFutureTasks!=null && !_periodicRebalancerFutureTasks.isCancelled()) { <END> lastScheduledFuture = _periodicRebalancerFutureTasks; } _timerPeriod = period; _periodicRebalancerFutureTasks = _periodicalRebalanceExecutor .scheduleAtFixedRate(new RebalanceTask(manager, ClusterEventType.PeriodicalRebalance), _timerPeriod, _timerPeriod, TimeUnit.MILLISECONDS); } if (lastScheduledFuture != null) { lastScheduledFuture.cancel(true ); } } else { logger.info("Controller already has periodical rebalance timer at period " + _timerPeriod); } }</code><technical_language>Is this check necessary</technical_language>

Target:
void startPeriodRebalance(long period, HelixManager manager) { if (period != _timerPeriod) { logger.info("Controller starting periodical rebalance timer at period " + period); ScheduledFuture lastScheduledFuture; synchronized (_periodicalRebalanceExecutor) { lastScheduledFuture = _periodicRebalanceFutureTask; _timerPeriod = period; _periodicRebalanceFutureTask = _periodicalRebalanceExecutor .scheduleAtFixedRate(new RebalanceTask(manager, ClusterEventType.PeriodicalRebalance), _timerPeriod, _timerPeriod, TimeUnit.MILLISECONDS); } if (lastScheduledFuture != null && !lastScheduledFuture.isCancelled()) { lastScheduledFuture.cancel(false ); } } else { logger.info("Controller already has periodical rebalance timer at period " + _timerPeriod); } }
Source:
<code>public List<User> getUsersByRole(Role role) throws APIException { List<Role> roles = new ArrayList<>(); roles.add(role); <START> return removeDaemonUsers(Context.getUserService().getUsers(null, roles, false)); <END> }</code><technical_language>in this DAO in query</technical_language>

Target:
public List<User> getUsersByRole(Role role) throws APIException { List<Role> roles = new ArrayList<>(); roles.add(role); return Context.getUserService().getUsers(null, roles, false); }