This is the mail archive of the java-patches@sources.redhat.com mailing list for the Java project.


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

Patch: java/sql/DriverManager


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));
 }

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