diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 164c5635d..0e9dc20b6 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,5 +8,3 @@ updates: interval: 'monthly' commit-message: prefix: 'build' - ignore: - - dependency-name: 'jakarta.servlet:jakarta-servlet-api' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6a076df01..501ea9cff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: - name: Checkout the repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - name: Setup Java - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b + uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 with: distribution: 'corretto' java-version: ${{ matrix.java }} @@ -42,7 +42,7 @@ jobs: - name: Checkout the repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - name: Setup Java - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b + uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 with: distribution: 'zulu' java-version: ${{ matrix.java }} @@ -50,6 +50,6 @@ jobs: - name: Test with Maven run: mvn -e --batch-mode verify -T 1C - name: Run Codecov - uses: codecov/codecov-action@288befbd1044bd1756afb0bdae077549e0ddb31f + uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 09a197894..dddfa5afa 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -27,7 +27,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@cbe18979603527f12c7871a6eb04833ecf1548c7 + uses: github/codeql-action/init@dd746615b3b9d728a6a37ca2045b68ca76d4841a with: languages: java-kotlin build-mode: none @@ -37,6 +37,6 @@ jobs: # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs # queries: security-extended,security-and-quality - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@cbe18979603527f12c7871a6eb04833ecf1548c7 + uses: github/codeql-action/analyze@dd746615b3b9d728a6a37ca2045b68ca76d4841a with: category: "/language:java-kotlin" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index becc8627f..2ae64f1f4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,7 +17,7 @@ jobs: with: ref: ${{ github.event.release.target_commitish }} - name: Setup Java - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b + uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 with: java-version: 21 distribution: 'temurin' diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index b48d0fb47..a1296d7c4 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -47,7 +47,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: Upload artifact - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 with: name: SARIF file path: results.sarif diff --git a/CHANGELOG.md b/CHANGELOG.md index f6e404851..7196b5357 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +# [8.16.0] - 2025-01-31 +- Added logging for requests & responses based on `java.util.logging` +- Improved SMS API documentation +- Deprecated Number Insight v2 / Fraud Score API +- Minor internal refactoring based on code coverage improvements + # [8.15.1] - 2024-12-19 - Removed hardcoded domain validation from `VoiceClient.downloadRecordingRaw` diff --git a/README.md b/README.md index 95c20cee7..aab83d332 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![codecov](https://codecov.io/gh/vonage/vonage-java-sdk/branch/main/graph/badge.svg)](https://codecov.io/gh/vonage/vonage-java-sdk) ![SLOC](https://sloc.xyz/github/vonage/vonage-java-sdk/) [![Snyk](https://snyk.io/test/github/vonage/vonage-java-sdk/badge.svg)](https://snyk.io/test/github/vonage/vonage-java-sdk) -[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/Vonage/vonage-java-sdk/badge)](https://scorecard.dev/viewer/?uri=github.com/Vonage/vonage-kotlin-sdk) +[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/Vonage/vonage-java-sdk/badge)](https://scorecard.dev/viewer/?uri=github.com/Vonage/vonage-java-sdk) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.1%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE.txt) @@ -147,6 +147,28 @@ VonageClient client = VonageClient.builder() .build(); ``` +### Logging + +The SDK uses [Java's built-in logging library (`java.util.logging`)](https://docs.oracle.com/javase/8/docs/api/java/util/logging/package-summary.html) to log requests and responses. +This is primarily centralised in two places: [AbstractMethod](src/main/java/com/vonage/client/AbstractMethod.java) +and [DynamicEndpoint](src/main/java/com/vonage/client/DynamicEndpoint.java). +For most cases, the former should provide sufficient level of detail. +It can be activated by setting the logger level to `FINE`, like so: + +```java +LogManager.getLogManager().getLogger("com.vonage.client.AbstractMethod").setLevel(Level.FINE); +``` + +Since the logger on `DynamicEndpoint` is not static and based on the class name, it will only be activated if the +global log level is set to `FINE`. You can set the global log level like so: + +```java +LogManager.getLogManager().getLogger("").setLevel(Level.FINE); +``` + +This will also activate the logger on `AbstractMethod` if you haven't already specified the desired log level on +that class, so you don't need to set it separately. + ## Frequently Asked Questions **Q: What happened to [`com.vonage:client`](https://search.maven.org/artifact/com.vonage/client)?** diff --git a/pom.xml b/pom.xml index 9b3ac952b..6a3e9f102 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.vonage server-sdk - 8.15.1 + 8.16.0 Vonage Java Server SDK Java client for Vonage APIs @@ -93,13 +93,13 @@ jakarta.servlet jakarta.servlet-api - 4.0.4 + 6.1.0 test commons-codec commons-codec - 1.17.2 + 1.18.0 test diff --git a/src/main/java/com/vonage/client/HttpWrapper.java b/src/main/java/com/vonage/client/HttpWrapper.java index 01eba80fa..5c8324b14 100644 --- a/src/main/java/com/vonage/client/HttpWrapper.java +++ b/src/main/java/com/vonage/client/HttpWrapper.java @@ -37,7 +37,7 @@ public class HttpWrapper { private static final String CLIENT_NAME = "vonage-java-sdk", - CLIENT_VERSION = "8.15.1", + CLIENT_VERSION = "8.16.0", JAVA_VERSION = System.getProperty("java.version"), USER_AGENT = String.format("%s/%s java/%s", CLIENT_NAME, CLIENT_VERSION, JAVA_VERSION); diff --git a/src/main/java/com/vonage/client/VonageClient.java b/src/main/java/com/vonage/client/VonageClient.java index 482a0116f..6cefd58f2 100644 --- a/src/main/java/com/vonage/client/VonageClient.java +++ b/src/main/java/com/vonage/client/VonageClient.java @@ -269,7 +269,9 @@ public VideoClient getVideoClient() { * * @return The {@linkplain NumberInsight2Client}. * @since 8.2.0 + * @deprecated This API is deprecated and will be removed in the next major release. */ + @Deprecated public NumberInsight2Client getNumberInsight2Client() { return numberInsight2; } diff --git a/src/main/java/com/vonage/client/numberinsight2/NumberInsight2Client.java b/src/main/java/com/vonage/client/numberinsight2/NumberInsight2Client.java index 36ef74a0d..cb5b017ec 100644 --- a/src/main/java/com/vonage/client/numberinsight2/NumberInsight2Client.java +++ b/src/main/java/com/vonage/client/numberinsight2/NumberInsight2Client.java @@ -25,7 +25,10 @@ /** * A client for talking to the Vonage NumberInsight2Client API. The standard way to obtain an instance of this class is to use * {@link VonageClient#getNumberInsight2Client()}. + * + * @deprecated This API is deprecated and will be removed in the next major release. */ +@Deprecated public class NumberInsight2Client { final RestEndpoint fraudCheck; diff --git a/src/main/java/com/vonage/client/numberinsight2/package-info.java b/src/main/java/com/vonage/client/numberinsight2/package-info.java index c60ae6518..081c4242f 100644 --- a/src/main/java/com/vonage/client/numberinsight2/package-info.java +++ b/src/main/java/com/vonage/client/numberinsight2/package-info.java @@ -18,5 +18,7 @@ * Number Insight v2 API. * * @since 8.2.0 + * + * @deprecated This API is deprecated and will be removed in the next major release. */ package com.vonage.client.numberinsight2; \ No newline at end of file diff --git a/src/test/java/com/vonage/client/auth/RequestSigningTest.java b/src/test/java/com/vonage/client/auth/RequestSigningTest.java index b45627526..51ce0b48c 100644 --- a/src/test/java/com/vonage/client/auth/RequestSigningTest.java +++ b/src/test/java/com/vonage/client/auth/RequestSigningTest.java @@ -22,9 +22,9 @@ import org.junit.jupiter.api.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import javax.servlet.ReadListener; -import javax.servlet.ServletInputStream; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.ReadListener; +import jakarta.servlet.ServletInputStream; +import jakarta.servlet.http.HttpServletRequest; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.LinkedHashMap;