Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 959478 - Add sun.nio.cs & sun.nio.ext paths to sun.jdk module
Add sun.nio.cs & sun.nio.ext paths to sun.jdk module
Status: CLOSED CURRENTRELEASE
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Class Loading (Show other bugs)
6.0.1
Unspecified Unspecified
unspecified Severity unspecified
: ER6
: EAP 6.2.0
Assigned To: David M. Lloyd
Ladislav Thon
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-03 11:16 EDT by Brad Maxwell
Modified: 2013-12-15 11:55 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Missing packages in the `sun.jdk` module resulted in a `ServiceConfigurationError` exception being thrown when attempting to load custom character sets when using `sun.jdk`. This release of JBoss EAP 6 has added the missing packages `sun.nio.cs` and `sun.nio.cs.ext`, and as a result, custom character sets can be used with the `sun.jdk` module.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-12-15 11:55:40 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Project with WAR to demonstrate the problem (327.24 KB, application/zip)
2013-05-14 17:53 EDT, Erhard Siegl
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker WFLY-1341 Major Resolved Missing charset-related paths from sun.jdk 2015-04-20 02:54:25 EDT

  None (edit)
Description Brad Maxwell 2013-05-03 11:16:37 EDT
Description of problem:

sun.nio.cs & sun.nio.ext paths are not exposed in sun.jdk module, which causes an issue when we try to load a custom character set using ServiceLoader

Version-Release number of selected component (if applicable):

EAP 6.0.1 / EAP 6.1.0 Beta1

How reproducible:

Steps to Reproduce:
1. java.util.ServiceLoader.load(java.nio.charset.spi.CharsetProvider.class)
  
Actual results:

Caused by: java.util.ServiceConfigurationError: java.nio.charset.spi.CharsetProvider: Provider sun.nio.cs.ext.ExtendedCharsets not found
	at java.util.ServiceLoader.fail(ServiceLoader.java:214) [rt.jar:1.6.0_24]
	at java.util.ServiceLoader.access$400(ServiceLoader.java:164) [rt.jar:1.6.0_24]
	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:350) [rt.jar:1.6.0_24]
	at java.util.ServiceLoader$1.next(ServiceLoader.java:421) [rt.jar:1.6.0_24]

Expected results:

No exception
Comment 1 David M. Lloyd 2013-05-03 12:20:17 EDT
The simple workaround is to use the variant of ServiceLoader.load() which accepts a class loader, and pass in null.  In fact this is almost always the right way to load things when you know they're part of the JDK.
Comment 2 Erhard Siegl 2013-05-14 17:53:18 EDT
Created attachment 747944 [details]
Project with WAR to demonstrate the problem
Comment 3 Erhard Siegl 2013-05-14 18:06:34 EDT
In this particular case we don't want to load a class from the JDK, but we created our own charset. But JBoss includes <path name="META-INF/services"/> in modules/sun/jdk/main/module.xml. Therefore it loads META-INF/services/java.nio.charset.spi.CharsetProvider from jre/lib/charsets.jar. But then it can't find sun.nio.cs.ext.ExtendedCharsets since this path is not included in the module. So it throws an exception before it gets to the custom service.
In my opinion sun/jdk/main/module.xml is not consistent. Either it should not include META-INF/services, or, if it does, it has to include the classes that are referenced in the extensions.
Comment 4 David M. Lloyd 2013-05-14 22:13:21 EDT
OK that makes sense.
Comment 5 Jaikiran Pai 2013-05-14 22:26:17 EDT
Added dev_ack+ on behalf of David.
Comment 9 Ladislav Thon 2013-10-07 08:05:56 EDT
I don't think this has been fixed correctly. Specifically, I belive that there is no such package as "sun.nio.ext" -- instead, it should have been "sun.nio.cs.ext". Moving back to assigned.

On the other hand, I admit I'm not expert in this area, so I'd like to be proven wrong :-)
Comment 12 Ladislav Thon 2013-10-11 02:52:55 EDT
I took the liberty to fix this myself. Here's the upstream pull request: https://github.com/wildfly/wildfly/pull/5259
Comment 17 Ladislav Thon 2013-10-21 05:13:05 EDT
Verified with EAP 6.2.0.ER6.

Note You need to log in before you can comment on or make changes to this bug.