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

asf-gitbox-commits pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 6fe7ee93872ca084a7b1106f4f2f407612e67fe5
Author: Damjan Jovanovic <[email protected]>
AuthorDate: Tue Sep 22 20:04:26 2026 +0200

    Returns empty values instead of null from JavaSQLResultSet.getBytes()
    and JavaSQLResultSet.getDate(), when the database field is NULL.
    
    This is what the C++ JDBC driver was also doing, and OpenOffice gives
    major warnings and even crashes when Java components returns null
    to UNO.
    
    Patch by: me
---
 .../src/main/java/com/sun/star/comp/sdbc/JavaSQLResultSet.java   | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/main/connectivity/java/sdbc_jdbc/src/main/java/com/sun/star/comp/sdbc/JavaSQLResultSet.java
 
b/main/connectivity/java/sdbc_jdbc/src/main/java/com/sun/star/comp/sdbc/JavaSQLResultSet.java
index d1cbf83883..f03c57391e 100644
--- 
a/main/connectivity/java/sdbc_jdbc/src/main/java/com/sun/star/comp/sdbc/JavaSQLResultSet.java
+++ 
b/main/connectivity/java/sdbc_jdbc/src/main/java/com/sun/star/comp/sdbc/JavaSQLResultSet.java
@@ -304,7 +304,12 @@ public class JavaSQLResultSet extends PropertySet
     @Override
     public byte[] getBytes(int columnIndex) throws SQLException {
         try {
-            return jdbcResultSet.getBytes(columnIndex);
+            byte[] bytes = jdbcResultSet.getBytes(columnIndex);
+            if (bytes != null) {
+                return bytes;
+            } else {
+                return new byte[0];
+            }
         } catch (java.sql.SQLException exception) {
             throw Tools.toUnoException(this, exception);
         }
@@ -317,7 +322,7 @@ public class JavaSQLResultSet extends PropertySet
             if (jdbcDate != null) {
                 return DBTypeConversion.toDate(jdbcDate.toString());
             } else {
-                return null;
+                return new Date();
             }
         } catch (java.sql.SQLException exception) {
             throw Tools.toUnoException(this, exception);

Reply via email to