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

commit 3763a8bbe61b71f32e30383e675249d6b4a049b7
Author: Pedro Giffuni <=>
AuthorDate: Thu Oct 29 17:15:12 2026 -0500

    Restore HSQLDB 2.5.0 AOO integration support
    
    Apply patch to restore fileaccess_class_name/storage_class_name property
    support that was lost in HSQLDB 2.5.0, enabling AOO/UNO storage-backed
    database access through the StorageFileAccess/StorageAccess JNI bridge.
    
    Changes:
      - Add aoo_integration.patch to restore FileUtil.getFileAccessCustom()
        and RAStorageWrapper instantiation in Logger.java/RAFile.java
      - Fix PATCH_FILES path in makefile.mk (add patches$/ prefix for
        dmake patch application, required for FreeBSD build)
      - Remove overly strict shutdown check in HDriver.cxx that blocked
        conversion of 1.8.0 databases with modified=yes flag
      - Only permit external HSQLDB jar if > 2.5.0 (2.5.0 needs the patch)
---
 main/configure.ac                                  | 30 ++++-----
 .../connectivity/source/drivers/hsqldb/HDriver.cxx |  7 --
 main/hsqldb/makefile.mk                            |  2 +-
 main/hsqldb/patches/aoo_integration.patch          | 78 ++++++++++++++++++++++
 4 files changed, 94 insertions(+), 23 deletions(-)

diff --git a/main/configure.ac b/main/configure.ac
index 4dd4ecea9c..d765e27a51 100644
--- a/main/configure.ac
+++ b/main/configure.ac
@@ -4974,32 +4974,32 @@ if test -n "$with_system_hsqldb" -o -n 
"$with_system_libs" && \
         fi
         AC_CHECK_FILE($HSQLDB_JAR, [],
                [AC_MSG_ERROR(hsqldb.jar not found.)], [])
-        AC_MSG_CHECKING([whether hsqldb is 2.5.0 or newer])
+AC_MSG_CHECKING([whether hsqldb is newer than 2.5.0])
         export HSQLDB_JAR
         if $PERL -e 'use Archive::Zip;
             my $file = "$ENV{'HSQLDB_JAR'}";
             my $zip = Archive::Zip->new( $file );
             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
             if ( $mf =~ m/Specification-Version: 2\.\d+\.\d+/ ) {
-               push @l, split(/\n/, $mf);
-               foreach my $line (@l) {
-                  if ($line =~ m/Specification-Version:/) {
-                      ($t, $version) = split (/:/,$line);
-                      $version =~ s/^\s//;
-                      ($a, $b, $c) = split (/\./,$version);
-                       if ($a == 2 && ($b > 5 || ($b == 5 && $c >= 0)))  {
-                          exit 0;
-                      } else {
-                          exit 1;
-                      }
-                  }
-               }
+                push @l, split(/\n/, $mf);
+                foreach my $line (@l) {
+                    if ($line =~ m/Specification-Version:/) {
+                        ($t, $version) = split (/:/,$line);
+                        $version =~ s/^\s//;
+                        ($a, $b, $c) = split (/\./,$version);
+                        if ($a == 2 && ($b > 5 || ($b == 5 && $c > 0)))  {
+                            exit 0;
+                        } else {
+                            exit 1;
+                        }
+                    }
+                }
             } else {
                 exit 1;
             }'; then
             AC_MSG_RESULT([yes])
          else
-            AC_MSG_ERROR([no, you need hsqldb >= 2.5.0])
+            AC_MSG_ERROR([no, you need hsqldb > 2.5.0])
          fi
 else
     AC_MSG_RESULT([internal])
diff --git a/main/connectivity/source/drivers/hsqldb/HDriver.cxx 
b/main/connectivity/source/drivers/hsqldb/HDriver.cxx
index 9537b25777..1ccc9dd4e6 100644
--- a/main/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/main/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -337,13 +337,6 @@ namespace connectivity
                                {
                                        
::dbtools::throwGenericSQLException(sMessage ,*this);
                                }
-                               // check if database was shutdown correctly 
before converting to new a version
-                               if ( bModified && bAskUser )
-                               {
-                                       ::connectivity::SharedResources 
aResources;
-                                       const ::rtl::OUString sShutdownMessage 
= aResources.getResourceString(STR_SHUTDOWN_REQUIRED);
-                                       
::dbtools::throwGenericSQLException(sShutdownMessage ,*this);
-                               }
                                // need to convert file, ask for user 
approvement
                 if ( xInteraction.is() && bAskUser )
                 {
diff --git a/main/hsqldb/makefile.mk b/main/hsqldb/makefile.mk
index 6d34c7670a..8843054009 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=patches$/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