diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index b0a634cb6c..0fc46e6b60 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -7,3 +7,4 @@ jobs: name: Run PR Build Workflow if: ${{ github.repository_owner == 'ballerina-platform' }} uses: ballerina-platform/ballerina-standard-library/.github/workflows/pull-request-build-template.yml@main + secrets: inherit diff --git a/ballerina-tests/http-advanced-tests/Ballerina.toml b/ballerina-tests/http-advanced-tests/Ballerina.toml index d7eb0cee7d..62546f2355 100644 --- a/ballerina-tests/http-advanced-tests/Ballerina.toml +++ b/ballerina-tests/http-advanced-tests/Ballerina.toml @@ -1,17 +1,17 @@ [package] org = "ballerina" name = "http_advanced_tests" -version = "2.10.3" +version = "2.10.4" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.10.3" +version = "2.10.4" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.10.3.jar" +path = "../../test-utils/build/libs/http-test-utils-2.10.4-SNAPSHOT.jar" diff --git a/ballerina-tests/http-advanced-tests/Dependencies.toml b/ballerina-tests/http-advanced-tests/Dependencies.toml index a3485c7f04..7501b3df56 100644 --- a/ballerina-tests/http-advanced-tests/Dependencies.toml +++ b/ballerina-tests/http-advanced-tests/Dependencies.toml @@ -72,7 +72,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.10.3" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -105,7 +105,7 @@ modules = [ [[package]] org = "ballerina" name = "http_advanced_tests" -version = "2.10.3" +version = "2.10.4" dependencies = [ {org = "ballerina", name = "crypto"}, {org = "ballerina", name = "file"}, @@ -125,7 +125,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.10.3" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, diff --git a/ballerina-tests/http-client-tests/Ballerina.toml b/ballerina-tests/http-client-tests/Ballerina.toml index ff7c5bb6f2..7c61a02480 100644 --- a/ballerina-tests/http-client-tests/Ballerina.toml +++ b/ballerina-tests/http-client-tests/Ballerina.toml @@ -1,17 +1,17 @@ [package] org = "ballerina" name = "http_client_tests" -version = "2.10.3" +version = "2.10.4" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.10.3" +version = "2.10.4" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.10.3.jar" +path = "../../test-utils/build/libs/http-test-utils-2.10.4-SNAPSHOT.jar" diff --git a/ballerina-tests/http-client-tests/Dependencies.toml b/ballerina-tests/http-client-tests/Dependencies.toml index 92b943803c..0b632e93c6 100644 --- a/ballerina-tests/http-client-tests/Dependencies.toml +++ b/ballerina-tests/http-client-tests/Dependencies.toml @@ -69,7 +69,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.10.3" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -102,7 +102,7 @@ modules = [ [[package]] org = "ballerina" name = "http_client_tests" -version = "2.10.3" +version = "2.10.4" dependencies = [ {org = "ballerina", name = "constraint"}, {org = "ballerina", name = "http"}, @@ -121,7 +121,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.10.3" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, diff --git a/ballerina-tests/http-dispatching-tests/Ballerina.toml b/ballerina-tests/http-dispatching-tests/Ballerina.toml index f1899bb7e8..d4342e485c 100644 --- a/ballerina-tests/http-dispatching-tests/Ballerina.toml +++ b/ballerina-tests/http-dispatching-tests/Ballerina.toml @@ -1,17 +1,17 @@ [package] org = "ballerina" name = "http_dispatching_tests" -version = "2.10.3" +version = "2.10.4" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.10.3" +version = "2.10.4" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.10.3.jar" +path = "../../test-utils/build/libs/http-test-utils-2.10.4-SNAPSHOT.jar" diff --git a/ballerina-tests/http-dispatching-tests/Dependencies.toml b/ballerina-tests/http-dispatching-tests/Dependencies.toml index 4de86ceead..4789c26d1f 100644 --- a/ballerina-tests/http-dispatching-tests/Dependencies.toml +++ b/ballerina-tests/http-dispatching-tests/Dependencies.toml @@ -69,7 +69,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.10.3" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -102,7 +102,7 @@ modules = [ [[package]] org = "ballerina" name = "http_dispatching_tests" -version = "2.10.3" +version = "2.10.4" dependencies = [ {org = "ballerina", name = "constraint"}, {org = "ballerina", name = "http"}, @@ -124,7 +124,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.10.3" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, diff --git a/ballerina-tests/http-dispatching-tests/tests/service_dispatching_data_binding_test.bal b/ballerina-tests/http-dispatching-tests/tests/service_dispatching_data_binding_test.bal index b7ca132bf4..b983b2e23d 100644 --- a/ballerina-tests/http-dispatching-tests/tests/service_dispatching_data_binding_test.bal +++ b/ballerina-tests/http-dispatching-tests/tests/service_dispatching_data_binding_test.bal @@ -110,6 +110,10 @@ service /dataBinding on generalListener { return "body11"; } + resource function post body12(map form) returns map { + return form; + } + resource function get negative1(http:Caller caller) returns error? { lock { var err = generalListener.attach(multipleAnnot1, "multipleAnnot1"); @@ -466,6 +470,18 @@ function testDataBindingWithMapOfString() { } } +@test:Config {} +function testDataBindingWithEncodedKeyValuePair() { + http:Request req = new; + req.setTextPayload("key0%261%3D2=value1&key2=value2%26value3%3Dvalue4", contentType = "application/x-www-form-urlencoded"); + http:Response|error response = dataBindingClient->post("/dataBinding/body12", req); + if response is http:Response { + common:assertJsonPayload(response.getJsonPayload(), {"key0&1=2": "value1", "key2": "value2&value3=value4"}); + } else { + test:assertFail(msg = "Found unexpected output type: " + response.message()); + } +} + //Test data binding with map of string type @test:Config {} function testDataBindingWithMapOfStringNegative() { diff --git a/ballerina-tests/http-interceptor-tests/Ballerina.toml b/ballerina-tests/http-interceptor-tests/Ballerina.toml index 15193e03e9..b621512c87 100644 --- a/ballerina-tests/http-interceptor-tests/Ballerina.toml +++ b/ballerina-tests/http-interceptor-tests/Ballerina.toml @@ -1,17 +1,17 @@ [package] org = "ballerina" name = "http_interceptor_tests" -version = "2.10.3" +version = "2.10.4" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.10.3" +version = "2.10.4" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.10.3.jar" +path = "../../test-utils/build/libs/http-test-utils-2.10.4-SNAPSHOT.jar" diff --git a/ballerina-tests/http-interceptor-tests/Dependencies.toml b/ballerina-tests/http-interceptor-tests/Dependencies.toml index 73e8518c9e..73259210ab 100644 --- a/ballerina-tests/http-interceptor-tests/Dependencies.toml +++ b/ballerina-tests/http-interceptor-tests/Dependencies.toml @@ -66,7 +66,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.10.3" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -99,7 +99,7 @@ modules = [ [[package]] org = "ballerina" name = "http_interceptor_tests" -version = "2.10.3" +version = "2.10.4" dependencies = [ {org = "ballerina", name = "http"}, {org = "ballerina", name = "http_test_common"}, @@ -115,7 +115,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.10.3" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, diff --git a/ballerina-tests/http-misc-tests/Ballerina.toml b/ballerina-tests/http-misc-tests/Ballerina.toml index 66faa4827f..da44462b2f 100644 --- a/ballerina-tests/http-misc-tests/Ballerina.toml +++ b/ballerina-tests/http-misc-tests/Ballerina.toml @@ -1,17 +1,17 @@ [package] org = "ballerina" name = "http_misc_tests" -version = "2.10.3" +version = "2.10.4" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.10.3" +version = "2.10.4" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.10.3.jar" +path = "../../test-utils/build/libs/http-test-utils-2.10.4-SNAPSHOT.jar" diff --git a/ballerina-tests/http-misc-tests/Dependencies.toml b/ballerina-tests/http-misc-tests/Dependencies.toml index cb1c862f0d..90c4aba515 100644 --- a/ballerina-tests/http-misc-tests/Dependencies.toml +++ b/ballerina-tests/http-misc-tests/Dependencies.toml @@ -66,7 +66,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.10.3" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -99,7 +99,7 @@ modules = [ [[package]] org = "ballerina" name = "http_misc_tests" -version = "2.10.3" +version = "2.10.4" dependencies = [ {org = "ballerina", name = "http"}, {org = "ballerina", name = "http_test_common"}, @@ -118,7 +118,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.10.3" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, diff --git a/ballerina-tests/http-resiliency-tests/Ballerina.toml b/ballerina-tests/http-resiliency-tests/Ballerina.toml index 89059995d7..9b955cff89 100644 --- a/ballerina-tests/http-resiliency-tests/Ballerina.toml +++ b/ballerina-tests/http-resiliency-tests/Ballerina.toml @@ -1,17 +1,17 @@ [package] org = "ballerina" name = "http_resiliency_tests" -version = "2.10.3" +version = "2.10.4" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.10.3" +version = "2.10.4" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.10.3.jar" +path = "../../test-utils/build/libs/http-test-utils-2.10.4-SNAPSHOT.jar" diff --git a/ballerina-tests/http-resiliency-tests/Dependencies.toml b/ballerina-tests/http-resiliency-tests/Dependencies.toml index fd885fab95..2ad97b20ff 100644 --- a/ballerina-tests/http-resiliency-tests/Dependencies.toml +++ b/ballerina-tests/http-resiliency-tests/Dependencies.toml @@ -66,7 +66,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.10.3" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -99,7 +99,7 @@ modules = [ [[package]] org = "ballerina" name = "http_resiliency_tests" -version = "2.10.3" +version = "2.10.4" dependencies = [ {org = "ballerina", name = "http"}, {org = "ballerina", name = "http_test_common"}, @@ -116,7 +116,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.10.3" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, diff --git a/ballerina-tests/http-security-tests/Ballerina.toml b/ballerina-tests/http-security-tests/Ballerina.toml index 225f1b8e00..244e2e3ab7 100644 --- a/ballerina-tests/http-security-tests/Ballerina.toml +++ b/ballerina-tests/http-security-tests/Ballerina.toml @@ -1,17 +1,17 @@ [package] org = "ballerina" name = "http_security_tests" -version = "2.10.3" +version = "2.10.4" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.10.3" +version = "2.10.4" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.10.3.jar" +path = "../../test-utils/build/libs/http-test-utils-2.10.4-SNAPSHOT.jar" diff --git a/ballerina-tests/http-security-tests/Dependencies.toml b/ballerina-tests/http-security-tests/Dependencies.toml index 644f14e659..f3015bb49b 100644 --- a/ballerina-tests/http-security-tests/Dependencies.toml +++ b/ballerina-tests/http-security-tests/Dependencies.toml @@ -69,7 +69,7 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.10.3" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -102,7 +102,7 @@ modules = [ [[package]] org = "ballerina" name = "http_security_tests" -version = "2.10.3" +version = "2.10.4" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "http"}, @@ -120,7 +120,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.10.3" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, diff --git a/ballerina-tests/http-service-tests/Ballerina.toml b/ballerina-tests/http-service-tests/Ballerina.toml index 8e0c6e7c56..133fb1134d 100644 --- a/ballerina-tests/http-service-tests/Ballerina.toml +++ b/ballerina-tests/http-service-tests/Ballerina.toml @@ -1,17 +1,17 @@ [package] org = "ballerina" name = "http_service_tests" -version = "2.10.3" +version = "2.10.4" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.10.3" +version = "2.10.4" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.10.3.jar" +path = "../../test-utils/build/libs/http-test-utils-2.10.4-SNAPSHOT.jar" diff --git a/ballerina-tests/http-service-tests/Dependencies.toml b/ballerina-tests/http-service-tests/Dependencies.toml index 1081578092..6cf2c1a3bb 100644 --- a/ballerina-tests/http-service-tests/Dependencies.toml +++ b/ballerina-tests/http-service-tests/Dependencies.toml @@ -69,7 +69,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.10.3" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -102,7 +102,7 @@ modules = [ [[package]] org = "ballerina" name = "http_service_tests" -version = "2.10.3" +version = "2.10.4" dependencies = [ {org = "ballerina", name = "file"}, {org = "ballerina", name = "http"}, @@ -121,7 +121,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.10.3" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, diff --git a/ballerina-tests/http-test-common/Ballerina.toml b/ballerina-tests/http-test-common/Ballerina.toml index 7f598aeb0a..a1cd6aa6cd 100644 --- a/ballerina-tests/http-test-common/Ballerina.toml +++ b/ballerina-tests/http-test-common/Ballerina.toml @@ -1,4 +1,4 @@ [package] org = "ballerina" name = "http_test_common" -version = "2.10.3" +version = "2.10.4" diff --git a/ballerina-tests/http-test-common/Dependencies.toml b/ballerina-tests/http-test-common/Dependencies.toml index 57e2c8ed56..810e229a31 100644 --- a/ballerina-tests/http-test-common/Dependencies.toml +++ b/ballerina-tests/http-test-common/Dependencies.toml @@ -10,7 +10,7 @@ distribution-version = "2201.8.0" [[package]] org = "ballerina" name = "http_test_common" -version = "2.10.3" +version = "2.10.4" dependencies = [ {org = "ballerina", name = "lang.string"}, {org = "ballerina", name = "mime"}, diff --git a/ballerina-tests/http2-tests/Ballerina.toml b/ballerina-tests/http2-tests/Ballerina.toml index 07dae3307c..2a965b9030 100644 --- a/ballerina-tests/http2-tests/Ballerina.toml +++ b/ballerina-tests/http2-tests/Ballerina.toml @@ -1,17 +1,17 @@ [package] org = "ballerina" name = "http2_tests" -version = "2.10.3" +version = "2.10.4" [[dependency]] org = "ballerina" name = "http_test_common" repository = "local" -version = "2.10.3" +version = "2.10.4" [platform.java17] graalvmCompatible = true [[platform.java17.dependency]] scope = "testOnly" -path = "../../test-utils/build/libs/http-test-utils-2.10.3.jar" +path = "../../test-utils/build/libs/http-test-utils-2.10.4-SNAPSHOT.jar" diff --git a/ballerina-tests/http2-tests/Dependencies.toml b/ballerina-tests/http2-tests/Dependencies.toml index b576aecebf..93951afa33 100644 --- a/ballerina-tests/http2-tests/Dependencies.toml +++ b/ballerina-tests/http2-tests/Dependencies.toml @@ -69,7 +69,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.10.3" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "auth"}, @@ -102,7 +102,7 @@ modules = [ [[package]] org = "ballerina" name = "http2_tests" -version = "2.10.3" +version = "2.10.4" dependencies = [ {org = "ballerina", name = "file"}, {org = "ballerina", name = "http"}, @@ -121,7 +121,7 @@ modules = [ [[package]] org = "ballerina" name = "http_test_common" -version = "2.10.3" +version = "2.10.4" scope = "testOnly" dependencies = [ {org = "ballerina", name = "lang.string"}, diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 93e22790f2..6620f67138 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,7 +1,7 @@ [package] org = "ballerina" name = "http" -version = "2.10.3" +version = "2.10.4" authors = ["Ballerina"] keywords = ["http", "network", "service", "listener", "client"] repository = "https://github.com/ballerina-platform/module-ballerina-http" @@ -16,8 +16,8 @@ graalvmCompatible = true [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" artifactId = "http-native" -version = "2.10.3" -path = "../native/build/libs/http-native-2.10.3.jar" +version = "2.10.4" +path = "../native/build/libs/http-native-2.10.4-SNAPSHOT.jar" [[platform.java17.dependency]] groupId = "io.ballerina.stdlib" diff --git a/ballerina/CompilerPlugin.toml b/ballerina/CompilerPlugin.toml index 4f0b741f05..a074e387cf 100644 --- a/ballerina/CompilerPlugin.toml +++ b/ballerina/CompilerPlugin.toml @@ -3,4 +3,4 @@ id = "http-compiler-plugin" class = "io.ballerina.stdlib.http.compiler.HttpCompilerPlugin" [[dependency]] -path = "../compiler-plugin/build/libs/http-compiler-plugin-2.10.3.jar" +path = "../compiler-plugin/build/libs/http-compiler-plugin-2.10.4-SNAPSHOT.jar" diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 6e26ed9026..f17306eb50 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -76,7 +76,7 @@ modules = [ [[package]] org = "ballerina" name = "http" -version = "2.10.3" +version = "2.10.4" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "cache"}, diff --git a/changelog.md b/changelog.md index 724a1d1a3f..2acd73f923 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,14 @@ This file contains all the notable changes done to the Ballerina HTTP package th The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Fixed +- [Fix URL encoded form data binding with encoded `&` and `=` characters](https://github.com/ballerina-platform/ballerina-standard-library/issues/5068) + +### Changed +- [Make some of the Java classes proper utility classes](https://github.com/ballerina-platform/ballerina-standard-library/issues/4923) + ## [2.10.3] - 2023-10-13 ### Fixed diff --git a/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/http/compiler/CompilerPluginTestConstants.java b/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/http/compiler/CompilerPluginTestConstants.java index 65aac2f2ab..6eb81f72d8 100644 --- a/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/http/compiler/CompilerPluginTestConstants.java +++ b/compiler-plugin-tests/src/test/java/io/ballerina/stdlib/http/compiler/CompilerPluginTestConstants.java @@ -21,7 +21,9 @@ /** * Constants related to compiler plugin tests. */ -public class CompilerPluginTestConstants { +public final class CompilerPluginTestConstants { + private CompilerPluginTestConstants() {} + public static final String HTTP_101 = "HTTP_101"; public static final String HTTP_102 = "HTTP_102"; public static final String HTTP_103 = "HTTP_103"; diff --git a/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/Constants.java b/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/Constants.java index e9a982e2bb..17f43a34ee 100644 --- a/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/Constants.java +++ b/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/Constants.java @@ -21,7 +21,9 @@ /** * Constants related to compiler plugin implementation. */ -public class Constants { +public final class Constants { + private Constants() {} + public static final String BALLERINA = "ballerina"; public static final String HTTP = "http"; public static final String SERVICE_KEYWORD = "service"; diff --git a/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/HttpCompilerPluginUtil.java b/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/HttpCompilerPluginUtil.java index 21b014b2ab..bb8d59bafa 100644 --- a/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/HttpCompilerPluginUtil.java +++ b/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/HttpCompilerPluginUtil.java @@ -93,7 +93,9 @@ /** * Utility class providing http compiler plugin utility methods. */ -public class HttpCompilerPluginUtil { +public final class HttpCompilerPluginUtil { + + private HttpCompilerPluginUtil() {} public static void updateDiagnostic(SyntaxNodeAnalysisContext ctx, Location location, HttpDiagnosticCodes httpDiagnosticCodes) { diff --git a/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/HttpInterceptorResourceValidator.java b/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/HttpInterceptorResourceValidator.java index baa7db7db0..7c54ae8bc2 100644 --- a/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/HttpInterceptorResourceValidator.java +++ b/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/HttpInterceptorResourceValidator.java @@ -35,7 +35,9 @@ /** * Validates a ballerina http interceptor resource. */ -public class HttpInterceptorResourceValidator { +public final class HttpInterceptorResourceValidator { + private HttpInterceptorResourceValidator() {} + public static void validateResource(SyntaxNodeAnalysisContext ctx, FunctionDefinitionNode member, String type, Map typeSymbols) { checkResourceAnnotation(ctx, member); diff --git a/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/HttpResourceValidator.java b/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/HttpResourceValidator.java index a0b2feb6ee..8250cfc39e 100644 --- a/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/HttpResourceValidator.java +++ b/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/HttpResourceValidator.java @@ -128,7 +128,9 @@ /** * Validates a ballerina http resource. */ -public class HttpResourceValidator { +public final class HttpResourceValidator { + + private HttpResourceValidator() {} static void validateResource(SyntaxNodeAnalysisContext ctx, FunctionDefinitionNode member, LinksMetaData linksMetaData, Map typeSymbols) { diff --git a/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/codeaction/Constants.java b/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/codeaction/Constants.java index dbd9333b3e..d1cd8715bf 100644 --- a/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/codeaction/Constants.java +++ b/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/codeaction/Constants.java @@ -21,7 +21,9 @@ /** * Constants related to compiler plugin code-action implementation. */ -public class Constants { +public final class Constants { + private Constants () {} + public static final String NODE_LOCATION_KEY = "node.location"; public static final String IS_ERROR_INTERCEPTOR_TYPE = "node.errorInterceptor"; diff --git a/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/completion/Constants.java b/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/completion/Constants.java index 4f3263c0a5..eb30ec55fe 100644 --- a/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/completion/Constants.java +++ b/compiler-plugin/src/main/java/io/ballerina/stdlib/http/compiler/completion/Constants.java @@ -23,7 +23,9 @@ /** * Constants related to compiler plugin completion implementation. */ -public class Constants { +public final class Constants { + private Constants() {} + public static final String GET = "get"; public static final String POST = "post"; diff --git a/load-tests/h1_h1_passthrough/results/summary.csv b/load-tests/h1_h1_passthrough/results/summary.csv index ef570bfad3..ea233ce42b 100644 --- a/load-tests/h1_h1_passthrough/results/summary.csv +++ b/load-tests/h1_h1_passthrough/results/summary.csv @@ -380,3 +380,7 @@ HTTP Request,9901924,19,14,41,54,88,0,651,0.00%,2845.4,683.6,17.97,1696875324,50 HTTP Request,10268693,18,14,39,52,86,0,504,0.00%,2950.8,708.9,17.35,1696961728,50,60 HTTP Request,12427947,15,11,33,44,73,0,576,0.00%,3571.3,857.9,14.77,1697048074,50,60 HTTP Request,11503299,16,12,35,47,76,0,456,0.00%,3305.6,794.1,15.37,1697134492,50,60 +HTTP Request,9977224,19,14,41,54,87,0,604,0.00%,2867.1,688.8,17.74,1697825699,50,60 +HTTP Request,10198580,18,14,40,52,86,0,479,0.00%,2930.7,704.0,17.49,1697912028,50,60 +HTTP Request,10243673,18,13,40,52,86,0,586,0.00%,2943.6,707.1,17.50,1697998419,50,60 +HTTP Request,9660484,19,14,42,56,91,0,610,0.00%,2776.1,666.9,18.49,1698084875,50,60 diff --git a/load-tests/h1_transformation/results/summary.csv b/load-tests/h1_transformation/results/summary.csv index e8eb5a12ea..97393921f2 100644 --- a/load-tests/h1_transformation/results/summary.csv +++ b/load-tests/h1_transformation/results/summary.csv @@ -384,3 +384,7 @@ HTTP Request,7968274,25,23,43,50,67,1,347,0.00%,2289.8,626.1,13.41,1696879253,50 HTTP Request,8372594,24,22,41,47,63,1,344,0.00%,2406.0,657.9,12.65,1696965628,50,60 HTTP Request,9885110,20,19,34,40,53,1,292,0.00%,2840.6,776.7,10.48,1697052002,50,60 HTTP Request,8948757,22,21,39,45,59,1,342,0.00%,2571.5,703.1,12.09,1697138426,50,60 +HTTP Request,8033129,25,23,43,49,66,1,383,0.00%,2308.4,631.2,13.33,1697829611,50,60 +HTTP Request,8330694,24,22,41,47,63,1,444,0.00%,2393.9,654.6,12.81,1697915944,50,60 +HTTP Request,8482361,23,22,40,47,62,1,320,0.00%,2437.5,666.5,12.56,1698002315,50,60 +HTTP Request,7806501,26,24,44,51,68,1,378,0.00%,2243.3,613.4,13.81,1698088773,50,60 diff --git a/load-tests/h1c_h1c_passthrough/results/summary.csv b/load-tests/h1c_h1c_passthrough/results/summary.csv index 65e74d0e9d..0461db27dd 100644 --- a/load-tests/h1c_h1c_passthrough/results/summary.csv +++ b/load-tests/h1c_h1c_passthrough/results/summary.csv @@ -382,3 +382,7 @@ HTTP Request,11203528,17,14,34,42,64,0,310,0.00%,3219.4,572.2,12.98,1696883191,5 HTTP Request,11714508,16,14,32,40,62,0,320,0.00%,3366.3,598.3,12.52,1696969635,50,60 HTTP Request,14393277,13,11,26,34,52,0,346,0.00%,4136.1,735.1,10.56,1697055923,50,60 HTTP Request,11932830,16,13,32,40,60,0,341,0.00%,3429.0,609.4,12.30,1697142393,50,60 +HTTP Request,11480920,17,14,33,40,62,0,348,0.00%,3299.2,586.4,12.58,1697833509,50,60 +HTTP Request,11603118,16,14,33,40,62,0,323,0.00%,3334.3,592.6,12.61,1697919866,50,60 +HTTP Request,11795981,16,13,32,40,61,0,316,0.00%,3389.7,602.4,12.43,1698006267,50,60 +HTTP Request,10964783,17,15,34,42,64,0,337,0.00%,3150.9,560.0,13.03,1698092751,50,60 diff --git a/load-tests/h1c_transformation/results/summary.csv b/load-tests/h1c_transformation/results/summary.csv index 002ff7f5dd..f0b36e92ed 100644 --- a/load-tests/h1c_transformation/results/summary.csv +++ b/load-tests/h1c_transformation/results/summary.csv @@ -378,3 +378,7 @@ HTTP Request,8014682,25,23,40,53,71,1,244,0.00%,2303.1,485.8,13.00,1696887114,50 HTTP Request,8391677,24,22,38,51,68,1,281,0.00%,2411.4,508.7,12.46,1696973561,50,60 HTTP Request,9894116,20,18,33,45,59,0,185,0.00%,2843.2,599.7,10.79,1697059850,50,60 HTTP Request,9652787,21,19,33,39,64,1,275,0.00%,2773.8,585.1,10.82,1697146348,50,60 +HTTP Request,7875572,26,23,40,55,74,1,227,0.00%,2263.1,477.4,13.40,1697837416,50,60 +HTTP Request,8348560,24,22,38,51,69,1,339,0.00%,2399.1,506.0,12.51,1697923777,50,60 +HTTP Request,8488107,24,22,37,49,67,1,254,0.00%,2439.1,514.5,12.09,1698010161,50,60 +HTTP Request,7527140,27,24,42,58,77,1,300,0.00%,2163.0,456.2,14.08,1698096695,50,60 diff --git a/load-tests/h2_h1c_passthrough/results/summary.csv b/load-tests/h2_h1c_passthrough/results/summary.csv index d790325118..90906aec62 100644 --- a/load-tests/h2_h1c_passthrough/results/summary.csv +++ b/load-tests/h2_h1c_passthrough/results/summary.csv @@ -336,3 +336,7 @@ H2-H1C Passthrough,5857,0.0,0,0,0,0,0,0,1.0,0.0,0,0,1696887993,0,1 H2-H1C Passthrough,5872,0.0,0,0,0,0,0,0,1.0,0.0,0,0,1696974434,0,1 H2-H1C Passthrough,5896,0.0,0,0,0,0,0,0,1.0,0.0,0,0,1697060729,0,1 H2-H1C Passthrough,5889,0.0,0,0,0,0,0,0,1.0,0.0,0,0,1697147233,0,1 +H2-H1C Passthrough,5851,0.0,0,0,0,0,0,0,1.0,0.0,0,0,1697838317,0,1 +H2-H1C Passthrough,5866,0.0,0,0,0,0,0,0,1.0,0.0,0,0,1697924654,0,1 +H2-H1C Passthrough,5860,0.0,0,0,0,0,0,0,1.0,0.0,0,0,1698011025,0,1 +H2-H1C Passthrough,5840,0.0,0,0,0,0,0,0,1.0,0.0,0,0,1698097620,0,1 diff --git a/load-tests/interceptors_passthrough/results/summary.csv b/load-tests/interceptors_passthrough/results/summary.csv index 0e243d0cd1..c173d336de 100644 --- a/load-tests/interceptors_passthrough/results/summary.csv +++ b/load-tests/interceptors_passthrough/results/summary.csv @@ -86,3 +86,6 @@ Test Request,247159,847,28,146,282,28892,1,30033,3.65%,70.6,8.5,4556.20,16968918 Test Request,234857,891,28,161,1169,30019,1,49975,5.73%,66.9,9.8,4130.24,1696978336,50,60 Test Request,225092,930,23,131,406,30026,1,51293,4.71%,64.2,9.8,4756.01,1697064640,50,60 Test Request,229758,911,25,128,270,29089,1,30036,3.84%,65.6,8.3,4668.09,1697151122,50,60 +Test Request,237846,880,27,142,323,28249,1,52161,4.08%,68.0,7.9,4618.30,1697928586,50,60 +Test Request,241763,866,26,141,311,30024,1,51773,3.92%,69.0,10.2,4607.87,1698014933,50,60 +Test Request,249425,840,31,145,288,30016,1,52822,3.64%,71.2,9.8,4536.91,1698101571,50,60 diff --git a/load-tests/observability_enabled/results/summary.csv b/load-tests/observability_enabled/results/summary.csv index a7abd89355..f550c20e98 100644 --- a/load-tests/observability_enabled/results/summary.csv +++ b/load-tests/observability_enabled/results/summary.csv @@ -367,3 +367,7 @@ HTTP Request,14232703,13,7,33,50,102,0,743,0.00%,4089.9,611.1,20.85,1696895836,5 HTTP Request,14536001,13,6,33,50,102,0,654,0.00%,4177.1,624.1,20.80,1696982268,50,60 HTTP Request,17754215,11,5,26,40,84,0,528,0.00%,5101.9,762.3,17.02,1697068574,50,60 HTTP Request,16516054,11,6,26,40,81,0,602,0.00%,4746.0,709.1,16.57,1697155061,50,60 +HTTP Request,14521076,13,7,32,49,100,0,678,0.00%,4172.8,623.5,20.46,1697842415,50,60 +HTTP Request,14472495,13,6,32,50,103,0,726,0.00%,4158.8,621.4,21.18,1697932552,50,60 +HTTP Request,14877913,13,7,31,47,95,0,720,0.00%,4275.4,638.8,19.57,1698018857,50,60 +HTTP Request,13745087,14,8,33,48,95,0,563,0.00%,3949.8,590.1,19.25,1698105517,50,60 diff --git a/load-tests/snowpeak_passthrough/results/summary.csv b/load-tests/snowpeak_passthrough/results/summary.csv index 726eb07ba9..354e29a21c 100644 --- a/load-tests/snowpeak_passthrough/results/summary.csv +++ b/load-tests/snowpeak_passthrough/results/summary.csv @@ -218,3 +218,7 @@ Retrieve Available Locations,6728880,30,19,66,71,87,0,674,0.00%,1933.6,186.9,23. Retrieve Available Locations,6746893,30,19,66,72,87,0,483,0.00%,1938.8,187.4,23.57,1696986174,50,60 Retrieve Available Locations,8196448,25,15,61,65,76,0,395,0.00%,2355.2,227.7,21.17,1697072505,50,60 Retrieve Available Locations,7389797,27,17,63,68,79,0,420,0.00%,2123.4,205.3,22.13,1697158983,50,60 +Retrieve Available Locations,7027521,29,18,65,70,84,0,237,0.00%,2019.5,195.2,22.79,1697846347,50,60 +Retrieve Available Locations,6975248,29,18,65,70,85,0,378,0.00%,2004.3,193.8,22.80,1697936453,50,60 +Retrieve Available Locations,6834608,30,18,66,71,86,0,394,0.00%,1964.0,189.9,23.41,1698022775,50,60 +Retrieve Available Locations,6387926,32,21,67,72,89,1,299,0.00%,1835.5,177.5,23.48,1698109435,50,60 diff --git a/native/src/main/java/io/ballerina/stdlib/http/api/HttpConstants.java b/native/src/main/java/io/ballerina/stdlib/http/api/HttpConstants.java index 88928a6a88..dc5f4fc2f6 100644 --- a/native/src/main/java/io/ballerina/stdlib/http/api/HttpConstants.java +++ b/native/src/main/java/io/ballerina/stdlib/http/api/HttpConstants.java @@ -30,7 +30,7 @@ * * @since 0.8.0 */ -public class HttpConstants { +public final class HttpConstants { public static final String HTTPS_ENDPOINT_STARTED = "[ballerina/http] started HTTPS/WSS listener "; public static final String HTTP_ENDPOINT_STARTED = "[ballerina/http] started HTTP/WS listener "; diff --git a/native/src/main/java/io/ballerina/stdlib/http/api/logging/util/LogLevelMapper.java b/native/src/main/java/io/ballerina/stdlib/http/api/logging/util/LogLevelMapper.java index abac2eb0cc..f05c0fe578 100644 --- a/native/src/main/java/io/ballerina/stdlib/http/api/logging/util/LogLevelMapper.java +++ b/native/src/main/java/io/ballerina/stdlib/http/api/logging/util/LogLevelMapper.java @@ -25,7 +25,9 @@ * * @since 0.89 */ -public class LogLevelMapper { +public final class LogLevelMapper { + + private LogLevelMapper() {} public static String getBallerinaLogLevel(Level level) { switch (level.getName()) { diff --git a/native/src/main/java/io/ballerina/stdlib/http/api/nativeimpl/ExternRequestContext.java b/native/src/main/java/io/ballerina/stdlib/http/api/nativeimpl/ExternRequestContext.java index cb87e87cc3..a59d559fb4 100644 --- a/native/src/main/java/io/ballerina/stdlib/http/api/nativeimpl/ExternRequestContext.java +++ b/native/src/main/java/io/ballerina/stdlib/http/api/nativeimpl/ExternRequestContext.java @@ -33,7 +33,9 @@ /** * Utilities related to HTTP request context. */ -public class ExternRequestContext { +public final class ExternRequestContext { + + private ExternRequestContext() {} public static Object getWithType(BObject requestCtx, BString key, BTypedesc targetType) { BMap members = requestCtx.getMapValue(HttpConstants.REQUEST_CTX_MEMBERS); diff --git a/native/src/main/java/io/ballerina/stdlib/http/api/nativeimpl/ExternUtils.java b/native/src/main/java/io/ballerina/stdlib/http/api/nativeimpl/ExternUtils.java index f6f5b96394..ccf6873f56 100644 --- a/native/src/main/java/io/ballerina/stdlib/http/api/nativeimpl/ExternUtils.java +++ b/native/src/main/java/io/ballerina/stdlib/http/api/nativeimpl/ExternUtils.java @@ -23,7 +23,9 @@ /** * Contains external utility functions. */ -public class ExternUtils { +public final class ExternUtils { + + private ExternUtils() {} /** * Provides the relevant reason phrase for a given status code. diff --git a/native/src/main/java/io/ballerina/stdlib/http/api/service/signature/converter/UrlEncodedStringToMapConverter.java b/native/src/main/java/io/ballerina/stdlib/http/api/service/signature/converter/UrlEncodedStringToMapConverter.java index d2bbce2c5f..6c311834f1 100644 --- a/native/src/main/java/io/ballerina/stdlib/http/api/service/signature/converter/UrlEncodedStringToMapConverter.java +++ b/native/src/main/java/io/ballerina/stdlib/http/api/service/signature/converter/UrlEncodedStringToMapConverter.java @@ -68,23 +68,25 @@ private static BMap getFormParamMap(Object stringDataSource) { return formParamsMap; } Map tempParamMap = new HashMap<>(); - String decodedValue = URLDecoder.decode(formData, StandardCharsets.UTF_8); - if (!decodedValue.contains("=")) { + if (!formData.contains("=")) { throw new BallerinaConnectorException("Datasource does not contain form data"); } - String[] formParamValues = decodedValue.split("&"); + String[] formParamValues = formData.split("&"); for (String formParam : formParamValues) { int index = formParam.indexOf('='); if (index == -1) { - if (!tempParamMap.containsKey(formParam)) { - tempParamMap.put(formParam, null); + String decodedFormParam = URLDecoder.decode(formParam, StandardCharsets.UTF_8); + if (!tempParamMap.containsKey(decodedFormParam)) { + tempParamMap.put(decodedFormParam, null); } continue; } - String formParamName = formParam.substring(0, index).trim(); - String formParamValue = formParam.substring(index + 1).trim(); - tempParamMap.put(formParamName, formParamValue); + String decodedFormParamName = URLDecoder.decode(formParam.substring(0, index).trim(), + StandardCharsets.UTF_8); + String decodedFormParamValue = URLDecoder.decode(formParam.substring(index + 1).trim(), + StandardCharsets.UTF_8); + tempParamMap.put(decodedFormParamName, decodedFormParamValue); } for (Map.Entry entry : tempParamMap.entrySet()) { diff --git a/native/src/main/java/io/ballerina/stdlib/http/transport/contractimpl/common/states/Http2StateUtil.java b/native/src/main/java/io/ballerina/stdlib/http/transport/contractimpl/common/states/Http2StateUtil.java index 9dd7225e15..55b52c9822 100644 --- a/native/src/main/java/io/ballerina/stdlib/http/transport/contractimpl/common/states/Http2StateUtil.java +++ b/native/src/main/java/io/ballerina/stdlib/http/transport/contractimpl/common/states/Http2StateUtil.java @@ -85,7 +85,9 @@ * * @since 6.0.241 */ -public class Http2StateUtil { +public final class Http2StateUtil { + + private Http2StateUtil() {} private static final Logger LOG = LoggerFactory.getLogger(Http2StateUtil.class); diff --git a/native/src/main/java/io/ballerina/stdlib/http/uri/DispatcherUtil.java b/native/src/main/java/io/ballerina/stdlib/http/uri/DispatcherUtil.java index f72809f3f0..f0e710ad9c 100644 --- a/native/src/main/java/io/ballerina/stdlib/http/uri/DispatcherUtil.java +++ b/native/src/main/java/io/ballerina/stdlib/http/uri/DispatcherUtil.java @@ -33,7 +33,9 @@ /** * Utilities related to dispatcher processing. */ -public class DispatcherUtil { +public final class DispatcherUtil { + + private DispatcherUtil() {} private static String[] allMethods = new String[]{HttpConstants.HTTP_METHOD_GET, HttpConstants.HTTP_METHOD_HEAD , HttpConstants.HTTP_METHOD_POST, HttpConstants.HTTP_METHOD_DELETE, HttpConstants.HTTP_METHOD_PATCH diff --git a/native/src/test/java/io/ballerina/stdlib/http/api/TestUtils.java b/native/src/test/java/io/ballerina/stdlib/http/api/TestUtils.java index fba5ffd650..c96790fcea 100644 --- a/native/src/test/java/io/ballerina/stdlib/http/api/TestUtils.java +++ b/native/src/test/java/io/ballerina/stdlib/http/api/TestUtils.java @@ -35,7 +35,9 @@ /** * A test utils for http unit test classes. */ -public class TestUtils { +public final class TestUtils { + + private TestUtils() {} public static final int SOCKET_SERVER_PORT = 8001; diff --git a/native/src/test/java/io/ballerina/stdlib/http/transport/http2/expect100continue/Continue100Util.java b/native/src/test/java/io/ballerina/stdlib/http/transport/http2/expect100continue/Continue100Util.java index 910c11d25e..0577d6e0c6 100644 --- a/native/src/test/java/io/ballerina/stdlib/http/transport/http2/expect100continue/Continue100Util.java +++ b/native/src/test/java/io/ballerina/stdlib/http/transport/http2/expect100continue/Continue100Util.java @@ -24,7 +24,9 @@ import static io.ballerina.stdlib.http.transport.contract.Constants.HTTP_2_0; -class Continue100Util { +public final class Continue100Util { + private Continue100Util() {} + static ListenerConfiguration getListenerConfigs() { ListenerConfiguration listenerConfiguration = new ListenerConfiguration(); listenerConfiguration.setPort(TestUtil.SERVER_CONNECTOR_PORT); diff --git a/native/src/test/java/io/ballerina/stdlib/http/transport/proxyserver/ProxyServerUtil.java b/native/src/test/java/io/ballerina/stdlib/http/transport/proxyserver/ProxyServerUtil.java index fd0e897ef9..e94f62f807 100644 --- a/native/src/test/java/io/ballerina/stdlib/http/transport/proxyserver/ProxyServerUtil.java +++ b/native/src/test/java/io/ballerina/stdlib/http/transport/proxyserver/ProxyServerUtil.java @@ -53,7 +53,9 @@ /** * A util class to use in both http and https proxy scenarios. */ -public class ProxyServerUtil { +public final class ProxyServerUtil { + private ProxyServerUtil() {} + private static HttpClientConnector httpClientConnector; private static ServerConnector serverConnector; private static HttpWsConnectorFactory httpWsConnectorFactory; diff --git a/native/src/test/java/io/ballerina/stdlib/http/transport/util/Http2Util.java b/native/src/test/java/io/ballerina/stdlib/http/transport/util/Http2Util.java index 66742df288..6175283354 100644 --- a/native/src/test/java/io/ballerina/stdlib/http/transport/util/Http2Util.java +++ b/native/src/test/java/io/ballerina/stdlib/http/transport/util/Http2Util.java @@ -48,7 +48,9 @@ * * @since 6.0.273 */ -public class Http2Util { +public final class Http2Util { + + private Http2Util() {} public static final String HTTP2_RESPONSE_PAYLOAD = "Final Response"; diff --git a/native/src/test/java/io/ballerina/stdlib/http/transport/util/TestUtil.java b/native/src/test/java/io/ballerina/stdlib/http/transport/util/TestUtil.java index 1c872d76df..66f2f8057e 100644 --- a/native/src/test/java/io/ballerina/stdlib/http/transport/util/TestUtil.java +++ b/native/src/test/java/io/ballerina/stdlib/http/transport/util/TestUtil.java @@ -69,7 +69,9 @@ /** * A util class to be used for tests. */ -public class TestUtil { +public final class TestUtil { + + private TestUtil() {} private static final Logger LOG = LoggerFactory.getLogger(TestUtil.class); diff --git a/native/src/test/java/io/ballerina/stdlib/http/transport/util/client/http2/MessageGenerator.java b/native/src/test/java/io/ballerina/stdlib/http/transport/util/client/http2/MessageGenerator.java index 953608402e..0886b55844 100644 --- a/native/src/test/java/io/ballerina/stdlib/http/transport/util/client/http2/MessageGenerator.java +++ b/native/src/test/java/io/ballerina/stdlib/http/transport/util/client/http2/MessageGenerator.java @@ -46,7 +46,9 @@ /** * A utility class which generates HTTP/2.0 requests. */ -public class MessageGenerator { +public final class MessageGenerator { + private MessageGenerator() {} + public static HttpCarbonMessage generateRequest(HttpMethod httpMethod, String payload) { HttpCarbonMessage httpCarbonMessage = new HttpCarbonRequest(new DefaultHttpRequest( new HttpVersion(Constants.DEFAULT_VERSION_HTTP_1_1, true), httpMethod, diff --git a/native/src/test/java/io/ballerina/stdlib/http/transport/util/client/websocket/WebSocketTestConstants.java b/native/src/test/java/io/ballerina/stdlib/http/transport/util/client/websocket/WebSocketTestConstants.java index 8e192a2ace..c744751767 100644 --- a/native/src/test/java/io/ballerina/stdlib/http/transport/util/client/websocket/WebSocketTestConstants.java +++ b/native/src/test/java/io/ballerina/stdlib/http/transport/util/client/websocket/WebSocketTestConstants.java @@ -22,7 +22,9 @@ /** * WebSocket constants for testing purposes. */ -public class WebSocketTestConstants { +public final class WebSocketTestConstants { + private WebSocketTestConstants() {} + public static final String PAYLOAD_NEW_CLIENT_CONNECTED = "NEW_CLIENT_CONNECTED"; public static final String PAYLOAD_CLIENT_LEFT = "CLIENT_LEFT"; } diff --git a/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/Assert.java b/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/Assert.java index aad6997297..c4b8573cff 100644 --- a/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/Assert.java +++ b/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/Assert.java @@ -21,7 +21,9 @@ /** * Contains assert functions used by mime test cases. */ -public class Assert { +public final class Assert { + + private Assert() {} public static void assertEquals(Object actual, Object expected) { if (!areEqual(actual, expected)) { diff --git a/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/ExternPipeliningTestUtil.java b/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/ExternPipeliningTestUtil.java index bb5139f76f..6913c9ca54 100644 --- a/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/ExternPipeliningTestUtil.java +++ b/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/ExternPipeliningTestUtil.java @@ -40,7 +40,9 @@ * * @since 0.982.0 */ -public class ExternPipeliningTestUtil { +public final class ExternPipeliningTestUtil { + + private ExternPipeliningTestUtil() {} private static final Logger log = LoggerFactory.getLogger(ExternPipeliningTestUtil.class); diff --git a/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/ExternRetryMultipartTestutil.java b/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/ExternRetryMultipartTestutil.java index e7f782b7b1..fc2efba04a 100644 --- a/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/ExternRetryMultipartTestutil.java +++ b/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/ExternRetryMultipartTestutil.java @@ -33,7 +33,9 @@ /** * Contains utility functions used for the retry test. */ -public class ExternRetryMultipartTestutil { +public final class ExternRetryMultipartTestutil { + + private ExternRetryMultipartTestutil() {} private static final Logger log = LoggerFactory.getLogger(ExternRetryMultipartTestutil.class); private static final String RETRY_HEADER = "x-retry"; diff --git a/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/TestConstant.java b/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/TestConstant.java index c1e8dc4ae6..4b6a3fd9eb 100644 --- a/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/TestConstant.java +++ b/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/TestConstant.java @@ -22,7 +22,9 @@ /** * Constants used in test cases. */ -public class TestConstant { +public final class TestConstant { + private TestConstant() {} + public static final String CONTENT_TYPE_JSON = "application/json"; public static final String CONTENT_TYPE_XML = "application/xml"; public static final String CONTENT_TYPE_TEXT_PLAIN = "text/plain"; diff --git a/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/Utils.java b/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/Utils.java index ba227d220f..89528384dd 100644 --- a/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/Utils.java +++ b/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/Utils.java @@ -36,7 +36,9 @@ /** * A utility class for keep payloads. */ -public class Utils { +public final class Utils { + + private Utils() {} public static String getEntityBodyFrom(FullHttpResponse httpResponse) { ByteBuffer content = httpResponse.content().nioBuffer(); diff --git a/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/client/HttpUrlClient.java b/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/client/HttpUrlClient.java index 0e01284dcd..0c21f6e35e 100644 --- a/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/client/HttpUrlClient.java +++ b/test-utils/src/main/java/io/ballerina/stdlib/http/testutils/client/HttpUrlClient.java @@ -43,7 +43,9 @@ /** * A simple URL connection HTTP client to be used in test cases. */ -public class HttpUrlClient { +public final class HttpUrlClient { + + private HttpUrlClient() {} private static final Logger log = LoggerFactory.getLogger(HttpUrlClient.class); private static final int DEFAULT_READ_TIMEOUT = 30000;