diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index 2efbcd590e..b9ffa6f323 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- java-version: [8, 11, 17]
+ java-version: [11, 17]
name: Java ${{ matrix.java-version }}
runs-on: ubuntu-latest
steps:
diff --git a/h2/.mvn/wrapper/maven-wrapper.jar b/h2/.mvn/wrapper/maven-wrapper.jar
index c6feb8bb6f..cb28b0e37c 100644
Binary files a/h2/.mvn/wrapper/maven-wrapper.jar and b/h2/.mvn/wrapper/maven-wrapper.jar differ
diff --git a/h2/.mvn/wrapper/maven-wrapper.properties b/h2/.mvn/wrapper/maven-wrapper.properties
index c9023edfe7..ac184013fc 100644
--- a/h2/.mvn/wrapper/maven-wrapper.properties
+++ b/h2/.mvn/wrapper/maven-wrapper.properties
@@ -1 +1,18 @@
-distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
\ No newline at end of file
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
diff --git a/h2/mvnw b/h2/mvnw
index a2c52ca653..8d937f4c14 100755
--- a/h2/mvnw
+++ b/h2/mvnw
@@ -19,7 +19,7 @@
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
-# Maven2 Start Up Batch script
+# Apache Maven Wrapper startup batch script, version 3.2.0
#
# Required ENV vars:
# ------------------
@@ -27,7 +27,6 @@
#
# Optional ENV vars
# -----------------
-# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@@ -36,6 +35,10 @@
if [ -z "$MAVEN_SKIP_RC" ] ; then
+ if [ -f /usr/local/etc/mavenrc ] ; then
+ . /usr/local/etc/mavenrc
+ fi
+
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
@@ -50,109 +53,56 @@ fi
cygwin=false;
darwin=false;
mingw=false
-case "`uname`" in
+case "$(uname)" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
- #
- # Look for the Apple JDKs first to preserve the existing behaviour, and then look
- # for the new JDKs provided by Oracle.
- #
- if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
- #
- # Apple JDKs
- #
- export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
- fi
-
- if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
- #
- # Apple JDKs
- #
- export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
- fi
-
- if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
- #
- # Oracle JDKs
- #
- export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
- fi
-
- if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
- #
- # Apple JDKs
- #
- export JAVA_HOME=`/usr/libexec/java_home`
- fi
- ;;
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+ if [ -z "$JAVA_HOME" ]; then
+ if [ -x "/usr/libexec/java_home" ]; then
+ JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
+ else
+ JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
+ fi
+ fi
+ ;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
- JAVA_HOME=`java-config --jre-home`
+ JAVA_HOME=$(java-config --jre-home)
fi
fi
-if [ -z "$M2_HOME" ] ; then
- ## resolve links - $0 may be a link to maven's home
- PRG="$0"
-
- # need this for relative symlinks
- while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG="`dirname "$PRG"`/$link"
- fi
- done
-
- saveddir=`pwd`
-
- M2_HOME=`dirname "$PRG"`/..
-
- # make it fully qualified
- M2_HOME=`cd "$M2_HOME" && pwd`
-
- cd "$saveddir"
- # echo Using m2 at $M2_HOME
-fi
-
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
- [ -n "$M2_HOME" ] &&
- M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
[ -n "$CLASSPATH" ] &&
- CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+ CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
fi
-# For Migwn, ensure paths are in UNIX format before anything is touched
+# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
- [ -n "$M2_HOME" ] &&
- M2_HOME="`(cd "$M2_HOME"; pwd)`"
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
- # TODO classpath?
+ [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
+ JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
fi
if [ -z "$JAVA_HOME" ]; then
- javaExecutable="`which javac`"
- if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+ javaExecutable="$(which javac)"
+ if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
- readLink=`which readlink`
- if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+ readLink=$(which readlink)
+ if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
if $darwin ; then
- javaHome="`dirname \"$javaExecutable\"`"
- javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+ javaHome="$(dirname "\"$javaExecutable\"")"
+ javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
else
- javaExecutable="`readlink -f \"$javaExecutable\"`"
+ javaExecutable="$(readlink -f "\"$javaExecutable\"")"
fi
- javaHome="`dirname \"$javaExecutable\"`"
- javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+ javaHome="$(dirname "\"$javaExecutable\"")"
+ javaHome=$(expr "$javaHome" : '\(.*\)/bin')
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
@@ -168,7 +118,7 @@ if [ -z "$JAVACMD" ] ; then
JAVACMD="$JAVA_HOME/bin/java"
fi
else
- JAVACMD="`which java`"
+ JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)"
fi
fi
@@ -182,54 +132,177 @@ if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
-CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin; then
- [ -n "$M2_HOME" ] &&
- M2_HOME=`cygpath --path --windows "$M2_HOME"`
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
-fi
-
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
- local basedir=$(pwd)
- local wdir=$(pwd)
+ if [ -z "$1" ]
+ then
+ echo "Path not specified to find_maven_basedir"
+ return 1
+ fi
+
+ basedir="$1"
+ wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
- wdir=$(cd "$wdir/.."; pwd)
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+ if [ -d "${wdir}" ]; then
+ wdir=$(cd "$wdir/.." || exit 1; pwd)
+ fi
+ # end of workaround
done
- echo "${basedir}"
+ printf '%s' "$(cd "$basedir" || exit 1; pwd)"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
- echo "$(tr -s '\n' ' ' < "$1")"
+ # Remove \r in case we run on Windows within Git Bash
+ # and check out the repository with auto CRLF management
+ # enabled. Otherwise, we may read lines that are delimited with
+ # \r\n and produce $'-Xarg\r' rather than -Xarg due to word
+ # splitting rules.
+ tr -s '\r\n' ' ' < "$1"
+ fi
+}
+
+log() {
+ if [ "$MVNW_VERBOSE" = true ]; then
+ printf '%s\n' "$1"
fi
}
-export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
+BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
+if [ -z "$BASE_DIR" ]; then
+ exit 1;
+fi
+
+MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
+log "$MAVEN_PROJECTBASEDIR"
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
+if [ -r "$wrapperJarPath" ]; then
+ log "Found $wrapperJarPath"
+else
+ log "Couldn't find $wrapperJarPath, downloading it ..."
+
+ if [ -n "$MVNW_REPOURL" ]; then
+ wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
+ else
+ wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
+ fi
+ while IFS="=" read -r key value; do
+ # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
+ safeValue=$(echo "$value" | tr -d '\r')
+ case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
+ esac
+ done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
+ log "Downloading from: $wrapperUrl"
+
+ if $cygwin; then
+ wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
+ fi
+
+ if command -v wget > /dev/null; then
+ log "Found wget ... using wget"
+ [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+ else
+ wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
+ fi
+ elif command -v curl > /dev/null; then
+ log "Found curl ... using curl"
+ [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
+ else
+ curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
+ fi
+ else
+ log "Falling back to using Java to download"
+ javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
+ javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
+ # For Cygwin, switch paths to Windows format before running javac
+ if $cygwin; then
+ javaSource=$(cygpath --path --windows "$javaSource")
+ javaClass=$(cygpath --path --windows "$javaClass")
+ fi
+ if [ -e "$javaSource" ]; then
+ if [ ! -e "$javaClass" ]; then
+ log " - Compiling MavenWrapperDownloader.java ..."
+ ("$JAVA_HOME/bin/javac" "$javaSource")
+ fi
+ if [ -e "$javaClass" ]; then
+ log " - Running MavenWrapperDownloader.java ..."
+ ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
+ fi
+ fi
+ fi
+fi
+##########################################################################################
+# End of extension
+##########################################################################################
+
+# If specified, validate the SHA-256 sum of the Maven wrapper jar file
+wrapperSha256Sum=""
+while IFS="=" read -r key value; do
+ case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
+ esac
+done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
+if [ -n "$wrapperSha256Sum" ]; then
+ wrapperSha256Result=false
+ if command -v sha256sum > /dev/null; then
+ if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
+ wrapperSha256Result=true
+ fi
+ elif command -v shasum > /dev/null; then
+ if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
+ wrapperSha256Result=true
+ fi
+ else
+ echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
+ echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
+ exit 1
+ fi
+ if [ $wrapperSha256Result = false ]; then
+ echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
+ echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
+ echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
+ exit 1
+ fi
+fi
+
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
-# Provide a "standardized" way to retrieve the CLI args that will
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+ MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
+fi
+
+# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
-MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+# shellcheck disable=SC2086 # safe args
exec "$JAVACMD" \
$MAVEN_OPTS \
- -Djava.net.useSystemProxies=true \
+ $MAVEN_DEBUG_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
- "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
- ${WRAPPER_LAUNCHER} $MAVEN_CMD_LINE_ARGS
-
+ "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/h2/mvnw.cmd b/h2/mvnw.cmd
index 49520334c4..f80fbad3e7 100644
--- a/h2/mvnw.cmd
+++ b/h2/mvnw.cmd
@@ -1,145 +1,205 @@
-@REM ----------------------------------------------------------------------------
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM ----------------------------------------------------------------------------
-
-@REM ----------------------------------------------------------------------------
-@REM Maven2 Start Up Batch script
-@REM
-@REM Required ENV vars:
-@REM JAVA_HOME - location of a JDK home dir
-@REM
-@REM Optional ENV vars
-@REM M2_HOME - location of maven2's installed home dir
-@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
-@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
-@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
-@REM e.g. to debug Maven itself, use
-@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-@REM ----------------------------------------------------------------------------
-
-@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
-@echo off
-@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
-@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
-
-@REM set %HOME% to equivalent of $HOME
-if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
-
-@REM Execute a user defined script before this one
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
-@REM check for pre script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
-if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
-:skipRcPre
-
-@setlocal
-
-set ERROR_CODE=0
-
-@REM To isolate internal variables from possible post scripts, we use another setlocal
-@setlocal
-
-@REM ==== START VALIDATION ====
-if not "%JAVA_HOME%" == "" goto OkJHome
-
-echo.
-echo Error: JAVA_HOME not found in your environment. >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-:OkJHome
-if exist "%JAVA_HOME%\bin\java.exe" goto init
-
-echo.
-echo Error: JAVA_HOME is set to an invalid directory. >&2
-echo JAVA_HOME = "%JAVA_HOME%" >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-@REM ==== END VALIDATION ====
-
-:init
-
-set MAVEN_CMD_LINE_ARGS=%MAVEN_CONFIG% %*
-
-@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
-@REM Fallback to current working directory if not found.
-
-set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
-IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
-
-set EXEC_DIR=%CD%
-set WDIR=%EXEC_DIR%
-:findBaseDir
-IF EXIST "%WDIR%"\.mvn goto baseDirFound
-cd ..
-IF "%WDIR%"=="%CD%" goto baseDirNotFound
-set WDIR=%CD%
-goto findBaseDir
-
-:baseDirFound
-set MAVEN_PROJECTBASEDIR=%WDIR%
-cd "%EXEC_DIR%"
-goto endDetectBaseDir
-
-:baseDirNotFound
-set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
-cd "%EXEC_DIR%"
-
-:endDetectBaseDir
-
-IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
-
-@setlocal EnableExtensions EnableDelayedExpansion
-for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
-@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
-
-:endReadAdditionalConfig
-
-SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
-
-set WRAPPER_JAR=""%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar""
-set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -Djava.net.useSystemProxies=true -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
-if ERRORLEVEL 1 goto error
-goto end
-
-:error
-set ERROR_CODE=1
-
-:end
-@endlocal & set ERROR_CODE=%ERROR_CODE%
-
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
-@REM check for post script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
-if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
-:skipRcPost
-
-@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
-if "%MAVEN_BATCH_PAUSE%" == "on" pause
-
-if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
-
-exit /B %ERROR_CODE%
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Apache Maven Wrapper startup batch script, version 3.2.0
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
+if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
+
+FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+ IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Found %WRAPPER_JAR%
+ )
+) else (
+ if not "%MVNW_REPOURL%" == "" (
+ SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
+ )
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Couldn't find %WRAPPER_JAR%, downloading it ...
+ echo Downloading from: %WRAPPER_URL%
+ )
+
+ powershell -Command "&{"^
+ "$webclient = new-object System.Net.WebClient;"^
+ "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
+ "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
+ "}"^
+ "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
+ "}"
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Finished downloading %WRAPPER_JAR%
+ )
+)
+@REM End of extension
+
+@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
+SET WRAPPER_SHA_256_SUM=""
+FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+ IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
+)
+IF NOT %WRAPPER_SHA_256_SUM%=="" (
+ powershell -Command "&{"^
+ "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
+ "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
+ " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
+ " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
+ " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
+ " exit 1;"^
+ "}"^
+ "}"
+ if ERRORLEVEL 1 goto error
+)
+
+@REM Provide a "standardized" way to retrieve the CLI args that will
+@REM work with both Windows and non-Windows executions.
+set MAVEN_CMD_LINE_ARGS=%*
+
+%MAVEN_JAVA_EXE% ^
+ %JVM_CONFIG_MAVEN_PROPS% ^
+ %MAVEN_OPTS% ^
+ %MAVEN_DEBUG_OPTS% ^
+ -classpath %WRAPPER_JAR% ^
+ "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
+ %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
+if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%"=="on" pause
+
+if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
+
+cmd /C exit /B %ERROR_CODE%
diff --git a/h2/pom.xml b/h2/pom.xml
index 59be36c917..39af803698 100644
--- a/h2/pom.xml
+++ b/h2/pom.xml
@@ -37,18 +37,17 @@
Remote TLS connections are supported using the Java Secure Socket Extension
-(
To use your own keystore, set the system properties HTTPS Connections
TLS Connections
SSLServerSocket, SSLSocket
). By default, anonymous TLS is enabled.
+(SSLServerSocket, SSLSocket
).
javax.net.ssl.keyStore
and
@@ -1521,9 +1521,6 @@ TLS Connections
Customizing the Default Key and Trust Stores, Store Types, and Store Passwords
for more information.
-To disable anonymous TLS, set the system property h2.enableAnonymousTLS
to false.
-
diff --git a/h2/src/docsrc/html/build.html b/h2/src/docsrc/html/build.html index 9e7904423f..435609bb19 100644 --- a/h2/src/docsrc/html/build.html +++ b/h2/src/docsrc/html/build.html @@ -49,29 +49,14 @@
-To run this database, a Java Runtime Environment (JRE) version 8 or higher is required. +To run this database, a Java Runtime Environment (JRE) version 11 or higher is required. It it also possible to compile a standalone executable with experimental native image build.
--To create the database executables, the following software stack was used. -To use this database, it is not required to install this software however. -
-
-You need to install a JDK, for example the Oracle JDK version 8.
+You need to install a JDK, for example the Oracle JDK version 11.
Ensure that Java binary directory is included in the PATH
environment variable, and that
the environment variable JAVA_HOME
points to your Java installation.
On the command line, go to the directory h2
and execute the following command:
@@ -97,7 +82,7 @@
-Apache Lucene 8.5.2 is used for testing. +Apache Lucene 9.7.0 is used for testing.
If you'd like to contribute bug fixes or new features, please consider the following guidelines to simplify merging them:
-src/installer/checkstyle.xml
.
diff --git a/h2/src/docsrc/html/installation.html b/h2/src/docsrc/html/installation.html
index 345649b637..6fcd7ef761 100644
--- a/h2/src/docsrc/html/installation.html
+++ b/h2/src/docsrc/html/installation.html
@@ -35,9 +35,8 @@ As this database is written in Java, it can run on many different platforms. -It is tested with Java 8 and 11. +It is tested with Java 11 and 17. All major operating systems (Windows, Mac OS X, Linux, ...) are supported.
diff --git a/h2/src/docsrc/html/tutorial.html b/h2/src/docsrc/html/tutorial.html index ffab47908a..abe2559810 100644 --- a/h2/src/docsrc/html/tutorial.html +++ b/h2/src/docsrc/html/tutorial.html @@ -1273,7 +1273,7 @@
To use the Apache Lucene full text search, you need the Lucene library in the classpath.
-Apache Lucene 8.5.2 or binary compatible version is required.
+Apache Lucene 9.7.0 or binary compatible version is required.
How to do that depends on the application; if you use the H2 Console, you can add the Lucene
jar file to the environment variables H2DRIVERS
or
CLASSPATH
.
diff --git a/h2/src/java10/precompiled/org/h2/util/Utils10.class b/h2/src/java10/precompiled/org/h2/util/Utils10.class
deleted file mode 100644
index 1ae38e89d7..0000000000
Binary files a/h2/src/java10/precompiled/org/h2/util/Utils10.class and /dev/null differ
diff --git a/h2/src/java10/src/org/h2/util/Utils10.java b/h2/src/java10/src/org/h2/util/Utils10.java
deleted file mode 100644
index becb570bf2..0000000000
--- a/h2/src/java10/src/org/h2/util/Utils10.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0,
- * and the EPL 1.0 (https://h2database.com/html/license.html).
- * Initial Developer: H2 Group
- */
-package org.h2.util;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.net.Socket;
-import java.nio.charset.Charset;
-
-import jdk.net.ExtendedSocketOptions;
-
-/**
- * Utilities with specialized implementations for Java 10 and later versions.
- *
- * This class contains implementations for Java 10 and later versions.
- */
-public final class Utils10 {
-
- /**
- * Converts the buffer's contents into a string by decoding the bytes using
- * the specified {@link java.nio.charset.Charset charset}.
- *
- * @param baos
- * the buffer to decode
- * @param charset
- * the charset to use
- * @return the decoded string
- */
- public static String byteArrayOutputStreamToString(ByteArrayOutputStream baos, Charset charset) {
- return baos.toString(charset);
- }
-
- /**
- * Returns the value of TCP_QUICKACK option.
- *
- * @param socket
- * the socket
- * @return the current value of TCP_QUICKACK option
- * @throws IOException
- * on I/O exception
- * @throws UnsupportedOperationException
- * if TCP_QUICKACK is not supported
- */
- public static boolean getTcpQuickack(Socket socket) throws IOException {
- return socket.getOption(ExtendedSocketOptions.TCP_QUICKACK);
- }
-
- /**
- * Sets the value of TCP_QUICKACK option.
- *
- * @param socket
- * the socket
- * @param value
- * the value to set
- * @return whether operation was successful
- */
- public static boolean setTcpQuickack(Socket socket, boolean value) {
- try {
- socket.setOption(ExtendedSocketOptions.TCP_QUICKACK, value);
- return true;
- } catch (Throwable t) {
- return false;
- }
- }
-
- private Utils10() {
- }
-
-}
diff --git a/h2/src/java10/src/org/h2/util/package.html b/h2/src/java10/src/org/h2/util/package.html
deleted file mode 100644
index 58c1d89c2a..0000000000
--- a/h2/src/java10/src/org/h2/util/package.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
- -Internal utility classes reimplemented for Java 10 and later versions. - -
\ No newline at end of file diff --git a/h2/src/java21/src/org/h2/util/package-info.java b/h2/src/java21/src/org/h2/util/package-info.java new file mode 100644 index 0000000000..9f05c24724 --- /dev/null +++ b/h2/src/java21/src/org/h2/util/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Internal utility classes. + */ +package org.h2.util; diff --git a/h2/src/java21/src/org/h2/util/package.html b/h2/src/java21/src/org/h2/util/package.html deleted file mode 100644 index 07363d4a39..0000000000 --- a/h2/src/java21/src/org/h2/util/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Internal utility classes reimplemented for Java 21 and later versions. - -
\ No newline at end of file diff --git a/h2/src/java9/precompiled/org/h2/util/Bits.class b/h2/src/java9/precompiled/org/h2/util/Bits.class deleted file mode 100644 index c5dabdfb86..0000000000 Binary files a/h2/src/java9/precompiled/org/h2/util/Bits.class and /dev/null differ diff --git a/h2/src/java9/src/org/h2/util/Bits.java b/h2/src/java9/src/org/h2/util/Bits.java deleted file mode 100644 index bd023d58f3..0000000000 --- a/h2/src/java9/src/org/h2/util/Bits.java +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, - * and the EPL 1.0 (https://h2database.com/html/license.html). - * Initial Developer: H2 Group - */ -package org.h2.util; - -import java.lang.invoke.MethodHandles; -import java.lang.invoke.VarHandle; -import java.nio.ByteOrder; -import java.util.Arrays; -import java.util.UUID; - -/** - * Manipulations with bytes and arrays. Specialized implementation for Java 9 - * and later versions. - */ -public final class Bits { - - /** - * VarHandle giving access to elements of a byte[] array viewed as if it - * were a int[] array on big-endian system. - */ - private static final VarHandle INT_VH_BE = MethodHandles.byteArrayViewVarHandle(int[].class, ByteOrder.BIG_ENDIAN); - - /** - * VarHandle giving access to elements of a byte[] array viewed as if it - * were a int[] array on little-endian system. - */ - private static final VarHandle INT_VH_LE = MethodHandles.byteArrayViewVarHandle(int[].class, - ByteOrder.LITTLE_ENDIAN); - - /** - * VarHandle giving access to elements of a byte[] array viewed as if it - * were a long[] array on big-endian system. - */ - private static final VarHandle LONG_VH_BE = MethodHandles.byteArrayViewVarHandle(long[].class, - ByteOrder.BIG_ENDIAN); - - /** - * VarHandle giving access to elements of a byte[] array viewed as if it - * were a long[] array on little-endian system. - */ - private static final VarHandle LONG_VH_LE = MethodHandles.byteArrayViewVarHandle(long[].class, - ByteOrder.LITTLE_ENDIAN); - - /** - * VarHandle giving access to elements of a byte[] array viewed as if it - * were a double[] array on big-endian system. - */ - private static final VarHandle DOUBLE_VH_BE = MethodHandles.byteArrayViewVarHandle(double[].class, - ByteOrder.BIG_ENDIAN); - - /** - * VarHandle giving access to elements of a byte[] array viewed as if it - * were a double[] array on little-endian system. - */ - private static final VarHandle DOUBLE_VH_LE = MethodHandles.byteArrayViewVarHandle(double[].class, - ByteOrder.LITTLE_ENDIAN); - - /** - * Compare the contents of two char arrays. If the content or length of the - * first array is smaller than the second array, -1 is returned. If the content - * or length of the second array is smaller than the first array, 1 is returned. - * If the contents and lengths are the same, 0 is returned. - * - * @param data1 - * the first char array (must not be null) - * @param data2 - * the second char array (must not be null) - * @return the result of the comparison (-1, 1 or 0) - */ - public static int compareNotNull(char[] data1, char[] data2) { - return Integer.signum(Arrays.compare(data1, data2)); - } - - /** - * Compare the contents of two byte arrays. If the content or length of the - * first array is smaller than the second array, -1 is returned. If the content - * or length of the second array is smaller than the first array, 1 is returned. - * If the contents and lengths are the same, 0 is returned. - * - *- * This method interprets bytes as signed. - *
- * - * @param data1 - * the first byte array (must not be null) - * @param data2 - * the second byte array (must not be null) - * @return the result of the comparison (-1, 1 or 0) - */ - public static int compareNotNullSigned(byte[] data1, byte[] data2) { - return Integer.signum(Arrays.compare(data1, data2)); - } - - /** - * Compare the contents of two byte arrays. If the content or length of the - * first array is smaller than the second array, -1 is returned. If the content - * or length of the second array is smaller than the first array, 1 is returned. - * If the contents and lengths are the same, 0 is returned. - * - *- * This method interprets bytes as unsigned. - *
- * - * @param data1 - * the first byte array (must not be null) - * @param data2 - * the second byte array (must not be null) - * @return the result of the comparison (-1, 1 or 0) - */ - public static int compareNotNullUnsigned(byte[] data1, byte[] data2) { - return Integer.signum(Arrays.compareUnsigned(data1, data2)); - } - - /** - * Reads a int value from the byte array at the given position in big-endian - * order. - * - * @param buff - * the byte array - * @param pos - * the position - * @return the value - */ - public static int readInt(byte[] buff, int pos) { - return (int) INT_VH_BE.get(buff, pos); - } - - /** - * Reads a int value from the byte array at the given position in - * little-endian order. - * - * @param buff - * the byte array - * @param pos - * the position - * @return the value - */ - public static int readIntLE(byte[] buff, int pos) { - return (int) INT_VH_LE.get(buff, pos); - } - - /** - * Reads a long value from the byte array at the given position in - * big-endian order. - * - * @param buff - * the byte array - * @param pos - * the position - * @return the value - */ - public static long readLong(byte[] buff, int pos) { - return (long) LONG_VH_BE.get(buff, pos); - } - - /** - * Reads a long value from the byte array at the given position in - * little-endian order. - * - * @param buff - * the byte array - * @param pos - * the position - * @return the value - */ - public static long readLongLE(byte[] buff, int pos) { - return (long) LONG_VH_LE.get(buff, pos); - } - - /** - * Reads a double value from the byte array at the given position in - * big-endian order. - * - * @param buff - * the byte array - * @param pos - * the position - * @return the value - */ - public static double readDouble(byte[] buff, int pos) { - return (double) DOUBLE_VH_BE.get(buff, pos); - } - - /** - * Reads a double value from the byte array at the given position in - * little-endian order. - * - * @param buff - * the byte array - * @param pos - * the position - * @return the value - */ - public static double readDoubleLE(byte[] buff, int pos) { - return (double) DOUBLE_VH_LE.get(buff, pos); - } - - /** - * Converts UUID value to byte array in big-endian order. - * - * @param msb - * most significant part of UUID - * @param lsb - * least significant part of UUID - * @return byte array representation - */ - public static byte[] uuidToBytes(long msb, long lsb) { - byte[] buff = new byte[16]; - LONG_VH_BE.set(buff, 0, msb); - LONG_VH_BE.set(buff, 8, lsb); - return buff; - } - - /** - * Converts UUID value to byte array in big-endian order. - * - * @param uuid - * UUID value - * @return byte array representation - */ - public static byte[] uuidToBytes(UUID uuid) { - return uuidToBytes(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits()); - } - - /** - * Writes a int value to the byte array at the given position in big-endian - * order. - * - * @param buff - * the byte array - * @param pos - * the position - * @param x - * the value to write - */ - public static void writeInt(byte[] buff, int pos, int x) { - INT_VH_BE.set(buff, pos, x); - } - - /** - * Writes a int value to the byte array at the given position in - * little-endian order. - * - * @param buff - * the byte array - * @param pos - * the position - * @param x - * the value to write - */ - public static void writeIntLE(byte[] buff, int pos, int x) { - INT_VH_LE.set(buff, pos, x); - } - - /** - * Writes a long value to the byte array at the given position in big-endian - * order. - * - * @param buff - * the byte array - * @param pos - * the position - * @param x - * the value to write - */ - public static void writeLong(byte[] buff, int pos, long x) { - LONG_VH_BE.set(buff, pos, x); - } - - /** - * Writes a long value to the byte array at the given position in - * little-endian order. - * - * @param buff - * the byte array - * @param pos - * the position - * @param x - * the value to write - */ - public static void writeLongLE(byte[] buff, int pos, long x) { - LONG_VH_LE.set(buff, pos, x); - } - - /** - * Writes a double value to the byte array at the given position in - * big-endian order. - * - * @param buff - * the byte array - * @param pos - * the position - * @param x - * the value to write - */ - public static void writeDouble(byte[] buff, int pos, double x) { - DOUBLE_VH_BE.set(buff, pos, x); - } - - /** - * Writes a double value to the byte array at the given position in - * little-endian order. - * - * @param buff - * the byte array - * @param pos - * the position - * @param x - * the value to write - */ - public static void writeDoubleLE(byte[] buff, int pos, double x) { - DOUBLE_VH_LE.set(buff, pos, x); - } - - private Bits() { - } -} diff --git a/h2/src/java9/src/org/h2/util/package.html b/h2/src/java9/src/org/h2/util/package.html deleted file mode 100644 index 4f972f10f2..0000000000 --- a/h2/src/java9/src/org/h2/util/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Internal utility classes reimplemented for Java 9 and later versions. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/api/package-info.java b/h2/src/main/org/h2/api/package-info.java new file mode 100644 index 0000000000..248784ec98 --- /dev/null +++ b/h2/src/main/org/h2/api/package-info.java @@ -0,0 +1,11 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Contains interfaces for user-defined extensions, such as triggers and + * user-defined aggregate functions. + */ +package org.h2.api; diff --git a/h2/src/main/org/h2/api/package.html b/h2/src/main/org/h2/api/package.html deleted file mode 100644 index 0b77b4cc41..0000000000 --- a/h2/src/main/org/h2/api/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Contains interfaces for user-defined extensions, such as triggers and user-defined aggregate functions. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/bnf/context/package-info.java b/h2/src/main/org/h2/bnf/context/package-info.java new file mode 100644 index 0000000000..3942716c8b --- /dev/null +++ b/h2/src/main/org/h2/bnf/context/package-info.java @@ -0,0 +1,11 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Classes that provide context for the BNF tool, in order to provide BNF-based + * auto-complete. + */ +package org.h2.bnf.context; diff --git a/h2/src/main/org/h2/bnf/context/package.html b/h2/src/main/org/h2/bnf/context/package.html deleted file mode 100644 index df32b8d1f7..0000000000 --- a/h2/src/main/org/h2/bnf/context/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Classes that provide context for the BNF tool, in order to provide BNF-based auto-complete. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/bnf/package-info.java b/h2/src/main/org/h2/bnf/package-info.java new file mode 100644 index 0000000000..d4121ca96e --- /dev/null +++ b/h2/src/main/org/h2/bnf/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * The implementation of the BNF (Backus-Naur form) parser and tool. + */ +package org.h2.bnf; diff --git a/h2/src/main/org/h2/bnf/package.html b/h2/src/main/org/h2/bnf/package.html deleted file mode 100644 index 122d8a733c..0000000000 --- a/h2/src/main/org/h2/bnf/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -The implementation of the BNF (Backus-Naur form) parser and tool. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/command/ddl/package-info.java b/h2/src/main/org/h2/command/ddl/package-info.java new file mode 100644 index 0000000000..8a5172ed72 --- /dev/null +++ b/h2/src/main/org/h2/command/ddl/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Contains DDL (data definition language) and related SQL statements. + */ +package org.h2.command.ddl; diff --git a/h2/src/main/org/h2/command/ddl/package.html b/h2/src/main/org/h2/command/ddl/package.html deleted file mode 100644 index 7d1c820806..0000000000 --- a/h2/src/main/org/h2/command/ddl/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Contains DDL (data definition language) and related SQL statements. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/command/dml/SetTypes.java b/h2/src/main/org/h2/command/dml/SetTypes.java index 14b2b3463c..06dd504f06 100644 --- a/h2/src/main/org/h2/command/dml/SetTypes.java +++ b/h2/src/main/org/h2/command/dml/SetTypes.java @@ -5,7 +5,7 @@ */ package org.h2.command.dml; -import java.util.ArrayList; +import java.util.List; /** * The list of setting for a SET statement. @@ -244,62 +244,61 @@ public class SetTypes { private static final int COUNT = TRUNCATE_LARGE_LENGTH + 1; - private static final ArrayList- -Contains DML (data manipulation language) and related SQL statements. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/command/package-info.java b/h2/src/main/org/h2/command/package-info.java new file mode 100644 index 0000000000..8561a88a16 --- /dev/null +++ b/h2/src/main/org/h2/command/package-info.java @@ -0,0 +1,11 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * This package contains the parser and the base classes for prepared SQL + * statements. + */ +package org.h2.command; diff --git a/h2/src/main/org/h2/command/package.html b/h2/src/main/org/h2/command/package.html deleted file mode 100644 index d2146901b6..0000000000 --- a/h2/src/main/org/h2/command/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -This package contains the parser and the base classes for prepared SQL statements. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/command/query/package-info.java b/h2/src/main/org/h2/command/query/package-info.java new file mode 100644 index 0000000000..c168ddc3d0 --- /dev/null +++ b/h2/src/main/org/h2/command/query/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Contains queries. + */ +package org.h2.command.query; diff --git a/h2/src/main/org/h2/command/query/package.html b/h2/src/main/org/h2/command/query/package.html deleted file mode 100644 index f5a45fbde8..0000000000 --- a/h2/src/main/org/h2/command/query/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Contains queries. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/compress/package-info.java b/h2/src/main/org/h2/compress/package-info.java new file mode 100644 index 0000000000..8dcee9a5da --- /dev/null +++ b/h2/src/main/org/h2/compress/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Lossless data compression classes. + */ +package org.h2.compress; diff --git a/h2/src/main/org/h2/compress/package.html b/h2/src/main/org/h2/compress/package.html deleted file mode 100644 index 78195fcb3d..0000000000 --- a/h2/src/main/org/h2/compress/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Lossless data compression classes. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/constraint/package-info.java b/h2/src/main/org/h2/constraint/package-info.java new file mode 100644 index 0000000000..d56aee948f --- /dev/null +++ b/h2/src/main/org/h2/constraint/package-info.java @@ -0,0 +1,11 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Database constraints such as check constraints, unique constraints, and + * referential constraints. + */ +package org.h2.constraint; diff --git a/h2/src/main/org/h2/constraint/package.html b/h2/src/main/org/h2/constraint/package.html deleted file mode 100644 index 5f7104b988..0000000000 --- a/h2/src/main/org/h2/constraint/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Database constraints such as check constraints, unique constraints, and referential constraints. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/engine/SysProperties.java b/h2/src/main/org/h2/engine/SysProperties.java index 010ceae49f..cc942fc3af 100644 --- a/h2/src/main/org/h2/engine/SysProperties.java +++ b/h2/src/main/org/h2/engine/SysProperties.java @@ -56,13 +56,6 @@ public class SysProperties { public static final String ALLOWED_CLASSES = Utils.getProperty("h2.allowedClasses", "*"); - /** - * System propertyh2.enableAnonymousTLS
(default: true).
- * When using TLS connection, the anonymous cipher suites should be enabled.
- */
- public static final boolean ENABLE_ANONYMOUS_TLS =
- Utils.getProperty("h2.enableAnonymousTLS", true);
-
/**
* System property h2.bindAddress
(default: null).
* The bind address to use.
diff --git a/h2/src/main/org/h2/engine/package-info.java b/h2/src/main/org/h2/engine/package-info.java
new file mode 100644
index 0000000000..0701293b26
--- /dev/null
+++ b/h2/src/main/org/h2/engine/package-info.java
@@ -0,0 +1,11 @@
+/*
+ * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0,
+ * and the EPL 1.0 (https://h2database.com/html/license.html).
+ * Initial Developer: H2 Group
+ */
+
+/**
+ * Contains high level classes of the database and classes that don't fit in
+ * another sub-package.
+ */
+package org.h2.engine;
diff --git a/h2/src/main/org/h2/engine/package.html b/h2/src/main/org/h2/engine/package.html
deleted file mode 100644
index 72c5ccb96d..0000000000
--- a/h2/src/main/org/h2/engine/package.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-- -Contains high level classes of the database and classes that don't fit in another sub-package. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/expression/aggregate/package-info.java b/h2/src/main/org/h2/expression/aggregate/package-info.java new file mode 100644 index 0000000000..4b70cd0641 --- /dev/null +++ b/h2/src/main/org/h2/expression/aggregate/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Aggregate functions. + */ +package org.h2.expression.aggregate; diff --git a/h2/src/main/org/h2/expression/aggregate/package.html b/h2/src/main/org/h2/expression/aggregate/package.html deleted file mode 100644 index f0e8c51175..0000000000 --- a/h2/src/main/org/h2/expression/aggregate/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Aggregate functions. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/expression/analysis/package-info.java b/h2/src/main/org/h2/expression/analysis/package-info.java new file mode 100644 index 0000000000..b1e9c2a8eb --- /dev/null +++ b/h2/src/main/org/h2/expression/analysis/package-info.java @@ -0,0 +1,11 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Base classes for data analysis operations and implementations of window + * functions. + */ +package org.h2.expression.analysis; diff --git a/h2/src/main/org/h2/expression/analysis/package.html b/h2/src/main/org/h2/expression/analysis/package.html deleted file mode 100644 index 393685691e..0000000000 --- a/h2/src/main/org/h2/expression/analysis/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Base classes for data analysis operations and implementations of window functions. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/expression/condition/BooleanTest.java b/h2/src/main/org/h2/expression/condition/BooleanTest.java index dbcd559e23..9eaa827e84 100644 --- a/h2/src/main/org/h2/expression/condition/BooleanTest.java +++ b/h2/src/main/org/h2/expression/condition/BooleanTest.java @@ -5,7 +5,7 @@ */ package org.h2.expression.condition; -import java.util.ArrayList; +import java.util.List; import org.h2.engine.SessionLocal; import org.h2.expression.Expression; @@ -75,10 +75,8 @@ public void createIndexConditions(SessionLocal session, TableFilter filter) { if (c.getType().getValueType() == Value.BOOLEAN && filter == c.getTableFilter()) { if (not) { if (right == null && c.getColumn().isNullable()) { - ArrayList- -Condition expressions. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/expression/function/BitFunction.java b/h2/src/main/org/h2/expression/function/BitFunction.java index 84aff52242..f1c69a9aa8 100644 --- a/h2/src/main/org/h2/expression/function/BitFunction.java +++ b/h2/src/main/org/h2/expression/function/BitFunction.java @@ -5,6 +5,8 @@ */ package org.h2.expression.function; +import static org.h2.util.Bits.LONG_VH_BE; + import java.util.Arrays; import org.h2.engine.SessionLocal; @@ -14,7 +16,6 @@ import org.h2.expression.aggregate.AggregateType; import org.h2.message.DbException; import org.h2.mvstore.db.Store; -import org.h2.util.Bits; import org.h2.value.DataType; import org.h2.value.TypeInfo; import org.h2.value.Value; @@ -187,7 +188,7 @@ private static ValueBigint bitCount(Value v1) { c = 0L; int i = 0; for (int bound = l & 0xfffffff8; i < bound; i += 8) { - c += Long.bitCount(Bits.readLong(bytes, i)); + c += Long.bitCount((long) LONG_VH_BE.get(bytes, i)); } for (; i < l; i++) { c += Integer.bitCount(bytes[i] & 0xff); diff --git a/h2/src/main/org/h2/expression/function/HashFunction.java b/h2/src/main/org/h2/expression/function/HashFunction.java index f3f2853d2d..2da49288eb 100644 --- a/h2/src/main/org/h2/expression/function/HashFunction.java +++ b/h2/src/main/org/h2/expression/function/HashFunction.java @@ -5,6 +5,9 @@ */ package org.h2.expression.function; +import static org.h2.util.Bits.INT_VH_BE; +import static org.h2.util.Bits.LONG_VH_BE; + import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; @@ -14,7 +17,6 @@ import org.h2.expression.TypedValueExpression; import org.h2.message.DbException; import org.h2.security.SHA3; -import org.h2.util.Bits; import org.h2.util.StringUtils; import org.h2.value.TypeInfo; import org.h2.value.Value; @@ -120,10 +122,10 @@ private static Value oraHash(Value value, long bucket, long seed) { } if (seed != 0L) { byte[] b = new byte[4]; - Bits.writeInt(b, 0, (int) seed); + INT_VH_BE.set(b, 0, (int) seed); md.update(b); } - long hc = Bits.readLong(md.digest(), 0); + long hc = (long) LONG_VH_BE.get(md.digest(), 0); // Strip sign and use modulo operation to get value from 0 to bucket // inclusive return ValueBigint.get((hc & Long.MAX_VALUE) % (bucket + 1)); diff --git a/h2/src/main/org/h2/expression/function/package-info.java b/h2/src/main/org/h2/expression/function/package-info.java new file mode 100644 index 0000000000..c9f10b9225 --- /dev/null +++ b/h2/src/main/org/h2/expression/function/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Functions. + */ +package org.h2.expression.function; diff --git a/h2/src/main/org/h2/expression/function/package.html b/h2/src/main/org/h2/expression/function/package.html deleted file mode 100644 index 7cbd5b1586..0000000000 --- a/h2/src/main/org/h2/expression/function/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Functions. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/expression/function/table/package-info.java b/h2/src/main/org/h2/expression/function/table/package-info.java new file mode 100644 index 0000000000..1d3db0528b --- /dev/null +++ b/h2/src/main/org/h2/expression/function/table/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Table value functions. + */ +package org.h2.expression.function.table; diff --git a/h2/src/main/org/h2/expression/function/table/package.html b/h2/src/main/org/h2/expression/function/table/package.html deleted file mode 100644 index 12204b4f55..0000000000 --- a/h2/src/main/org/h2/expression/function/table/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Table value functions. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/expression/package-info.java b/h2/src/main/org/h2/expression/package-info.java new file mode 100644 index 0000000000..5b95ac8566 --- /dev/null +++ b/h2/src/main/org/h2/expression/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Expressions include mathematical operations, simple values, and others. + */ +package org.h2.expression; diff --git a/h2/src/main/org/h2/expression/package.html b/h2/src/main/org/h2/expression/package.html deleted file mode 100644 index 7f8505df48..0000000000 --- a/h2/src/main/org/h2/expression/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Expressions include mathematical operations, simple values, and others. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/fulltext/package-info.java b/h2/src/main/org/h2/fulltext/package-info.java new file mode 100644 index 0000000000..5a01382b13 --- /dev/null +++ b/h2/src/main/org/h2/fulltext/package-info.java @@ -0,0 +1,11 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * The native full text search implementation, and the wrapper for the Lucene + * full text search implementation. + */ +package org.h2.fulltext; diff --git a/h2/src/main/org/h2/fulltext/package.html b/h2/src/main/org/h2/fulltext/package.html deleted file mode 100644 index 4115dc39d8..0000000000 --- a/h2/src/main/org/h2/fulltext/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -The native full text search implementation, and the wrapper for the Lucene full text search implementation. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/index/package-info.java b/h2/src/main/org/h2/index/package-info.java new file mode 100644 index 0000000000..81e8b48679 --- /dev/null +++ b/h2/src/main/org/h2/index/package-info.java @@ -0,0 +1,11 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Various table index implementations, as well as cursors to navigate in an + * index. + */ +package org.h2.index; diff --git a/h2/src/main/org/h2/index/package.html b/h2/src/main/org/h2/index/package.html deleted file mode 100644 index 646fa63e0d..0000000000 --- a/h2/src/main/org/h2/index/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Various table index implementations, as well as cursors to navigate in an index. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/jdbc/JdbcConnection.java b/h2/src/main/org/h2/jdbc/JdbcConnection.java index 9c8fda40bf..c4c6d20214 100644 --- a/h2/src/main/org/h2/jdbc/JdbcConnection.java +++ b/h2/src/main/org/h2/jdbc/JdbcConnection.java @@ -69,8 +69,7 @@ * should be used. * */ -public class JdbcConnection extends TraceObject implements Connection, JdbcConnectionBackwardsCompat, - CastDataProvider { +public class JdbcConnection extends TraceObject implements Connection, CastDataProvider { private static final String NUM_SERVERS = "numServers"; private static final String PREFIX_SERVER = "server"; diff --git a/h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java b/h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java index 445d1c5bb7..45bf40b558 100644 --- a/h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java +++ b/h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java @@ -30,8 +30,7 @@ /** * Represents the meta data for a database. */ -public final class JdbcDatabaseMetaData extends TraceObject - implements DatabaseMetaData, JdbcDatabaseMetaDataBackwardsCompat { +public final class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaData { private final JdbcConnection conn; @@ -2498,7 +2497,7 @@ public int getJDBCMajorVersion() { @Override public int getJDBCMinorVersion() { debugCodeCall("getJDBCMinorVersion"); - return 2; + return 3; } /** diff --git a/h2/src/main/org/h2/jdbc/JdbcDatabaseMetaDataBackwardsCompat.java b/h2/src/main/org/h2/jdbc/JdbcDatabaseMetaDataBackwardsCompat.java deleted file mode 100644 index e9eb727b0d..0000000000 --- a/h2/src/main/org/h2/jdbc/JdbcDatabaseMetaDataBackwardsCompat.java +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, and the - * EPL 1.0 (https://h2database.com/html/license.html). Initial Developer: H2 - * Group - */ -package org.h2.jdbc; - -/** - * Allows us to compile on older platforms, while still implementing the methods - * from the newer JDBC API. - */ -public interface JdbcDatabaseMetaDataBackwardsCompat { - - // compatibility interface - -} diff --git a/h2/src/main/org/h2/jdbc/JdbcStatement.java b/h2/src/main/org/h2/jdbc/JdbcStatement.java index b0043fa2d5..1eaeebde4f 100644 --- a/h2/src/main/org/h2/jdbc/JdbcStatement.java +++ b/h2/src/main/org/h2/jdbc/JdbcStatement.java @@ -45,7 +45,7 @@ * } * */ -public class JdbcStatement extends TraceObject implements Statement, JdbcStatementBackwardsCompat { +public class JdbcStatement extends TraceObject implements Statement { protected JdbcConnection conn; protected Session session; diff --git a/h2/src/main/org/h2/jdbc/JdbcStatementBackwardsCompat.java b/h2/src/main/org/h2/jdbc/JdbcStatementBackwardsCompat.java deleted file mode 100644 index ed17310512..0000000000 --- a/h2/src/main/org/h2/jdbc/JdbcStatementBackwardsCompat.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, - * and the EPL 1.0 (https://h2database.com/html/license.html). - * Initial Developer: H2 Group - */ -package org.h2.jdbc; - -import java.sql.SQLException; - -/** - * Allows us to compile on older platforms, while still implementing the methods - * from the newer JDBC API. - */ -public interface JdbcStatementBackwardsCompat { - - // compatibility interface - - // JDBC 4.3 (incomplete) - - /** - * Enquotes the specified identifier. - * - * @param identifier - * identifier to quote if required - * @param alwaysQuote - * if {@code true} identifier will be quoted unconditionally - * @return specified identifier quoted if required or explicitly requested - * @throws SQLException on failure - */ - String enquoteIdentifier(String identifier, boolean alwaysQuote) throws SQLException; - - /** - * Checks if specified identifier may be used without quotes. - * - * @param identifier - * identifier to check - * @return is specified identifier may be used without quotes - * @throws SQLException on failure - */ - boolean isSimpleIdentifier(String identifier) throws SQLException; -} diff --git a/h2/src/main/org/h2/jdbc/meta/package-info.java b/h2/src/main/org/h2/jdbc/meta/package-info.java new file mode 100644 index 0000000000..ba62359991 --- /dev/null +++ b/h2/src/main/org/h2/jdbc/meta/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Implementation of the JDBC database metadata API (package {@code java.sql}). + */ +package org.h2.jdbc.meta; diff --git a/h2/src/main/org/h2/jdbc/meta/package.html b/h2/src/main/org/h2/jdbc/meta/package.html deleted file mode 100644 index 972875d6f2..0000000000 --- a/h2/src/main/org/h2/jdbc/meta/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Implementation of the JDBC database metadata API (package java.sql). - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/jdbc/JdbcConnectionBackwardsCompat.java b/h2/src/main/org/h2/jdbc/package-info.java similarity index 51% rename from h2/src/main/org/h2/jdbc/JdbcConnectionBackwardsCompat.java rename to h2/src/main/org/h2/jdbc/package-info.java index fc9483ea0e..b1eb567e21 100644 --- a/h2/src/main/org/h2/jdbc/JdbcConnectionBackwardsCompat.java +++ b/h2/src/main/org/h2/jdbc/package-info.java @@ -3,14 +3,8 @@ * and the EPL 1.0 (https://h2database.com/html/license.html). * Initial Developer: H2 Group */ -package org.h2.jdbc; /** - * Allows us to compile on older platforms, while still implementing the methods - * from the newer JDBC API. + * Implementation of the JDBC API (package {@code java.sql}). */ -public interface JdbcConnectionBackwardsCompat { - - // compatibility interface - -} +package org.h2.jdbc; diff --git a/h2/src/main/org/h2/jdbc/package.html b/h2/src/main/org/h2/jdbc/package.html deleted file mode 100644 index a2d892b9f9..0000000000 --- a/h2/src/main/org/h2/jdbc/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Implementation of the JDBC API (package java.sql). - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/jdbcx/package-info.java b/h2/src/main/org/h2/jdbcx/package-info.java new file mode 100644 index 0000000000..f0a7045c68 --- /dev/null +++ b/h2/src/main/org/h2/jdbcx/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Implementation of the extended JDBC API (package {@code javax.sql}). + */ +package org.h2.jdbcx; diff --git a/h2/src/main/org/h2/jdbcx/package.html b/h2/src/main/org/h2/jdbcx/package.html deleted file mode 100644 index 3d958db07c..0000000000 --- a/h2/src/main/org/h2/jdbcx/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Implementation of the extended JDBC API (package javax.sql). - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/jmx/package-info.java b/h2/src/main/org/h2/jmx/package-info.java new file mode 100644 index 0000000000..ea5e9bdb55 --- /dev/null +++ b/h2/src/main/org/h2/jmx/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Implementation of the Java Management Extension (JMX) features. + */ +package org.h2.jmx; diff --git a/h2/src/main/org/h2/jmx/package.html b/h2/src/main/org/h2/jmx/package.html deleted file mode 100644 index 1826600e0c..0000000000 --- a/h2/src/main/org/h2/jmx/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Implementation of the Java Management Extension (JMX) features. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/message/package-info.java b/h2/src/main/org/h2/message/package-info.java new file mode 100644 index 0000000000..be40aeb068 --- /dev/null +++ b/h2/src/main/org/h2/message/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Trace (logging facility) and error message tool. + */ +package org.h2.message; diff --git a/h2/src/main/org/h2/message/package.html b/h2/src/main/org/h2/message/package.html deleted file mode 100644 index 2f531cb51d..0000000000 --- a/h2/src/main/org/h2/message/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Trace (logging facility) and error message tool. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/mode/package-info.java b/h2/src/main/org/h2/mode/package-info.java new file mode 100644 index 0000000000..d230912ce4 --- /dev/null +++ b/h2/src/main/org/h2/mode/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Utility classes for compatibility with other database, for example MySQL. + */ +package org.h2.mode; diff --git a/h2/src/main/org/h2/mode/package.html b/h2/src/main/org/h2/mode/package.html deleted file mode 100644 index 47a74f4b6b..0000000000 --- a/h2/src/main/org/h2/mode/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Utility classes for compatibility with other database, for example MySQL. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/mvstore/cache/package-info.java b/h2/src/main/org/h2/mvstore/cache/package-info.java new file mode 100644 index 0000000000..7b17a7377b --- /dev/null +++ b/h2/src/main/org/h2/mvstore/cache/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Classes related to caching. + */ +package org.h2.mvstore.cache; diff --git a/h2/src/main/org/h2/mvstore/cache/package.html b/h2/src/main/org/h2/mvstore/cache/package.html deleted file mode 100644 index a7e436a0a4..0000000000 --- a/h2/src/main/org/h2/mvstore/cache/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Classes related to caching. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/mvstore/db/package-info.java b/h2/src/main/org/h2/mvstore/db/package-info.java new file mode 100644 index 0000000000..3069b58d2f --- /dev/null +++ b/h2/src/main/org/h2/mvstore/db/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Helper classes to use the MVStore in the H2 database. + */ +package org.h2.mvstore.db; diff --git a/h2/src/main/org/h2/mvstore/db/package.html b/h2/src/main/org/h2/mvstore/db/package.html deleted file mode 100644 index 41e6b4df2b..0000000000 --- a/h2/src/main/org/h2/mvstore/db/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Helper classes to use the MVStore in the H2 database. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/mvstore/package-info.java b/h2/src/main/org/h2/mvstore/package-info.java new file mode 100644 index 0000000000..74236f5152 --- /dev/null +++ b/h2/src/main/org/h2/mvstore/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * A persistent storage for tree maps. + */ +package org.h2.mvstore; diff --git a/h2/src/main/org/h2/mvstore/package.html b/h2/src/main/org/h2/mvstore/package.html deleted file mode 100644 index 7a37e10ab4..0000000000 --- a/h2/src/main/org/h2/mvstore/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -A persistent storage for tree maps. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/mvstore/rtree/package-info.java b/h2/src/main/org/h2/mvstore/rtree/package-info.java new file mode 100644 index 0000000000..caa29ed254 --- /dev/null +++ b/h2/src/main/org/h2/mvstore/rtree/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * An R-tree implementation. + */ +package org.h2.mvstore.rtree; diff --git a/h2/src/main/org/h2/mvstore/rtree/package.html b/h2/src/main/org/h2/mvstore/rtree/package.html deleted file mode 100644 index 940ea20df0..0000000000 --- a/h2/src/main/org/h2/mvstore/rtree/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -An R-tree implementation - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/mvstore/tx/package-info.java b/h2/src/main/org/h2/mvstore/tx/package-info.java new file mode 100644 index 0000000000..7213d39468 --- /dev/null +++ b/h2/src/main/org/h2/mvstore/tx/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Helper classes to use the MVStore in a transactional manner. + */ +package org.h2.mvstore.tx; diff --git a/h2/src/main/org/h2/mvstore/tx/package.html b/h2/src/main/org/h2/mvstore/tx/package.html deleted file mode 100644 index 7f28d60916..0000000000 --- a/h2/src/main/org/h2/mvstore/tx/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Helper classes to use the MVStore in a transactional manner. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/mvstore/type/package-info.java b/h2/src/main/org/h2/mvstore/type/package-info.java new file mode 100644 index 0000000000..af5f342a81 --- /dev/null +++ b/h2/src/main/org/h2/mvstore/type/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Data types and serialization / deserialization. + */ +package org.h2.mvstore.type; diff --git a/h2/src/main/org/h2/mvstore/type/package.html b/h2/src/main/org/h2/mvstore/type/package.html deleted file mode 100644 index 41d52f7aeb..0000000000 --- a/h2/src/main/org/h2/mvstore/type/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Data types and serialization / deserialization - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/package-info.java b/h2/src/main/org/h2/package-info.java new file mode 100644 index 0000000000..0628ff675e --- /dev/null +++ b/h2/src/main/org/h2/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Implementation of the JDBC driver. + */ +package org.h2; diff --git a/h2/src/main/org/h2/package.html b/h2/src/main/org/h2/package.html deleted file mode 100644 index dcba8e78b2..0000000000 --- a/h2/src/main/org/h2/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Implementation of the JDBC driver. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/result/package-info.java b/h2/src/main/org/h2/result/package-info.java new file mode 100644 index 0000000000..1b54a3380f --- /dev/null +++ b/h2/src/main/org/h2/result/package-info.java @@ -0,0 +1,10 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Implementation of row and internal result sets. + */ +package org.h2.result; diff --git a/h2/src/main/org/h2/result/package.html b/h2/src/main/org/h2/result/package.html deleted file mode 100644 index 787b6fa242..0000000000 --- a/h2/src/main/org/h2/result/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Implementation of row and internal result sets. - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/schema/package-info.java b/h2/src/main/org/h2/schema/package-info.java new file mode 100644 index 0000000000..257c398289 --- /dev/null +++ b/h2/src/main/org/h2/schema/package-info.java @@ -0,0 +1,11 @@ +/* + * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, + * and the EPL 1.0 (https://h2database.com/html/license.html). + * Initial Developer: H2 Group + */ + +/** + * Schema implementation and objects that are stored in a schema (for example, + * sequences and constants). + */ +package org.h2.schema; diff --git a/h2/src/main/org/h2/schema/package.html b/h2/src/main/org/h2/schema/package.html deleted file mode 100644 index 0b55a0a076..0000000000 --- a/h2/src/main/org/h2/schema/package.html +++ /dev/null @@ -1,14 +0,0 @@ - - - -- -Schema implementation and objects that are stored in a schema (for example, sequences and constants). - -
\ No newline at end of file diff --git a/h2/src/main/org/h2/security/AES.java b/h2/src/main/org/h2/security/AES.java index e015b60b13..13a78d317a 100644 --- a/h2/src/main/org/h2/security/AES.java +++ b/h2/src/main/org/h2/security/AES.java @@ -5,7 +5,7 @@ */ package org.h2.security; -import org.h2.util.Bits; +import static org.h2.util.Bits.INT_VH_BE; /** * An implementation of the AES block cipher algorithm, @@ -137,10 +137,10 @@ public void decrypt(byte[] bytes, int off, int len) { private void encryptBlock(byte[] in, byte[] out, int off) { int[] k = encKey; - int x0 = Bits.readInt(in, off) ^ k[0]; - int x1 = Bits.readInt(in, off + 4) ^ k[1]; - int x2 = Bits.readInt(in, off + 8) ^ k[2]; - int x3 = Bits.readInt(in, off + 12) ^ k[3]; + int x0 = (int) INT_VH_BE.get(in, off) ^ k[0]; + int x1 = (int) INT_VH_BE.get(in, off + 4) ^ k[1]; + int x2 = (int) INT_VH_BE.get(in, off + 8) ^ k[2]; + int x3 = (int) INT_VH_BE.get(in, off + 12) ^ k[3]; int y0 = FT0[(x0 >> 24) & 255] ^ FT1[(x1 >> 16) & 255] ^ FT2[(x2 >> 8) & 255] ^ FT3[x3 & 255] ^ k[4]; int y1 = FT0[(x1 >> 24) & 255] ^ FT1[(x2 >> 16) & 255] @@ -221,18 +221,18 @@ private void encryptBlock(byte[] in, byte[] out, int off) { | (FS[(y0 >> 8) & 255] << 8) | FS[y1 & 255]) ^ k[42]; x3 = ((FS[(y3 >> 24) & 255] << 24) | (FS[(y0 >> 16) & 255] << 16) | (FS[(y1 >> 8) & 255] << 8) | FS[y2 & 255]) ^ k[43]; - Bits.writeInt(out, off, x0); - Bits.writeInt(out, off + 4, x1); - Bits.writeInt(out, off + 8, x2); - Bits.writeInt(out, off + 12, x3); + INT_VH_BE.set(out, off, x0); + INT_VH_BE.set(out, off + 4, x1); + INT_VH_BE.set(out, off + 8, x2); + INT_VH_BE.set(out, off + 12, x3); } private void decryptBlock(byte[] in, byte[] out, int off) { int[] k = decKey; - int x0 = Bits.readInt(in, off) ^ k[0]; - int x1 = Bits.readInt(in, off + 4) ^ k[1]; - int x2 = Bits.readInt(in, off + 8) ^ k[2]; - int x3 = Bits.readInt(in, off + 12) ^ k[3]; + int x0 = (int) INT_VH_BE.get(in, off) ^ k[0]; + int x1 = (int) INT_VH_BE.get(in, off + 4) ^ k[1]; + int x2 = (int) INT_VH_BE.get(in, off + 8) ^ k[2]; + int x3 = (int) INT_VH_BE.get(in, off + 12) ^ k[3]; int y0 = RT0[(x0 >> 24) & 255] ^ RT1[(x3 >> 16) & 255] ^ RT2[(x2 >> 8) & 255] ^ RT3[x1 & 255] ^ k[4]; int y1 = RT0[(x1 >> 24) & 255] ^ RT1[(x0 >> 16) & 255] @@ -313,10 +313,10 @@ private void decryptBlock(byte[] in, byte[] out, int off) { | (RS[(y0 >> 8) & 255] << 8) | RS[y3 & 255]) ^ k[42]; x3 = ((RS[(y3 >> 24) & 255] << 24) | (RS[(y2 >> 16) & 255] << 16) | (RS[(y1 >> 8) & 255] << 8) | RS[y0 & 255]) ^ k[43]; - Bits.writeInt(out, off, x0); - Bits.writeInt(out, off + 4, x1); - Bits.writeInt(out, off + 8, x2); - Bits.writeInt(out, off + 12, x3); + INT_VH_BE.set(out, off, x0); + INT_VH_BE.set(out, off + 4, x1); + INT_VH_BE.set(out, off + 8, x2); + INT_VH_BE.set(out, off + 12, x3); } @Override diff --git a/h2/src/main/org/h2/security/CipherFactory.java b/h2/src/main/org/h2/security/CipherFactory.java index a025f4f27c..15175747ce 100644 --- a/h2/src/main/org/h2/security/CipherFactory.java +++ b/h2/src/main/org/h2/security/CipherFactory.java @@ -17,16 +17,11 @@ import java.security.KeyFactory; import java.security.KeyStore; import java.security.PrivateKey; -import java.security.Security; import java.security.cert.Certificate; import java.security.cert.CertificateFactory; import java.security.spec.PKCS8EncodedKeySpec; import java.util.Arrays; -import java.util.Collections; import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.LinkedList; -import java.util.List; import java.util.Properties; import javax.net.ServerSocketFactory; @@ -54,20 +49,6 @@ public class CipherFactory { public static final String KEYSTORE_PASSWORD = "h2pass"; - /** - * The security property which can prevent anonymous TLS connections. - * Introduced into Java 6, 7, 8 in updates from July 2015. - */ - public static final String LEGACY_ALGORITHMS_SECURITY_KEY = - "jdk.tls.legacyAlgorithms"; - - /** - * The value of {@value #LEGACY_ALGORITHMS_SECURITY_KEY} security - * property at the time of class initialization. - * Null if it is not set. - */ - public static final String DEFAULT_LEGACY_ALGORITHMS = getLegacyAlgorithmsSilently(); - private static final String KEYSTORE = "~/.h2.keystore"; private static final String KEYSTORE_KEY = @@ -115,23 +96,12 @@ public static Socket createSocket(InetAddress address, int port) SysProperties.SOCKET_CONNECT_TIMEOUT); secureSocket.setEnabledProtocols( disableSSL(secureSocket.getEnabledProtocols())); - if (SysProperties.ENABLE_ANONYMOUS_TLS) { - String[] list = enableAnonymous( - secureSocket.getEnabledCipherSuites(), - secureSocket.getSupportedCipherSuites()); - secureSocket.setEnabledCipherSuites(list); - } return secureSocket; } -/** + /** * Create a secure server socket. If a bind address is specified, the * socket is only bound to this address. - * If h2.enableAnonymousTLS is true, an attempt is made to modify - * the security property jdk.tls.legacyAlgorithms (in newer JVMs) to allow - * anonymous TLS. This system change is effectively permanent for the - * lifetime of the JVM. - * @see #removeAnonFromLegacyAlgorithms() * * @param port the port to listen on * @param bindAddress the address to bind to, or null to bind to all @@ -141,9 +111,6 @@ public static Socket createSocket(InetAddress address, int port) */ public static ServerSocket createServerSocket(int port, InetAddress bindAddress) throws IOException { - if (SysProperties.ENABLE_ANONYMOUS_TLS) { - removeAnonFromLegacyAlgorithms(); - } setKeystore(); ServerSocketFactory f = SSLServerSocketFactory.getDefault(); SSLServerSocket secureSocket; @@ -154,104 +121,9 @@ public static ServerSocket createServerSocket(int port, } secureSocket.setEnabledProtocols( disableSSL(secureSocket.getEnabledProtocols())); - if (SysProperties.ENABLE_ANONYMOUS_TLS) { - String[] list = enableAnonymous( - secureSocket.getEnabledCipherSuites(), - secureSocket.getSupportedCipherSuites()); - secureSocket.setEnabledCipherSuites(list); - } return secureSocket; } - /** - * Removes DH_anon and ECDH_anon from a comma separated list of ciphers. - * Only the first occurrence is removed. - * If there is nothing to remove, returns the reference to the argument. - * @param list a list of names separated by commas (and spaces) - * @return a new string without DH_anon and ECDH_anon items, - * or the original if none were found - */ - public static String removeDhAnonFromCommaSeparatedList(String list) { - if (list == null) { - return list; - } - List- * NOTE: In current (as of 2016) default implementations of JSSE which use - * this security property, the value is permanently cached inside the - * ServerHandshake class upon its first use. - * Therefore the modification accomplished by this method has to be done - * before the first use of a server SSL socket. - * Later changes to this property will not have any effect on server socket - * behavior. - */ - public static synchronized void removeAnonFromLegacyAlgorithms() { - String legacyOriginal = getLegacyAlgorithmsSilently(); - if (legacyOriginal == null) { - return; - } - String legacyNew = removeDhAnonFromCommaSeparatedList(legacyOriginal); - if (!legacyOriginal.equals(legacyNew)) { - setLegacyAlgorithmsSilently(legacyNew); - } - } - - /** - * Attempts to resets the security property to the default value. - * The default value of {@value #LEGACY_ALGORITHMS_SECURITY_KEY} was - * obtained at time of class initialization. - *
- * NOTE: Resetting the property might not have any effect on server
- * socket behavior.
- * @see #removeAnonFromLegacyAlgorithms()
- */
- public static synchronized void resetDefaultLegacyAlgorithms() {
- setLegacyAlgorithmsSilently(DEFAULT_LEGACY_ALGORITHMS);
- }
-
- /**
- * Returns the security property {@value #LEGACY_ALGORITHMS_SECURITY_KEY}.
- * Ignores security exceptions.
- *
- * @return the value of the security property, or null if not set
- * or not accessible
- */
- public static String getLegacyAlgorithmsSilently() {
- String defaultLegacyAlgorithms = null;
- try {
- defaultLegacyAlgorithms = Security.getProperty(LEGACY_ALGORITHMS_SECURITY_KEY);
- } catch (SecurityException e) {
- // ignore
- }
- return defaultLegacyAlgorithms;
- }
-
- private static void setLegacyAlgorithmsSilently(String legacyAlgorithms) {
- if (legacyAlgorithms == null) {
- return;
- }
- try {
- Security.setProperty(LEGACY_ALGORITHMS_SECURITY_KEY, legacyAlgorithms);
- } catch (SecurityException e) {
- // ignore
- }
- }
-
private static byte[] getKeyStoreBytes(KeyStore store, String password)
throws IOException {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
@@ -385,18 +257,6 @@ private static void setKeystore() throws IOException {
}
}
- private static String[] enableAnonymous(String[] enabled, String[] supported) {
- LinkedHashSet
-
-Authentication classes.
-
-
-
-Authentication classes.
-
-
-
-Security classes, such as encryption and cryptographically secure hash algorithms.
-
-
-
-A small FTP server.
-
-
-
-PostgreSQL server implementation of this database.
-
-
-
-The H2 Console tool.
-
-
-
-This file system stores files on disk and uses java.nio.channels.AsynchronousFileChannel to access the files.
-
-
+ * This is the most common file system.
+ *
-
-This file system stores files on disk.
-
-
-An encrypted file system abstraction.
-
-
+ * There is an option to compress file blocks to save memory.
+ *
-
-This file system keeps files fully in memory.
-There is an option to compress file blocks to save memory.
-
-
-
-This file system stores files on disk and uses java.nio to access the files.
-This class used memory mapped files.
-
-
+ * There is an option to compress file blocks to save memory.
+ *
-
-This file system keeps files fully in off-java-heap memory.
-There is an option to compress file blocks to save memory.
-
-
-
-A file system abstraction.
-
-
-
-A file system that records all write operations and can re-play them.
-
-
+ * This will clear the interrupt flag. It is mainly useful for applications that
+ * call {@link java.lang.Thread#interrupt()} by mistake.
+ *
-
-A file system that re-opens and re-tries the operation if the file was closed, because a thread was interrupted.
-This will clear the interrupt flag.
-It is mainly useful for applications that call Thread.interrupt by mistake.
-
-
-
-A file system that may split files into multiple smaller files
-(required for a FAT32 because it only support files up to 2 GB).
-
-
-
-A zip-file base file system abstraction.
-
-
-
-Storage abstractions, such as a file with a cache, or a class to convert values to a byte array and vice versa.
-
-
-
-Classes related to a table and table meta data.
-
-
+ * Most tools are command line driven, but not all (for example the CSV tool).
+ *
-
-Various tools. Most tools are command line driven, but not all (for example the CSV tool).
-
-
- * This method interprets bytes as signed.
- *
- * This method interprets bytes as unsigned.
- *
- * This system change is effectively permanent for the lifetime of the JVM.
- * @see CipherFactory#removeAnonFromLegacyAlgorithms()
+ * set.
*
* @param port the port to listen on
* @param ssl if SSL should be used
diff --git a/h2/src/main/org/h2/util/Profiler.java b/h2/src/main/org/h2/util/Profiler.java
index 77bee9f3b8..e6d570d479 100644
--- a/h2/src/main/org/h2/util/Profiler.java
+++ b/h2/src/main/org/h2/util/Profiler.java
@@ -266,11 +266,11 @@ private static String exec(String... args) {
copyInThread(p.getInputStream(), out);
copyInThread(p.getErrorStream(), err);
p.waitFor();
- String e = Utils10.byteArrayOutputStreamToString(err, StandardCharsets.UTF_8);
+ String e = err.toString(StandardCharsets.UTF_8);
if (e.length() > 0) {
throw new RuntimeException(e);
}
- return Utils10.byteArrayOutputStreamToString(out, StandardCharsets.UTF_8);
+ return out.toString(StandardCharsets.UTF_8);
} catch (Exception e) {
throw new RuntimeException(e);
}
diff --git a/h2/src/main/org/h2/util/SourceCompiler.java b/h2/src/main/org/h2/util/SourceCompiler.java
index 6c2dc34bdd..07a36517bc 100644
--- a/h2/src/main/org/h2/util/SourceCompiler.java
+++ b/h2/src/main/org/h2/util/SourceCompiler.java
@@ -388,7 +388,7 @@ private static int exec(String... args) {
copyInThread(p.getInputStream(), buff);
copyInThread(p.getErrorStream(), buff);
p.waitFor();
- String output = Utils10.byteArrayOutputStreamToString(buff, StandardCharsets.UTF_8);
+ String output = buff.toString(StandardCharsets.UTF_8);
handleSyntaxError(output, p.exitValue());
return p.exitValue();
} catch (Exception e) {
@@ -422,7 +422,7 @@ private static synchronized void javacSun(Path javaFile) {
"-d", COMPILE_DIR,
"-encoding", "UTF-8",
javaFile.toAbsolutePath().toString() });
- String output = Utils10.byteArrayOutputStreamToString(buff, StandardCharsets.UTF_8);
+ String output = buff.toString(StandardCharsets.UTF_8);
handleSyntaxError(output, status);
} catch (Exception e) {
throw DbException.convert(e);
diff --git a/h2/src/main/org/h2/util/Utils10.java b/h2/src/main/org/h2/util/Utils10.java
index 96302ea024..c9b0fd7689 100644
--- a/h2/src/main/org/h2/util/Utils10.java
+++ b/h2/src/main/org/h2/util/Utils10.java
@@ -5,44 +5,18 @@
*/
package org.h2.util;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.io.UnsupportedEncodingException;
import java.net.Socket;
-import java.nio.charset.Charset;
+
+import jdk.net.ExtendedSocketOptions;
/**
* Utilities with specialized implementations for Java 10 and later versions.
*
- * This class contains basic implementations for Java 8 and 9 and it is
- * overridden in multi-release JARs.
+ * This class contains implementations for Java 10 and later versions.
*/
public final class Utils10 {
- /*
- * Signatures of methods should match with
- * h2/src/java10/src/org/h2/util/Utils10.java and precompiled
- * h2/src/java10/precompiled/org/h2/util/Utils10.class.
- */
-
- /**
- * Converts the buffer's contents into a string by decoding the bytes using
- * the specified {@link java.nio.charset.Charset charset}.
- *
- * @param baos
- * the buffer to decode
- * @param charset
- * the charset to use
- * @return the decoded string
- */
- public static String byteArrayOutputStreamToString(ByteArrayOutputStream baos, Charset charset) {
- try {
- return baos.toString(charset.name());
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
- }
- }
-
/**
* Returns the value of TCP_QUICKACK option.
*
@@ -55,7 +29,7 @@ public static String byteArrayOutputStreamToString(ByteArrayOutputStream baos, C
* if TCP_QUICKACK is not supported
*/
public static boolean getTcpQuickack(Socket socket) throws IOException {
- throw new UnsupportedOperationException();
+ return socket.getOption(ExtendedSocketOptions.TCP_QUICKACK);
}
/**
@@ -68,8 +42,12 @@ public static boolean getTcpQuickack(Socket socket) throws IOException {
* @return whether operation was successful
*/
public static boolean setTcpQuickack(Socket socket, boolean value) {
- // The default implementation does nothing
- return false;
+ try {
+ socket.setOption(ExtendedSocketOptions.TCP_QUICKACK, value);
+ return true;
+ } catch (Throwable t) {
+ return false;
+ }
}
private Utils10() {
diff --git a/h2/src/main/org/h2/util/geometry/EWKBUtils.java b/h2/src/main/org/h2/util/geometry/EWKBUtils.java
index 6f5a15ef7d..a615073df6 100644
--- a/h2/src/main/org/h2/util/geometry/EWKBUtils.java
+++ b/h2/src/main/org/h2/util/geometry/EWKBUtils.java
@@ -5,6 +5,10 @@
*/
package org.h2.util.geometry;
+import static org.h2.util.Bits.DOUBLE_VH_BE;
+import static org.h2.util.Bits.DOUBLE_VH_LE;
+import static org.h2.util.Bits.INT_VH_BE;
+import static org.h2.util.Bits.INT_VH_LE;
import static org.h2.util.geometry.GeometryUtils.DIMENSION_SYSTEM_XYM;
import static org.h2.util.geometry.GeometryUtils.DIMENSION_SYSTEM_XYZ;
import static org.h2.util.geometry.GeometryUtils.DIMENSION_SYSTEM_XYZM;
@@ -24,7 +28,6 @@
import java.io.ByteArrayOutputStream;
-import org.h2.util.Bits;
import org.h2.util.StringUtils;
import org.h2.util.geometry.GeometryUtils.Target;
@@ -165,13 +168,13 @@ protected void addCoordinate(double x, double y, double z, double m, int index,
}
private void writeInt(int v) {
- Bits.writeInt(buf, 0, v);
+ INT_VH_BE.set(buf, 0, v);
output.write(buf, 0, 4);
}
private void writeDouble(double v) {
v = toCanonicalDouble(v);
- Bits.writeDouble(buf, 0, v);
+ DOUBLE_VH_BE.set(buf, 0, v);
output.write(buf, 0, 8);
}
@@ -215,7 +218,7 @@ byte readByte() {
* @return next 32-bit integer
*/
int readInt() {
- int result = bigEndian ? Bits.readInt(ewkb, offset) : Bits.readIntLE(ewkb, offset);
+ int result = bigEndian ? (int) INT_VH_BE.get(ewkb, offset) : (int) INT_VH_LE.get(ewkb, offset);
offset += 4;
return result;
}
@@ -226,7 +229,7 @@ int readInt() {
* @return next 64-bit floating point
*/
double readCoordinate() {
- double v = bigEndian ? Bits.readDouble(ewkb, offset) : Bits.readDoubleLE(ewkb, offset);
+ double v = bigEndian ? (double) DOUBLE_VH_BE.get(ewkb, offset) : (double) DOUBLE_VH_LE.get(ewkb, offset);
offset += 8;
return toCanonicalDouble(v);
}
@@ -528,31 +531,31 @@ public static byte[] envelope2wkb(double[] envelope) {
if (minX == maxX && minY == maxY) {
result = new byte[21];
result[4] = POINT;
- Bits.writeDouble(result, 5, minX);
- Bits.writeDouble(result, 13, minY);
+ DOUBLE_VH_BE.set(result, 5, minX);
+ DOUBLE_VH_BE.set(result, 13, minY);
} else if (minX == maxX || minY == maxY) {
result = new byte[41];
result[4] = LINE_STRING;
result[8] = 2;
- Bits.writeDouble(result, 9, minX);
- Bits.writeDouble(result, 17, minY);
- Bits.writeDouble(result, 25, maxX);
- Bits.writeDouble(result, 33, maxY);
+ DOUBLE_VH_BE.set(result, 9, minX);
+ DOUBLE_VH_BE.set(result, 17, minY);
+ DOUBLE_VH_BE.set(result, 25, maxX);
+ DOUBLE_VH_BE.set(result, 33, maxY);
} else {
result = new byte[93];
result[4] = POLYGON;
result[8] = 1;
result[12] = 5;
- Bits.writeDouble(result, 13, minX);
- Bits.writeDouble(result, 21, minY);
- Bits.writeDouble(result, 29, minX);
- Bits.writeDouble(result, 37, maxY);
- Bits.writeDouble(result, 45, maxX);
- Bits.writeDouble(result, 53, maxY);
- Bits.writeDouble(result, 61, maxX);
- Bits.writeDouble(result, 69, minY);
- Bits.writeDouble(result, 77, minX);
- Bits.writeDouble(result, 85, minY);
+ DOUBLE_VH_BE.set(result, 13, minX);
+ DOUBLE_VH_BE.set(result, 21, minY);
+ DOUBLE_VH_BE.set(result, 29, minX);
+ DOUBLE_VH_BE.set(result, 37, maxY);
+ DOUBLE_VH_BE.set(result, 45, maxX);
+ DOUBLE_VH_BE.set(result, 53, maxY);
+ DOUBLE_VH_BE.set(result, 61, maxX);
+ DOUBLE_VH_BE.set(result, 69, minY);
+ DOUBLE_VH_BE.set(result, 77, minX);
+ DOUBLE_VH_BE.set(result, 85, minY);
}
return result;
}
diff --git a/h2/src/main/org/h2/util/geometry/package-info.java b/h2/src/main/org/h2/util/geometry/package-info.java
new file mode 100644
index 0000000000..ca7194b6f8
--- /dev/null
+++ b/h2/src/main/org/h2/util/geometry/package-info.java
@@ -0,0 +1,10 @@
+/*
+ * Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0,
+ * and the EPL 1.0 (https://h2database.com/html/license.html).
+ * Initial Developer: H2 Group
+ */
+
+/**
+ * Internal utility classes for GEOMETRY data type.
+ */
+package org.h2.util.geometry;
diff --git a/h2/src/main/org/h2/util/geometry/package.html b/h2/src/main/org/h2/util/geometry/package.html
deleted file mode 100644
index 21c62e092c..0000000000
--- a/h2/src/main/org/h2/util/geometry/package.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-Internal utility classes for GEOMETRY data type.
-
-
-
-Internal utility classes for JSON data type.
-
-
-
-Internal utility classes.
-
-
-
-LOB data for values.
-
-
-
-Data type and value implementations.
-
-
-
-Standalone sample applications.
-
-
-
-An annotation processor used for testing.
-
-
-
-Tests for custom authentication.
-
-
-
-The implementation of the benchmark application.
-
-
-
-A standalone code coverage tool.
-
-
-
-Database tests. Most tests are on the SQL level.
-
-
-
-JDBC API tests.
-
-
-
-Tests related to distributed transactions.
-
-
-
-Multi version concurrency tests.
-
-
-
-High level test classes.
-
-
-
-Multi version concurrency tests.
-
-
-
-Recovery tests.
-
-
-
-Row level locking tests.
-
-
-
-Script test files.
-
-
-
-This package contains server tests.
-
-
-
-This package contains tests for the map store.
-
-
-
-Synthetic tests using random operations or statements.
-
-
-
-A synthetic test using random SQL statements executed against multiple databases.
-
-
-
-Synthetic tests using random operations in multiple threads.
-
-
-
-Documentation and tests for open issues.
-
-
-
-A player to interpret and execute Java statements in a trace file.
-
-
-
-Unit tests that don't start the database (in most cases).
-
-
-
-Utility classes used by the tests.
-
-
-
-Source code checking classes.
-
-
-
-Tools to build the documentation.
-
-
-
-A Javadoc indexing mechanism.
-
-
-
-The pure Java build system and implementation.
-
-
-
-A LIRS cache implementation.
-
-
-
-A clustering implementation.
-
-
-
-An encrypting file system.
-
-
-
-A simple FTP client.
-
-
-
-A simple FTP server.
-
-
-
-A perfect hash function tool.
-
-
-
-A tool to redirect and interpret PostgreSQL network protocol packets.
-
-
-
-Security tools.
-
-
-
-Sorting utilities.
-
-
-
-Utility classes that are currently not used in the database engine.
-
-
-
-Utility classes related to the JCR API.
-
-
-This is the most common file system.
-
-