jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r613799 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionFactory.java
Date Mon, 21 Jan 2008 08:48:51 GMT
Author: thomasm
Date: Mon Jan 21 00:48:50 2008
New Revision: 613799

URL: http://svn.apache.org/viewvc?rev=613799&view=rev
Log:
JCR-1305 JNDI data sources with BundleDbPersistenceManager: UnsupportedOperationException

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionFactory.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionFactory.java?rev=613799&r1=613798&r2=613799&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionFactory.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/ConnectionFactory.java
Mon Jan 21 00:48:50 2008
@@ -57,7 +57,11 @@
                     // JNDI context
                     Context context = (Context) d.newInstance();
                     DataSource ds = (DataSource) context.lookup(url);
-                    return ds.getConnection(user, password);
+                    if (isNullOrEmpty(user) && isNullOrEmpty(password)) {
+                        return ds.getConnection();
+                    } else {
+                        return ds.getConnection(user, password);
+                    }
                 } else {
                     try {
                         // Workaround for Apache Derby:
@@ -80,6 +84,15 @@
             }
         }
         return DriverManager.getConnection(url, user, password);
+    }
+    
+    /**
+     * Check if a String is null or empty (the length is null).
+     *
+     * @return true if it is null or empty
+     */
+    private static boolean isNullOrEmpty(String s) {
+        return s == null || s.length() == 0;
     }
 
 }



Mime
View raw message