libgcj/7180: possible bug in javax.naming.spi.NamingManager.getPlusPath()

daveho@cs.umd.edu daveho@cs.umd.edu
Mon Jul 1 13:36:00 GMT 2002


>Number:         7180
>Category:       libgcj
>Synopsis:       possible bug in javax.naming.spi.NamingManager.getPlusPath()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 01 13:36:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     daveho@cs.umd.edu
>Release:        libjava from CVS, dated June 27, 2002
>Organization:
>Environment:
Jikes RVM, RedHat Linux 7.2
>Description:
The javax.naming.spi.NamingManager.getPlusPath() method will instantiate a StringTokenizer() on a null string if a path element is found in neither the passed-in environment nor the passed-in Context, which will then cause a NullPointerException.  However, for the getStateToBind() method (also in NamingManager), it should be legal for the path to be empty.  I've attached a small patch which should fix the problem.

Note that I'm not using gcj.  However, this problem should be easy to reproduce on any VM.
>How-To-Repeat:
Any call to javax.naming.spi.NamingManager.getStateToBind() where neither the environment nor the Context contains a value associated with Context.STATE_FACTORIES.
>Fix:
diff -u -r1.1 NamingManager.java
--- NamingManager.java	2002/06/27 21:00:14	1.1
+++ NamingManager.java	2002/07/01 20:10:14
@@ -170,7 +170,7 @@
       path = path2;
     else if (path2 != null)
       path += ":" + path2;
-    return new StringTokenizer (path, ":");
+    return new StringTokenizer (path != null ? path : "", ":");
   }
 
   public static Object getObjectInstance (Object refInfo,
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list