[HtmlUnit] [htmlunit:bugs] #1978 WebResponseWrapper missing cleanUp / defaultCharsetUtf8 / ...
RBRi via HtmlUnit-develop <[email protected]> Thu, 02 Aug 2018 10:16:32 -0000
| Newsgroups | gmane.comp.java.htmlunit.devel |
|---|---|
| Message-ID | </p/htmlunit/bugs/1978/3c4761020aafb61524c0c3985363230bc4c0dc06.bugs@htmlunit.p.sourceforge.net> |
- **status**: open --> accepted
- **assigned_to**: RBRi
- **Comment**:
Will fix this soon, thanks
---
** [bugs:#1978] WebResponseWrapper missing cleanUp / defaultCharsetUtf8 / ...**
**Status:** accepted
**Group:** Latest SVN
**Created:** Thu Aug 02, 2018 05:48 AM UTC by Atsushi Nakagawa
**Last Updated:** Thu Aug 02, 2018 05:48 AM UTC
**Owner:** RBRi
### Problem in brief
`WebResponseWrapper` is quite useful but it got left sometime between 2.28 and 2.32 is currently missing delegate calls to these following methods:
* `getContentLength()`
* `cleanUp()`
* `defaultCharsetUtf8()`
Since we use it extensively, the side effect of this is `XMLHttpRequest.responseText` outputting garbled text as `UTF-8` is being treated as `ISO-8859-1`.
### Possible fix
```diff
--- a/src/main/java/com/gargoylesoftware/htmlunit/util/WebResponseWrapper.java
+++ b/src/main/java/com/gargoylesoftware/htmlunit/util/WebResponseWrapper.java
@@ -50,6 +50,11 @@ public WebResponseWrapper(final WebResponse webResponse) throws IllegalArgumentE
wrappedWebResponse_ = webResponse;
}
+ @Override
+ public long getContentLength() {
+ return wrappedWebResponse_.getContentLength();
+ }
+
/**
* {@inheritDoc}
* The default behavior of this method is to return getContentAsStream() on the wrapped webResponse object.
@@ -123,6 +128,16 @@ public long getLoadTime() {
return wrappedWebResponse_.getLoadTime();
}
+ @Override
+ public void cleanUp() {
+ wrappedWebResponse_.cleanUp();
+ }
+
+ @Override
+ public void defaultCharsetUtf8() {
+ wrappedWebResponse_.defaultCharsetUtf8();
+ }
+
/**
* {@inheritDoc}
* The default behavior of this method is to return getResponseHeaders() on the wrapped webResponse object.
```
---
Sent from sourceforge.net because [email protected] is subscribed to https://sourceforge.net/p/htmlunit/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
HtmlUnit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop