You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Tim Ellison (JIRA)" <ji...@apache.org> on 2006/06/19 15:38:30 UTC
[jira] Closed: (HARMONY-618)
[classlib][nio]java.nio.channels.nio.SelectorProvider should not use
thread's context classloader to load provider class defined in property
file
[ http://issues.apache.org/jira/browse/HARMONY-618?page=all ]
Tim Ellison closed HARMONY-618:
-------------------------------
Verified by Paulex.
> [classlib][nio]java.nio.channels.nio.SelectorProvider should not use thread's context classloader to load provider class defined in property file
> -------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-618
> URL: http://issues.apache.org/jira/browse/HARMONY-618
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Paulex Yang
> Assignee: Tim Ellison
> Priority: Minor
> Attachments: Harmony-618.diff
>
> SelectorProvider.provider() should not use the Thread.currentThread().getContextClassLoader() to load the provider class defined in property file, test shows RI doesn't uses it.
> Run the test below, and
> RI prints: pass
> while Harmony prints: fail
> public class SelectorProviderTest {
> private static final Class CLASS1 = MockSelectorProvider1.class;
> private static final Class CLASS2 = MockSelectorProvider2.class;
> private static final String KEY = "java.nio.channels.spi.SelectorProvider";
> public static void main(String[] args) {
> System.setProperty(KEY, CLASS1.getName());
> Thread.currentThread().setContextClassLoader(new MockClassLoader());
> SelectorProvider provider = SelectorProvider.provider();
> if (provider.getClass() == CLASS1) {
> System.out.println("pass");
> } else {
> System.out.println("fail");
> }
> }
> private static class MockClassLoader extends ClassLoader {
> public Class<?> loadClass(String name) throws ClassNotFoundException {
> return CLASS2;
> }
> }
>
> public static class MockSelectorProvider2 extends SelectorProvider{
> public DatagramChannel openDatagramChannel() throws IOException {
> return null;
> }
> public Pipe openPipe() throws IOException {
> return null;
> }
> public AbstractSelector openSelector() throws IOException {
> return null;
> }
> public ServerSocketChannel openServerSocketChannel() throws IOException {
> return null;
> }
> public SocketChannel openSocketChannel() throws IOException {
> return null;
> }
> }
> public static class MockSelectorProvider1 extends SelectorProvider{
> public DatagramChannel openDatagramChannel() throws IOException {
> return null;
> }
> public Pipe openPipe() throws IOException {
> return null;
> }
> public AbstractSelector openSelector() throws IOException {
> return null;
> }
> public ServerSocketChannel openServerSocketChannel() throws IOException {
> return null;
> }
> public SocketChannel openSocketChannel() throws IOException {
> return null;
> }
> }
> }
--
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
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira