Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dependencies update 2024-03 #327

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 28 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
buildscript {

ext {
set("jacksonVersion", "2.13.4")
set("springVersion", "5.3.23")
set("springBotVersion", "2.7.4")
set("jettyVersion", "9.4.49.v20220914")
set("slf4jVersion", "2.0.3")
set("jacksonVersion", "2.16.1")
// Versions 6.0.0 and above no longer support Java 1.8
set("springVersion", "5.3.32")
// Versions 3.0.0 and above no longer support Java 1.8
set("springBootVersion", "2.7.18")
set("jettyVersion", "9.4.54.v20240208")
set("slf4jVersion", "2.0.12")
}

repositories {
gradlePluginPortal()
mavenCentral()
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
}

dependencies {
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.5.3"
classpath("com.adarshr:gradle-test-logger-plugin:1.6.0")
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0"
classpath("com.adarshr:gradle-test-logger-plugin:3.2.0")
}
}

Expand All @@ -29,7 +30,6 @@ repositories {
mavenLocal()
gradlePluginPortal()
mavenCentral()
jcenter()
}

apply plugin: "java"
Expand All @@ -41,8 +41,10 @@ description = """
This project aims to provide the facility to easily implement JSON-RPC for the java programming language.
"""

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

compileJava {
options.encoding = 'UTF-8'
Expand All @@ -67,23 +69,27 @@ test {
}

jacoco {
toolVersion = "0.8.5"
toolVersion = "0.8.11"
}

jacocoTestReport {
dependsOn test
reports {
xml.enabled true
csv.enabled true
html.enabled true
xml.required = true
csv.required = true
html.required = true
}
}

java {
registerFeature('servletSupport') {
// TODO: create a separate sourceSet for this library feature.
// Gradle is planning to break this in v9.0
usingSourceSet(sourceSets.main)
}
registerFeature('springSupport') {
// TODO: create a separate sourceSet for this library feature.
// Gradle is planning to break this in v9.0
usingSourceSet(sourceSets.main)
}
}
Expand All @@ -110,23 +116,23 @@ dependencies {
springSupportImplementation "org.springframework:spring-web:${springVersion}"
springSupportImplementation "org.springframework:spring-webmvc:${springVersion}"

implementation 'commons-codec:commons-codec:1.15'
implementation 'org.apache.httpcomponents:httpcore-nio:4.4.15'
implementation 'commons-codec:commons-codec:1.16.1'
implementation 'org.apache.httpcomponents:httpcore-nio:4.4.16'

testImplementation 'junit:junit:4.13.2'
testImplementation 'org.easymock:easymock:4.3'
testImplementation("org.springframework.boot:spring-boot-starter-web:${springBotVersion}") {
testImplementation 'org.easymock:easymock:5.2.0'
testImplementation("org.springframework.boot:spring-boot-starter-web:${springBootVersion}") {
exclude module: 'logback-classic'
}
testImplementation "org.springframework.boot:spring-boot-starter-test:${springBotVersion}"
testImplementation "org.springframework.boot:spring-boot-starter-test:${springBootVersion}"
testImplementation("org.eclipse.jetty:jetty-server:${jettyVersion}") {
exclude module: 'javax.servlet'
}
testImplementation("org.eclipse.jetty:jetty-servlet:${jettyVersion}") {
exclude module: 'org.eclipse.jetty.orbit'
}
testRuntime 'org.apache.logging.log4j:log4j-slf4j-impl:2.19.0'
testRuntime 'org.apache.logging.log4j:log4j-core:2.19.0'
testRuntimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl:2.23.0'
testRuntimeOnly 'org.apache.logging.log4j:log4j-core:2.23.0'

}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Mon Oct 07 19:30:35 PDT 2019
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
Expand Down
2 changes: 1 addition & 1 deletion publishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
gradlePluginPortal()
}
dependencies {
classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.11.0'
classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0'
classpath 'gradle.plugin.net.wooga.gradle:atlas-github:1.0.1'
classpath 'net.researchgate:gradle-release:2.7.0'
classpath 'org.ajoberstar:grgit:2.3.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ protected Class<?>[] getHandlerInterfaces(final String serviceName) {
*
* @param node the {@link JsonNode}
* @return the {@link JsonResponse} instance
* @throws JsonParseException when {@link JsonNode} read fails
* @throws JsonMappingException when {@link JsonNode} read fails
*/
protected JsonResponse handleJsonNodeRequest(final JsonNode node)
throws JsonParseException, JsonMappingException {
Expand Down
22 changes: 13 additions & 9 deletions src/main/java/com/googlecode/jsonrpc4j/JsonRpcHttpAsyncClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -412,29 +412,33 @@ private void initialize() {
pool = new BasicNIOConnPool(ioReactor, nioConnFactory, Integer.getInteger("com.googlecode.jsonrpc4j.async.connect.timeout", 30000));
pool.setDefaultMaxPerRoute(Integer.getInteger("com.googlecode.jsonrpc4j.async.max.inflight.route", 500));
pool.setMaxTotal(Integer.getInteger("com.googlecode.jsonrpc4j.async.max.inflight.total", 500));

Thread t = new Thread(new Runnable() {
@Override
public void run() {

Thread t = new Thread(
() -> {
try {
HttpAsyncRequestExecutor protocolHandler = new HttpAsyncRequestExecutor();
IOEventDispatch ioEventDispatch = new DefaultHttpClientIODispatch(protocolHandler, sslContext, connectionConfig);
IOEventDispatch ioEventDispatch = new DefaultHttpClientIODispatch<>(
protocolHandler,
sslContext,
connectionConfig
);
ioReactor.execute(ioEventDispatch);
} catch (InterruptedIOException ex) {
System.err.println("Interrupted");
} catch (IOException e) {
System.err.println("I/O error: " + e.getMessage());
}
}
}, "jsonrpc4j HTTP IOReactor");

},
"jsonrpc4j HTTP IOReactor"
);

t.setDaemon(true);
t.start();

HttpProcessor httpProcessor = new ImmutableHttpProcessor(new RequestContent(), new RequestTargetHost(), new RequestConnControl(), new RequestUserAgent(), new RequestExpectContinue(false));
requester = new HttpAsyncRequester(httpProcessor, new DefaultConnectionReuseStrategy());
}

private IOReactorConfig.Builder createConfig() {
IOReactorConfig.Builder config = IOReactorConfig.custom();
config = config.setSoTimeout(Integer.getInteger("com.googlecode.jsonrpc4j.async.socket.timeout", 30000));
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/googlecode/jsonrpc4j/JsonRpcServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ private InputStream getRequestStream(ResourceRequest request) throws IOException
}

private static InputStream createInputStream(ResourceRequest request) throws IOException {
return createInputStream(request.getParameter(METHOD), request.getParameter(ID), request.getParameter(PARAMS));
return createInputStream(
request.getRenderParameters().getValue(METHOD),
request.getRenderParameters().getValue(ID),
request.getRenderParameters().getValue(PARAMS)
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,24 @@
import java.net.MalformedURLException;

import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.endsWith;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.startsWith;

public class HttpCodeTest extends BaseRestTest {

@Test
public void http405OnInvalidUrl() throws MalformedURLException {
expectedEx.expectMessage(anyOf(
expectedEx.expectMessage(
anyOf(
equalTo("405 HTTP method POST is not supported by this URL"),
equalTo("404 Not Found"),
equalTo("HTTP method POST is not supported by this URL"),
equalTo("Method Not Allowed"),
startsWith("Server returned HTTP response code: 405 for URL: http://127.0.0.1")));
expectedEx.expect(Exception.class);
startsWith("Server returned HTTP response code: 405 for URL: http://127.0.0.1"),
endsWith("Method Not Allowed")
)
);
expectedEx.expect(JsonRpcClientException.class);
FakeServiceInterface service = ProxyUtil.createClientProxy(FakeServiceInterface.class, getClient("error"));
service.doSomething();
}
Expand Down
Loading