auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Vector<Integer> getCasesMatchingValueSet(String indexName, String[] targetValueSet) { String[] args = new String[1 + targetValueSet.length]; args[0] = indexName; for(int i =0 ; i < targetValueSet.length ; ++i) { args[i + 1] = targetValueSet[i]; } String inSet = getInSet(targetValueSet.length); if (SqlStorage.STORAGE_OUTPUT_DEBUG) { String query = String.format("SELECT %s FROM %s WHERE %s = ? AND %s in " + inSet, COL_CASE_RECORD_ID, TABLE_NAME, COL_INDEX_NAME, COL_INDEX_TARGET); DbUtil.explainSql(db, query, args); } Cursor c = db.query(TABLE_NAME, new String[]{COL_CASE_RECORD_ID}, COL_INDEX_NAME + " = ? AND " + COL_INDEX_TARGET + " in " + inSet, args, null, null, null); return SqlStorage.fillIdWindow(c, COL_CASE_RECORD_ID); }

Target:
public Vector<Integer> getCasesMatchingValueSet(String indexName, String[] targetValueSet) { String[] args = new String[1 + targetValueSet.length]; args[0] = indexName; for (int i = 0; i < targetValueSet.length; ++i) { args[i + 1] = targetValueSet[i]; } String inSet = getArgumentBasedVariableSet(targetValueSet.length); String whereExpr = String.format("%s = ? AND %s IN %s", COL_INDEX_NAME, COL_INDEX_TARGET, inSet); if (SqlStorage.STORAGE_OUTPUT_DEBUG) { String query = String.format("SELECT %s FROM %s WHERE %s", COL_CASE_RECORD_ID, TABLE_NAME, whereExpr); DbUtil.explainSql(db, query, args); } Cursor c = db.query(TABLE_NAME, new String[]{COL_CASE_RECORD_ID}, whereExpr, args, null, null, null); return SqlStorage.fillIdWindow(c, COL_CASE_RECORD_ID); }
Source:
public void deletePolicyByGroup(Group group, AuthorizationPolicy policy) { ioService.startBatch(fileSystem, new CommentedOption("system", "Delete Policy")); try (StringWriter sw = new StringWriter()){ AuthorizationPolicyMarshaller marshaller = new AuthorizationPolicyMarshaller(); NonEscapedProperties entries = new NonEscapedProperties(); marshaller.remove(group, policy, entries); entries.store(sw, "Authorization Policy", "Last update: " + new Date().toString()); String policyContent = sw.toString(); Path policyPath = getAuthzPath().resolve(POLICY_FILE); ioService.write(policyPath, policyContent); } catch (Exception e) { logger.error("Authz policy write error.", e); } finally { ioService.endBatch(); } }

Target:
public void deletePolicyByGroup(Group group, AuthorizationPolicy policy) { AuthorizationPolicyMarshaller marshaller = new AuthorizationPolicyMarshaller(); NonEscapedProperties entries = new NonEscapedProperties(); marshaller.remove(group, policy, entries); savePolicyIntoVfs(entries, "system", "Delete Policy"); }
Source:
private static void processSampleQC(String sampleQc, Sample s, User u, QualityControlService qcService) throws Exception { if (!isStringEmptyOrNull(sampleQc)) { try { SampleQC sqc = new SampleQC(); sqc.setSample(s); sqc.setResults(Double.valueOf(sampleQc)); sqc.setCreator(u); sqc.setDate(new Date()); sqc.setType(qcService.getQcType(QcTarget.Sample, "QuBit")); if (s.getQCs().stream().noneMatch(existing -> existing.getType().getQcTypeId() == sqc.getType().getQcTypeId())) { qcService.createQC(sqc); log.info("Added sample QC: {}", sqc.toString()); } } catch (NumberFormatException nfe) { throw new InputFormException("Supplied Sample QC concentration for sample '" + sampleQc + "' is invalid", nfe); } } }

Target:
private static void processSampleQC(String sampleQc, Sample s, User u, QualityControlService qcService) throws Exception { if (!isStringEmptyOrNull(sampleQc)) { try { SampleQC sqc = new SampleQC(); sqc.setSample(s); sqc.setResults(Double.valueOf(sampleQc)); sqc.setCreator(u); sqc.setDate(new Date()); sqc.setType(qcService.getQcType(QcTarget.Sample, "QuBit")); if (s.getQCs().stream().noneMatch(existing -> existing.getType().getQcTypeId() == sqc.getType().getQcTypeId())) { qcService.createQC(sqc); log.info("Added sample QC: {}", sqc); } } catch (NumberFormatException nfe) { throw new InputFormException("Supplied Sample QC concentration for sample '" + sampleQc + "' is invalid", nfe); } } }
Source:
public Response add(Disk disk) { validateEnums(Disk.class, disk); if (disk.isSetId()) { return Response.fromResponse(attachDiskToVm(disk)) .entity(resolveCreated(Guid.createGuidFromString(disk.getId()), getEntityIdResolver(null), VM.class)).build(); }else { return super.add(disk); } }

Target:
public Response add(Disk disk) { validateEnums(Disk.class, disk); if (disk.isSetId()) { return Response.fromResponse(attachDiskToVm(disk)) .entity(lookupEntity(Guid.createGuidFromString(disk.getId()))) .build(); }else { validateParameters(disk, "format", "interface"); if (!disk.isSetLunStorage() || disk.getLunStorage().getLogicalUnits().isEmpty()) { validateParameters(disk, "provisionedSize|size"); } return performCreation(addAction, getAddParameters(map(disk), disk), getEntityIdResolver(disk.getName())); } }
Source:
public CatalogEntitySummary getApplication(String applicationId) throws Exception { return getEntity(applicationId); }

Target:
public CatalogEntitySummary getApplication(String applicationId) { return getEntity(applicationId); }
Source:
protected List<ForgeTimings<T>> getSortedTimings() { ArrayList<ForgeTimings<T>> list = new ArrayList<>(); list.addAll(tracker.getTimingData()); list.sort((o1, o2) -> Double.compare(o2.getAverageTimings(), o1.getAverageTimings())); return list; }

Target:
protected List<ForgeTimings<T>> getSortedTimings() { ArrayList<ForgeTimings<T>> list = new ArrayList<>(); list.addAll(tracker.getTimingData()); list.sort(Comparator.comparingDouble(ForgeTimings::getAverageTimings)); Collections.reverse(list); return list; }
Source:
public int hashCode() { return Objects.hash(sqls, sqlFirehoseDatabaseConnector, objectMapper, foldCase); }

Target:
public int hashCode() { return Objects.hash(sqls, sqlFirehoseDatabaseConnector, foldCase); }
Source:
public LogoutResponse buildLogoutResponse( String issuerOrEntityId, String statusCodeValue, String inResponseTo) { if (issuerOrEntityId == null) { throw new IllegalArgumentException("Issuer cannot be null"); } if (statusCodeValue == null) { throw new IllegalArgumentException("Status Code cannot be null"); } return SamlProtocol.createLogoutResponse( SamlProtocol.createIssuer(issuerOrEntityId), SamlProtocol.createStatus(statusCodeValue), inResponseTo, "a" + UUID.randomUUID().toString()); }

Target:
public LogoutResponse buildLogoutResponse( String issuerOrEntityId, String statusCodeValue, String inResponseTo) { Validate.notNull(issuerOrEntityId, ISSUER_CANNOT_BE_NULL_MSG); Validate.notNull(statusCodeValue, "Status Code cannot be null"); return SamlProtocol.createLogoutResponse( SamlProtocol.createIssuer(issuerOrEntityId), SamlProtocol.createStatus(statusCodeValue), inResponseTo, "_" + UUID.randomUUID().toString()); }
Source:
public boolean isAsFileTabOpened() { return seleniumWebDriverHelper .waitVisibilityAndGetAttribute( By.xpath(AS_FILE_BUTTON_XPATH + "/parent::md-tab-item"), "aria-selected") .equals("true"); }

Target:
public boolean isAsFileTabOpened() { final String asFileButtonParentContainer = AS_FILE_BUTTON_XPATH + "/parent::md-tab-item"; return seleniumWebDriverHelper .waitVisibilityAndGetAttribute(By.xpath(asFileButtonParentContainer), "aria-selected") .equals("true"); }
Source:
public TransportConnection(SignalFxEndpoint endpoint, int timeoutMs) { super(endpoint, timeoutMs, new BasicHttpClientConnectionManager()); this.transportRequestConfig = RequestConfig.custom().setSocketTimeout(0) .setConnectionRequestTimeout(this.requestConfig.getConnectionRequestTimeout()) .setConnectTimeout(this.requestConfig.getConnectTimeout()) .setProxy(this.requestConfig.getProxy()).build(); if (log.isDebugEnabled()) { log.debug("constructed request config: " + this.transportRequestConfig.toString()); } }

Target:
public TransportConnection(SignalFxEndpoint endpoint, int timeoutMs) { super(endpoint, timeoutMs, new BasicHttpClientConnectionManager()); this.transportRequestConfig = RequestConfig.custom().setSocketTimeout(0) .setConnectionRequestTimeout(this.requestConfig.getConnectionRequestTimeout()) .setConnectTimeout(this.requestConfig.getConnectTimeout()) .setProxy(this.requestConfig.getProxy()).build(); log.debug("constructed request config: {}", this.transportRequestConfig.toString()); }
Source:
public void validate_implicit_unwrapping_having_two_type_parameters_and_only_one_maximally_specific_value_extractor_is_ok() { Validator validator = TestUtil.getConfigurationUnderTest() .addValueExtractor( new UnwrapByDefaultWrapperWithTwoTypeArgumentsFirstValueExtractor() ) .buildValidatorFactory() .getValidator(); Set<ConstraintViolation<BeanWithWrapperWithTwoTypeArguments>> constraintViolations = validator.validate( new BeanWithWrapperWithTwoTypeArguments() ); assertThat( constraintViolations ).containsOnlyViolations( violationOf( Min.class ).withProperty( "wrapper" ) ); }

Target:
public void validate_implicit_unwrapping_having_two_type_parameters_and_only_one_maximally_specific_value_extractor_is_ok() { Validator validator = TestUtil.getConfigurationUnderTest() .addValueExtractor( new UnwrapByDefaultWrapperWithTwoTypeArgumentsFirstValueExtractor() ) .buildValidatorFactory() .getValidator(); Set<ConstraintViolation<BeanWithWrapperWithTwoTypeArguments>> constraintViolations = validator.validate( new BeanWithWrapperWithTwoTypeArguments() ); assertThat( constraintViolations ).containsOnlyViolations( violationOf( Min.class ) .withPropertyPath( pathWith() .property( "wrapper" ) .containerElement( "first", false, null, null, WrapperWithTwoTypeArguments.class, 0 ) ) ); }
Source:
public void testCancelDuringPreparation() throws InterruptedException, ExecutionException { final Props jobProps = new Props(); jobProps.put("command", "echo hello"); jobProps.put("working.dir", "/tmp"); jobProps.put("user.to.proxy", "test"); jobProps.put("azkaban.flow.projectname", "test"); jobProps.put("azkaban.flow.flowid", "test"); jobProps.put("azkaban.job.id", "test"); jobProps.put("azkaban.flow.execid", "1"); final Props sysProps = new Props(); sysProps.put("execute.as.user", "false"); final SleepBeforeRunJob job = new SleepBeforeRunJob("test", sysProps, jobProps, this.log); final ExecutorService executorService = Executors.newSingleThreadExecutor(); final Future future = executorService.submit(job); Thread.sleep(2000); try { this.job.cancel(); } catch (final Exception e) { this.log.error(e.getMessage()); } future.get(); assertEquals(this.job.getProgress(), 0.0, 0.001); }

Target:
public void testCancelDuringPreparation() throws InterruptedException, ExecutionException { final Props jobProps = new Props(); jobProps.put("command", "echo hello"); jobProps.put("working.dir", "/tmp"); jobProps.put("user.to.proxy", "test"); jobProps.put("azkaban.flow.projectname", "test"); jobProps.put("azkaban.flow.flowid", "test"); jobProps.put("azkaban.job.id", "test"); jobProps.put("azkaban.flow.execid", "1"); final Props sysProps = new Props(); sysProps.put("execute.as.user", "false"); final SleepBeforeRunJob sleepBeforeRunJob = new SleepBeforeRunJob("test", sysProps, jobProps, this.log); final ExecutorService executorService = Executors.newSingleThreadExecutor(); final Future future = executorService.submit(sleepBeforeRunJob); Thread.sleep(1000); assertThatThrownBy(() -> sleepBeforeRunJob.cancel()).hasMessage("Not started."); future.get(); assertThat(sleepBeforeRunJob.getProgress()).isEqualTo(0.0); }
Source:
public static String resolveSymlink(@Nonnull File link) throws IOException { try { Path path = link.toPath(); return Files.readSymbolicLink(path).toString(); } catch (UnsupportedOperationException | FileSystemException x) { return null; } catch (IOException x) { throw x; } catch (Exception x) { throw new IOException(x); } }

Target:
public static String resolveSymlink(@Nonnull File link) throws IOException { try { Path path = fileToPath(link); return Files.readSymbolicLink(path).toString(); } catch (UnsupportedOperationException | FileSystemException x) { return null; } catch (IOException x) { throw x; } catch (Exception x) { throw new IOException(x); } }
Source:
public void testXMLReaderWithXMLPreProcessingRequired() throws Exception { String processedFileTable = "XMLTrackingTableXMLPreProcessingRequired"; Map<String, String> sourceProperties = new ImmutableMap.Builder<String, String>() .put(Constants.Reference.REFERENCE_NAME, "XMLReaderXMLPreProcessingRequiredTest") .put("path", sourceFolderUri) .put("nodePath", "/catalog/book/price") .put("targetFolder", targetFolderUri) .put("reprocessingRequired", "Yes") .put("tableName", processedFileTable) .put("actionAfterProcess", "None") .put("tableExpiryPeriod", "30") .build(); ETLStage source = new ETLStage("XMLReader", new ETLPlugin("XMLReader", BatchSource.PLUGIN_TYPE, sourceProperties, null)); String outputDatasetName = "output-batchsink-test-preprocessing-required"; ETLStage sink = new ETLStage("sink", MockSink.getPlugin(outputDatasetName)); ETLBatchConfig etlConfig = ETLBatchConfig.builder("* * * * *") .addStage(source) .addStage(sink) .addConnection(source.getName(), sink.getName()) .build(); AppRequest<ETLBatchConfig> appRequest = new AppRequest<>(ETLBATCH_ARTIFACT, etlConfig); ApplicationId appId = NamespaceId.DEFAULT.app("XMLReaderXMLPreProcessingRequiredTest"); ApplicationManager appManager = deployApplication(appId.toId(), appRequest); Date preProcessedDate = new Date(); createPreProcessedRecord(processedFileTable, preProcessedDate); MapReduceManager mrManager = appManager.getMapReduceManager(ETLMapReduce.NAME); mrManager.start(); mrManager.waitForFinish(5, TimeUnit.MINUTES); List<String> processedFileList = getProcessedFileList(processedFileTable, preProcessedDate); Assert.assertEquals(2, processedFileList.size()); DataSetManager<Table> outputManager = getDataset(outputDatasetName); List<StructuredRecord> output = MockSink.readOutput(outputManager); Assert.assertEquals(12, output.size()); }

Target:
public void testXMLReaderWithXMLPreProcessingRequired() throws Exception { String processedFileTable = "XMLTrackingTableXMLPreProcessingRequired"; Map<String, String> sourceProperties = new ImmutableMap.Builder<String, String>() .put(Constants.Reference.REFERENCE_NAME, "XMLReaderXMLPreProcessingRequiredTest") .put("path", sourceFolderUri) .put("nodePath", "/catalog/book/price") .put("targetFolder", targetFolderUri) .put("reprocessingRequired", "Yes") .put("tableName", processedFileTable) .put("actionAfterProcess", "None") .put("tableExpiryPeriod", "30") .put("temporaryFolder", "/tmp") .build(); String outputDatasetName = "output-batchsink-test-preprocessing-required"; ApplicationManager appManager = deployApplication(sourceProperties, outputDatasetName, "XMLReaderXMLPreProcessingRequiredTest"); Date preProcessedDate = new Date(); createPreProcessedRecord(processedFileTable, preProcessedDate); startMapReduceJob(appManager); List<String> processedFileList = getProcessedFileList(processedFileTable, preProcessedDate); Assert.assertEquals(2, processedFileList.size()); DataSetManager<Table> outputManager = getDataset(outputDatasetName); List<StructuredRecord> output = MockSink.readOutput(outputManager); Assert.assertEquals(12, output.size()); }
Source:
public void testValueForNestedXrefDefaultDepth() { Entity gender = new DynamicEntity(genderEntityType); gender.set("id", "1"); gender.set("label", "male"); Entity person = new DynamicEntity(personGenderEntityType); person.set("gender", gender); Object scriptExceptionObj = jsMagmaScriptEvaluator.eval("$('gender.xref.label').value()", person); assertEquals(scriptExceptionObj.toString(), "javax.script.ScriptException: TypeError: Cannot read property \"label\" from undefined in <eval> at line number 431"); }

Target:
public void testValueForNestedXrefDefaultDepth() { Entity gender = new DynamicEntity(genderEntityType); gender.set("id", "1"); gender.set("label", "male"); Entity person = new DynamicEntity(personGenderEntityType); person.set("gender", gender); Object scriptExceptionObj = jsMagmaScriptEvaluator.eval("$('gender.xref.label').value()", person); assertEquals(scriptExceptionObj.toString(), "org.molgenis.script.core.ScriptException: <eval>:434 TypeError: Cannot read property \"label\" from undefined"); }
Source:
public List<String> getTags() { return tags; }

Target:
public List<String> getTags() { return Collections.unmodifiableList(tags); }
Source:
private void updateProblemIndication(Diagnostic diagnostic) { Assert.isNotNull(diagnostic); int lastEditorPage = getPageCount() - 1; if (lastEditorPage >= 0 && getItemControl(lastEditorPage) instanceof ProblemIndicationComposite) { ((ProblemIndicationComposite)getItemControl(lastEditorPage)).setDiagnostic(diagnostic); if (diagnostic.getSeverity() != Diagnostic.OK && diagnostic.getSeverity() != Diagnostic.WARNING) { setActivePage(lastEditorPage); updateLayout(false, true); } } else if (diagnostic.getSeverity() != Diagnostic.OK && !getControl().isDisposed()) { ProblemIndicationComposite problemIndicationComposite = new ProblemIndicationComposite( getControl(), SWT.NONE); problemIndicationComposite.setDiagnostic(diagnostic); createItem(++lastEditorPage, problemIndicationComposite); getControl().getItem(lastEditorPage) .setText(CommonUIPlugin.getPlugin().getString("_UI_Problems_label")); if (diagnostic.getSeverity() != Diagnostic.WARNING) { setActivePage(lastEditorPage); updateLayout(false, true); } showTabs(); } }

Target:
private void updateProblemIndication(Diagnostic diagnostic) { ProblemIndicationComposite problemIndicationComposite = getProblemIndicationFor(diagnostic); if (problemIndicationComposite != null) { problemIndicationComposite.setDiagnostic(diagnostic); if (diagnostic.getSeverity() != Diagnostic.OK && diagnostic.getSeverity() != Diagnostic.WARNING) { int lastEditorPage = getPageCount() - 1; setActivePage(lastEditorPage); updateLayout(false, true); } } }
Source:
public void addContainedEntity(IndexedTypeIdentifier entity) { final IndexedTypesSet oldSet = containedEntityTypes; final IndexedTypesSet newSet = IndexedTypesSets.composite( oldSet, entity ); if ( ! oldSet.equals( newSet ) ) { this.containedEntityTypes = newSet; triggerWorkspaceReconfiguration(); } }

Target:
public void addContainedEntity(IndexedTypeIdentifier entity) { final IndexedTypeSet oldSet = containedEntityTypes; final IndexedTypeSet newSet = IndexedTypesSets.composite( oldSet, entity ); if ( ! oldSet.equals( newSet ) ) { this.containedEntityTypes = newSet; triggerWorkspaceReconfiguration(); } }
Source:
public final void write(String mountPath, boolean shuttingDown) throws IOException, ReplicationException { long writeStartTimeMs = SystemTime.getInstance().milliseconds(); List<ReplicaTokenInfo> tokensPersisted = new ArrayList<>(); for (PartitionInfo info : partitionGroupedByMountPath.get(mountPath)) { for (RemoteReplicaInfo remoteReplica : info.getRemoteReplicaInfos()) { FindToken tokenToPersist = remoteReplica.getTokenToPersist(); if (tokenToPersist != null) { tokensPersisted.add(new ReplicaTokenInfo(remoteReplica)); } } } try { persistTokens(mountPath, tokensPersisted); } finally { replicationMetrics.remoteReplicaTokensPersistTime.update( SystemTime.getInstance().milliseconds() - writeStartTimeMs); } for (ReplicaTokenInfo replicaTokenInfo : tokensPersisted) { replicaTokenInfo.getReplicaInfo().onTokenPersisted(); if (shuttingDown) { logger.info("Persisted token {}", replicaTokenInfo.getReplicaToken()); } } }

Target:
public final void write(String mountPath, boolean shuttingDown) throws IOException, ReplicationException { long writeStartTimeMs = SystemTime.getInstance().milliseconds(); List<ReplicaTokenInfo> tokensPersisted = new ArrayList<>(); for (PartitionInfo info : partitionGroupedByMountPath.get(mountPath)) { for (RemoteReplicaInfo remoteReplica : info.getRemoteReplicaInfos()) { FindToken tokenToPersist = remoteReplica.getTokenToPersist(); if (tokenToPersist != null) { tokensPersisted.add(new ReplicaTokenInfo(remoteReplica)); } } } try { persist(mountPath, tokensPersisted); } finally { replicationMetrics.remoteReplicaTokensPersistTime.update( SystemTime.getInstance().milliseconds() - writeStartTimeMs); } for (ReplicaTokenInfo replicaTokenInfo : tokensPersisted) { replicaTokenInfo.getReplicaInfo().onTokenPersisted(); if (shuttingDown) { logger.info("Persisted token {}", replicaTokenInfo.getReplicaToken()); } } }
Source:
public List<SMREntry> current() { ILogData data = streamView.current(); if (data != null && data.isHole()) { throw new HoleInStreamException(); } if (data == null || data.getType() != DataType.DATA || !(data.getPayload(runtime) instanceof ISMRConsumable)) { return Collections.emptyList(); } return ((ISMRConsumable) data.getPayload(runtime)).getSMRUpdates(streamView.getId()); }

Target:
public List<SMREntry> current() { ILogData data = streamView.current(); if (data == null || data.getType() != DataType.DATA || !(data.getPayload(runtime) instanceof ISMRConsumable)) { return Collections.emptyList(); } return ((ISMRConsumable) data.getPayload(runtime)).getSMRUpdates(streamView.getId()); }
Source:
@Test public void testDistinctCountOnMetricRenamed() { String sql = "select \"B\", count(distinct \"A\") from " + "(select \"unit_sales\" as \"A\", \"store_state\" as \"B\" from \"foodmart\") " + "group by \"B\""; String expectedSubExplain = "PLAN=EnumerableInterpreter\n" + " BindableAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n" + " DruidQuery(table=[[foodmart, foodmart]], " + "intervals=[[1900-01-09T00:00:00.000Z/2992-01-10T00:00:00.000Z]], groups=[{63, 89}], " + "aggs=[[]])\n" + "\n" + ""; testCountWithApproxDistinct(true, sql, expectedSubExplain, "\"queryType\":\"groupBy\""); testCountWithApproxDistinct(false, sql, expectedSubExplain, "\"queryType\":\"groupBy\""); }

Target:
@Test public void testDistinctCountOnMetricRenamed() { String sql = "select \"B\", count(distinct \"A\") from " + "(select \"unit_sales\" as \"A\", \"store_state\" as \"B\" from \"foodmart\") " + "group by \"B\""; String expectedSubExplain = "PLAN=EnumerableInterpreter\n" + " BindableAggregate(group=[{0}], EXPR$1=[COUNT($1)])\n" + " DruidQuery(table=[[foodmart, foodmart]], " + "intervals=[[1900-01-09T00:00:00.000Z/2992-01-10T00:00:00.000Z]], groups=[{63, 89}], " + "aggs=[[]])"; testCountWithApproxDistinct(true, sql, expectedSubExplain, "\"queryType\":\"groupBy\""); testCountWithApproxDistinct(false, sql, expectedSubExplain, "\"queryType\":\"groupBy\""); }
Source:
public Response addCloudConfig(@PathParam("clusterId") String clusterId, String content) { HelixZkClient zkClient = getHelixZkClient(); if (!ZKUtil.isClusterSetup(clusterId, zkClient)) { return notFound("Cluster is not properly setup!"); } HelixAdmin admin = getHelixAdmin(); ZNRecord record; try { record = toZNRecord(content); } catch (IOException e) { _logger.error("Failed to deserialize user's input " + content + ", Exception: " + e); return badRequest("Input is not a vaild ZNRecord!"); } try { CloudConfig cloudConfig = new CloudConfig.Builder(record).build(); admin.addCloudConfig(clusterId, cloudConfig); } catch (HelixException ex) { _logger.error("Error in adding a CloudConfig to cluster: " + clusterId, ex); return badRequest(ex.getMessage()); } catch (Exception ex) { _logger.error("Cannot add CloudConfig to cluster: " + clusterId, ex); return badRequest(ex.getMessage()); } return OK(); }

Target:
public Response addCloudConfig(@PathParam("clusterId") String clusterId, String content) { HelixZkClient zkClient = getHelixZkClient(); if (!ZKUtil.isClusterSetup(clusterId, zkClient)) { return notFound("Cluster is not properly setup!"); } HelixAdmin admin = getHelixAdmin(); ZNRecord record; try { record = toZNRecord(content); } catch (IOException e) { _logger.error("Failed to deserialize user's input " + content + ", Exception: " + e); return badRequest("Input is not a vaild ZNRecord!"); } try { CloudConfig cloudConfig = new CloudConfig.Builder(record).build(); admin.addCloudConfig(clusterId, cloudConfig); } catch (HelixException ex) { _logger.error("Error in adding a CloudConfig to cluster: " + clusterId, ex); return badRequest(ex.getMessage()); } catch (Exception ex) { _logger.error("Cannot add CloudConfig to cluster: " + clusterId, ex); return serverError(ex); } return OK(); }
Source:
protected boolean isBlockingUserInput() { View cover = this.findViewById(R.id.form_entry_cover); if(cover != null && cover.getVisibility() == View.VISIBLE) { return true; } else { return false; } }

Target:
protected boolean isBlockingUserInput() { View cover = this.findViewById(R.id.form_entry_cover); return cover != null && cover.getVisibility() == View.VISIBLE; }
Source:
private static void addVarArgTypeSignature(TypeSignature typeSignature, Map<String, TypeVariableConstraint> typeVariableConstraints, List<TypeSignature> builder, int actualArity) { TypeVariableConstraint typeVariableConstraint = resolveTypeVariableConstraint( typeSignature, typeVariableConstraints ); if (typeVariableConstraint != null && typeVariableConstraint.isAnyAllowed()) { var newConstraintName = "_generated_" + typeVariableConstraint + actualArity; TypeSignature newTypeSignature; if (typeSignature.getParameters().isEmpty()) { newTypeSignature = new TypeSignature(newConstraintName); } else { newTypeSignature = replaceTypeVariable( typeSignature, typeVariableConstraint.getName(), newConstraintName ); } typeVariableConstraints.put(newConstraintName, typeVariableOfAnyType(newConstraintName)); builder.add(newTypeSignature); } else { builder.add(typeSignature); } }

Target:
private static void addVarArgTypeSignature(TypeSignature typeSignature, Map<String, TypeVariableConstraint> typeVariableConstraints, List<TypeSignature> builder, int actualArity) { TypeVariableConstraint typeVariableConstraint = resolveTypeVariableConstraint( typeSignature, typeVariableConstraints ); if (typeVariableConstraint != null && typeVariableConstraint.isAnyAllowed()) { var newConstraintName = "_generated_" + typeVariableConstraint + actualArity; var newTypeSignature = replaceTypeVariable( typeSignature, typeVariableConstraint.getName(), newConstraintName ); typeVariableConstraints.put(newConstraintName, typeVariableOfAnyType(newConstraintName)); builder.add(newTypeSignature); } else { builder.add(typeSignature); } }
Source:
public void onPageScrolled(int oldScrollY, int scrollY, boolean isHumanScroll) { oldScrollY = (int) (oldScrollY / app.getScreenDensity()); scrollY = (int) (scrollY / app.getScreenDensity()); if (isHumanScroll) { if (scrollY > oldScrollY) { scrollFluxDown += (scrollY - oldScrollY); } else { scrollFluxUp += (oldScrollY - scrollY); } } if (scrollY > pageHeightReached) { pageHeightReached = scrollY; } }

Target:
public void onPageScrolled(int oldScrollY, int scrollY, boolean isHumanScroll) { if (isHumanScroll) { if (scrollY > oldScrollY) { scrollFluxDown += (scrollY - oldScrollY); } else { scrollFluxUp += (oldScrollY - scrollY); } } maxScrollY = Math.max(maxScrollY, scrollY); }
Source:
private void bindToConfiguration() { this.projectDirText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { File projectDir = FileUtils.getAbsoluteFile(GradleProjectWizardPage.this.projectDirText.getText()).orNull(); getConfiguration().setProjectDir(projectDir); if (NONE == getMessageType()) { if (WorkspaceUtils.isInWorkspaceFolder(projectDir)) { setMessage("It is recommended to locate your Gradle projects outside the workspace location", WARNING); } } } }); this.workingSetConfigurationWidget.addWorkingSetChangeListener(new WorkingSetChangedListener() { @Override public void workingSetsChanged(List<IWorkingSet> workingSets) { List<String> workingSetNames = WorkingSetUtils.toWorkingSetNames(workingSets); getConfiguration().setWorkingSets(workingSetNames); } }); this.workingSetConfigurationWidget.getWorkingSetsEnabledButton().addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean selected = GradleProjectWizardPage.this.workingSetConfigurationWidget.getWorkingSetsEnabledButton().getSelection(); getConfiguration().setApplyWorkingSets(selected); } }); }

Target:
private void bindToConfiguration() { this.projectDirText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { File projectDir = FileUtils.getAbsoluteFile(GradleProjectWizardPage.this.projectDirText.getText()).orNull(); getConfiguration().setProjectDir(projectDir); if (NONE == getMessageType()) { if (WorkspaceUtils.isInWorkspaceFolder(projectDir)) { setMessage(ProjectWizardMessages.GradleProjectWizardPage_project_workspace_location_warning, WARNING); } } } }); this.workingSetConfigurationWidget.addWorkingSetChangeListener(new WorkingSetChangedListener() { @Override public void workingSetsChanged(List<IWorkingSet> workingSets) { List<String> workingSetNames = WorkingSetUtils.toWorkingSetNames(workingSets); getConfiguration().setWorkingSets(workingSetNames); } }); this.workingSetConfigurationWidget.getWorkingSetsEnabledButton().addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean selected = GradleProjectWizardPage.this.workingSetConfigurationWidget.getWorkingSetsEnabledButton().getSelection(); getConfiguration().setApplyWorkingSets(selected); } }); }
Source:
private static Map<String, String> getHostSystemProperties() { final Map<String, String> hostSystemProperties = new HashMap<String, String>(); try { RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); for (String arg : runtime.getInputArguments()) { if (arg != null && arg.length() > 2 && arg.startsWith("-D")) { arg = arg.substring(2); int doubleEqualIndex = arg.indexOf("=="); if (doubleEqualIndex > 0) { hostSystemProperties.put(arg.substring(0, doubleEqualIndex), arg.substring(doubleEqualIndex + 1)); continue; } int equalIndex = arg.indexOf("="); if (equalIndex >= 0) { hostSystemProperties.put(arg.substring(0, equalIndex), arg.substring(equalIndex + 1)); } else { hostSystemProperties.put(arg, null); } } } } catch (Exception e) { STDERR.println(HostControllerLogger.ROOT_LOGGER.cannotAccessJvmInputArgument(e)); } return hostSystemProperties; }

Target:
private static Map<String, String> getHostSystemProperties() { final Map<String, String> hostSystemProperties = new HashMap<String, String>(); try { RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); String propertyName, propertyValue; for (String arg : runtime.getInputArguments()) { if (arg != null && arg.length() > 2 && arg.startsWith("-D")) { arg = arg.substring(2); int equalIndex = arg.indexOf("="); if (equalIndex >= 0) { propertyName = arg.substring(0, equalIndex); propertyValue = arg.substring(equalIndex + 1); } else { propertyName = arg; propertyValue = null; } if (!hostSystemProperties.containsKey(propertyName)) { hostSystemProperties.put(propertyName, propertyValue); } } } } catch (Exception e) { STDERR.println(HostControllerLogger.ROOT_LOGGER.cannotAccessJvmInputArgument(e)); } return hostSystemProperties; }
Source:
@Override public boolean test(Map<Object, Object> map) throws Exception { final int n = nextRandom(args.range()); final String key = "key"+n; final String otherKey = "other_"+key; final IgniteCache<String, Integer> cache = cacheForOperation(); final Lock lock = cache.lock(key); lock.lock(); try { cache.put(otherKey, cache.get(otherKey)+1); } finally { lock.unlock(); } return true; }

Target:
@Override public boolean test(Map<Object, Object> map) throws Exception { lock.lock(); lock.unlock(); return true; }
Source:
public void testEquals_other() { setUp(); try (CtfIterator obj = (CtfIterator) trace.createIterator();) { assertNotNull(obj); CtfLocation ctfLocation1 = new CtfLocation(new CtfLocationInfo(1, 0)); obj.setLocation(ctfLocation1); obj.increaseRank(); boolean result = iterator.equals(obj); assertTrue(result); } }

Target:
public void testEquals_other() { CtfIterator obj = iterator; assertNotNull(obj); CtfLocation ctfLocation1 = new CtfLocation(new CtfLocationInfo(1, 0)); obj.setLocation(ctfLocation1); obj.increaseRank(); boolean result = iterator.equals(obj); assertTrue(result); }
Source:
public void testRedactImage() throws IOException { RedactImageFile.redactImageFile(PROJECT_ID, "src/test/resources/test.png"); String output = bout.toString(); assertThat(output, containsString("Redacted image written")); Path outputFile = Paths.get("redacted.png"); Files.delete(outputFile); }

Target:
public void testRedactImage() { RedactImageFile.redactImageFile(PROJECT_ID, "src/test/resources/test.png"); String output = bout.toString(); assertThat(output, containsString("Redacted image written")); }
Source:
public CustomConversions(StoreConversions storeConversions, List<?> converters) { Assert.notNull(converters, "List of converters must not be null!"); this.readingPairs = new LinkedHashSet<>(); this.writingPairs = new LinkedHashSet<>(); this.customSimpleTypes = new HashSet<>(); this.customReadTargetTypes = new ConcurrentHashMap<>(); this.customWriteTargetTypes = new ConcurrentHashMap<>(); this.rawWriteTargetTypes = new ConcurrentHashMap<>(); List<Object> toRegister = new ArrayList<Object>(); toRegister.addAll(converters); toRegister.addAll(JodaTimeConverters.getConvertersToRegister()); toRegister.addAll(Jsr310Converters.getConvertersToRegister()); toRegister.addAll(ThreeTenBackPortConverters.getConvertersToRegister()); toRegister.addAll(storeConversions.getStoreConverters()); toRegister.stream() .flatMap(it -> storeConversions.getRegistrationsFor(it).stream()) .forEach(this::register); Collections.reverse(toRegister); this.converters = Collections.unmodifiableList(toRegister); this.simpleTypeHolder = new SimpleTypeHolder(customSimpleTypes, storeConversions.getStoreTypeHolder()); }

Target:
public CustomConversions(StoreConversions storeConversions, List<?> converters) { Assert.notNull(converters, "List of converters must not be null!"); this.readingPairs = new LinkedHashSet<>(); this.writingPairs = new LinkedHashSet<>(); this.customSimpleTypes = new HashSet<>(); this.customReadTargetTypes = new ConcurrentHashMap<>(); this.customWriteTargetTypes = new ConcurrentHashMap<>(); this.rawWriteTargetTypes = new ConcurrentHashMap<>(); List<Object> toRegister = new ArrayList<Object>(); toRegister.addAll(converters); toRegister.addAll(storeConversions.getStoreConverters()); toRegister.addAll(DEFAULT_CONVERTERS); toRegister.stream() .flatMap(it -> storeConversions.getRegistrationsFor(it).stream()) .forEach(this::register); Collections.reverse(toRegister); this.converters = Collections.unmodifiableList(toRegister); this.simpleTypeHolder = new SimpleTypeHolder(customSimpleTypes, storeConversions.getStoreTypeHolder()); }
Source:
public void shutdown() throws Exception { stopThread = true; synchronized (close) { thread.interrupt(); } thread.join(); thread = null; }

Target:
public void shutdown() throws Exception { stopThread = true; synchronized (close) { stopThread = true; close.notify(); thread.interrupt(); } thread.join(); thread = null; }
Source:
public void add(ConstraintVariable2 variable) { for (ConstraintVariable2 fVariable : fVariables) { if (fVariable == variable) { return; } } int length= fVariables.length; ConstraintVariable2[] newElements= new ConstraintVariable2[length + 1]; System.arraycopy(fVariables, 0, newElements, 0, length); newElements[length]= variable; fVariables= newElements; }

Target:
public void add(ConstraintVariable2 variable) { for (ConstraintVariable2 constraintVariable : fVariables) { if (constraintVariable == variable) { return; } } int length= fVariables.length; ConstraintVariable2[] newElements= new ConstraintVariable2[length + 1]; System.arraycopy(fVariables, 0, newElements, 0, length); newElements[length]= variable; fVariables= newElements; }
Source:
protected void initSynchronizer(final DiagramDescription description, final String diagramName) { sync = new DDiagramSynchronizer(interpreter, description, accessor); sync.initDiagram(semanticModel, new NullProgressMonitor()); boolean syncOnCreation = Platform.getPreferencesService().getBoolean(DiagramPlugin.ID, SiriusDiagramInternalPreferencesKeys.PREF_SYNCHRONIZE_DIAGRAM_ON_CREATION.name(), false, null); sync.getDiagram().setSynchronized(syncOnCreation); if (sync.getDiagram() != null) { RepresentationsHelper.createDRepresentationDescriptor(sync.getDiagram(), (DAnalysisSessionImpl) session, sync.getDiagram().eResource(), diagramName); } }

Target:
protected void initSynchronizer(final DiagramDescription description, final String diagramName) { sync = new DDiagramSynchronizer(interpreter, description, accessor); sync.initDiagram(semanticModel, new NullProgressMonitor()); boolean syncOnCreation = Platform.getPreferencesService().getBoolean(DiagramPlugin.ID, SiriusDiagramInternalPreferencesKeys.PREF_SYNCHRONIZE_DIAGRAM_ON_CREATION.name(), false, null); sync.getDiagram().setSynchronized(syncOnCreation); DRepresentationDescriptorInternalHelper.createDRepresentationDescriptor(sync.getDiagram(), (DAnalysisSessionImpl) session, sync.getDiagram().eResource(), diagramName); }
Source:
public void onAddGroupsToGroup(Id me, Collection<AccountGroupById> added) { List<AccountGroupByIdAud> includesAudit = new ArrayList<>(); for (AccountGroupById groupInclude : added) { AccountGroupByIdAud audit = new AccountGroupByIdAud(groupInclude, me, TimeUtil.nowTs()); includesAudit.add(audit); } try { db.get().accountGroupByIdAud().insert(includesAudit); } catch (OrmException e) { for (AccountGroupById m : added) { String pattern = "Cannot log add groups to group event: " + "group {0} added to group {1} by user {2}"; String message = MessageFormat.format(pattern, m.getKey().getIncludeUUID(), m .getKey().getGroupId(), me); log.error(message); } } }

Target:
public void onAddGroupsToGroup(Id me, Collection<AccountGroupById> added) { List<AccountGroupByIdAud> includesAudit = new ArrayList<>(); for (AccountGroupById groupInclude : added) { AccountGroupByIdAud audit = new AccountGroupByIdAud(groupInclude, me, TimeUtil.nowTs()); includesAudit.add(audit); } try { db.get().accountGroupByIdAud().insert(includesAudit); } catch (OrmException e) { StringBuilder message = new StringBuilder( "Cannot log add groups to group event performed by user "); message.append(me); message.append(": "); message.append(Joiner.on("; ").join(added)); log.error(message.toString(), e); } }
Source:
public String getRestMethodName() { if (scrollId.length() > MAX_SCROLL_ID_LENGTH) { return "POST"; } return "GET"; }

Target:
public String getRestMethodName() { return scrollId.length() > MAX_SCROLL_ID_LENGTH ? "POST" : "GET"; }
Source:
public static Slice succinctDuration(@SqlType(StandardTypes.DOUBLE) double value, @SqlType(StandardTypes.VARCHAR) Slice unit) { try { Duration duration = Duration.succinctDuration(value, valueOfTimeUnit(unit.toStringUtf8())); return utf8Slice(duration.toString()); } catch (IllegalArgumentException e) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, e); } }

Target:
public static Slice succinctDuration(@SqlType(StandardTypes.DOUBLE) double value, @SqlType(StandardTypes.VARCHAR) Slice unit) { Duration duration; try { duration = Duration.succinctDuration(value, valueOfTimeUnit(unit.toStringUtf8())); } catch (IllegalArgumentException e) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, e); } return utf8Slice(duration.toString()); }
Source:
public Deployment getNode(final String id) { final Deployment deployment = api.getDeploymentApiForService(id).get(id); if (deployment != null && !deployment.roleInstanceList().isEmpty()) { return FluentIterable.from(deployment.roleInstanceList()).allMatch( new Predicate<RoleInstance>() { @Override public boolean apply(final RoleInstance input) { return input != null && !input.instanceStatus().isTransient(); } }) ? deployment : null; } return FluentIterable.from(api.getCloudServiceApi().list()). transform(new Function<CloudService, Deployment>() { @Override public Deployment apply(final CloudService input) { final Deployment deployment = api.getDeploymentApiForService(input.name()).get(id); return deployment == null || deployment.roleInstanceList().isEmpty() ? null : FluentIterable.from(deployment.roleInstanceList()).allMatch( new Predicate<RoleInstance>() { @Override public boolean apply(final RoleInstance input) { return input != null && !input.instanceStatus().isTransient(); } }) ? deployment : null; } }). firstMatch(notNull()). orNull(); }

Target:
public Deployment getNode(final String id) { final Deployment deployment = api.getDeploymentApiForService(id).get(id); if (deployment != null) { return isSettled(deployment); } return FluentIterable.from(api.getCloudServiceApi().list()). transform(new Function<CloudService, Deployment>() { @Override public Deployment apply(final CloudService input) { final Deployment deployment = api.getDeploymentApiForService(input.name()).get(id); return isSettled(deployment); } }). firstMatch(notNull()). orNull(); }
Source:
@Override public void onDestroyView() { super.onDestroyView(); if (disposable != null) { disposable.dispose(); } }

Target:
public void onDestroyView() { super.onDestroyView(); if (disposable != null) { disposable.dispose(); } }
Source:
public GridFsResource[] getResources(String locationPattern) { Pattern pattern = Pattern.compile(locationPattern); return StreamSupport .stream(find(query(whereFilename().regex(pattern))).spliterator(), false) .map(GridFsResource::new) .toArray(GridFsResource[]::new); }

Target:
public GridFsResource[] getResources(String locationPattern) { if (!StringUtils.hasText(locationPattern)) { return new GridFsResource[0]; } AntPath path = new AntPath(locationPattern); if (!path.isPattern()) { return new GridFsResource[0]; } return StreamSupport .stream(find(query(whereFilename().regex(path.toRegex()))).spliterator(), false) .map(this::getResource) .toArray(GridFsResource[]::new); }
Source:
public AbstractVariant(String chromosome, long start, long end, String reference, String alternate) { if (start > end && !(reference.equals("-"))) { throw new IllegalArgumentException("End position must be greater than the start position"); } this.chromosome = (chromosome != null) ? chromosome : ""; this.start = start; this.end = end; this.reference = (reference != null) ? reference : ""; this.alternate = (alternate != null) ? alternate : ""; this.ids = new HashSet<>(); this.hgvs = new HashMap<>(); if (getType() == VariantType.SNV) { Set<String> hgvsCodes = new HashSet<>(); hgvsCodes.add(chromosome + ":g." + start + reference + ">" + alternate); this.hgvs.put("genomic", hgvsCodes); } }

Target:
public AbstractVariant(String chromosome, long start, long end, String reference, String alternate) { if (end < start) { throw new IllegalArgumentException("End position must be equal or greater than the start position"); } if (chromosome == null || chromosome.trim().equals("")) { throw new IllegalArgumentException("Chromosome name cannot be empty"); } this.chromosome = chromosome; this.start = start; this.end = end; this.reference = (reference != null) ? reference : ""; this.alternate = (alternate != null) ? alternate : ""; this.ids = new HashSet<>(); this.hgvs = new HashMap<>(); if (getType() == VariantType.SNV) { Set<String> hgvsCodes = new HashSet<>(); hgvsCodes.add(chromosome + ":g." + start + reference + ">" + alternate); this.hgvs.put("genomic", hgvsCodes); } }
Source:
void flushallAsync() throws InterruptedException { writeKeysToTwoNodes(); assertThat(sync.flushallAsync()).isEqualTo("OK"); Thread.sleep(1000); Long dbsize = sync.dbsize(); assertThat(dbsize).isEqualTo(0); }

Target:
void flushallAsync() throws InterruptedException { writeKeysToTwoNodes(); assertThat(sync.flushallAsync()).isEqualTo("OK"); boolean bothKeysCleared = false; final Instant deadline = Instant.now().plusSeconds(1); while (!bothKeysCleared && Instant.now().isBefore(deadline)) { bothKeysCleared = sync.get(KEY_ON_NODE_1) == null && sync.get(KEY_ON_NODE_2) == null; } assertThat(bothKeysCleared).isTrue(); }
Source:
public RestClient(RestClientConnectionConfig config, HttpClientConnectionManager connectionManager) { this.config = config; this.baseUrl = config.isSsl() ? HTTPS_PROTOCOL : HTTP_PROTOCOL + PROTOCOL_POSTFIX + config.getHost() + COLON + config.getPort() + FORWARD_SLASH + config.getVersion() + FORWARD_SLASH; this.httpClient = HttpClients.custom().setConnectionManager(connectionManager).build(); }

Target:
public RestClient(RestClientConnectionConfig config, HttpClientConnectionManager connectionManager) { this.config = config; this.baseUrl = URI.create(String.format("%s://%s:%d", config.isSSL() ? HTTPS_PROTOCOL : HTTP_PROTOCOL, config.getHost(), config.getPort())); this.version = config.getVersion(); this.httpClient = HttpClients.custom().setConnectionManager(connectionManager).build(); }
Source:
public void setUp() throws Exception { organization = db.organizations().insert(); publicProject = db.components().insertProject(organization, PUBLIC_PROJECT_UUID); privateProject = db.components().insertProject(organization, dto -> dto.setUuid(PRIVATE_PROJECT_UUID).setProjectUuid(PRIVATE_PROJECT_UUID).setPrivate(true)); db.components().insertComponent(ComponentTesting.newFileDto(publicProject, null, FILE_UUID).setKey(FILE_KEY)); user = db.users().insertUser(LOGIN); groupOfUser = db.users().insertGroup(organization); }

Target:
public void setUp() throws Exception { organization = db.organizations().insert(); publicProject = db.components().insertPublicProject(organization, PUBLIC_PROJECT_UUID); privateProject = db.components().insertPrivateProject(organization, dto -> dto.setUuid(PRIVATE_PROJECT_UUID).setProjectUuid(PRIVATE_PROJECT_UUID).setPrivate(true)); db.components().insertComponent(ComponentTesting.newFileDto(publicProject, null, FILE_UUID).setKey(FILE_KEY)); user = db.users().insertUser(LOGIN); groupOfUser = db.users().insertGroup(organization); }
Source:
public String getDisplayProperty() { return ""; }

Target:
public String getDisplayProperty() { return "1/day x 7 days/week"; }
Source:
private static Map<RowKey, Map<String, Object>> loadRowKeysByQuery(InfinispanRemoteDatastoreProvider provider, AssociationKey key) { final String cacheName = cacheName( key ); ProtostreamAssociationMappingAdapter mapper = provider.getCollectionsDataMapper( cacheName ); return mapper.withinCacheEncodingContext( c -> { QueryBuilder qb = Search.getQueryFactory( c ) .from( provider.getProtobufPackageName() + "." + c.getName() ); final String[] columnNames = key.getColumnNames(); FilterConditionContext bqEnd = null; boolean firstIteration = true; for ( int i = 0; i < columnNames.length; i++ ) { String fieldName = mapper.convertColumnNameToFieldName( columnNames[i] ); if ( firstIteration ) { bqEnd = qb.having( fieldName ).eq( key.getColumnValues()[i] ); firstIteration = false; } else { bqEnd = bqEnd.and().having( fieldName ).eq( key.getColumnValues()[i] ); } } Query query = bqEnd.toBuilder().build(); Map<RowKey,Map<String, Object>> resultsCollector = new HashMap<>(); try ( CloseableIterator<Entry<Object,Object>> iterator = c.retrieveEntriesByQuery( query, null, 100 ) ) { while ( iterator.hasNext() ) { Entry<Object,Object> e = iterator.next(); ProtostreamPayload value = ( (ProtostreamPayload) e.getValue() ); Map<String, Object> entryObject = value.toMap(); RowKey entryKey = value.asRowKey( key ); resultsCollector.put( entryKey, entryObject ); } } return resultsCollector; } ); }

Target:
private static Map<RowKey, Map<String, Object>> loadRowKeysByQuery(InfinispanRemoteDatastoreProvider provider, AssociationKey key) { final String cacheName = cacheName( key ); ProtostreamAssociationMappingAdapter mapper = provider.getCollectionsDataMapper( cacheName ); return mapper.withinCacheEncodingContext( c -> { QueryBuilder qb = Search.getQueryFactory( c ).from( provider.getEntityType( c ) ); final String[] columnNames = key.getColumnNames(); FilterConditionContext bqEnd = null; boolean firstIteration = true; for ( int i = 0; i < columnNames.length; i++ ) { String fieldName = mapper.convertColumnNameToFieldName( columnNames[i] ); if ( firstIteration ) { bqEnd = qb.having( fieldName ).eq( key.getColumnValues()[i] ); firstIteration = false; } else { bqEnd = bqEnd.and().having( fieldName ).eq( key.getColumnValues()[i] ); } } Query query = bqEnd.toBuilder().build(); Map<RowKey,Map<String, Object>> resultsCollector = new HashMap<>(); try ( CloseableIterator<Entry<Object,Object>> iterator = c.retrieveEntriesByQuery( query, null, 100 ) ) { while ( iterator.hasNext() ) { Entry<Object,Object> e = iterator.next(); ProtostreamPayload value = ( (ProtostreamPayload) e.getValue() ); Map<String, Object> entryObject = value.toMap(); RowKey entryKey = value.asRowKey( key ); resultsCollector.put( entryKey, entryObject ); } } return resultsCollector; } ); }
Source:
protected DynamicRouteDescriptor() { }

Target:
DynamicRouteDescriptor() { }