JDK-8065138 : Encodings.isRecognizedEnconding sometimes fails to recognize 'UTF8'
  • Type: Bug
  • Component: xml
  • Sub-Component: org.w3c.dom
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: os_x
  • CPU: x86_64
  • Submitted: 2014-11-17
  • Updated: 2016-08-24
  • Resolved: 2014-11-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b42Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
This shows up consistently on my Mac with org/w3c/dom/ls/LSSerializerTest.java

test org.w3c.dom.ls.LSSerializerTest.testDOMErrorHandler(): failure
java.lang.AssertionError: Unexpected Error Type: unsupported-encoding @ (-1, -1), An unsupported encoding is encountered.
	at org.testng.Assert.fail(Assert.java:94)
	at org.w3c.dom.ls.LSSerializerTest$DOMErrorHandlerImpl.handleError(LSSerializerTest.java:64)
	at com.sun.org.apache.xml.internal.serializer.dom3.LSSerializerImpl.write(LSSerializerImpl.java:866)
	at org.w3c.dom.ls.LSSerializerTest.testDOMErrorHandler(LSSerializerTest.java:130)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
	at org.testng.TestRunner.privateRun(TestRunner.java:767)
	at org.testng.TestRunner.run(TestRunner.java:617)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
	at org.testng.SuiteRunner.run(SuiteRunner.java:240)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
	at org.testng.TestNG.run(TestNG.java:1057)
	at com.sun.javatest.regtest.TestNGAction$TestNGRunner.main(TestNGAction.java:161)
	at com.sun.javatest.regtest.TestNGAction$TestNGRunner.main(TestNGAction.java:145)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94)
	at java.lang.Thread.run(Thread.java:745)

Comments
Filed JDK-8065576 to investigate use of pipefail. This bug should just be fixed with LC_ALL=C.
20-11-2014

The issue occurs with jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/Encodings.properties It contains a special character '��' which confuses the build system when LC_ALL is not set to 'C' in the environment (e.g. when you have LC_ALL=en_US.UTF-8). The Encodings.properties file ends up truncated in resources.jar - it contains only one line (the line before the special character was encountered). A possible fix could be to replace the special character '��' by its unicode representation \u00e5 - however it seems better to fix the build macro (add_file_to_clean in make/common/JavaCompilation.gmk) rather than in the individual .properties file.
20-11-2014

Should be fixed in the build by explicitly setting LC_ALL=C before running the sed expressions. We should also investigate adding "pipefail" to the shell options to make this fail the build when it happens.
20-11-2014