Discrepancy in Usage of Default Character Set
"Stefan Hübner" <[email protected]>
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi HttpUnit-Team,
while working on the patch for 1705925
(http://sourceforge.net/tracker/index.php?func=detail&aid=1705925&group_id=6550&atid=106550)
I figured a discrepancy regarding detection of a default character set
to be used by different parts of HttpUnit.
There are two places where a default character set is defined:
HttpUnitOptions and HttpUnitUtils. The latter simply defines a public
static field DEFAULT_CHARACTER_SET, while the former provides static
getter and setter (get/set-DefaultCharacterSet) for its
_characterSet-field. By default HttpUnitOptions#_characterSet is
initialized with HttpUnitUtils.DEFAULT_CHARACTER_SET's value.
Apparently both those providers of a default character set are used
simultaneously throughout the code. Consider this scenario: I want
HttpUnit to use UTF-8 as it's default character set. So I set it using
HttpUnitOptions.setDefaultcharacterSet("UTF-8"). Then my tests execute
different parts of the framework which make use of both those
characterset-fields. Thus, HttpUnit's behaviour could seem to be
somewhat random occasionally (at least for bug 1709525 it was).
Usages of HttpUnitOptions.getDefaultCharacterSet() are:
- WebResponse.getCharacterSet()
- WebResponse.readContentTypeHeader()
- constructor of UncheckedParameterHolder
Usages of HttpUnitUtils.DEFAULT_CHARACTER_SET are:
- different occasions in HttpUnitOptions to initialize and reset its
own characterSet-Field -> this is ok
- ParameterHolder.getCharacterSet() which is called by another
UncheckedParameterHolder's constructor (see above)
- WebRequest.encode(...)
- WebResponse.DEFAULT_ENCODING_CANDIDATES
- ServletUnitHttpResponse.getCharacterEncoding()
Are there certain reasons for maintaining both those default character
set-providers? Since bug 1705925 was caused by this discrepancy I'd
guess it's not the only issue raised by this.
Any comments on this?
Cheers,
Stefan Hübner
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop