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

[JENKINS-53823] - Update JTH and commons-io to fix JDK11 compatibility issues #3661

Closed
wants to merge 13 commits into from
Closed
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ THE SOFTWARE.
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<version>2.6</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion test-pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ THE SOFTWARE.
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jenkins-test-harness</artifactId>
<version>2.41.1</version>
<version>2.42</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand Down
3 changes: 2 additions & 1 deletion test/src/test/java/hudson/model/ComputerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.gargoylesoftware.htmlunit.xml.XmlPage;

import java.io.File;
import java.nio.charset.StandardCharsets;

import jenkins.model.Jenkins;
import hudson.slaves.DumbSlave;
Expand Down Expand Up @@ -106,7 +107,7 @@ public void removeUserDetailsFromOfflineCause() throws Exception {

private void verifyOfflineCause(Computer computer) throws Exception {
XmlPage page = j.createWebClient().goToXml("computer/" + computer.getName() + "/config.xml");
String content = page.getWebResponse().getContentAsString("UTF-8");
String content = page.getWebResponse().getContentAsString(StandardCharsets.UTF_8);
assertThat(content, containsString("temporaryOfflineCause"));
assertThat(content, containsString("<userId>username</userId>"));
assertThat(content, not(containsString("ApiTokenProperty")));
Expand Down
11 changes: 6 additions & 5 deletions test/src/test/java/hudson/model/ViewTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,17 @@ public class ViewTest {
ListView view = listView("v");
view.description = "one";
WebClient wc = j.createWebClient();
String xml = wc.goToXml("view/v/config.xml").getContent();
assertTrue(xml, xml.contains("<description>one</description>"));
xml = xml.replace("<description>one</description>", "<description>two</description>");
//TODO: replace by XPath assert
String xml = wc.goToXml("view/v/config.xml").asXml();
assertTrue(xml, xml.contains("one"));
xml = xml.replace("one", "two");
WebRequest req = new WebRequest(wc.createCrumbedUrl("view/v/config.xml"), HttpMethod.POST);
req.setRequestBody(xml);
req.setEncodingType(null);
wc.getPage(req);
assertEquals("two", view.getDescription());
assertTrue("New description was not set", view.getDescription().contains("two"));
xml = new XmlFile(Jenkins.XSTREAM, new File(j.jenkins.getRootDir(), "config.xml")).asString();
assertTrue(xml, xml.contains("<description>two</description>"));
assertTrue(xml, xml.contains("two"));
}

@Issue("JENKINS-21017")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
package hudson.tools;

import com.gargoylesoftware.htmlunit.HttpMethod;
import com.gargoylesoftware.htmlunit.InteractivePage;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
Expand Down Expand Up @@ -148,7 +147,7 @@ private class SpyingJavaScriptEngine extends JavaScriptEngine {
}

@Override
public Object callFunction(InteractivePage page, Function function, Scriptable scope, Scriptable thisObject, Object[] args) {
public Object callFunction(HtmlPage page, Function function, Scriptable scope, Scriptable thisObject, Object[] args) {
if (thisObject instanceof XMLHttpRequest) {
try {
WebRequest request = getPrivateWebRequestField((XMLHttpRequest) thisObject);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private HtmlForm getRekeyForm(WebClient wc) throws IOException, SAXException {
}

private HtmlButton getButton(HtmlForm form, int index) {
return form.<HtmlButton>getHtmlElementsByTagName("button").get(index);
return form.getButtonsByName("button").get(index);
}

public void testScanOnBoot() throws Exception {
Expand Down
4 changes: 2 additions & 2 deletions test/src/test/java/lib/form/PasswordTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public void testExposedCiphertext() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
String pName = p.getFullName();
getJobCommand.main(Collections.singletonList(pName), Locale.ENGLISH, System.in, new PrintStream(baos), System.err);
assertEquals(xmlAdmin, baos.toString(configXml.getWebResponse().getContentCharset()));
assertEquals(xmlAdmin, baos.toString(configXml.getWebResponse().getContentCharset().toString()));
CopyJobCommand copyJobCommand = new CopyJobCommand();
copyJobCommand.setTransportAuth(adminAuth);
String pAdminName = pName + "-admin";
Expand All @@ -171,7 +171,7 @@ public void testExposedCiphertext() throws Exception {
getJobCommand.setTransportAuth(devAuth);
baos = new ByteArrayOutputStream();
getJobCommand.main(Collections.singletonList(pName), Locale.ENGLISH, System.in, new PrintStream(baos), System.err);
assertEquals(xmlDev, baos.toString(configXml.getWebResponse().getContentCharset()));
assertEquals(xmlDev, baos.toString(configXml.getWebResponse().getContentCharset().toString()));
copyJobCommand = new CopyJobCommand();
copyJobCommand.setTransportAuth(devAuth);
String pDevName = pName + "-dev";
Expand Down