Skip to content

Commit

Permalink
applied spotlessApply
Browse files Browse the repository at this point in the history
Signed-off-by: Mitchell Gale <Mitchell.Gale@improving.com>
  • Loading branch information
MitchellGale committed Jul 11, 2023
1 parent c94e6e4 commit a87df9b
Show file tree
Hide file tree
Showing 1,436 changed files with 74,839 additions and 76,706 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@Fork(value = 1)
public class ComparisonOperatorBenchmark {

@Param(value = { "int", "string", "date" })
@Param(value = {"int", "string", "date"})
private String testDataType;

private final Map<String, ExprValue> params =
Expand All @@ -65,9 +65,7 @@ public void testGreaterOperator() {

private void run(Function<Expression[], FunctionExpression> dsl) {
ExprValue param = params.get(testDataType);
FunctionExpression func = dsl.apply(new Expression[] {
literal(param), literal(param)
});
FunctionExpression func = dsl.apply(new Expression[] {literal(param), literal(param)});
func.valueOf();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/


package org.opensearch.sql.common.antlr;

import org.antlr.v4.runtime.CharStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/


package org.opensearch.sql.common.antlr;

import java.util.Locale;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/


package org.opensearch.sql.common.antlr;

public class SyntaxCheckException extends RuntimeException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ public class AwsSigningInterceptor implements Interceptor {
private static final Logger LOG = LogManager.getLogger();

/**
* AwsSigningInterceptor which intercepts http requests
* and adds required headers for sigv4 authentication.
* AwsSigningInterceptor which intercepts http requests and adds required headers for sigv4
* authentication.
*
* @param awsCredentialsProvider awsCredentialsProvider.
* @param region region.
* @param serviceName serviceName.
*/
public AwsSigningInterceptor(@NonNull AWSCredentialsProvider awsCredentialsProvider,
@NonNull String region, @NonNull String serviceName) {
public AwsSigningInterceptor(
@NonNull AWSCredentialsProvider awsCredentialsProvider,
@NonNull String region,
@NonNull String serviceName) {
this.okHttpAwsV4Signer = new OkHttpAwsV4Signer(region, serviceName);
this.awsCredentialsProvider = awsCredentialsProvider;
}
Expand All @@ -48,25 +50,27 @@ public AwsSigningInterceptor(@NonNull AWSCredentialsProvider awsCredentialsProvi
public Response intercept(Interceptor.Chain chain) throws IOException {
Request request = chain.request();

DateTimeFormatter timestampFormat = DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss'Z'")
.withZone(ZoneId.of("GMT"));
DateTimeFormatter timestampFormat =
DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss'Z'").withZone(ZoneId.of("GMT"));


Request.Builder newRequestBuilder = request.newBuilder()
.addHeader("x-amz-date", timestampFormat.format(ZonedDateTime.now()))
.addHeader("host", request.url().host());
Request.Builder newRequestBuilder =
request
.newBuilder()
.addHeader("x-amz-date", timestampFormat.format(ZonedDateTime.now()))
.addHeader("host", request.url().host());

AWSCredentials awsCredentials = awsCredentialsProvider.getCredentials();
if (awsCredentialsProvider instanceof STSAssumeRoleSessionCredentialsProvider) {
newRequestBuilder.addHeader("x-amz-security-token",
newRequestBuilder.addHeader(
"x-amz-security-token",
((STSAssumeRoleSessionCredentialsProvider) awsCredentialsProvider)
.getCredentials()
.getSessionToken());
}
Request newRequest = newRequestBuilder.build();
Request signed = okHttpAwsV4Signer.sign(newRequest,
awsCredentials.getAWSAccessKeyId(), awsCredentials.getAWSSecretKey());
Request signed =
okHttpAwsV4Signer.sign(
newRequest, awsCredentials.getAWSAccessKeyId(), awsCredentials.getAWSSecretKey());
return chain.proceed(signed);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ public BasicAuthenticationInterceptor(@NonNull String username, @NonNull String
this.credentials = Credentials.basic(username, password);
}


@Override
public Response intercept(Interceptor.Chain chain) throws IOException {
Request request = chain.request();
Request authenticatedRequest = request.newBuilder()
.header("Authorization", credentials).build();
Request authenticatedRequest =
request.newBuilder().header("Authorization", credentials).build();
return chain.proceed(authenticatedRequest);
}

}
Loading

0 comments on commit a87df9b

Please sign in to comment.