auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testDescribeTable() { MaterializedResult actualColumns = this.computeActual("DESC orders").toTestTypes(); MaterializedResult.Builder builder = resultBuilder(this.getQueryRunner().getDefaultSession(), VARCHAR, VARCHAR, VARCHAR, VARCHAR); for (MaterializedRow row : actualColumns.getMaterializedRows()) { builder.row(row.getField(0), row.getField(1), "", ""); } MaterializedResult filteredActual = builder.build(); builder = resultBuilder(this.getQueryRunner().getDefaultSession(), VARCHAR, VARCHAR, VARCHAR, VARCHAR); MaterializedResult expectedColumns = builder .row("orderkey", "bigint", "", "") .row("custkey", "bigint", "", "") .row("orderstatus", "varchar", "", "") .row("totalprice", "double", "", "") .row("orderdate", "varchar", "", "") .row("orderpriority", "varchar", "", "") .row("clerk", "varchar", "", "") .row("shippriority", "bigint", "", "") .row("comment", "varchar", "", "").build(); <START> assertEquals(filteredActual, expectedColumns, String.format("%s != %s", filteredActual, expectedColumns)); <END> }</code><technical_language>static import format</technical_language>

Target:
public void testDescribeTable() { MaterializedResult actualColumns = computeActual("DESC orders").toTestTypes(); MaterializedResult.Builder builder = resultBuilder(getQueryRunner().getDefaultSession(), VARCHAR, VARCHAR, VARCHAR, VARCHAR); for (MaterializedRow row : actualColumns.getMaterializedRows()) { builder.row(row.getField(0), row.getField(1), "", ""); } MaterializedResult actualResult = builder.build(); builder = resultBuilder(getQueryRunner().getDefaultSession(), VARCHAR, VARCHAR, VARCHAR, VARCHAR); MaterializedResult expectedColumns = builder .row("orderkey", "bigint", "", "") .row("custkey", "bigint", "", "") .row("orderstatus", "varchar", "", "") .row("totalprice", "double", "", "") .row("orderdate", "varchar", "", "") .row("orderpriority", "varchar", "", "") .row("clerk", "varchar", "", "") .row("shippriority", "bigint", "", "") .row("comment", "varchar", "", "").build(); assertEquals(actualResult, expectedColumns, format("%s != %s", actualResult, expectedColumns)); }
Source:
<code>protected void putManagedState(Object tuple) { <START> ((ManagedTimeStateImpl)managedState).put(getBucketId(getKey(tuple)), DEFAULT_CONSTANT_TIME, <END> getKey(tuple), new Slice(new byte[0])); }</code><technical_language>getKey called once. need call for parameters of getAsync. Add a line note</technical_language>

Target:
protected void putManagedState(Object tuple) { Slice key = getKey(tuple); ((ManagedTimeStateImpl)managedState).put(getBucketId(key), DEFAULT_CONSTANT_TIME, key, new Slice(new byte[0])); }
Source:
<code>private void generateAspects(ITmfEventField[] fieldsArray) { ImmutableList.Builder<ITmfEventAspect> builder = new ImmutableList.Builder<>(); for (ITmfEventAspect criterion : TmfTrace.BASE_ASPECTS) { <START> builder.add(criterion); <END> } for (ITmfEventField field : fieldsArray) { String name = field.getName(); if (name == null) { break; } ITmfEventAspect criterion = new TmfEventFieldAspect(name, name); if (name.equals(CRITERION_CPU)) { criterion = new XmlStubCpuAspect((TmfEventFieldAspect) criterion); } builder.add(criterion); } @SuppressWarnings("null") @NonNull Collection<ITmfEventAspect> criteriaList = builder.build(); fAspect = criteriaList; }</code><technical_language>This matter, this put CPU column end, big "Content" column. If want put that, list define column explicitly (like is done in CtfTmfTrace#CTF_ASPECTS)</technical_language>

Target:
private void generateAspects(ITmfEventField[] fieldsArray) { ImmutableList.Builder<ITmfEventAspect> builder = new ImmutableList.Builder<>(); builder.add(ITmfEventAspect.BaseAspects.TIMESTAMP); builder.add(ITmfEventAspect.BaseAspects.EVENT_TYPE); for (ITmfEventField field : fieldsArray) { String name = field.getName(); if (name == null) { break; } ITmfEventAspect aspect = new TmfEventFieldAspect(name, name); if (name.equals(ASPECT_CPU)) { aspect = new XmlStubCpuAspect((TmfEventFieldAspect) aspect); } builder.add(aspect); } builder.add(ITmfEventAspect.BaseAspects.CONTENTS); @SuppressWarnings("null") @NonNull Collection<ITmfEventAspect> aspectList = builder.build(); fAspects = aspectList; }
Source:
<code>public void testToString_withCustomConfigurations() { toolbarConfig = new ToolbarConfiguration() { @Override protected String getToolbarGroupConfiguration() { return "CKEDITOR.config.toolbarGroups = [];"; } @Override protected String getRemoveButtonConfiguration() { return "CKEDITOR.config.removeButtons = \"Subscript\";"; } @Override public String getToolbarLanguage() { return "de"; } }; JsonObject config = ( JsonObject )JsonValue.readFrom( toolbarConfig.toString() ); assertNotNull( config.get( "toolbarGroups" ) ); assertNotNull( config.get( "removeButtons" ) ); assertNotNull( config.get( "toolbarCanCollapse" ) ); assertNotNull( config.get( "toolbarStartupExpanded" ) ); <START> assertEquals( "en", config.get( "language" ).asString() ); <END> }</code><technical_language>wrong assert... "de"</technical_language>

Target:
public void testToString_withCustomConfigurations() { toolbarConfig = new ToolbarConfiguration() { @Override protected String getToolbarGroupConfiguration() { return "CKEDITOR.config.toolbarGroups = [];"; } @Override protected String getRemoveButtonConfiguration() { return "CKEDITOR.config.removeButtons = \"Subscript\";"; } @Override public String getToolbarLanguage() { return "de"; } }; JsonObject config = ( JsonObject )JsonValue.readFrom( toolbarConfig.toString() ); assertNotNull( config.get( "toolbarGroups" ) ); assertNotNull( config.get( "removeButtons" ) ); assertNotNull( config.get( "toolbarCanCollapse" ) ); assertNotNull( config.get( "toolbarStartupExpanded" ) ); assertEquals( "de", config.get( "language" ).asString() ); }
Source:
<code>public void canSetRequestedArchiveLocationPrefix() { Assert.assertFalse(this.jobEntity.getRequestedArchiveLocationPrefix().isPresent()); final String requestedArchiveLocationPrefix = UUID.randomUUID().toString(); this.jobEntity.setRequestedArchiveLocationPrefix(requestedArchiveLocationPrefix); Assert.assertThat( <START> this.jobEntity.getRequestedArchiveLocationPrefix().orElse(UUID.randomUUID().toString()), <END> Matchers.is(requestedArchiveLocationPrefix) ); }</code><technical_language>I find orElse a bit confusing... .get</technical_language>

Target:
public void canSetRequestedArchiveLocationPrefix() { Assert.assertFalse(this.jobEntity.getRequestedArchiveLocationPrefix().isPresent()); final String requestedArchiveLocationPrefix = UUID.randomUUID().toString(); this.jobEntity.setRequestedArchiveLocationPrefix(requestedArchiveLocationPrefix); Assert.assertThat( this.jobEntity.getRequestedArchiveLocationPrefix().get(), Matchers.is(requestedArchiveLocationPrefix) ); }
Source:
<code><START> public Long getDbGeneration() { <END> return dbGeneration; }</code><technical_language>question in VM</technical_language>

Target:
public long getDbGeneration() { return dbGeneration; }
Source:
<code>public ElasticsearchPersistentEntity<?> getPersistentEntityFor(Class<?> type) { Assert.notNull(type, "type must not be null!"); <START> Assert.isTrue(type.isAnnotationPresent(Document.class), "Unable to identify index name. " + type.getSimpleName() <END> + " is not a Document. Make sure the document class is annotated with @Document(indexName=\"foo\")"); return getElasticsearchConverter().getMappingContext().getRequiredPersistentEntity(type); }</code><technical_language>try expose protected utility methods API. introducing a package-private utility class for Spring Data ES ES API conversion. Alternatively, default methods Query retrieve fields, indices, types array</technical_language>

Target:
public ElasticsearchPersistentEntity<?> getPersistentEntityFor(Class<?> type) { Assert.notNull(type, "type must not be null!"); Assert.isTrue(type.isAnnotationPresent(Document.class), "Unable to identify index name. " + type.getSimpleName() + " is not a Document. Make sure the document class is annotated with @Document(indexName=\"foo\")"); return elasticsearchConverter.getMappingContext().getRequiredPersistentEntity(type); }
Source:
<code>public boolean hasSelectedResources() { <START> return selectedBaseResources.size() > 0; <END> }</code><technical_language>suggestion return !selectedBaseResources.isEmpty();</technical_language>

Target:
public boolean hasSelectedResources() { return !selectedBaseContainers.isEmpty(); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) return true; <START> if (obj == null) <END> return false; if (getClass() != obj.getClass()) return false; ComparableEvent other = (ComparableEvent) obj; if (outcome != other.outcome) return false; if (!Arrays.equals(predIndexes, other.predIndexes)) return false; if (seen != other.seen) return false; if (!Arrays.equals(values, other.values)) return false; return true; }</code><technical_language>a style for equals in this project, Java contains Objects utils do this nicer</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) return true; if (obj instanceof ComparableEvent) { ComparableEvent other = (ComparableEvent) obj; return outcome == other.outcome && Arrays.equals(predIndexes, other.predIndexes) && seen == other.seen && Arrays.equals(values, other.values); } return false; }
Source:
<code>private AuthenticationResult parseJsonResponse(final String responseBody) throws JSONException, AuthenticationException { <START> HashMap<String, String> responseItems = new HashMap<>(); <END> extractJsonObjects(responseItems, responseBody); return processUIResponseParams(responseItems); }</code><technical_language>Map</technical_language>

Target:
private AuthenticationResult parseJsonResponse(final String responseBody) throws JSONException, AuthenticationException { final Map<String, String> responseItems = new HashMap<>(); extractJsonObjects(responseItems, responseBody); return processUIResponseParams(responseItems); }
Source:
<code>public void createClaimWithLogging(String wikidataEntityId, String fileName) { if (wikidataEntityId == null) { Timber.d("Skipping creation of claim as Wikidata entity ID is null"); return; } if (fileName == null) { Timber.d("Skipping creation of claim as fileName entity ID is null"); return; } if (!(directKvStore.getBoolean("Picture_Has_Correct_Location", true))) { Timber.d("Image location and nearby place location mismatched, so Wikidata item won't be edited"); return; } <START> editWikidataProperty(wikidataEntityId, fileName); <END> editWikidataPropertyP180(wikidataEntityId, fileName); }</code><technical_language>editWikidataProperty editWikidataPropertyP180 needed? If not, please remove one</technical_language>

Target:
public void createClaimWithLogging(String wikidataEntityId, String fileName) { if (wikidataEntityId == null) { Timber.d("Skipping creation of claim as Wikidata entity ID is null"); return; } if (fileName == null) { Timber.d("Skipping creation of claim as fileName entity ID is null"); return; } if (!(directKvStore.getBoolean("Picture_Has_Correct_Location", true))) { Timber.d("Image location and nearby place location mismatched, so Wikidata item won't be edited"); return; } editWikidataProperty(wikidataEntityId, fileName); editWikiBaseDepictsProperty(wikidataEntityId, fileName); }
Source:
<code>public Builder metadata(Map<String, Object> metadata) { if (metadata == null) { this.metadata = ImmutableMap.of(); } else { this.metadata = ImmutableMap.copyOf(metadata); <START> } <END> return this; }</code><technical_language>constructor this logic. this this.metadata = metadata</technical_language>

Target:
public Builder metadata(Map<String, Object> metadata) { this.metadata = metadata; return this; }
Source:
<code>private static <K, V> void testMultimapAggWithGroupBy( InternalAggregationFunction aggregationFunction, GroupedAccumulator groupedAccumulator, int groupId, Type keyType, List<K> expectedKeys, Type valueType, List<V> expectedValues) { RowPageBuilder pageBuilder = RowPageBuilder.rowPageBuilder(keyType, valueType); ImmutableMultimap.Builder<K, V> outputBuilder = ImmutableMultimap.builder(); for (int i = 0; i < expectedValues.size(); i++) { pageBuilder.row(expectedKeys.get(i), expectedValues.get(i)); outputBuilder.put(expectedKeys.get(i), expectedValues.get(i)); } Page page = pageBuilder.build(); AggregationTestInput input = new AggregationTestInputBuilder( <START> new Block[]{page.getBlock(0), page.getBlock(1)}, <END> aggregationFunction ).build(); AggregationTestOutput testOutput2 = new AggregationTestOutput(outputBuilder.build().asMap()); input.runPagesOnAccumulatorWithAssertion(groupId, groupedAccumulator, testOutput2); }</code><technical_language>style nit: java AggregationTestInput input = new AggregationTestInputBuilder( new Block[] {page.getBlock(0), page.getBlock(1)}, aggregationFunction).build();</technical_language>

Target:
private static <K, V> void testMultimapAggWithGroupBy( InternalAggregationFunction aggregationFunction, GroupedAccumulator groupedAccumulator, int groupId, Type keyType, List<K> expectedKeys, Type valueType, List<V> expectedValues) { RowPageBuilder pageBuilder = RowPageBuilder.rowPageBuilder(keyType, valueType); ImmutableMultimap.Builder<K, V> outputBuilder = ImmutableMultimap.builder(); for (int i = 0; i < expectedValues.size(); i++) { pageBuilder.row(expectedKeys.get(i), expectedValues.get(i)); outputBuilder.put(expectedKeys.get(i), expectedValues.get(i)); } Page page = pageBuilder.build(); AggregationTestInput input = new AggregationTestInputBuilder( new Block[] {page.getBlock(0), page.getBlock(1)}, aggregationFunction).build(); AggregationTestOutput testOutput = new AggregationTestOutput(outputBuilder.build().asMap()); input.runPagesOnAccumulatorWithAssertion(groupId, groupedAccumulator, testOutput); }
Source:
<code>public void NGramFeatureGenerator(int minGram, int maxGram) throws InvalidFormatException { if (minGram <= maxGram) { this.minGram = minGram; this.maxGram = maxGram; } else { throw new InvalidFormatException("minimum range value (minGram) should be less than or equal to maximum range value (maxGram)!"); <START> } <END> }</code><technical_language>This is good, if minGram/maxGram negative</technical_language>

Target:
public NGramFeatureGenerator(int minGram, int maxGram) throws InvalidFormatException { if (minGram > 0 && maxGram > 0) { if (minGram <= maxGram) { this.minGram = minGram; this.maxGram = maxGram; } else { throw new InvalidFormatException("Minimum range value (minGram) should be less than or equal to maximum range value (maxGram)!"); } } else { throw new InvalidFormatException("Both minimum range value (minGram) & maximum range value (maxGram) should be greater than or equal to 1!"); } }
Source:
<code>public String getText(Object object) { LabelProviderService labelProviderService = Activator.getDefault().getLabelProviderService(); if (labelProviderService != null) { <START> return labelProviderService.getLabelProvider(PAPYRUS_LABEL_PROVIDER_COMPARE_CONTEXT, object) <END> .getText(object); } return super.getText(object); }</code><technical_language>retrieve label provider for image? constant for image object, I get it. Also, I need a null check useful</technical_language>

Target:
public String getText(Object object) { LabelProviderService labelProviderService = Activator.getDefault().getLabelProviderService(); if (labelProviderService != null) { ILabelProvider labelProvider = labelProviderService .getLabelProvider(PAPYRUS_LABEL_PROVIDER_COMPARE_CONTEXT, object); if (labelProvider != null) { return labelProvider.getText(object); } } return super.getText(object); }
Source:
<code>public AsyncRequestResponseHandlerFactory(Integer handlerCount, RestServerMetrics restServerMetrics, BlobStorageService blobStorageService) { if (restServerMetrics == null || blobStorageService == null) { throw new IllegalArgumentException("One or more arguments received is null"); } else if (handlerCount <= 0) { throw new IllegalArgumentException("Request handler scaling unit count has to be > 0. Is " + handlerCount); } else { <START> AsyncRequestResponseHandler requestHandler = buildInstance(restServerMetrics); <END> requestHandler.setRequestWorkersCount(handlerCount); requestHandler.setBlobStorageService(blobStorageService); } logger.trace("Instantiated AsyncRequestResponseHandlerFactory as RestRequestHandler"); }</code><technical_language>I prefer member "instance" instead of return value. a bit of confusing</technical_language>

Target:
public AsyncRequestResponseHandlerFactory(Integer handlerCount, RestServerMetrics restServerMetrics, BlobStorageService blobStorageService) { if (restServerMetrics == null || blobStorageService == null) { throw new IllegalArgumentException("One or more arguments received is null"); } else if (handlerCount <= 0) { throw new IllegalArgumentException("Request handler scaling unit count has to be > 0. Is " + handlerCount); } else { buildInstance(restServerMetrics); instance.setupRequestHandling(handlerCount, blobStorageService); } logger.trace("Instantiated AsyncRequestResponseHandlerFactory as RestRequestHandler"); }
Source:
<code>protected void maybeSetNotificationBadge(NotificationData data) { <START> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.BASE && data.badgeCount > 0) { <END> builder.setNumber(data.badgeCount); } }</code><technical_language>repeat question I in test code, if set badgeCount 0</technical_language>

Target:
protected void maybeSetNotificationBadge(NotificationData data) { if (data.badgeCount > 0) { builder.setNumber(data.badgeCount); } }
Source:
<code>private ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> getMappings(TransportClient client, GetMappingsRequest request) { try { return retry() .maxAttempts(maxAttempts) .exponentialBackoff(maxRetryTime, 2.0) .run("getMappings", () -> { return client.admin() .indices() .getMappings(request) .actionGet(requestTimeout.toMillis()) .getMappings(); }); } <START> catch (InterruptedException e) { <END> Thread.currentThread().interrupt(); throw new RuntimeException(e); } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>ditto InterruptedException</technical_language>

Target:
private ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> getMappings(TransportClient client, GetMappingsRequest request) { try { return retry() .maxAttempts(maxAttempts) .exponentialBackoff(maxRetryTime) .run("getMappings", () -> client.admin() .indices() .getMappings(request) .actionGet(requestTimeout.toMillis()) .getMappings()); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>public LifeCycleMethods get(Class<?> clazz) { <START> LifeCycleMethods methods = map.get(clazz); <END> if (methods == null) { synchronized (this) { methods = map.get(clazz); if(methods == null) { methods = new LifeCycleMethods(clazz); map.put(clazz, methods); } } } return methods; }</code><technical_language>This is a safe operation. accessing a non-thread-safe mutable object (the map) proper synchronization. a variety of issue ranging incorrect result looping walking map internal structures. In general, double-checked locking idiom is broken due Java memory model semantics</technical_language>

Target:
public LifeCycleMethods get(Class<?> clazz) { return map.computeIfAbsent(clazz, (c) -> new LifeCycleMethods(c)); }
Source:
<code>private PhpCfgBlock buildIfStatement(IfStatementTree tree, PhpCfgBlock successor) { PhpCfgBlock elseBlock = successor; if (tree.elseClause() != null) { elseBlock = buildSubFlow(tree.elseClause().statements(), successor); } <START> PhpCfgBlock falseSuccessor = elseBlock; <END> if (!tree.elseifClauses().isEmpty()) { List<ElseifClauseTree> elseIfs = tree.elseifClauses(); for (int i = elseIfs.size() - 1; i >= 0; i--) { falseSuccessor = buildElseIfStatement(elseIfs.get(i), successor, falseSuccessor); } } PhpCfgBlock thenBlock = buildSubFlow(tree.statements(), successor); PhpCfgBranchingBlock conditionBlock = createBranchingBlock(tree, thenBlock, falseSuccessor); conditionBlock.addElement(tree.condition().expression()); return conditionBlock; }</code><technical_language>drop elseBlock var, falseSuccessor start (and rename falseBlock consistent)</technical_language>

Target:
private PhpCfgBlock buildIfStatement(IfStatementTree tree, PhpCfgBlock successor) { PhpCfgBlock falseBlock = successor; if (tree.elseClause() != null) { falseBlock = buildSubFlow(tree.elseClause().statements(), successor); } if (!tree.elseifClauses().isEmpty()) { for (ElseifClauseTree elseifClause : Lists.reverse(tree.elseifClauses())) { falseBlock = buildElseIfStatement(elseifClause, successor, falseBlock); } } PhpCfgBlock trueBlock = buildSubFlow(tree.statements(), successor); PhpCfgBranchingBlock conditionBlock = createBranchingBlock(tree, trueBlock, falseBlock); conditionBlock.addElement(tree.condition().expression()); return conditionBlock; }
Source:
<code>public void quietDownShouldSuccessOnAlreadyQuietDownedJenkins() throws Exception { <START> j.jenkins.get().doQuietDown(); <END> assertJenkinsInQuietMode(); final CLICommandInvoker.Result result = command .authorizedTo(Jenkins.READ, Jenkins.ADMINISTER) .invoke(); assertThat(result, succeededSilently()); assertJenkinsInQuietMode(); }</code><technical_language>this (and other occurences in tests) changed Jenkins.get</technical_language>

Target:
public void quietDownShouldSuccessOnAlreadyQuietDownedJenkins() throws Exception { j.jenkins.doQuietDown(); assertJenkinsInQuietMode(); final CLICommandInvoker.Result result = command .authorizedTo(Jenkins.READ, Jenkins.ADMINISTER) .invoke(); assertThat(result, succeededSilently()); assertJenkinsInQuietMode(); }
Source:
<code>public void addMembersToGroup() throws Exception { System.out.println(CLASS_NAME + "addMembersToGroup"); vo = setUpVo(); setUpGroup(vo); <START> Attribute synchroAttr = new Attribute(perun.getAttributesManager().getAttributeDefinition(sess, GroupsManager.GROUPSYNCHROENABLED_ATTRNAME)); <END> synchroAttr.setValue("false"); perun.getAttributesManager().setAttribute(sess, group, synchroAttr); List<Member> members = Arrays.asList(setUpMember(vo), setUpMember(vo), setUpMember(vo)); groupsManager.addMembers(sess, group, members); List<Member> membersFromDb = groupsManager.getGroupMembers(sess, group); for (Member member : members) { assertTrue("List of members should contain member", membersFromDb.contains(member)); } }</code><technical_language>in previous test. Method logic (and test) work if attribute is set all</technical_language>

Target:
public void addMembersToGroup() throws Exception { System.out.println(CLASS_NAME + "addMembersToGroup"); vo = setUpVo(); setUpGroup(vo); List<Member> members = Arrays.asList(setUpMember(vo), setUpMember(vo), setUpMember(vo)); groupsManager.addMembers(sess, group, members); List<Member> membersFromDb = groupsManager.getGroupMembers(sess, group); for (Member member : members) { assertTrue("List of members should contain member", membersFromDb.contains(member)); } }
Source:
<code>public void init() { initState(); setReportBaseUrl((String) AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.RedirectServletReportsPage)); <START> parseReportsXML(); <END> }</code><technical_language>1. please format 2. I code (and is now)- if (!reportBaseUrl.trim().isEmpty()) { parseReportsXML(); } else { setXmlInitialized(); } Is meaning parsing xml if url is empty</technical_language>

Target:
public void init() { initState(); setReportBaseUrl((String) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigurationValues.RedirectServletReportsPage)); if (!reportBaseUrl.trim().isEmpty()) { parseReportsXML(); } else { setXmlInitialized(); } }
Source:
<code>public boolean isEmpty() { for ( int i = 0; i < keys.length; i = i + width ) { if ( keys[i] != NOT_IN_USE ) { return false; <START> } <END> } return true; }</code><technical_language>checking numberOfEntries != 0 instead</technical_language>

Target:
public boolean isEmpty() { return numberOfEntries == 0; }
Source:
<code>public VcrMetrics(MetricRegistry registry) { this.registry = registry; blobEncryptionCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobEncryptionCount")); blobDecryptionCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobDecryptionCount")); blobEncryptionErrorCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobEncryptionErrorCount")); blobDecryptionErrorCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobDecryptionErrorCount")); blobEncryptionTime = registry.timer(MetricRegistry.name(CloudBlobStore.class, "BlobEncryptionTime")); blobDecryptionTime = registry.timer(MetricRegistry.name(CloudBlobStore.class, "BlobDecryptionTime")); blobUploadSkippedCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobUploadSkippedCount")); updateTtlNotSetError = registry.counter(MetricRegistry.name(CloudBlobStore.class, "UpdateTtlNotSetError")); addPartitionErrorCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "AddPartitionErrorCount")); removePartitionErrorCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "RemovePartitionErrorCount")); <START> tokenReloadWarnCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "TokenReloadWarnCount")); <END> }</code><technical_language>Instead of CloudBlobStore.class, I CloudBackupManager.class</technical_language>

Target:
public VcrMetrics(MetricRegistry registry) { this.registry = registry; blobEncryptionCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobEncryptionCount")); blobDecryptionCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobDecryptionCount")); blobEncryptionErrorCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobEncryptionErrorCount")); blobDecryptionErrorCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobDecryptionErrorCount")); blobEncryptionTime = registry.timer(MetricRegistry.name(CloudBlobStore.class, "BlobEncryptionTime")); blobDecryptionTime = registry.timer(MetricRegistry.name(CloudBlobStore.class, "BlobDecryptionTime")); blobUploadSkippedCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobUploadSkippedCount")); updateTtlNotSetError = registry.counter(MetricRegistry.name(CloudBlobStore.class, "UpdateTtlNotSetError")); addPartitionErrorCount = registry.counter(MetricRegistry.name(CloudBackupManager.class, "AddPartitionErrorCount")); removePartitionErrorCount = registry.counter(MetricRegistry.name(CloudBackupManager.class, "RemovePartitionErrorCount")); tokenReloadWarnCount = registry.counter(MetricRegistry.name(CloudBackupManager.class, "TokenReloadWarnCount")); }
Source:
<code>protected Object writeReplace() { Channel currentChannel = Channel.current(); if (currentChannel == null) <START> return null; <END> return remoteProxyFor(currentChannel.export(GitClient.class, this)); }</code><technical_language>More want throw IllegalStateException here</technical_language>

Target:
protected Object writeReplace() throws java.io.ObjectStreamException { Channel currentChannel = Channel.current(); if (currentChannel == null) throw new java.io.WriteAbortedException("No current channel", new java.lang.NullPointerException()); return remoteProxyFor(currentChannel.export(GitClient.class, this)); }
Source:
<code>public Object getValue(final Object element, final String property) { VarDeclaration var = (VarDeclaration) element; switch (property) { case IV_NAME: return var.getName(); case IV_TYPE: <START> for (int i = 0; i < typeDropDown.getItems().length; i++) { if (typeDropDown.getItems()[i].equals(var.getType().getName())) { return i; } } return 0; <END> case IV_COMMENT: return var.getComment(); case IV_ARRAY: return Integer.toString(var.getArraySize()); default: return var.getValue().getValue(); } }</code><technical_language>I this is part of change, this part of code cleanup, refactoring a stream reduce complexity. int length = typeDropDown.getItems().length; IntStream.range(0, length) .filter(i -> t == typeDropDown.getItems()) .findFirst() // occurence .orElse(0); // element and/or put this in a helper function Another general question, unrelated this change, 0 is indicator for found, a valid index for list. differentiate this cases</technical_language>

Target:
public Object getValue(final Object element, final String property) { VarDeclaration var = (VarDeclaration) element; switch (property) { case IV_NAME: return var.getName(); case IV_TYPE: return Arrays.asList(typeDropDown.getItems()).indexOf(var.getType().getName()); case IV_COMMENT: return var.getComment(); case IV_ARRAY: return Integer.toString(var.getArraySize()); default: return var.getValue().getValue(); } }
Source:
<code>private Map<String, Pair<String, String>> getSharedLocksForVmDisk() { Map<String, Pair<String, String>> lockMap = new HashMap<>(); if (getDiskImage() != null) { <START> vmsForDisk = vmDao.getVmsWithPlugInfo(getDiskImage().getId()); <END> if (!vmsForDisk.isEmpty()) { for (Pair<VM, VmDevice> pair : vmsForDisk) { lockMap.put(pair.getFirst().getId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.VM, EngineMessage.ACTION_TYPE_FAILED_VM_IS_LOCKED)); } } } return lockMap; }</code><technical_language>This is place update a cached member. do properly do all</technical_language>

Target:
private Map<String, Pair<String, String>> getSharedLocksForVmDisk() { Map<String, Pair<String, String>> lockMap = new HashMap<>(); if (getDiskImage() != null) { List<Pair<VM, VmDevice>> vmsForDisk = vmDao.getVmsWithPlugInfo(getDiskImage().getId()); if (!vmsForDisk.isEmpty()) { for (Pair<VM, VmDevice> pair : vmsForDisk) { lockMap.put(pair.getFirst().getId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.VM, EngineMessage.ACTION_TYPE_FAILED_VM_IS_LOCKED)); } } } return lockMap; }
Source:
<code>private String getStatsSection(ExecutionHandlerContext context) { final RedisStats redisStats = context.getRedisStats(); String instantaneous_input_kbps = <START> new DecimalFormat("0.00") <END> .format(redisStats .getNetworkKiloBytesReadOverLastSecond()); final String STATS_STRING = "# Stats\r\n" + "total_commands_processed:" + redisStats.getCommandsProcessed() + "\r\n" + "instantaneous_ops_per_sec:" + redisStats.getOpsPerformedOverLastSecond() + "\r\n" + "total_net_input_bytes:" + redisStats.getTotalNetworkBytesRead() + "\r\n" + "instantaneous_input_kbps:" + instantaneous_input_kbps + "\r\n" + "total_connections_received:" + redisStats.getConnectionsReceived() + "\r\n" + "keyspace_hits:" + redisStats.getKeyspaceHits() + "\r\n" + "keyspace_misses:" + redisStats.getKeyspaceMisses() + "\r\n" + "evicted_keys:0\r\n" + "rejected_connections:0\r\n"; return STATS_STRING; }</code><technical_language>create a private instance variable for this DecimalForamt re-use calling .format. static DecimalFormat is thread-safe</technical_language>

Target:
private String getStatsSection(ExecutionHandlerContext context) { final RedisStats redisStats = context.getRedisStats(); String instantaneous_input_kbps = decimalFormat.format(redisStats .getNetworkKiloBytesReadOverLastSecond()); final String STATS_STRING = "# Stats\r\n" + "total_commands_processed:" + redisStats.getCommandsProcessed() + "\r\n" + "instantaneous_ops_per_sec:" + redisStats.getOpsPerformedOverLastSecond() + "\r\n" + "total_net_input_bytes:" + redisStats.getTotalNetworkBytesRead() + "\r\n" + "instantaneous_input_kbps:" + instantaneous_input_kbps + "\r\n" + "total_connections_received:" + redisStats.getConnectionsReceived() + "\r\n" + "keyspace_hits:" + redisStats.getKeyspaceHits() + "\r\n" + "keyspace_misses:" + redisStats.getKeyspaceMisses() + "\r\n" + "evicted_keys:0\r\n" + "rejected_connections:0\r\n"; return STATS_STRING; }
Source:
<code>private static void checkExceptions(DataTable dataTable, PinotSplit split) { Map<String, String> metadata = dataTable.getMetadata(); List<String> exceptions = new ArrayList<>(); metadata.forEach((k, v) -> { if (k.startsWith(DataTable.EXCEPTION_METADATA_KEY)) { exceptions.add(v); } }); <START> if (exceptions.size() > 0) { <END> throw new PinotException(PinotErrorCode.PINOT_EXCEPTION, split.getSegmentPql(), String.format("Encountered %d pinot exceptions for split %s: %s", exceptions.size(), split, exceptions)); } }</code><technical_language>nit: !exceptions.isEmpty()</technical_language>

Target:
private static void checkExceptions(DataTable dataTable, PinotSplit split) { Map<String, String> metadata = dataTable.getMetadata(); List<String> exceptions = new ArrayList<>(); metadata.forEach((k, v) -> { if (k.startsWith(DataTable.EXCEPTION_METADATA_KEY)) { exceptions.add(v); } }); if (!exceptions.isEmpty()) { throw new PinotException(PinotErrorCode.PINOT_EXCEPTION, split.getSegmentPql(), String.format("Encountered %d pinot exceptions for split %s: %s", exceptions.size(), split, exceptions)); } }
Source:
<code>public int isApplicable(VElement vElement, ViewModelContext context) { if (!VControl.class.isInstance(vElement)) { return NOT_APPLICABLE; } final VControl control = (VControl) vElement; IValueProperty valueProperty; try { valueProperty = Activator.getDefault().getEMFFormsDatabinding() <START> .getValueProperty(control.getDomainModelReference(), context.getDomainModel()); <END> } catch (final DatabindingFailedException ex) { Activator.getDefault().getReportService().report(new DatabindingFailedReport(ex)); return NOT_APPLICABLE; } catch (final IllegalArgumentException ex) { Activator.getDefault().getReportService().report(new AbstractReport(ex)); return NOT_APPLICABLE; } final EStructuralFeature feature = (EStructuralFeature) valueProperty.getValueType(); return isApplicable(feature); }</code><technical_language>check for null</technical_language>

Target:
public int isApplicable(VElement vElement, ViewModelContext context) { if (!VControl.class.isInstance(vElement)) { return NOT_APPLICABLE; } final VControl control = (VControl) vElement; if (control.getDomainModelReference() == null) { return NOT_APPLICABLE; } IValueProperty valueProperty; try { valueProperty = Activator.getDefault().getEMFFormsDatabinding() .getValueProperty(control.getDomainModelReference(), context.getDomainModel()); } catch (final DatabindingFailedException ex) { Activator.getDefault().getReportService().report(new DatabindingFailedReport(ex)); return NOT_APPLICABLE; } catch (final IllegalArgumentException ex) { Activator.getDefault().getReportService().report(new AbstractReport(ex)); return NOT_APPLICABLE; } final EStructuralFeature feature = (EStructuralFeature) valueProperty.getValueType(); return isApplicable(feature); }
Source:
<code>public Block distinct(@TypeParameter("E") Type type, @SqlType("array(E)") Block array) { int length = 0; if (array.getPositionCount() < 2) { return array; } if (array.getPositionCount() == 2) { if (type.equalTo(array, 0, array, 1)) { return array.getSingleValueBlock(0); } else { return array; } } TypedSet typedSet = new TypedSet(type, array.getPositionCount(), "array_distinct"); BlockBuilder distinctElementBlockBuilder = pageBuilder.getBlockBuilder(0); for (int i = 0; i < array.getPositionCount(); i++) { if (!typedSet.contains(array, i)) { typedSet.add(array, i); length++; type.appendTo(array, i, distinctElementBlockBuilder); } } <START> if (pageBuilder.isFull()) { <END> pageBuilder.reset(); } pageBuilder.declarePositions(length); return distinctElementBlockBuilder.getRegion(distinctElementBlockBuilder.getPositionCount() - length, length); }</code><technical_language>Move if full reset logic line 61 (before block builder page builder). is working, assumes pageBuilder.reset() affect distinctElementBlockBuilder</technical_language>

Target:
public Block distinct(@TypeParameter("E") Type type, @SqlType("array(E)") Block array) { if (array.getPositionCount() < 2) { return array; } if (array.getPositionCount() == 2) { if (type.equalTo(array, 0, array, 1)) { return array.getSingleValueBlock(0); } else { return array; } } TypedSet typedSet = new TypedSet(type, array.getPositionCount(), "array_distinct"); int distinctCount = 0; if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder distinctElementBlockBuilder = pageBuilder.getBlockBuilder(0); for (int i = 0; i < array.getPositionCount(); i++) { if (!typedSet.contains(array, i)) { typedSet.add(array, i); distinctCount++; type.appendTo(array, i, distinctElementBlockBuilder); } } pageBuilder.declarePositions(distinctCount); return distinctElementBlockBuilder.getRegion(distinctElementBlockBuilder.getPositionCount() - distinctCount, distinctCount); }
Source:
<code>public static void main(final String[] args) throws Exception { Properties jobProps = HadoopSecureWrapperUtils.loadAzkabanProps(); HadoopConfigurationInjector.injectResources(new Props(null, jobProps)); final Configuration conf = new Configuration(); UserGroupInformation.setConfiguration(conf); securityEnabled = UserGroupInformation.isSecurityEnabled(); if (HadoopSecureWrapperUtils.shouldProxy(jobProps)) { UserGroupInformation proxyUser = null; <START> String userToProxy = jobProps.getProperty("user.to.proxy"); <END> if (securityEnabled) { proxyUser = HadoopSecureWrapperUtils.createSecurityEnabledProxyUser(userToProxy, logger); } else { proxyUser = UserGroupInformation.createRemoteUser(userToProxy); } logger.info("Proxying to execute job. Proxied as user " + userToProxy); proxyUser.doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { runSpark(args); return null; } }); } else { logger.info("Not proxying to execute job. "); runSpark(args); } }</code><technical_language>Is this done</technical_language>

Target:
public static void main(final String[] args) throws Exception { Properties jobProps = HadoopSecureWrapperUtils.loadAzkabanProps(); HadoopConfigurationInjector.injectResources(new Props(null, jobProps)); final Configuration conf = new Configuration(); UserGroupInformation.setConfiguration(conf); securityEnabled = UserGroupInformation.isSecurityEnabled(); if (HadoopSecureWrapperUtils.shouldProxy(jobProps)) { UserGroupInformation proxyUser = null; String userToProxy = jobProps.getProperty(HadoopSecurityManager.USER_TO_PROXY); if (securityEnabled) { proxyUser = HadoopSecureWrapperUtils.createSecurityEnabledProxyUser(userToProxy, logger); } else { proxyUser = UserGroupInformation.createRemoteUser(userToProxy); } logger.info("Proxying to execute job. Proxied as user " + userToProxy); proxyUser.doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { runSpark(args); return null; } }); } else { logger.info("Not proxying to execute job. "); runSpark(args); } }
Source:
<code>public void testHttpAnnouncement() { final StaticAnnouncementHttpServerInfoImpl httpServerInfo = new StaticAnnouncementHttpServerInfoImpl( URI.create("<LINK_0>"), URI.create("<LINK_1>"), null, null); Injector injector = Guice.createInjector( new TestingDiscoveryModule(), binder -> { binder.bind(AnnouncementHttpServerInfo.class).toInstance(httpServerInfo); <START> DiscoveryBinder.discoveryBinder(binder).bindHttpAnnouncement("apple"); <END> }); ServiceAnnouncement announcement = serviceAnnouncement("apple") .addProperty("http", httpServerInfo.getHttpUri().toASCIIString()) .addProperty("http-external", httpServerInfo.getHttpExternalUri().toASCIIString()) .build(); Set<ServiceAnnouncement> announcements = injector.getInstance(Key.get(new TypeLiteral<Set<ServiceAnnouncement>>() { })); assertAnnouncement(announcements, announcement); }</code><technical_language>Static import</technical_language>

Target:
public void testHttpAnnouncement() { final StaticAnnouncementHttpServerInfoImpl httpServerInfo = new StaticAnnouncementHttpServerInfoImpl( URI.create("<LINK_0>"), URI.create("<LINK_1>"), null, null); Injector injector = Guice.createInjector( new TestingDiscoveryModule(), binder -> { binder.bind(AnnouncementHttpServerInfo.class).toInstance(httpServerInfo); discoveryBinder(binder).bindHttpAnnouncement("apple"); }); ServiceAnnouncement announcement = serviceAnnouncement("apple") .addProperty("http", httpServerInfo.getHttpUri().toASCIIString()) .addProperty("http-external", httpServerInfo.getHttpExternalUri().toASCIIString()) .build(); Set<ServiceAnnouncement> announcements = injector.getInstance(Key.get(new TypeLiteral<Set<ServiceAnnouncement>>() { })); assertAnnouncement(announcements, announcement); }
Source:
<code>public Task<AuthResult> then(@NonNull Task<AuthResult> task) { final AuthResult authResult = task.getResult(); FirebaseUser firebaseUser = authResult.getUser(); String name = firebaseUser.getDisplayName(); Uri photoUri = firebaseUser.getPhotoUrl(); if (!TextUtils.isEmpty(name) && photoUri != null) { return Tasks.forResult(authResult); } User user = mResponse.getUser(); <START> if (TextUtils.isEmpty(name)) { name = user.getName(); } <END> if (photoUri == null) { photoUri = user.getPhotoUri(); } return firebaseUser.updateProfile( new UserProfileChangeRequest.Builder() .setDisplayName(name) .setPhotoUri(photoUri) .build()) .continueWithTask(new Continuation<Void, Task<AuthResult>>() { @Override public Task<AuthResult> then(@NonNull Task<Void> task) { return Tasks.forResult(authResult); } }); }</code><technical_language>Nit: put contents of if separate lines</technical_language>

Target:
public Task<AuthResult> then(@NonNull Task<AuthResult> task) { final AuthResult authResult = task.getResult(); FirebaseUser firebaseUser = authResult.getUser(); String name = firebaseUser.getDisplayName(); Uri photoUri = firebaseUser.getPhotoUrl(); if (!TextUtils.isEmpty(name) && photoUri != null) { return Tasks.forResult(authResult); } User user = mResponse.getUser(); if (TextUtils.isEmpty(name)) { name = user.getName(); } if (photoUri == null) { photoUri = user.getPhotoUri(); } return firebaseUser.updateProfile( new UserProfileChangeRequest.Builder() .setDisplayName(name) .setPhotoUri(photoUri) .build()) .addOnFailureListener(new TaskFailureLogger(TAG, "Error updating profile")) .continueWithTask(new Continuation<Void, Task<AuthResult>>() { @Override public Task<AuthResult> then(@NonNull Task<Void> task) { return Tasks.forResult(authResult); } }); }
Source:
<code>public void toXmlTestForAudio() { String xml = "<media xmlns='urn:xmpp:media-element'>" + "<uri type='audio/x-wav'>" + "<LINK_0>" + "</uri>" + "<uri type='audio/ogg; codecs=speex'>" + "cid:sha1+a15a505e360702b79c75a5f67773072ed392f52a@bob.xmpp.org" + "</uri>" + "<uri type='audio/mpeg'>" + "<LINK_1>" + "</uri>" + "</media>"; URI uri1 = null; URI uri2 = null; URI uri3 = null; try { uri1 = new URI("<LINK_0>"); uri2 = new URI("cid:sha1+a15a505e360702b79c75a5f67773072ed392f52a@bob.xmpp.org"); uri3 = new URI("<LINK_1>"); } catch (URISyntaxException e) { <START> throw new IllegalArgumentException("Invalid URI"); <END> } List<URINode> uriNodeList = new ArrayList<URINode>(); URINode urinode1 = new URINode(MediaType.audio_xwav, uri1); URINode urinode2 = new URINode(MediaType.audio_ogg, "codecs=speex", uri2); URINode urinode3 = new URINode(MediaType.audio_mpeg, uri3); uriNodeList.add(urinode1); uriNodeList.add(urinode2); uriNodeList.add(urinode3); MediaElement mediaElement = new MediaElement(uriNodeList); assertXmlSimilar(xml, mediaElement.toXML().toString()); }</code><technical_language>throw AssertionError here, matter much</technical_language>

Target:
public void toXmlTestForAudio() throws URISyntaxException { String xml = "<media xmlns='urn:xmpp:media-element'>" + "<uri type='audio/x-wav'>" + "<LINK_0>" + "</uri>" + "<uri type='audio/ogg; codecs=speex'>" + "cid:sha1+a15a505e360702b79c75a5f67773072ed392f52a@bob.xmpp.org" + "</uri>" + "<uri type='audio/mpeg'>" + "<LINK_1>" + "</uri>" + "</media>"; URI uri1 = new URI("<LINK_0>"); URI uri2 = new URI("cid:sha1+a15a505e360702b79c75a5f67773072ed392f52a@bob.xmpp.org"); URI uri3 = new URI("<LINK_1>"); List<URINode> uriNodeList = new ArrayList<URINode>(); URINode urinode1 = new URINode("audio/x-wav", uri1); URINode urinode2 = new URINode("audio/ogg", "codecs=speex", uri2); URINode urinode3 = new URINode("audio/mpeg", uri3); uriNodeList.add(urinode1); uriNodeList.add(urinode2); uriNodeList.add(urinode3); MediaElement mediaElement = new MediaElement(uriNodeList); assertXmlSimilar(xml, mediaElement.toXML().toString()); }
Source:
<code><START> public int getSSLPort() { <END> for (Port extraPort : ports) { if (extraPort.getPortType() == PortType.SSL) { return extraPort.getPortNo(); } } return -1; }</code><technical_language>Instead of ArrayList<Port> save of Ports, HashMap, key is PortType, is Integer. getSSLPort() easier</technical_language>

Target:
public int getSSLPort() { Port sslPort = ports.get(PortType.SSL); if (sslPort != null) { return sslPort.getPort(); } throw new IllegalStateException("No SSL Port Exists for Server " + host + ":" + port); }
Source:
<code>public Response getOpenApiSpec(@Context HttpHeaders headers, @Context UriInfo uriInfo, @PathParam("type") String type, @Context ServletConfig config, @Context Application app) throws Exception { <START> setOpenApiConfiguration(oasConfig); <END> Response response = super.getOpenApi(headers, config, app, uriInfo, type); response.getHeaders().add("Access-Control-Allow-Origin", "*"); return response; }</code><technical_language>thread safe. Needs done startup / postconstruct</technical_language>

Target:
public Response getOpenApiSpec( @Context HttpHeaders headers, @Context UriInfo uriInfo, @PathParam("type") String type, @Context ServletConfig config, @Context Application app) throws Exception { Response response = getOpenApi(headers, config, app, uriInfo, type); response.getHeaders().add("Access-Control-Allow-Origin", "*"); return response; }
Source:
<code>public void setEnabled(boolean enabled) { if (!enabled) <START> slidingPane.closePane(); <END> slidingPane.setSlidingEnabled(enabled); }</code><technical_language>enclose if (and other conditional) bodies in curly braces</technical_language>

Target:
public void setEnabled(boolean enabled) { if (!enabled) { slidingPane.closePane(); } slidingPane.setSlidingEnabled(enabled); }
Source:
<code>public Resource getConfigFile(String profile, String label, String path) { <START> Assert.isTrue(!StringUtils.isEmpty(configClientProperties.getName()), <END> "Spring application name is undefined."); Assert.notEmpty(configClientProperties.getUri(), "Config server URI is undefined"); Assert.hasText(configClientProperties.getUri()[0], "Config server URI is undefined."); String effectiveProfile = profile; if (effectiveProfile == null) { effectiveProfile = configClientProperties.getProfile(); if (effectiveProfile == null || effectiveProfile.isEmpty()) { effectiveProfile = "default"; } } String effectiveLabel = label; if (effectiveLabel == null) { effectiveLabel = configClientProperties.getLabel(); } String url = configClientProperties.getUri()[0] + "/" + configClientProperties.getName() + "/" + effectiveProfile + "/" + (effectiveLabel == null ? path + "?useDefaultLabel" : effectiveLabel + "/" + path); ResponseEntity<Resource> forEntity = restTemplate.getForEntity(url, Resource.class); return forEntity.getBody(); }</code><technical_language>Assert.notEmpty this</technical_language>

Target:
public Resource getConfigFile(String profile, String label, String path) { Assert.hasText(configClientProperties.getName(), "Spring application name is undefined."); Assert.notEmpty(configClientProperties.getUri(), "Config server URI is undefined"); Assert.hasText(configClientProperties.getUri()[0], "Config server URI is undefined."); String effectiveProfile = profile; if (effectiveProfile == null) { effectiveProfile = configClientProperties.getProfile(); if (effectiveProfile == null || effectiveProfile.isEmpty()) { effectiveProfile = "default"; } } String effectiveLabel = label; if (effectiveLabel == null) { effectiveLabel = configClientProperties.getLabel(); } String url = configClientProperties.getUri()[0] + "/" + configClientProperties.getName() + "/" + effectiveProfile + "/" + (effectiveLabel == null ? path + "?useDefaultLabel" : effectiveLabel + "/" + path); ResponseEntity<Resource> forEntity = restTemplate.getForEntity(url, Resource.class); return forEntity.getBody(); }