Commit 1e2457da authored by neelesh thakur's avatar neelesh thakur
Browse files

use local variable for returnedField as services has Singleton scope

parent 1bd39b5a
Pipeline #34398 failed with stage
in 40 minutes and 31 seconds
......@@ -266,16 +266,15 @@ abstract class QueryBase {
if (returnedFields == null) {
returnedFields = new ArrayList<>();
}
String[] includesArr = null;
String[] excludesArr = null;
Set<String> returnedFieldsSet = new HashSet<>(returnedFields);
includesArr = returnedFieldsSet.toArray(new String[returnedFieldsSet.size()]);
String[] includesArr = returnedFieldsSet.toArray(new String[returnedFieldsSet.size()]);
// remove all matching returnedField and queryable from excludes
Set<String> shouldNotExclude = returnedFieldsSet.stream().filter(queryableExcludes::contains).collect(Collectors.toSet());
Set<String> shouldExclude = queryableExcludes.stream().filter(n -> !shouldNotExclude.contains(n)).collect(Collectors.toSet());
excludes.addAll(shouldExclude);
excludesArr = excludes.toArray(new String[excludes.size()]);
Set<String> requestQueryableExcludes = new HashSet<>(queryableExcludes);
Set<String> requestExcludes = new HashSet<>(excludes);
requestQueryableExcludes.removeAll(returnedFields);
requestExcludes.addAll(requestQueryableExcludes);
String[] excludesArr = requestExcludes.toArray(new String[requestExcludes.size()]);
sourceBuilder.fetchSource(includesArr, excludesArr);
return sourceBuilder;
......
......@@ -164,6 +164,13 @@
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<!-- https://github.com/Azure/azure-sdk-for-java/issues/15180 remove this once applicationinsights-spring-boot-starter upgraded to >3.0.0-->
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>7.9</version>
</dependency>
</dependencies>
<build>
......
......@@ -269,16 +269,15 @@ abstract class QueryBase {
if (returnedFields == null) {
returnedFields = new ArrayList<>();
}
String[] includesArr = null;
String[] excludesArr = null;
Set<String> returnedFieldsSet = new HashSet<>(returnedFields);
includesArr = returnedFieldsSet.toArray(new String[returnedFieldsSet.size()]);
String[] includesArr = returnedFieldsSet.toArray(new String[returnedFieldsSet.size()]);
// remove all matching returnedField and queryable from excludes
Set<String> shouldNotExclude = Sets.intersection(returnedFieldsSet, queryableExcludes);
Set<String> shouldExclude = Sets.difference(queryableExcludes, shouldNotExclude);
excludes.addAll(shouldExclude);
excludesArr = excludes.toArray(new String[excludes.size()]);
Set<String> requestQueryableExcludes = new HashSet<>(queryableExcludes);
Set<String> requestExcludes = new HashSet<>(excludes);
requestQueryableExcludes.removeAll(returnedFields);
requestExcludes.addAll(requestQueryableExcludes);
String[] excludesArr = requestExcludes.toArray(new String[requestExcludes.size()]);
sourceBuilder.fetchSource(includesArr, excludesArr);
return sourceBuilder;
......
......@@ -222,16 +222,15 @@ abstract class QueryBase {
if (returnedFields == null) {
returnedFields = new ArrayList<>();
}
String[] includesArr = null;
String[] excludesArr = null;
Set<String> returnedFieldsSet = new HashSet<>(returnedFields);
includesArr = returnedFieldsSet.toArray(new String[returnedFieldsSet.size()]);
String[] includesArr = returnedFieldsSet.toArray(new String[returnedFieldsSet.size()]);
// remove all matching returnedField and queryable from excludes
Set<String> shouldNotExclude = Sets.intersection(returnedFieldsSet, queryableExcludes);
Set<String> shouldExclude = Sets.difference(queryableExcludes, shouldNotExclude);
excludes.addAll(shouldExclude);
excludesArr = excludes.toArray(new String[excludes.size()]);
Set<String> requestQueryableExcludes = new HashSet<>(queryableExcludes);
Set<String> requestExcludes = new HashSet<>(excludes);
requestQueryableExcludes.removeAll(returnedFields);
requestExcludes.addAll(requestQueryableExcludes);
String[] excludesArr = requestExcludes.toArray(new String[requestExcludes.size()]);
sourceBuilder.fetchSource(includesArr, excludesArr);
return sourceBuilder;
......
......@@ -272,16 +272,15 @@ abstract class QueryBase {
if (returnedFields == null) {
returnedFields = new ArrayList<>();
}
String[] includesArr = null;
String[] excludesArr = null;
Set<String> returnedFieldsSet = new HashSet<>(returnedFields);
includesArr = returnedFieldsSet.toArray(new String[returnedFieldsSet.size()]);
String[] includesArr = returnedFieldsSet.toArray(new String[returnedFieldsSet.size()]);
// remove all matching returnedField and queryable from excludes
Set<String> shouldNotExclude = Sets.intersection(returnedFieldsSet, queryableExcludes);
Set<String> shouldExclude = Sets.difference(queryableExcludes, shouldNotExclude);
excludes.addAll(shouldExclude);
excludesArr = excludes.toArray(new String[excludes.size()]);
Set<String> requestQueryableExcludes = new HashSet<>(queryableExcludes);
Set<String> requestExcludes = new HashSet<>(excludes);
requestQueryableExcludes.removeAll(returnedFields);
requestExcludes.addAll(requestQueryableExcludes);
String[] excludesArr = requestExcludes.toArray(new String[requestExcludes.size()]);
sourceBuilder.fetchSource(includesArr, excludesArr);
return sourceBuilder;
......
......@@ -256,16 +256,15 @@ abstract class QueryBase {
if (returnedFields == null) {
returnedFields = new ArrayList<>();
}
String[] includesArr = null;
String[] excludesArr = null;
Set<String> returnedFieldsSet = new HashSet<>(returnedFields);
includesArr = returnedFieldsSet.toArray(new String[returnedFieldsSet.size()]);
String[] includesArr = returnedFieldsSet.toArray(new String[returnedFieldsSet.size()]);
// remove all matching returnedField and queryable from excludes
Set<String> shouldNotExclude = Sets.intersection(returnedFieldsSet, queryableExcludes);
Set<String> shouldExclude = Sets.difference(queryableExcludes, shouldNotExclude);
excludes.addAll(shouldExclude);
excludesArr = excludes.toArray(new String[excludes.size()]);
Set<String> requestQueryableExcludes = new HashSet<>(queryableExcludes);
Set<String> requestExcludes = new HashSet<>(excludes);
requestQueryableExcludes.removeAll(returnedFields);
requestExcludes.addAll(requestQueryableExcludes);
String[] excludesArr = requestExcludes.toArray(new String[requestExcludes.size()]);
sourceBuilder.fetchSource(includesArr, excludesArr);
return sourceBuilder;
......
......@@ -282,16 +282,15 @@ abstract class QueryBase {
if (returnedFields == null) {
returnedFields = new ArrayList<>();
}
String[] includesArr = null;
String[] excludesArr = null;
Set<String> returnedFieldsSet = new HashSet<>(returnedFields);
includesArr = returnedFieldsSet.toArray(new String[returnedFieldsSet.size()]);
String[] includesArr = returnedFieldsSet.toArray(new String[returnedFieldsSet.size()]);
// remove all matching returnedField and queryable from excludes
Set<String> shouldNotExclude = Sets.intersection(returnedFieldsSet, queryableExcludes);
Set<String> shouldExclude = Sets.difference(queryableExcludes, shouldNotExclude);
excludes.addAll(shouldExclude);
excludesArr = excludes.toArray(new String[excludes.size()]);
Set<String> requestQueryableExcludes = new HashSet<>(queryableExcludes);
Set<String> requestExcludes = new HashSet<>(excludes);
requestQueryableExcludes.removeAll(returnedFields);
requestExcludes.addAll(requestQueryableExcludes);
String[] excludesArr = requestExcludes.toArray(new String[requestExcludes.size()]);
sourceBuilder.fetchSource(includesArr, excludesArr);
return sourceBuilder;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment