Skip to content

Commit 7c3d0e4

Browse files
committed
Merge branch 'master' into release_v2.4.0
2 parents de10ae4 + 6e8133b commit 7c3d0e4

File tree

163 files changed

+3070
-1041
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+3070
-1041
lines changed

.devcontainer/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM mcr.microsoft.com/devcontainers/java:1-21-bullseye
2+
3+
ENV MAVEN_CONFIG=/var/maven/.m2
4+
5+
# [Optional] Uncomment if you want to install more tools
6+
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
7+
&& apt-get -y install --no-install-recommends maven \
8+
&& mkdir -p /var/maven/.m2 \
9+
&& chown -R vscode:vscode /var/maven/.m2

.devcontainer/commands/initialize.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
set -e
3+
4+
git config --local user.name "$(git config user.name)"
5+
git config --local user.email "$(git config user.email)"

.devcontainer/devcontainer.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/java
3+
{
4+
"name": "YDB Java SDK",
5+
"dockerFile": "Dockerfile",
6+
// Allows the container to use ptrace, which is useful for debugging.
7+
"capAdd": [
8+
"SYS_PTRACE"
9+
],
10+
// Disables seccomp, which can be necessary for some debugging tools to function correctly.
11+
"securityOpt": [
12+
"seccomp=unconfined"
13+
],
14+
"features": {
15+
"ghcr.io/devcontainers/features/github-cli:1": {},
16+
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
17+
},
18+
// Use 'initializeCommand' to run commands before the container is created.
19+
"initializeCommand": "chmod +x .devcontainer/commands/initialize.sh && .devcontainer/commands/initialize.sh",
20+
// Use 'postCreateCommand' to run commands after the container is created.
21+
// Use 'postStartCommand' to run commands after the container is started.
22+
// Configure tool-specific properties.
23+
"customizations": {
24+
"vscode": {
25+
"extensions": [
26+
"redhat.java",
27+
"vscjava.vscode-java-pack"
28+
]
29+
}
30+
},
31+
// Maven cache volume configuration.
32+
"mounts": [
33+
"source=maven-cache,target=/var/maven/.m2,type=volume"
34+
]
35+
}

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,20 @@ ij_java_insert_override_annotation = true
1717
ij_java_lambda_brace_style = end_of_line
1818
ij_java_method_brace_style = end_of_line
1919
ij_java_names_count_to_use_import_on_demand = 9000
20+
ij_java_space_after_colon = true
21+
ij_java_space_before_colon = true
22+
ij_java_spaces_around_additive_operators = true
23+
ij_java_spaces_around_annotation_eq = true
24+
ij_java_spaces_around_assignment_operators = true
25+
ij_java_spaces_around_bitwise_operators = true
26+
ij_java_spaces_around_equality_operators = true
27+
ij_java_spaces_around_lambda_arrow = true
28+
ij_java_spaces_around_logical_operators = true
29+
ij_java_spaces_around_method_ref_dbl_colon = false
30+
ij_java_spaces_around_multiplicative_operators = true
31+
ij_java_spaces_around_relational_operators = true
32+
ij_java_spaces_around_shift_operators = true
33+
ij_java_spaces_around_type_bounds_in_type_parameters = true
34+
ij_java_spaces_around_unary_operator = false
2035
ij_java_use_single_class_imports = true
2136
ij_java_while_brace_force = always

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for more information:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
# https://containers.dev/guide/dependabot
6+
7+
version: 2
8+
updates:
9+
- package-ecosystem: "devcontainers"
10+
directory: "/"
11+
schedule:
12+
interval: weekly

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@
99
**/.idea/
1010
**/*.iml
1111
**/*.iws
12-
**/*.ipr
12+
**/*.ipr
13+
14+
# VS Code
15+
.vscode

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
## 2.3.17 ##
2+
* Query: Fixed session status updating
3+
* Topic: Fixed maxActivePartitions on topic creation
4+
* Tests: Updated JUnit5 helper to avoid NPE
5+
* Added devcontainer configuration
6+
7+
## 2.3.16 ##
8+
* Core: Added option to control the grpc stream flow
9+
* Table: Added Serializable to all values and types
10+
* Topic: Fixed double compression of one message
11+
12+
## 2.3.15 ##
13+
14+
* Core: ResourceExhausted isn't pessimize the node
15+
* Table: Added flag about default value in TableColumn
16+
* Table: Added support of describeTableOptions
17+
* Query: Fixed QueryReader.setRowIndex() & added tests
18+
* Topic: Added max_active_partitions support to topic operations
19+
* Topic: Added configuration for GrpcStreamRetrier ID
20+
* Topic: Added equals & hashCode implementations for descriptions
21+
122
## 2.3.14 ##
223

324
* Core: Removed mockito-inline from compile dependencies

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Firstly you can import YDB Java BOM to specify correct versions of SDK modules.
3030
<dependency>
3131
<groupId>tech.ydb</groupId>
3232
<artifactId>ydb-sdk-bom</artifactId>
33-
<version>2.3.14</version>
33+
<version>2.3.17</version>
3434
<type>pom</type>
3535
<scope>import</scope>
3636
</dependency>

auth-providers/oauth2-provider/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>tech.ydb</groupId>
77
<artifactId>ydb-sdk-parent</artifactId>
8-
<version>2.3.15-SNAPSHOT</version>
8+
<version>2.3.18-SNAPSHOT</version>
99
<relativePath>../../pom.xml</relativePath>
1010
</parent>
1111

auth-providers/oauth2-provider/src/main/java/tech/ydb/auth/OAuth2TokenExchangeProvider.java

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import java.util.ArrayList;
1515
import java.util.Arrays;
1616
import java.util.HashSet;
17-
import java.util.Iterator;
1817
import java.util.List;
1918
import java.util.Set;
2019
import java.util.concurrent.CompletableFuture;
@@ -54,12 +53,12 @@ public class OAuth2TokenExchangeProvider implements AuthRpcProvider<GrpcAuthRpc>
5453

5554
private static final Logger logger = LoggerFactory.getLogger(OAuth2TokenExchangeProvider.class);
5655
private static final Gson GSON = new Gson();
57-
private static final Set<String> SUPPORTED_JWT_ALGS = new HashSet<String>(Arrays.asList(new String[]{
58-
"HS256", "HS384", "HS512",
59-
"RS256", "RS384", "RS512",
60-
"PS256", "PS384", "PS512",
61-
"ES256", "ES384", "ES512",
62-
}));
56+
private static final Set<String> SUPPORTED_JWT_ALGS = new HashSet<>(Arrays.asList(
57+
"HS256", "HS384", "HS512",
58+
"RS256", "RS384", "RS512",
59+
"PS256", "PS384", "PS512",
60+
"ES256", "ES384", "ES512"
61+
));
6362

6463
private final Clock clock;
6564
private final String endpoint;
@@ -83,41 +82,40 @@ private OAuth2TokenExchangeProvider(Clock clock, String endpoint, String scope,
8382
public static String[] getSupportedJwtAlgorithms() {
8483
String[] result = new String[SUPPORTED_JWT_ALGS.size()];
8584
int i = 0;
86-
Iterator<String> it = SUPPORTED_JWT_ALGS.iterator();
87-
while (it.hasNext()) {
88-
result[i++] = it.next();
85+
for (String supportedJwtAlg : SUPPORTED_JWT_ALGS) {
86+
result[i++] = supportedJwtAlg;
8987
}
9088
Arrays.sort(result);
9189
return result;
9290
}
9391

9492
private static OAuth2TokenSource buildFixedTokenSourceFromConfig(TokenSourceJsonConfig cfg) {
95-
if (cfg.getToken() == null || cfg.getToken().length() == 0
96-
|| cfg.getTokenType() == null || cfg.getTokenType().length() == 0) {
93+
if (cfg.getToken() == null || cfg.getToken().isEmpty()
94+
|| cfg.getTokenType() == null || cfg.getTokenType().isEmpty()) {
9795
throw new RuntimeException("Both token and token-type are required");
9896
}
9997
return OAuth2TokenSource.fromValue(cfg.getToken(), cfg.getTokenType());
10098
}
10199

102100
private static OAuth2TokenSource buildJwtTokenSourceFromConfig(TokenSourceJsonConfig cfg) {
103-
if (cfg.getAlg() == null || cfg.getAlg().length() == 0) {
101+
if (cfg.getAlg() == null || cfg.getAlg().isEmpty()) {
104102
throw new RuntimeException("Algorithm is required");
105103
}
106-
if (cfg.getPrivateKey() == null || cfg.getPrivateKey().length() == 0) {
104+
if (cfg.getPrivateKey() == null || cfg.getPrivateKey().isEmpty()) {
107105
throw new RuntimeException("Key is required");
108106
}
109107

110108
String alg = cfg.getAlg().toUpperCase();
111109
if (!SUPPORTED_JWT_ALGS.contains(alg)) {
112110
String[] supportedAlgs = getSupportedJwtAlgorithms();
113-
String lstMsg = "";
111+
StringBuilder lstMsg = new StringBuilder();
114112
for (int i = 0; i < supportedAlgs.length; i++) {
115113
if (lstMsg.length() > 0) {
116-
lstMsg += ", ";
114+
lstMsg.append(", ");
117115
}
118-
lstMsg += "\"";
119-
lstMsg += supportedAlgs[i];
120-
lstMsg += "\"";
116+
lstMsg.append("\"");
117+
lstMsg.append(supportedAlgs[i]);
118+
lstMsg.append("\"");
121119
}
122120
throw new RuntimeException(
123121
String.format("Algorithm \"%s\" is not supported. Supported algorithms: %s",
@@ -129,7 +127,7 @@ private static OAuth2TokenSource buildJwtTokenSourceFromConfig(TokenSourceJsonCo
129127
boolean isHmac = "HS256".equals(alg)
130128
|| "HS384".equals(alg)
131129
|| "HS512".equals(alg);
132-
OAuth2TokenSource.JWTTokenBuilder builder = null;
130+
OAuth2TokenSource.JWTTokenBuilder builder;
133131
if (isHmac) {
134132
builder = OAuth2TokenSource.withHmacPrivateKeyBase64(cfg.getPrivateKey(), alg);
135133
} else {
@@ -196,13 +194,13 @@ public static Builder fromFile(File configFile) {
196194
builder.withCustomGrantType(cfg.getGrantType());
197195
}
198196

199-
if (cfg.getResource() != null && cfg.getResource().length != 0) {
197+
if (cfg.getResource() != null) {
200198
for (String res: cfg.getResource()) {
201199
builder.withResource(res);
202200
}
203201
}
204202

205-
if (cfg.getAudience() != null && cfg.getAudience().length != 0) {
203+
if (cfg.getAudience() != null) {
206204
for (String audience: cfg.getAudience()) {
207205
builder.withAudience(audience);
208206
}
@@ -535,13 +533,13 @@ private static class SingleStringOrArrayOfStringsJsonConfigDeserializer implemen
535533
public String[] deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) {
536534
if (json.isJsonArray()) {
537535
JsonArray arr = json.getAsJsonArray();
538-
if (arr.size() == 0) {
536+
if (arr.isEmpty()) {
539537
return null;
540538
}
541539
String[] result = new String[arr.size()];
542540
for (int i = 0; i < arr.size(); i++) {
543541
result[i] = arr.get(i).getAsJsonPrimitive().getAsString();
544-
if (result[i].length() == 0) {
542+
if (result[i].isEmpty()) {
545543
throw new RuntimeException("Cannot parse config from json: empty string");
546544
}
547545
}
@@ -550,7 +548,7 @@ public String[] deserialize(JsonElement json, Type typeOfT, JsonDeserializationC
550548
if (json.isJsonPrimitive()) {
551549
String[] result = new String[1];
552550
result[0] = json.getAsJsonPrimitive().getAsString();
553-
if (result[0].length() == 0) {
551+
if (result[0].isEmpty()) {
554552
throw new RuntimeException("Cannot parse config from json: empty string");
555553
}
556554
return result;
@@ -715,14 +713,14 @@ public String[] getScope() {
715713
}
716714

717715
public String buildScope() {
718-
String result = new String();
716+
StringBuilder result = new StringBuilder();
719717
for (String s: this.scope) {
720718
if (result.length() != 0) {
721-
result += " ";
719+
result.append(" ");
722720
}
723-
result += s;
721+
result.append(s);
724722
}
725-
return result;
723+
return result.toString();
726724
}
727725

728726
public String getRequestedTokenType() {

0 commit comments

Comments
 (0)