Skip to content

Commit 18a0078

Browse files
authored
refactor: sonar lint cleanup (#116)
* refactor: add @SuppressWarnings("null") on false positive * refactor: use lambdas to avoid force cast with method reference * release: bump version to 0.6.1 * dependencies: up spring-boot version to 2.7.4 * dependencies: up SDR to 2.7.3 * dependencies: up Gson version to 2.9.1 as per gson - Deserialization of Untrusted Data [CVE-2022-25647]
1 parent 3a3d248 commit 18a0078

File tree

8 files changed

+33
-24
lines changed

8 files changed

+33
-24
lines changed

demos/roms-documents/pom.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>2.6.6</version>
10-
<relativePath/> <!-- lookup parent from repository -->
9+
<version>2.7.4</version>
10+
<relativePath /> <!-- lookup parent from repository -->
1111
</parent>
1212

1313
<groupId>com.redis.om</groupId>
@@ -31,7 +31,7 @@
3131
<dependency>
3232
<groupId>com.redis.om</groupId>
3333
<artifactId>redis-om-spring</artifactId>
34-
<version>0.6.0</version>
34+
<version>0.6.1</version>
3535
</dependency>
3636
<dependency>
3737
<groupId>org.springframework.boot</groupId>
@@ -106,4 +106,4 @@
106106
</plugin>
107107
</plugins>
108108
</build>
109-
</project>
109+
</project>

demos/roms-hashes/pom.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>2.6.6</version>
10-
<relativePath/> <!-- lookup parent from repository -->
9+
<version>2.7.4</version>
10+
<relativePath /> <!-- lookup parent from repository -->
1111
</parent>
1212

1313
<groupId>com.redis.om</groupId>
@@ -29,7 +29,7 @@
2929
<dependency>
3030
<groupId>com.redis.om</groupId>
3131
<artifactId>redis-om-spring</artifactId>
32-
<version>0.6.0</version>
32+
<version>0.6.1</version>
3333
</dependency>
3434
<dependency>
3535
<groupId>org.springframework.boot</groupId>
@@ -76,4 +76,4 @@
7676
</plugin>
7777
</plugins>
7878
</build>
79-
</project>
79+
</project>

demos/roms-permits/pom.xml

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
45
<modelVersion>4.0.0</modelVersion>
56
<parent>
67
<groupId>org.springframework.boot</groupId>
78
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>2.6.6</version>
9-
<relativePath/>
9+
<version>2.7.4</version>
10+
<relativePath />
1011
<!-- lookup parent from repository -->
1112
</parent>
1213
<groupId>com.redis.om</groupId>
@@ -32,7 +33,7 @@
3233
<dependency>
3334
<groupId>com.redis.om</groupId>
3435
<artifactId>redis-om-spring</artifactId>
35-
<version>0.6.0</version>
36+
<version>0.6.1</version>
3637
</dependency>
3738

3839
<dependency>
@@ -77,4 +78,4 @@
7778
</plugins>
7879
</build>
7980

80-
</project>
81+
</project>

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66
<groupId>com.redis.om</groupId>
77
<artifactId>redis-om-spring-parent</artifactId>
8-
<version>0.6.0</version>
8+
<version>0.6.1</version>
99
<name>redis-om-spring-parent</name>
1010
<packaging>pom</packaging>
1111

redis-om-spring/pom.xml

+10-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<groupId>com.redis.om</groupId>
99
<artifactId>redis-om-spring</artifactId>
10-
<version>0.6.0</version>
10+
<version>0.6.1</version>
1111
<packaging>jar</packaging>
1212

1313
<name>redis-om-spring</name>
@@ -57,8 +57,8 @@
5757
<maven.test.source>11</maven.test.source>
5858
<maven.test.target>11</maven.test.target>
5959
<java.version>11</java.version>
60-
<spring.version>2.7.3</spring.version>
61-
<sdr.version>2.7.2</sdr.version>
60+
<spring.version>2.7.4</spring.version>
61+
<sdr.version>2.7.3</sdr.version>
6262
<jredisjson.version>1.5.0</jredisjson.version>
6363
<jredisearch.version>2.2.0</jredisearch.version>
6464
<jredisbloom.version>2.2.0</jredisbloom.version>
@@ -74,6 +74,7 @@
7474
<javapoet.version>1.13.0</javapoet.version>
7575
<assertj.version>3.23.1</assertj.version>
7676
<elementary.version>1.1.2</elementary.version>
77+
<gson.version>2.9.1</gson.version>
7778
</properties>
7879

7980
<dependencyManagement>
@@ -146,6 +147,11 @@
146147
<artifactId>guava</artifactId>
147148
<version>${guava.version}</version>
148149
</dependency>
150+
<dependency>
151+
<groupId>com.google.code.gson</groupId>
152+
<artifactId>gson</artifactId>
153+
<version>${gson.version}</version>
154+
</dependency>
149155
<dependency>
150156
<groupId>com.github.f4b6a3</groupId>
151157
<artifactId>ulid-creator</artifactId>
@@ -327,7 +333,7 @@
327333
</executions>
328334
</plugin>
329335

330-
<!--Sign the components - this is required by maven central for
336+
<!--Sign the components - this is required by maven central for
331337
releases -->
332338
<plugin>
333339
<groupId>org.apache.maven.plugins</groupId>

redis-om-spring/src/main/java/com/redis/om/spring/convert/MappingRedisOMConverter.java

+2
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@ private void writeCollection(Class<?> entityClass, @Nullable String keyspace, St
707707

708708
if ((field != null) && (collectionElementType != null) && (indexed != null || tagIndexed != null)
709709
&& CharSequence.class.isAssignableFrom(collectionElementType)) {
710+
@SuppressWarnings("null")
710711
String separator = indexed != null ? indexed.separator() : tagIndexed.separator();
711712
String value = StreamSupport.stream(values.spliterator(), false).map(Object::toString).map(QueryUtils::escape)
712713
.collect(Collectors.joining(separator));
@@ -797,6 +798,7 @@ private Object readCollectionOrArray(Class<?> entityClass, String path, Class<?>
797798

798799
if ((field != null) && (indexed != null || tagIndexed != null)
799800
&& CharSequence.class.isAssignableFrom(collectionElementType)) {
801+
@SuppressWarnings("null")
800802
String separator = indexed != null ? indexed.separator() : tagIndexed.separator();
801803
Bucket elementData = bucket.extract(path);
802804
TypeInformation<?> typeInformation = typeMapper.readType(elementData.getPropertyPath(path),

redis-om-spring/src/test/java/com/redis/om/spring/search/stream/EntityStreamTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1567,15 +1567,15 @@ void testToArrayTyped() {
15671567
void testReduceWithIdentityBifunctionAndBinaryOperator() {
15681568
Integer firstEstablish = entityStream //
15691569
.of(Company.class) //
1570-
.reduce(Integer.MAX_VALUE, (minimum, company) -> Integer.min(minimum, company.getYearFounded()), Integer::min);
1570+
.reduce(Integer.MAX_VALUE, (minimum, company) -> Integer.min(minimum, company.getYearFounded()), (t, u) -> Integer.min(t, u));
15711571
assertThat(firstEstablish).isEqualTo(1975);
15721572
}
15731573

15741574
@Test
15751575
void testReduceWithMethodReferenceAndCombiner() {
15761576
int result = entityStream //
15771577
.of(Company.class) //
1578-
.reduce(0, (acc, company) -> acc + company.getYearFounded(), Integer::sum);
1578+
.reduce(0, (acc, company) -> acc + company.getYearFounded(), (t, u) -> Integer.sum(t, u));
15791579

15801580
assertThat(result).isEqualTo(2011 + 1975 + 2003);
15811581
}
@@ -1611,7 +1611,7 @@ void testReduceWithMethodReferenceOnMappedField() {
16111611
int result = entityStream //
16121612
.of(Company.class) //
16131613
.map(Company$.YEAR_FOUNDED) //
1614-
.reduce(0, Integer::sum);
1614+
.reduce(0, (t, u) -> Integer.sum(t, u));
16151615

16161616
assertThat(result).isEqualTo(2011 + 1975 + 2003);
16171617
}
@@ -1646,7 +1646,7 @@ void testReduceWithIdentityBifunctionAndBinaryOperatorOnMappedField() {
16461646
Integer firstEstablish = entityStream //
16471647
.of(Company.class) //
16481648
.map(Company$.YEAR_FOUNDED) //
1649-
.reduce(Integer.MAX_VALUE, (minimum, yearFounded) -> Integer.min(minimum, yearFounded), Integer::min);
1649+
.reduce(Integer.MAX_VALUE, (minimum, yearFounded) -> Integer.min(minimum, yearFounded), (t, u) -> Integer.min(t, u));
16501650
assertThat(firstEstablish).isEqualTo(1975);
16511651
}
16521652

redis-om-spring/src/test/java/com/redis/om/spring/search/stream/WrapperSearchStreamTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ void testReduceWithMethodReferenceOnMappedField() {
402402
.of(Company.class) //
403403
.map(Company$.YEAR_FOUNDED) //
404404
.sequential() //
405-
.reduce(0, Integer::sum);
405+
.reduce(0, (t, u) -> Integer.sum(t, u));
406406

407407
assertThat(result).isEqualTo(2011 + 1975 + 2003);
408408
}
@@ -440,7 +440,7 @@ void testReduceWithIdentityBifunctionAndBinaryOperatorOnMappedField() {
440440
.of(Company.class) //
441441
.map(Company$.YEAR_FOUNDED) //
442442
.sequential() //
443-
.reduce(Integer.MAX_VALUE, (minimum, yearFounded) -> Integer.min(minimum, yearFounded), Integer::min);
443+
.reduce(Integer.MAX_VALUE, (minimum, yearFounded) -> Integer.min(minimum, yearFounded), (t, u) -> Integer.min(t, u));
444444
assertThat(firstEstablish).isEqualTo(1975);
445445
}
446446

0 commit comments

Comments
 (0)