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

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


The following commit(s) were added to refs/heads/hsqldb2 by this push:
     new 14eaca0e81 Patch HSQLDB 2.5.0 to restore OpenOffice.org AOO 
integration support
14eaca0e81 is described below

commit 14eaca0e8100a0ee2c58e1a5ac35cf1fea512a22
Author: Pedro Giffuni <=>
AuthorDate: Thu Oct 29 01:18:17 2026 -0500

    Patch HSQLDB 2.5.0 to restore OpenOffice.org AOO integration support
    
    HSQLDB 2.5.0 removed support for the fileaccess_class_name and
    storage_class_name JDBC properties that AOO uses to delegate file
    I/O to the UNO storage layer via StorageFileAccess and StorageAccess.
    
    This patch restores that support in two places:
    
    1. Logger.java: Added getFileAccessCustom() which checks for the
       fileaccess_class_name property in urlProperties and instantiates
       the custom FileAccess class (StorageFileAccess) if present.
       Previously, fileAccess was always set to FileUtil.getFileAccess()
       (filesystem-based), ignoring AOO's StorageFileAccess entirely.
    
    2. RAFile.java: Extended newScaledRAFile() to check for the
       storage_class_name property and use RAStorageWrapper to wrap
       AOO's StorageAccess implementation. Previously, all file access
       went through java.io.RandomAccessFile, bypassing UNO storage.
    
    HSQLDB 2.5.0 already contains RAStorageWrapper (designed specifically
    for AOO integration) and the org.hsqldb.lib.Storage interface, but
    they were never wired up. This completes that integration.
    
    Without this patch, HSQLDB 2.5.0 opens ODB files via filesystem paths
    instead of the UNO storage, causing:
    - New databases: files created on filesystem (appears to work but wrong)
    - Old 1.8.0 databases: files in ODB not found (appears empty)
    - Conversion prompt: never triggered because properties file unreadable
---
 main/hsqldb/makefile.mk                   |  2 +-
 main/hsqldb/patches/aoo_integration.patch | 78 +++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+), 1 deletion(-)

diff --git a/main/hsqldb/makefile.mk b/main/hsqldb/makefile.mk
index 6d34c7670a..207330d0be 100644
--- a/main/hsqldb/makefile.mk
+++ b/main/hsqldb/makefile.mk
@@ -48,7 +48,7 @@ TARFILE_ROOTDIR=hsqldb-$(HSQLDB_VERSION)$/hsqldb
 CONVERTFILES=build$/build.xml \
                        src$/org$/hsqldb$/persist$/HsqlDatabaseProperties.java
 
-PATCH_FILES=
+PATCH_FILES=aoo_integration.patch
 
 JAVAC_SRCTGT=-Dant.build.javac.source=1.8 -Dant.build.javac.target=1.8
 
diff --git a/main/hsqldb/patches/aoo_integration.patch 
b/main/hsqldb/patches/aoo_integration.patch
new file mode 100644
index 0000000000..4df11bd393
--- /dev/null
+++ b/main/hsqldb/patches/aoo_integration.patch
@@ -0,0 +1,78 @@
+--- misc/build/hsqldb-2.5.0/hsqldb/src/org/hsqldb/persist/Logger.java  
2019-05-31 10:26:20.000000000 -0500
++++ misc/build/hsqldb-2.5.0/hsqldb/src/org/hsqldb/persist/Logger.java  
2026-10-29 00:54:34.415210848 -0500
+@@ -62,6 +62,7 @@
+ import org.hsqldb.lib.FileAccess;
+ import org.hsqldb.lib.FileUtil;
+ import org.hsqldb.lib.FrameworkLogger;
++import java.lang.reflect.Constructor;
+ import org.hsqldb.lib.HsqlArrayList;
+ import org.hsqldb.lib.InputStreamInterface;
+ import org.hsqldb.lib.InputStreamWrapper;
+@@ -183,6 +184,26 @@
+         this.database = database;
+     }
+ 
++    private static FileAccess getFileAccessCustom(Database database) {
++        String fileAccessClassName = 
database.urlProperties.getProperty("fileaccess_class_name");
++        if (fileAccessClassName != null && !fileAccessClassName.isEmpty()) {
++            try {
++                Class<?> fileAccessClass = Class.forName(fileAccessClassName);
++                String storageKey = 
database.urlProperties.getProperty("storage_key");
++                if (storageKey != null) {
++                    Constructor<?> ctor = 
fileAccessClass.getConstructor(Object.class);
++                    return (FileAccess) ctor.newInstance(storageKey);
++                } else {
++                    Constructor<?> ctor = fileAccessClass.getConstructor();
++                    return (FileAccess) ctor.newInstance();
++                }
++            } catch (Exception e) {
++                return FileUtil.getFileAccess(database.isFilesInJar());
++            }
++        }
++        return FileUtil.getFileAccess(database.isFilesInJar());
++    }
++
+     /**
+      *  Opens the specified Database object's database files and starts up
+      *  the logging process. <p>
+@@ -198,7 +219,7 @@
+         boolean hasFileProps = false;
+         boolean hasScript    = false;
+ 
+-        fileAccess = FileUtil.getFileAccess(database.isFilesInJar());
++        fileAccess = getFileAccessCustom(database);
+         propIsFileDatabase          = database.getType().isFileBased();
+         database.databaseProperties = new HsqlDatabaseProperties(database);
+         propTextAllowFullPath = database.databaseProperties.isPropertyTrue(
+--- misc/build/hsqldb-2.5.0/hsqldb/src/org/hsqldb/persist/RAFile.java  
2019-04-27 08:55:28.000000000 -0500
++++ misc/build/hsqldb-2.5.0/hsqldb/src/org/hsqldb/persist/RAFile.java  
2026-10-29 00:55:40.935211237 -0500
+@@ -43,6 +43,8 @@
+ import org.hsqldb.lib.ArrayUtil;
+ import org.hsqldb.lib.HsqlByteArrayInputStream;
+ import org.hsqldb.lib.HsqlByteArrayOutputStream;
++import org.hsqldb.lib.Storage;
++import java.lang.reflect.Constructor;
+ 
+ /**
+  * This class is a wrapper for a random access file such as that used for
+@@ -93,6 +95,20 @@
+             String name, boolean readonly,
+             int type) throws FileNotFoundException, IOException {
+ 
++        String storageClassName = 
database.urlProperties.getProperty("storage_class_name");
++        if (storageClassName != null && !storageClassName.isEmpty()) {
++            try {
++                Class<?> storageClass = Class.forName(storageClassName);
++                String storageKey = 
database.urlProperties.getProperty("storage_key");
++                Constructor<?> ctor = storageClass.getConstructor(
++                        String.class, Boolean.class, Object.class);
++                Storage storage = (Storage) ctor.newInstance(
++                        name, Boolean.valueOf(readonly), storageKey);
++                return new RAStorageWrapper(storage);
++            } catch (Exception e) {
++                // fall through to default implementation
++            }
++        }
+         if (type == DATA_FILE_JAR) {
+             return new RAFileInJar(name);
+         } else if (type == DATA_FILE_TEXT) {

Reply via email to