Skip to content

Commit 6096205

Browse files
committed
Merge remote-tracking branch 'origin/1.0.x'
2 parents 135da47 + b2dd6dc commit 6096205

File tree

9 files changed

+19
-27
lines changed

9 files changed

+19
-27
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88
}
99

1010
group = 'io.github.waileong'
11-
version = '1.0.3'
11+
version = '1.0.4'
1212
java {
1313
toolchain {
1414
languageVersion = JavaLanguageVersion.of(17)

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ org.gradle.workers.max=4
33
org.gradle.jvmargs=-Xmx1024M
44

55

6-
spring_boot_version=3.2.3
6+
spring_boot_version=3.3.3
77
jjwt_version=0.11.5
88
commons_pool2_version=2.12.0

readme.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
= Spring Boot and Firebase Cloud Messaging (FCM) Integration via REST API for Push Notifications
22

3-
image:https://img.shields.io/badge/Spring%20Boot-3.2.x-brightgreen.svg[link="https://spring.io/projects/spring-boot"]
3+
image:https://img.shields.io/badge/Spring%20Boot-3.3.x-brightgreen.svg[link="https://spring.io/projects/spring-boot"]
44
image:https://img.shields.io/badge/Java-17-blue.svg[link="https://adoptopenjdk.net/?variant=openjdk17&jvmVariant=hotspot"]
55
image:https://img.shields.io/badge/Java-21-blue.svg[link="https://adoptopenjdk.net/?variant=openjdk21&jvmVariant=hotspot"]
66

@@ -61,7 +61,7 @@ Add the following to your `build.gradle`:
6161

6262
----
6363
dependencies {
64-
implementation 'io.github.waileong:spring-boot-fcm:1.0.3'
64+
implementation 'io.github.waileong:spring-boot-fcm:1.0.4'
6565
}
6666
----
6767

@@ -74,7 +74,7 @@ Insert this dependency in your `pom.xml`:
7474
<dependency>
7575
<groupId>io.github.waileong</groupId>
7676
<artifactId>spring-boot-fcm</artifactId>
77-
<version>1.0.3</version>
77+
<version>1.0.4</version>
7878
</dependency>
7979
</dependencies>
8080
----

src/main/java/io/github/waileong/fcm/authentication/FcmJwtTokenPooledObjectFactory.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import org.apache.commons.pool2.BasePooledObjectFactory;
88
import org.apache.commons.pool2.PooledObject;
99
import org.apache.commons.pool2.impl.DefaultPooledObject;
10-
import org.slf4j.Logger;
11-
import org.slf4j.LoggerFactory;
1210

1311
import java.time.Instant;
1412
import java.util.Date;
@@ -29,7 +27,6 @@
2927
* @author Wai Leong
3028
*/
3129
public class FcmJwtTokenPooledObjectFactory extends BasePooledObjectFactory<FcmJwtToken> {
32-
private final Logger logger = LoggerFactory.getLogger(this.getClass());
3330
private final FcmProperties.Credential credential;
3431
private static final String FCM_ENDPOINT_URL = "https://fcm.googleapis.com/";
3532

src/main/java/io/github/waileong/fcm/exception/FcmRestClientException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
public class FcmRestClientException extends RuntimeException {
1616
private final int httpStatus;
17-
private final FcmError error;
17+
private final transient FcmError error;
1818

1919
/**
2020
* Constructs a new FcmRestClientException with specified HTTP status code and FCM error details.

src/main/java/io/github/waileong/fcm/exception/FcmRestClientResponseErrorHandler.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import com.fasterxml.jackson.core.JsonProcessingException;
44
import com.fasterxml.jackson.databind.ObjectMapper;
55
import io.github.waileong.fcm.service.domain.FcmErrorResponse;
6-
import org.slf4j.Logger;
7-
import org.slf4j.LoggerFactory;
86
import org.springframework.http.HttpStatusCode;
97
import org.springframework.http.client.ClientHttpResponse;
108
import org.springframework.web.client.DefaultResponseErrorHandler;
@@ -18,7 +16,6 @@
1816
* @author Wai Leong
1917
**/
2018
public class FcmRestClientResponseErrorHandler extends DefaultResponseErrorHandler {
21-
private final Logger logger = LoggerFactory.getLogger(this.getClass());
2219
private final ObjectMapper objectMapper;
2320

2421
public FcmRestClientResponseErrorHandler(ObjectMapper objectMapper) {

src/main/java/io/github/waileong/fcm/service/impl/FcmServiceImpl.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import io.github.waileong.fcm.service.domain.FcmMessage;
88
import io.github.waileong.fcm.service.domain.FcmSendRequest;
99
import org.apache.commons.pool2.impl.GenericObjectPool;
10-
import org.slf4j.Logger;
11-
import org.slf4j.LoggerFactory;
1210
import org.springframework.aot.hint.annotation.RegisterReflectionForBinding;
1311
import org.springframework.web.client.RestClient;
1412

@@ -28,7 +26,6 @@
2826
*/
2927
@RegisterReflectionForBinding({FcmSendRequest.class, FcmMessage.class, FcmError.class, FcmErrorResponse.class})
3028
public class FcmServiceImpl implements FcmService {
31-
private final Logger logger = LoggerFactory.getLogger(this.getClass());
3229
private final RestClient fcmRestClient;
3330
private final GenericObjectPool<FcmJwtToken> fcmJwtTokenPool;
3431

@@ -61,7 +58,7 @@ private String getAccessToken(GenericObjectPool<FcmJwtToken> pool) {
6158
fcmJwtToken = pool.borrowObject();
6259
return fcmJwtToken.token();
6360
} catch (Exception e) {
64-
throw new RuntimeException(e);
61+
throw new IllegalStateException(e);
6562
} finally {
6663
if (fcmJwtToken != null) {
6764
pool.returnObject(fcmJwtToken);

src/main/java/io/github/waileong/fcm/util/RSAKeyPairUtil.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
*/
1818
public class RSAKeyPairUtil {
1919

20+
private RSAKeyPairUtil() {
21+
throw new IllegalStateException("Utility class");
22+
}
23+
2024
/**
2125
* Converts a base64 encoded string representation of an RSA private key into an {@link RSAPrivateKey} object.
2226
* <p>

src/test/java/io/github/waileong/fcm/service/FcmServiceTest.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package io.github.waileong.fcm.service;
22

3-
import jakarta.validation.Validator;
4-
import org.junit.jupiter.api.Disabled;
5-
import org.junit.jupiter.api.Test;
63
import io.github.waileong.fcm.config.FcmAutoConfiguration;
74
import io.github.waileong.fcm.service.domain.FcmMessage;
85
import io.github.waileong.fcm.service.domain.FcmNotification;
96
import io.github.waileong.fcm.service.domain.FcmSendRequest;
10-
import org.slf4j.Logger;
11-
import org.slf4j.LoggerFactory;
7+
import jakarta.validation.Validator;
8+
import org.junit.jupiter.api.Disabled;
9+
import org.junit.jupiter.api.Test;
1210
import org.springframework.beans.factory.annotation.Autowired;
1311
import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration;
1412
import org.springframework.boot.test.context.SpringBootTest;
@@ -37,8 +35,7 @@
3735
webEnvironment = SpringBootTest.WebEnvironment.NONE)
3836
@ActiveProfiles("test")
3937
@Disabled
40-
public class FcmServiceTest {
41-
private final Logger logger = LoggerFactory.getLogger(this.getClass());
38+
class FcmServiceTest {
4239

4340
static {
4441
// Enable detailed HTTP client logging for debugging purposes
@@ -49,7 +46,7 @@ public class FcmServiceTest {
4946
private FcmService fcmService;
5047

5148
@Test
52-
public void testSendNotification() throws Exception {
49+
void testSendNotification() {
5350
String deviceToken = "";
5451
String title = "FCM Title";
5552
String message = "FCM Message";
@@ -75,14 +72,14 @@ public void testSendNotification() throws Exception {
7572
*/
7673
@Configuration(proxyBeanMethods = false)
7774
@Import({FcmAutoConfiguration.class, TaskExecutionAutoConfiguration.class})
78-
public static class ContextConfiguration {
75+
static class ContextConfiguration {
7976
@Bean
80-
public Validator validator() {
77+
Validator validator() {
8178
return new LocalValidatorFactoryBean();
8279
}
8380

8481
@Bean
85-
public MethodValidationPostProcessor methodValidationPostProcessor() {
82+
MethodValidationPostProcessor methodValidationPostProcessor() {
8683
return new MethodValidationPostProcessor();
8784
}
8885
}

0 commit comments

Comments
 (0)