This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
libgcj/7180: possible bug in javax.naming.spi.NamingManager.getPlusPath()
- From: daveho at cs dot umd dot edu
- To: gcc-gnats at gcc dot gnu dot org
- Date: 1 Jul 2002 20:32:05 -0000
- Subject: libgcj/7180: possible bug in javax.naming.spi.NamingManager.getPlusPath()
- Reply-to: daveho at cs dot umd dot edu
>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: