This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-java.git


The following commit(s) were added to refs/heads/main by this push:
     new 18de621ff GH-1004:  [JDBC] Fix NPE in 
ArrowFlightJdbcDriver#connect​(final String url, final Properties info)  (#1005)
18de621ff is described below

commit 18de621ff2e7a72f54d416b9ef6e6a4a96b2aa8d
Author: Pedro Matias <[email protected]>
AuthorDate: Wed Mar 11 10:59:07 2026 +0000

    GH-1004:  [JDBC] Fix NPE in ArrowFlightJdbcDriver#connect​(final String 
url, final Properties info)  (#1005)
    
    ## What's Changed
    `ArrowFlightJdbcDriver.connect(final String url, final Properties info)`
    now properly ignores a null value for `info`, obtaining the properties
    solely from the URL.
    
    Closes #1004.
---
 .../arrow/driver/jdbc/ArrowFlightJdbcDriver.java   |  4 +++-
 .../driver/jdbc/ArrowFlightJdbcDriverTest.java     | 24 ++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git 
a/flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/ArrowFlightJdbcDriver.java
 
b/flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/ArrowFlightJdbcDriver.java
index 53e6120f6..12ef8030d 100644
--- 
a/flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/ArrowFlightJdbcDriver.java
+++ 
b/flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/ArrowFlightJdbcDriver.java
@@ -75,7 +75,9 @@ public class ArrowFlightJdbcDriver extends UnregisteredDriver 
{
   public ArrowFlightConnection connect(final String url, final Properties info)
       throws SQLException {
     final Properties properties = new Properties(info);
-    properties.putAll(info);
+    if (info != null) {
+      properties.putAll(info);
+    }
 
     if (url != null) {
       final Optional<Map<Object, Object>> maybeProperties = getUrlsArgs(url);
diff --git 
a/flight/flight-sql-jdbc-core/src/test/java/org/apache/arrow/driver/jdbc/ArrowFlightJdbcDriverTest.java
 
b/flight/flight-sql-jdbc-core/src/test/java/org/apache/arrow/driver/jdbc/ArrowFlightJdbcDriverTest.java
index ae355829d..88fb9889b 100644
--- 
a/flight/flight-sql-jdbc-core/src/test/java/org/apache/arrow/driver/jdbc/ArrowFlightJdbcDriverTest.java
+++ 
b/flight/flight-sql-jdbc-core/src/test/java/org/apache/arrow/driver/jdbc/ArrowFlightJdbcDriverTest.java
@@ -201,6 +201,30 @@ public class ArrowFlightJdbcDriverTest {
     }
   }
 
+  /**
+   * Tests whether the {@link ArrowFlightJdbcDriver} can establish a 
successful connection to the
+   * Arrow Flight client when provided with null properties.
+   */
+  @Test
+  public void testConnectWithNullProperties() throws Exception {
+    final Driver driver = new ArrowFlightJdbcDriver();
+    try (Connection connection =
+        driver.connect(
+            "jdbc:arrow-flight://"
+                + dataSource.getConfig().getHost()
+                + ":"
+                + dataSource.getConfig().getPort()
+                + "?"
+                + "useEncryption=false"
+                + "&user="
+                + dataSource.getConfig().getUser()
+                + "&password="
+                + dataSource.getConfig().getPassword(),
+            null)) {
+      assertTrue(connection.isValid(300));
+    }
+  }
+
   /**
    * Tests whether an exception is thrown upon attempting to connect to a 
malformed URI.
    *

Reply via email to