United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6676075 RegistryContext (com.sun.jndi.url.rmi.rmiURLContext) coding problem
JDK-6676075 : RegistryContext (com.sun.jndi.url.rmi.rmiURLContext) coding problem

Details
Type:
Bug
Submit Date:
2008-03-17
Status:
Resolved
Updated Date:
2011-02-16
Project Name:
JDK
Resolved Date:
2008-06-10
Component:
core-libs
OS:
solaris_8
Sub-Component:
javax.naming
CPU:
sparc
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:
6u10 (b26)

Related Reports
Backport:
Relates:

Sub Tasks

Description
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.

                                    

Comments
EVALUATION

This appears to be a regression introduced with the fix for 5107423.
                                     
2008-03-17



Hardware and Software, Engineered to Work Together