diff --git a/Jenkinsfile b/Jenkinsfile index 9f42fa028..b4fa05b00 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,5 @@ buildPlugin(useContainerAgent: true, configurations: [ + [platform: 'windows', jdk: '17'], [platform: 'linux', jdk: '11'], - [platform: 'windows', jdk: '11'], - [platform: 'linux', jdk: '17'], + [platform: 'linux', jdk: '21'], ]) diff --git a/pom.xml b/pom.xml index 7736f4308..3935bff3d 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ org.jenkins-ci.plugins plugin - 4.71 + 4.74 @@ -121,7 +121,7 @@ org.kohsuke.metainf-services metainf-services - 1.9 + 1.11 provided @@ -194,9 +194,9 @@ pdfs - 2.2.3 + 2.2.4 2.3.9 - 2.5.8 + 2.5.10 9.4.3.0 diff --git a/src/main/java/com/cloudbees/plugins/credentials/CredentialsSelectHelper.java b/src/main/java/com/cloudbees/plugins/credentials/CredentialsSelectHelper.java index ccf6c41fb..d5befb700 100644 --- a/src/main/java/com/cloudbees/plugins/credentials/CredentialsSelectHelper.java +++ b/src/main/java/com/cloudbees/plugins/credentials/CredentialsSelectHelper.java @@ -614,7 +614,7 @@ public JSONObject doAddCredentials(StaplerRequest req, StaplerResponse rsp) thro .element("notificationType", "ERROR"); } store.checkPermission(CredentialsStoreAction.CREATE); - Credentials credentials = req.bindJSON(Credentials.class, data.getJSONObject("credentials")); + Credentials credentials = Descriptor.bindJSON(req, Credentials.class, data.getJSONObject("credentials")); boolean credentialsWereAdded = store.addCredentials(wrapper.getDomain(), credentials); if (credentialsWereAdded) { return new JSONObject() diff --git a/src/main/java/com/cloudbees/plugins/credentials/CredentialsStoreAction.java b/src/main/java/com/cloudbees/plugins/credentials/CredentialsStoreAction.java index f58366dda..b752bfe21 100644 --- a/src/main/java/com/cloudbees/plugins/credentials/CredentialsStoreAction.java +++ b/src/main/java/com/cloudbees/plugins/credentials/CredentialsStoreAction.java @@ -33,7 +33,6 @@ import com.thoughtworks.xstream.converters.UnmarshallingContext; import com.thoughtworks.xstream.io.HierarchicalStreamReader; import com.thoughtworks.xstream.io.HierarchicalStreamWriter; -import com.thoughtworks.xstream.io.xml.XppDriver; import edu.umd.cs.findbugs.annotations.CheckForNull; import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -541,7 +540,7 @@ public HttpResponse doCreateDomain(StaplerRequest req) throws ServletException, } Domain domain = (Domain) - Items.XSTREAM.unmarshal(new XppDriver().createReader(new StringReader(out.toString()))); + Items.XSTREAM.unmarshal(XStream2.getDefaultDriver().createReader(new StringReader(out.toString()))); if (getStore().addDomain(domain)) { return HttpResponses.ok(); } else { @@ -804,7 +803,7 @@ public HttpResponse doCreateCredentials(StaplerRequest req) throws ServletExcept } Credentials credentials = (Credentials) - Items.XSTREAM.unmarshal(new XppDriver().createReader(new StringReader(out.toString()))); + Items.XSTREAM.unmarshal(XStream2.getDefaultDriver().createReader(new StringReader(out.toString()))); if (getStore().addCredentials(domain, credentials)) { return HttpResponses.ok(); } else { @@ -812,7 +811,7 @@ public HttpResponse doCreateCredentials(StaplerRequest req) throws ServletExcept } } else { JSONObject data = req.getSubmittedForm(); - Credentials credentials = req.bindJSON(Credentials.class, data.getJSONObject("credentials")); + Credentials credentials = Descriptor.bindJSON(req, Credentials.class, data.getJSONObject("credentials")); getStore().addCredentials(domain, credentials); return HttpResponses.redirectTo("../../domain/" + getUrlName()); } @@ -998,7 +997,7 @@ public void updateByXml(Source source) throws IOException { } Domain replacement = (Domain) - Items.XSTREAM.unmarshal(new XppDriver().createReader(new StringReader(out.toString()))); + Items.XSTREAM.unmarshal(XStream2.getDefaultDriver().createReader(new StringReader(out.toString()))); getStore().updateDomain(domain, replacement); } @@ -1395,7 +1394,7 @@ public HttpResponse doDoMove(StaplerRequest req, @QueryParameter String destinat public HttpResponse doUpdateSubmit(StaplerRequest req) throws ServletException, IOException { getStore().checkPermission(UPDATE); JSONObject data = req.getSubmittedForm(); - Credentials credentials = req.bindJSON(Credentials.class, data); + Credentials credentials = Descriptor.bindJSON(req, Credentials.class, data); if (!getStore().updateCredentials(this.domain.domain, this.credentials, credentials)) { return HttpResponses.redirectTo("concurrentModification"); } @@ -1505,7 +1504,7 @@ public void updateByXml(Source source) throws IOException { } Credentials credentials = (Credentials) - Items.XSTREAM.unmarshal(new XppDriver().createReader(new StringReader(out.toString()))); + Items.XSTREAM.unmarshal(XStream2.getDefaultDriver().createReader(new StringReader(out.toString()))); getStore().updateCredentials(domain.getDomain(), this.credentials, credentials); } @@ -1561,4 +1560,5 @@ public String getDisplayName() { } } } + } diff --git a/src/main/java/com/cloudbees/plugins/credentials/cli/BaseCredentialsCLICommand.java b/src/main/java/com/cloudbees/plugins/credentials/cli/BaseCredentialsCLICommand.java index a90fa42d5..87023aab1 100644 --- a/src/main/java/com/cloudbees/plugins/credentials/cli/BaseCredentialsCLICommand.java +++ b/src/main/java/com/cloudbees/plugins/credentials/cli/BaseCredentialsCLICommand.java @@ -28,7 +28,6 @@ import com.cloudbees.plugins.credentials.common.IdCredentials; import com.cloudbees.plugins.credentials.domains.Domain; import com.thoughtworks.xstream.io.HierarchicalStreamReader; -import com.thoughtworks.xstream.io.xml.XppDriver; import hudson.cli.CLICommand; import java.io.IOException; import java.io.InputStream; @@ -42,6 +41,7 @@ import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; +import hudson.util.XStream2; import jenkins.util.xml.XMLUtils; import org.apache.commons.lang.StringUtils; import org.xml.sax.SAXException; @@ -103,7 +103,7 @@ protected static HierarchicalStreamReader safeXmlStreamReader(Source source) thr } catch (TransformerException | SAXException e) { throw new IOException("Failed to parse", e); } - return new XppDriver().createReader(new StringReader(out.toString())); + return XStream2.getDefaultDriver().createReader(new StringReader(out.toString())); } } diff --git a/src/main/resources/com/cloudbees/plugins/credentials/CredentialsParameterDefinition/config.jelly b/src/main/resources/com/cloudbees/plugins/credentials/CredentialsParameterDefinition/config.jelly index 31a659d44..67348f58a 100644 --- a/src/main/resources/com/cloudbees/plugins/credentials/CredentialsParameterDefinition/config.jelly +++ b/src/main/resources/com/cloudbees/plugins/credentials/CredentialsParameterDefinition/config.jelly @@ -40,6 +40,6 @@ - +