diff --git a/src/main/java/com/cloudbees/plugins/credentials/CredentialsStoreAction.java b/src/main/java/com/cloudbees/plugins/credentials/CredentialsStoreAction.java index f58366dda..d4d71c560 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 { @@ -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); } @@ -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())); } }