You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Sergey Ushakov (JIRA)" <xa...@xml.apache.org> on 2005/04/05 13:58:18 UTC

[jira] Updated: (XALANJ-2087) Get rid of the dependency on sun.io.CharToByteConverter

     [ http://issues.apache.org/jira/browse/XALANJ-2087?page=history ]

Sergey Ushakov updated XALANJ-2087:
-----------------------------------

    Attachment: Encodings&Converter.zip

Hi, first some comments to prior discussion.

The fact that the XALANJ-2086 bug was present since 2003 just shows that too few people:
- trod on this issue;
- care/dare reporting it :(

The code that uses sun.io.CharToByteConverter is perhaps rarely depended on - many people may just fallback to different UTF flavors or other charsets that are described sufficiently well by lastPrintable=0xFFFF. But this code is definitely not a dead one - I know it on my skin :)

sun.io.CharToByteConverter is still available in Java 1.5. It seems to be scheduled for removal in 1.6.

Sorry I have not read the whole discussion before doing anything. But the result is a new piece of code that:
- removes dependency on sun.io.CharToByteConverter for platforms starting with 1.4;
- retains compatibility with platforms prior to 1.4 through use of sun.io.CharToByteConverter when appropriate;
- fixes the XALANJ-2086 bug;
- fixes some bugs in Encodings.properties (hope does not introduce new ones :) and slightly reorders it;
- changes the ENCODINGS_PROP value to reflect package change from 'org.apache.xalan.serialize' to 'org.apache.xml.serializer' that took place some time ago :) ;
- adds some more error logging;
- adds some javadocs.
My first intention was just to fix the 'Encodings' problems, but when I occasionally saw a brief piece of this discussion on the mail list, the result became as it is :)

The implementation uses an approach with 'Converter' abstraction and conditional loading of platform-specific subclasses. Reflection is removed entirely. Hope it's not bad :)  The code became more straightforward, but with a cost of five (!) new small classes. I have tried to retain reflection at first, but got security issues with some charsets even without any J2EE containers...

The API style of sun.io.CharToByteConverter is retained as more simple.

Being not an expert in security issues I was not sure if all this AccessController stuff is ever needed for mere Class.forName() within the same package. So dynamic class loading is done without any ceremonies :)  At least some of Xalan code still does without AccessController in similar cases... Hope someone more knowledgeable will correct me if I am wrong.

I have tested the new code for Russian charsets with no problems. Is it a solution?


> Get rid of the dependency on sun.io.CharToByteConverter
> -------------------------------------------------------
>
>          Key: XALANJ-2087
>          URL: http://issues.apache.org/jira/browse/XALANJ-2087
>      Project: XalanJ2
>         Type: Improvement
>   Components: Xalan
>     Versions: CurrentCVS
>     Reporter: Jack
>  Attachments: Encodings&Converter.zip
>
> The class org.apache.xml.serializer.Encodings references sun.io.CharToByteConverter directly, while the latter is not a public API. Is it possible to use java.nio.charset classes instead to remove this dependency?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org