This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]