Skip to content

Commit

Permalink
Merge branch 'master' into form-apply
Browse files Browse the repository at this point in the history
  • Loading branch information
yaroslavafenkin committed Oct 13, 2023
2 parents d71602e + ff276f7 commit ccd45a5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -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'],
])
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.71</version>
<version>4.74</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -121,7 +121,7 @@
<dependency>
<groupId>org.kohsuke.metainf-services</groupId>
<artifactId>metainf-services</artifactId>
<version>1.9</version>
<version>1.11</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -194,9 +194,9 @@
<profile>
<id>pdfs</id>
<properties>
<asciidoctor.maven.plugin.version>2.2.3</asciidoctor.maven.plugin.version>
<asciidoctor.maven.plugin.version>2.2.4</asciidoctor.maven.plugin.version>
<asciidoctorj.pdf.version>2.3.9</asciidoctorj.pdf.version>
<asciidoctorj.version>2.5.8</asciidoctorj.version>
<asciidoctorj.version>2.5.10</asciidoctorj.version>
<jruby.version>9.4.3.0</jruby.version>
</properties>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -804,15 +803,15 @@ 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 {
return HttpResponses.status(HttpServletResponse.SC_CONFLICT);
}
} 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());
}
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -1561,4 +1560,5 @@ public String getDisplayName() {
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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()));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@
<c:select/>
</f:entry>
<f:entry field="description" title="${%Description}" help="/help/parameter/description.html">
<f:textarea/>
<f:textarea codemirror-mode="${app.markupFormatter.codeMirrorMode}" codemirror-config="${app.markupFormatter.codeMirrorConfig}" previewEndpoint="/markupFormatter/previewDescription" />
</f:entry>
</j:jelly>

0 comments on commit ccd45a5

Please sign in to comment.