diff --git a/jenkins-client-it-docker/pom.xml b/jenkins-client-it-docker/pom.xml
index 11e6b485..e0d656f3 100644
--- a/jenkins-client-it-docker/pom.xml
+++ b/jenkins-client-it-docker/pom.xml
@@ -11,7 +11,7 @@
com.offbytwo.jenkins
jenkins-client-parent
- 0.4.0-SNAPSHOT
+ 0.4.1
jenkins-client-it-docker
@@ -41,17 +41,20 @@
org.assertj
assertj-core
+ 3.26.0
test
org.apache.httpcomponents
httpclient
+ 4.5.14
test
org.slf4j
slf4j-api
+ 2.0.12
test
@@ -97,7 +100,14 @@
-
+
+
+ maven_central
+ Maven Central
+ https://repo.maven.apache.org/maven2/
+
+
+
run-docker-its
diff --git a/jenkins-client/pom.xml b/jenkins-client/pom.xml
index 2cbc3df9..4e528cfe 100644
--- a/jenkins-client/pom.xml
+++ b/jenkins-client/pom.xml
@@ -11,85 +11,82 @@
com.offbytwo.jenkins
jenkins-client-parent
- 0.4.0-SNAPSHOT
+ 0.4.1
jenkins-client
Jenkins API client for Java :: The Client.
-
+
com.fasterxml.jackson.core
jackson-annotations
+ 2.14.0
+
com.fasterxml.jackson.core
jackson-core
+ 2.14.0
com.fasterxml.jackson.core
jackson-databind
+ 2.14.0
- org.dom4j
- dom4j
+ javax.xml.bind
+ jaxb-api
- org.jvnet.hudson
- xstream
- test
-
-
-
- net.sf.json-lib
- json-lib
- jdk15
+ org.dom4j
+ dom4j
-
org.apache.commons
commons-lang3
+ 3.12.0
commons-io
commons-io
+ 2.11.0
org.apache.httpcomponents
httpclient
+ 4.5.14
org.apache.httpcomponents
httpcore
+ 4.4.16
org.apache.httpcomponents
httpmime
-
-
-
- jaxen
- jaxen
+ 4.5.14
org.slf4j
slf4j-api
+ 2.0.6
-
junit
junit
+ 4.13.2
test
@@ -104,65 +101,14 @@
jenkins-test-harness
test
+
org.assertj
assertj-core
+ 3.23.1
test
-
- xerces
- xmlParserAPIs
-
-
-
-
-
- org.apache.maven.plugins
- maven-shade-plugin
-
-
- httpclient
- package
-
- shade
-
-
-
-
- org.apache.httpcomponents:httpclient
- org.apache.httpcomponents:httpcore
-
-
- true
- apachehttp
-
-
-
-
-
-
-
-
-
- run-its
-
-
-
- maven-failsafe-plugin
-
-
- integration-test
-
- integration-test
- verify
-
-
-
-
-
-
-
-
+
diff --git a/jenkins-client/src/main/java/com/offbytwo/jenkins/client/JenkinsHttpClient.java b/jenkins-client/src/main/java/com/offbytwo/jenkins/client/JenkinsHttpClient.java
index 4eadc5c9..d4d3b1ab 100755
--- a/jenkins-client/src/main/java/com/offbytwo/jenkins/client/JenkinsHttpClient.java
+++ b/jenkins-client/src/main/java/com/offbytwo/jenkins/client/JenkinsHttpClient.java
@@ -12,9 +12,8 @@
import com.offbytwo.jenkins.model.BaseModel;
import com.offbytwo.jenkins.model.Crumb;
import com.offbytwo.jenkins.model.ExtractHeader;
-import net.sf.json.JSONObject;
import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
@@ -45,27 +44,28 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
-import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
+import static org.apache.commons.lang3.StringUtils.isNotBlank;
+
import com.offbytwo.jenkins.client.util.ResponseUtils;
import com.offbytwo.jenkins.client.util.UrlUtils;
-import static org.apache.commons.lang.StringUtils.isNotBlank;
public class JenkinsHttpClient implements JenkinsHttpConnection {
private final Logger LOGGER = LoggerFactory.getLogger(getClass());
- private URI uri;
- private CloseableHttpClient client;
+ private final URI uri;
+ private final CloseableHttpClient client;
private HttpContext localContext;
- private HttpResponseValidator httpResponseValidator;
+ private final HttpResponseValidator httpResponseValidator;
// private HttpResponseContentExtractor contentExtractor;
- private ObjectMapper mapper;
+ private final ObjectMapper mapper;
private String context;
private String jenkinsVersion;
@@ -89,7 +89,7 @@ public JenkinsHttpClient(URI uri, CloseableHttpClient client) {
this.httpResponseValidator = new HttpResponseValidator();
// this.contentExtractor = new HttpResponseContentExtractor();
this.jenkinsVersion = EMPTY_VERSION;
- LOGGER.debug("uri={}", uri.toString());
+ LOGGER.debug("uri={}", uri);
}
/**
@@ -168,7 +168,7 @@ public String get(String path) throws IOException {
response.getStatusLine().getStatusCode());
try {
httpResponseValidator.validateResponse(response);
- return IOUtils.toString(response.getEntity().getContent());
+ return IOUtils.toString(response.getEntity().getContent(), Charset.defaultCharset());
} finally {
EntityUtils.consume(response.getEntity());
releaseConnection(getMethod);
@@ -296,7 +296,10 @@ public void post_form(String path, Map data, boolean crumbFlag)
queryParams.add(param + "=" + EncodingUtils.formParameter(data.get(param)));
}
- queryParams.add("json=" + EncodingUtils.formParameter(JSONObject.fromObject(data).toString()));
+ ObjectMapper objectMapper = new ObjectMapper();
+ String jsonPathPart = objectMapper.writeValueAsString(data);
+
+ queryParams.add("json=" + EncodingUtils.formParameter(jsonPathPart));
String value = mapper.writeValueAsString(data);
StringEntity stringEntity = new StringEntity(value, ContentType.APPLICATION_FORM_URLENCODED);
request = new HttpPost(UrlUtils.toNoApiUri(uri, context, path) + StringUtils.join(queryParams, "&"));
@@ -361,7 +364,7 @@ public String post_xml(String path, String xml_data, boolean crumbFlag) throws I
jenkinsVersion = ResponseUtils.getJenkinsVersion(response);
try {
httpResponseValidator.validateResponse(response);
- return IOUtils.toString(response.getEntity().getContent());
+ return IOUtils.toString(response.getEntity().getContent(), Charset.defaultCharset());
} finally {
EntityUtils.consume(response.getEntity());
releaseConnection(request);
@@ -392,7 +395,7 @@ public String post_text(String path, String textData, ContentType contentType, b
jenkinsVersion = ResponseUtils.getJenkinsVersion(response);
try {
httpResponseValidator.validateResponse(response);
- return IOUtils.toString(response.getEntity().getContent());
+ return IOUtils.toString(response.getEntity().getContent(), Charset.defaultCharset());
} finally {
EntityUtils.consume(response.getEntity());
releaseConnection(request);
diff --git a/jenkins-client/src/main/java/com/offbytwo/jenkins/client/PreemptiveAuth.java b/jenkins-client/src/main/java/com/offbytwo/jenkins/client/PreemptiveAuth.java
index ce772ca9..803385e1 100644
--- a/jenkins-client/src/main/java/com/offbytwo/jenkins/client/PreemptiveAuth.java
+++ b/jenkins-client/src/main/java/com/offbytwo/jenkins/client/PreemptiveAuth.java
@@ -15,23 +15,20 @@
import org.apache.http.auth.AuthState;
import org.apache.http.auth.Credentials;
import org.apache.http.client.CredentialsProvider;
-import org.apache.http.client.protocol.ClientContext;
-import org.apache.http.protocol.ExecutionContext;
+import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.protocol.HttpContext;
-import java.io.IOException;
-
public class PreemptiveAuth implements HttpRequestInterceptor {
@Override
- public void process(HttpRequest request, HttpContext context) throws HttpException, IOException {
- AuthState authState = (AuthState) context.getAttribute(ClientContext.TARGET_AUTH_STATE);
+ public void process(HttpRequest request, HttpContext context) throws HttpException {
+ AuthState authState = (AuthState) context.getAttribute(HttpClientContext.TARGET_AUTH_STATE);
if (authState.getAuthScheme() == null) {
AuthScheme authScheme = (AuthScheme) context.getAttribute("preemptive-auth");
CredentialsProvider credsProvider = (CredentialsProvider) context
- .getAttribute(ClientContext.CREDS_PROVIDER);
- HttpHost targetHost = (HttpHost) context.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
+ .getAttribute(HttpClientContext.CREDS_PROVIDER);
+ HttpHost targetHost = (HttpHost) context.getAttribute(HttpClientContext.HTTP_TARGET_HOST);
if (authScheme != null) {
Credentials creds = credsProvider
.getCredentials(new AuthScope(targetHost.getHostName(), targetHost.getPort()));
diff --git a/jenkins-client/src/main/java/com/offbytwo/jenkins/helper/Range.java b/jenkins-client/src/main/java/com/offbytwo/jenkins/helper/Range.java
index cdbdc60a..7ef6f8be 100644
--- a/jenkins-client/src/main/java/com/offbytwo/jenkins/helper/Range.java
+++ b/jenkins-client/src/main/java/com/offbytwo/jenkins/helper/Range.java
@@ -51,7 +51,7 @@ private Range setFrom(int from) {
if (from < 0) {
throw new IllegalArgumentException("from value must be greater or equal null.");
}
- this.from = new Integer(from);
+ this.from = from;
return this;
}
@@ -59,7 +59,7 @@ private Range setTo(int to) {
if (to < 0) {
throw new IllegalArgumentException("to must be greater or equal null.");
}
- this.to = new Integer(to);
+ this.to = to;
return this;
}
@@ -81,7 +81,7 @@ public String getRangeString() {
}
public static final class FromBuilder {
- private Range range;
+ private final Range range;
public FromBuilder(Range range) {
this.range = range;
@@ -101,7 +101,7 @@ public Range build() {
}
public static final class ToBuilder {
- private Range range;
+ private final Range range;
public ToBuilder(Range range) {
this.range = range;
@@ -113,9 +113,9 @@ public Range build() {
}
public static final class Builder {
- private Range range;
+ private final Range range;
- protected Builder() {
+ private Builder() {
this.range = new Range();
}
@@ -130,8 +130,8 @@ public ToBuilder to(int t) {
}
public Range only(int only) {
- this.range.from = new Integer(only);
- this.range.to = new Integer(only + 1);
+ this.range.from = only;
+ this.range.to = only + 1;
return this.range;
}
}
@@ -139,4 +139,4 @@ public Range only(int only) {
public static Builder build() {
return new Builder();
}
-}
\ No newline at end of file
+}
diff --git a/jenkins-client/src/main/java/com/offbytwo/jenkins/model/BuildCause.java b/jenkins-client/src/main/java/com/offbytwo/jenkins/model/BuildCause.java
index 821a027f..46608bfc 100644
--- a/jenkins-client/src/main/java/com/offbytwo/jenkins/model/BuildCause.java
+++ b/jenkins-client/src/main/java/com/offbytwo/jenkins/model/BuildCause.java
@@ -19,7 +19,7 @@ public class BuildCause {
private String userName;
public BuildCause() {
- this.upstreamBuild = new Integer(0);
+ this.upstreamBuild = 0;
//TODO: Think about initialization of the other
// attributes as well.
// userId = StringConstant.EMPTY;
diff --git a/pom.xml b/pom.xml
index f88539d9..86885d2b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
com.offbytwo.jenkins
jenkins-client-parent
- 0.4.0-SNAPSHOT
+ 0.4.1
pom
@@ -41,10 +41,13 @@
+ 21
+ 21
+ 21
UTF-8
UTF-8
- 1.8
- 1.8
+ 21
+ 21
true
true
@@ -54,14 +57,13 @@
1.644
4.12
3.0.0
- 2.4
+ 2.16.1
1.4.7-jenkins-1
- 3.9
- 2.4
- 4.5.8
- 4.4.11
- 4.5.8
- 2.10.3
+ 3.14.0
+ 4.5.14
+ 4.4.16
+ 4.5.14
+ 2.17.1
@@ -71,18 +73,6 @@
-
-
- Cosmin Stejerean
- cosmin@offbytwo.com
- http://offbytwo.com
-
-
- Karl Heinz Marbaise
- khmarbaise@apache.org
-
-
-
@@ -106,7 +96,14 @@
org.dom4j
dom4j
- 2.1.3
+ 2.1.4
+
+
+
+
+ javax.xml.bind
+ jaxb-api
+ 2.3.1
@@ -116,13 +113,6 @@
test
-
- net.sf.json-lib
- json-lib
- ${json-lib.version}
- jdk15
-
-
org.apache.commons
@@ -157,7 +147,7 @@
jaxen
jaxen
- 1.1.6
+ 1.2.0
@@ -199,19 +189,19 @@
org.slf4j
slf4j-api
- 1.7.25
+ 1.7.36
org.apache.logging.log4j
log4j-bom
- 2.12.1
+ 2.23.1
import
pom
xerces
xmlParserAPIs
- 2.6.1
+ 2.6.2
@@ -222,22 +212,22 @@
org.apache.maven.plugins
maven-help-plugin
- 3.2.0
+ 3.9.7
org.apache.maven.plugins
maven-clean-plugin
- 3.1.0
+ 3.3.2
org.apache.maven.plugins
maven-resources-plugin
- 3.1.0
+ 3.3.1
org.apache.maven.plugins
maven-source-plugin
- 3.1.0
+ 3.3.1