Skip to content

Commit d1bdeb9

Browse files
authored
Merge pull request #3904 from yue9944882/sync-master-srcs-java8
Branch(master-java8): Sync missing source files from master branch
2 parents 5f4cfa1 + 4e028e7 commit d1bdeb9

File tree

4 files changed

+83
-1
lines changed

4 files changed

+83
-1
lines changed

kubernetes/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@
180180
<groupId>jakarta.ws.rs</groupId>
181181
<artifactId>jakarta.ws.rs-api</artifactId>
182182
</dependency>
183+
<dependency>
184+
<groupId>com.fasterxml.jackson.core</groupId>
185+
<artifactId>jackson-databind</artifactId>
186+
</dependency>
187+
<dependency>
188+
<groupId>com.fasterxml.jackson.core</groupId>
189+
<artifactId>jackson-core</artifactId>
190+
</dependency>
183191

184192
<!-- test dependencies -->
185193
<dependency>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Copyright 2024 The Kubernetes Authors.
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
package io.kubernetes.client.custom;
14+
15+
import java.util.Arrays;
16+
import java.util.Map;
17+
18+
public class MapUtils {
19+
public static boolean equals(Map<String, byte[]> map1, Map<String, byte[]> map2) {
20+
if (map1 == map2) {
21+
return true; // Both pointing to the same instance
22+
}
23+
if (map1 == null || map2 == null || map1.size() != map2.size()) {
24+
return false; // One is null or their sizes are different
25+
}
26+
for (String key : map1.keySet()) {
27+
if (!map2.containsKey(key) || !Arrays.equals(map1.get(key), map2.get(key))) {
28+
// Key doesn't exist in map2 or the byte arrays are not equal
29+
return false;
30+
}
31+
}
32+
// All keys matched and their corresponding byte arrays are equal
33+
return true;
34+
}
35+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
Copyright 2024 The Kubernetes Authors.
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
package io.kubernetes.client.gson;
14+
15+
import com.google.gson.ExclusionStrategy;
16+
import com.google.gson.FieldAttributes;
17+
import io.kubernetes.client.openapi.models.V1ObjectMeta;
18+
19+
public class V1MetadataExclusionStrategy implements com.google.gson.ExclusionStrategy {
20+
public boolean shouldSkipField(FieldAttributes f) {
21+
// Don't serialize the 'managedFields' field.
22+
return (f.getDeclaringClass().equals(V1ObjectMeta.class) && f.getName().equalsIgnoreCase("managedFields"));
23+
}
24+
25+
public boolean shouldSkipClass(Class<?> clazz) {
26+
return false;
27+
}
28+
}

pom.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
<junit.version>4.13</junit.version>
5454
<bucket4j.version>7.6.0</bucket4j.version>
5555
<bouncycastle.version>1.80</bouncycastle.version>
56+
<jackson.version>2.18.2</jackson.version>
5657
<gson.version>2.12.1</gson.version>
5758
<jsr305.version>3.0.2</jsr305.version>
5859
<okhttp3.version>4.12.0</okhttp3.version>
@@ -263,9 +264,19 @@
263264
<dependency>
264265
<groupId>com.fasterxml.jackson.core</groupId>
265266
<artifactId>jackson-annotations</artifactId>
266-
<version>2.18.2</version>
267+
<version>${jackson.version}</version>
267268
<optional>true</optional>
268269
</dependency>
270+
<dependency>
271+
<groupId>com.fasterxml.jackson.core</groupId>
272+
<artifactId>jackson-databind</artifactId>
273+
<version>${jackson.version}</version>
274+
</dependency>
275+
<dependency>
276+
<groupId>com.fasterxml.jackson.core</groupId>
277+
<artifactId>jackson-core</artifactId>
278+
<version>${jackson.version}</version>
279+
</dependency>
269280

270281
<!-- tests -->
271282
<dependency>

0 commit comments

Comments
 (0)