Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6676075

RegistryContext (com.sun.jndi.url.rmi.rmiURLContext) coding problem

XMLWordPrintable

    • 6
    • b26
    • sparc
    • solaris_8

        FULL PRODUCT VERSION :
        JRE 1.6

        A DESCRIPTION OF THE PROBLEM :
        There is a problem in the class : [com.sun.jndi.rmi.registry.RegistryContext]

        There is a difference on the constructor [public RegistryContext(String s, int i, Hashtable hashtable)] between JRE 1.5 and JRE 1.6

        The code is :
            public RegistryContext(String s, int i, Hashtable hashtable)
                throws NamingException
            {
                reference = null;
                environment = hashtable != null ? hashtable : new Hashtable(5);
                if(environment.get("java.naming.rmi.security.manager") != null)
                    installSecurityMgr();
                if(s != null && s.charAt(0) == '[')
                    s = s.substring(1, s.length() - 1);
                RMIClientSocketFactory rmiclientsocketfactory = (RMIClientSocketFactory)hashtable.get("com.sun.jndi.rmi.factory.socket");
                registry = getRegistry(s, i, rmiclientsocketfactory);
                host = s;
                port = i;
            }


        The line added is :
        RMIClientSocketFactory rmiclientsocketfactory = (RMIClientSocketFactory)hashtable.get("com.sun.jndi.rmi.factory.socket");

        But hashtable can be null and a NullPointerException can appear !!!

        Caused by: java.lang.NullPointerException
                at com.sun.jndi.rmi.registry.RegistryContext.<init>(Unknown Source)
                at com.sun.jndi.url.rmi.rmiURLContext.getRootURLContext(Unknown Source)
                at com.sun.jndi.toolkit.url.GenericURLContext.lookup(Unknown Source)
                at com.xxx.aes.naming.InitialServerContext.lookup(InitialServerContext.java:131)
                at com.xxx.aes.naming.InitialServerContext.lookup(InitialServerContext.java:159)
                at javax.naming.InitialContext.lookup(Unknown Source)
                at com.xxx.aes.services.resource.Resources.getDataSource(Resources.java:60)
                at com.xxx.aes.services.user.SQLContext.getConnection(SQLContext.java:64)
                at com.xxx.aes.services.user.SQLContext.initialSetting(SQLContext.java:1547)
                at com.xxx.aes.services.user.UserHandler.initialSetting(UserHandler.java:496)
                at com.xxx.aes.services.user.UserHandler.init(UserHandler.java:53)
                at com.xxx.aes.server.UserServer.start(UserServer.java:25)
                at com.xxx.aes.server.ApplicationServer.start(ApplicationServer.java:40)
                at com.xxx.arm.server.ARMServer.start(ARMServer.java:57)
                ... 4 more

        The good line code must be :

        RMIClientSocketFactory rmiclientsocketfactory = (RMIClientSocketFactory)environment.get("com.sun.jndi.rmi.factory.socket");

        Can you fix the bug for the JRE 1.6_05 ?


        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        NullPointerException

        REPRODUCIBILITY :
        This bug can be reproduced always.

        Release Regression From : 5.0
        The above release value was the last known release where this
        bug was not reproducible. Since then there has been a regression.

              vinnie Vincent Ryan
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: