JDK-6254234 : 'Warning: Could not get charToByteConverterClass!' printed to stderr when running XSLT
  • Type: Bug
  • Component: xml
  • Sub-Component: javax.xml.transform
  • Affected Version: 6
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: linux
  • CPU: x86
  • Submitted: 2005-04-12
  • Updated: 2013-04-06
Description
In some recent Mustang build, the message 'Warning: Could not get charToByteConverterClass!' (which seems to have been present for a long time in rt.jar!/com/sun/org/apache/xml/internal/serializer/Encodings.class) has begun to be printed to standard error, for no discernible reason, it seems while performing XSLT transformations.

Visible sometimes in log files of NetBeans IDE development builds. I can also reproduce by running the following on NB source code:

JAVA_HOME=/space/jdk1.6.0-b31 ant -f ant/project/build.xml test

All unit tests pass, but I also get the warning in several places, e.g.

---%<--- [portion of test output]
Warning: Could not get charToByteConverterClass!
Testsuite: org.netbeans.spi.project.support.ant.ProjectGeneratorTest
Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 2.414 sec

------------- Standard Error -----------------
Warning: Could not get charToByteConverterClass!
------------- ---------------- ---------------
---%<---

The same tests run in b26 just show:

---%<---
Testsuite: org.netbeans.spi.project.support.ant.ProjectGeneratorTest
Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 2.38 sec
---%<---

By the way, I run Fedora Core 3 (all updates applied) in UTF-8 locale.
###@###.### 2005-04-12 21:10:43 GMT

Comments
SUGGESTED FIX In com.sun.org.apache.xml.internal.serializer.Encodings, delete at least the findCharToByteConverterMethod and getCharToByteConverter methods and the SUN_CHAR2BYTE_CONVERTER_METHOD field, and rewrite usages of E.gCTBC from e.g. ToStream.escapingNotNeeded. ###@###.### 2005-05-18 18:27:30 GMT
18-05-2005

EVALUATION It does not look like JAXP bug. This message is coming from Netbeans Testing framework classes. P3 bugs are suppose to be bugs who impact JAXP functionality. How this bug is impacting JAXP functionality ? This is not a JAXP bug so please close it. ###@###.### 2005-05-18 08:46:52 GMT You did not read my description at all, I guess. The message is *not* coming from the NB unit tests. The unit tests are calling JAXP and JAXP code is printing the message (as of JDK 1.6 only). I even pointed you to the exact class which is printing it. The cause for the bug is obvious when you look at Encodings.java: ---%<--- try { .... Class charToByteConverterClass = (Class) Class.forName("sun.io.CharToByteConverter"); .... catch (Exception e) { System.err.println("Warning: Could not get charToByteConverterClass!"); } ---%<--- Ignoring the awful exception handling for a moment (catching an untyped Exception and then not printing any info whatsoever about it), you can see that the code is trying to load a class - sun.io.CharToByteConvertor - which no longer exists in Mustang, because it is obsolete. Look through this class a bit - it clearly needs to be rewritten to use the NIO encoding support in JDK 1.4+. Maybe some of this code is useful in Xalan as distributed from xml.apache.org, for people using ancient JDKs, but it could be simplified and updated for inclusion in the Sun JDK (Mustang at least). ###@###.### 2005-05-18 18:27:30 GMT ###@###.### 2005-05-19 07:19:12 GMT
12-04-2005

WORK AROUND None known. ###@###.### 2005-04-12 21:10:43 GMT
12-04-2005