Skip to content
This repository was archived by the owner on Apr 7, 2022. It is now read-only.

Commit ba8b122

Browse files
committed
Updated to HtmlUnit 2.3
1 parent 3a2a11b commit ba8b122

3 files changed

Lines changed: 13 additions & 16 deletions

File tree

jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@
8383
import net.sourceforge.jwebunit.util.TestContext;
8484

8585
import org.apache.commons.httpclient.Cookie;
86-
import org.apache.commons.httpclient.HttpState;
8786
import org.apache.commons.httpclient.NameValuePair;
88-
8987
import org.apache.regexp.RE;
9088
import org.apache.regexp.RESyntaxException;
9189
import org.slf4j.Logger;
@@ -217,14 +215,13 @@ public void setScriptingEnabled(boolean value) {
217215

218216
public List<javax.servlet.http.Cookie> getCookies() {
219217
List<javax.servlet.http.Cookie> result = new LinkedList<javax.servlet.http.Cookie>();
220-
final HttpState stateForUrl = wc.getWebConnection().getState();
221-
Cookie[] cookies = stateForUrl.getCookies();
222-
for (int i = 0; i < cookies.length; i++) {
218+
Set<Cookie> cookies = wc.getCookieManager().getCookies();
219+
for (Cookie cookie : cookies) {
223220
javax.servlet.http.Cookie c = new javax.servlet.http.Cookie(
224-
cookies[i].getName(), cookies[i].getValue());
225-
c.setComment(cookies[i].getComment());
226-
c.setDomain(cookies[i].getDomain());
227-
Date expire = cookies[i].getExpiryDate();
221+
cookie.getName(), cookie.getValue());
222+
c.setComment(cookie.getComment());
223+
c.setDomain(cookie.getDomain());
224+
Date expire = cookie.getExpiryDate();
228225
if (expire == null) {
229226
c.setMaxAge(-1);
230227
} else {
@@ -234,9 +231,9 @@ public List<javax.servlet.http.Cookie> getCookies() {
234231
(expire.getTime() - now.getTime()) / 1000);
235232
c.setMaxAge(second.intValue());
236233
}
237-
c.setPath(cookies[i].getPath());
238-
c.setSecure(cookies[i].getSecure());
239-
c.setVersion(cookies[i].getVersion());
234+
c.setPath(cookie.getPath());
235+
c.setSecure(cookie.getSecure());
236+
c.setVersion(cookie.getVersion());
240237
result.add(c);
241238
}
242239
return result;
@@ -839,7 +836,7 @@ public String handlePrompt(Page page, String msg) {
839836
// Deal with cookies
840837
for (javax.servlet.http.Cookie c : getTestContext().getCookies()) {
841838
// If Path==null, cookie is not send to the server.
842-
wc.getWebConnection().getState().addCookie(
839+
wc.getCookieManager().addCookie(
843840
new Cookie(c.getDomain() != null ? c.getDomain() : "", c
844841
.getName(), c.getValue(), c.getPath() != null ? c
845842
.getPath() : "", c.getMaxAge(), c.getSecure()));

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@
282282
<dependency>
283283
<groupId>net.sourceforge.htmlunit</groupId>
284284
<artifactId>htmlunit</artifactId>
285-
<version>2.2</version>
285+
<version>2.3</version>
286286
</dependency>
287287
<dependency>
288288
<groupId>org.openqa.selenium.client-drivers</groupId>

src/changes/changes.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
<body>
1010
<release version="2.0" date="UNKNOW">
1111
<action type="update" dev="henryju">
12-
Updated to HtmlUnit 2.2.
12+
Updated to HtmlUnit 2.3.
1313
</action>
1414
<action type="fix" dev="joshlane" issue="2007985,2009776" due-to="Josh Lane">
1515
selectOptionByValue failed with Selenium Plugin.
1616
selectOption always failed, cannot find element.
1717
Other improvements to Selenium plugin.
1818
</action>
1919
<action type="update" dev="henryju" issue="1950248" due-to="Agnes Ro">
20-
Update to HtmlUnit 2.1 and Java 1.5.
20+
Updated to HtmlUnit 2.1 and Java 1.5.
2121
</action>
2222
</release>
2323
<release version="1.5" date="april 22, 2008" description="The latest major release before Java 1.5 migration">

0 commit comments

Comments
 (0)