This is the mail archive of the
java-patches@sources.redhat.com
mailing list for the Java project.
Patch: java/sql/DriverManager
- To: java-patches at sources dot redhat dot com
- Subject: Patch: java/sql/DriverManager
- From: Jeff Sturm <jsturm at detroit dot appnet dot com>
- Date: Wed, 27 Dec 2000 12:31:37 -0500
- Organization: Commerce One
DriverManager.getConnection(url, null, null) currently throws a
NullPointerException in libgcj. Sun's JDK accepts this usage,
performing similarly to getConnection(url). The patch below makes
DriverManager conform to Sun's implementation:
2000-12-27 Jeff Sturm <jeff.sturm@commerceone.com>
* java/sql/DriverManager.java (getConnection): Don't set user/password
properties if null.
Index: java/sql/DriverManager.java
===================================================================
RCS file: /cvs/gcc/gccIndex: java/sql/DriverManager.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/sql/DriverManager.java,v
retrieving revision 1.2
diff -u -r1.2 DriverManager.java
--- DriverManager.java 2000/12/01 01:48:34 1.2
+++ DriverManager.java 2000/12/27 17:21:05
@@ -341,8 +341,10 @@
{
Properties p = new Properties();
- p.setProperty("user", user);
- p.setProperty("password", password);
+ if (user != null)
+ p.setProperty("user", user);
+ if (password != null)
+ p.setProperty("password", password);
return(getConnection(url, p));
}