Skip to content

Commit

Permalink
Merge REL1_6_STABLE into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jcflack committed Apr 3, 2024
2 parents 070f827 + 8992155 commit 5df3520
Show file tree
Hide file tree
Showing 20 changed files with 482 additions and 221 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-runnerpg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
# cc: msvc
# - os: windows-latest
# cc: mingw
java: [9, 11, 12, 17, 18, 19]
java: [9, 11, 17, 19, 21]

steps:

Expand Down
52 changes: 14 additions & 38 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,56 +12,32 @@ environment:
APPVEYOR_RDP_PASSWORD: MrRobot@2020
VCVARSALL: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
matrix:
# - SYS: MINGW
# JDK: 9
# PG: 12
# - SYS: MINGW
# JDK: 10
# PG: 12
- SYS: MINGW
JDK: 11
PG: 12
PG: pacman
- SYS: MINGW
JDK: 12
PG: 12
JDK: 17
PG: pacman
- SYS: MINGW
JDK: 13
PG: 12
JDK: 19
PG: pacman
- SYS: MINGW
JDK: 14
PG: 12
- SYS: MINGW
JDK: 15
PG: 12
JDK: 21
PG: pacman
- SYS: MSVC
JDK: 15
PG: 12
JDK: 21
PG: 15
- SYS: MSVC
JDK: 14
PG: 12
JDK: 21
PG: 14
- SYS: MSVC
JDK: 13
PG: 12
JDK: 21
PG: 13
- SYS: MSVC
JDK: 12
JDK: 21
PG: 12
- SYS: MSVC
JDK: 11
PG: 12
# - SYS: MSVC
# JDK: 10
# PG: 12
# - SYS: MSVC
# JDK: 9
# PG: 12
- SYS: MSVC
JDK: 14
PG: 11
- SYS: MSVC
JDK: 14
PG: 10
- SYS: MSVC
JDK: 14
PG: 9.6
before_build:
- ps: .appveyor/appveyor_download_java.ps1
Expand Down
60 changes: 52 additions & 8 deletions pljava-api/src/main/java/org/postgresql/pljava/Adjusting.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2023 Tada AB and other contributors, as listed below.
* Copyright (c) 2019-2024 Tada AB and other contributors, as listed below.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the The BSD 3-Clause License
Expand Down Expand Up @@ -147,16 +147,34 @@ private XML() { } // no instances
* {@link Exception#getSuppressed getSuppressed}. The return is
* immediate, without any remaining names being tried, if an exception
* is caught that is not assignable to a class in the
* <var>expected</var> list. Such an exception will be passed to the
* <var>onUnexpected</var> handler if that is non-null; otherwise,
* it will be returned (or added to the suppressed list of the
* exception to be returned) just as expected exceptions are.
* <var>expected</var> list. Such an exception is returned (or added to
* the suppressed list of an exception already to be returned) only if
* the <var>onUnexpected</var> handler is null; otherwise, it is passed
* to the handler and does not affect the method's return.
*<p>
* For some purposes, a single call of this method may not suffice: if
* alternate means to establish a desired configuration have existed and
* are not simply alternate property names that will accept the same
* value. For such a case, this method may be called more than once. The
* caller abandons the sequence of calls after the first call that
* returns null (indicating that it either succeeded, or incurred an
* unexpected exception and passed it to the <var>onUnexpected</var>
* handler. Otherwise, the exception returned by the first call can be
* passed as <var>caught</var> to the next call, instead of passing the
* usual null. (When a non-null <var>caught</var> is passed, it will be
* returned on failure, even if an unexpected exception has been caught;
* therefore, should it ever be necessary to chain more than two of
* these calls, the caller should abandon the sequence as soon as a call
* returns null <em>or</em> returns its <var>caught</var> argument with
* no growth of its suppressed list.)
* @param setter typically a method reference for a method that
* takes a string key and some value.
* @param value the value to pass to the setter
* @param expected a list of exception classes that can be foreseen
* to indicate that a key was not recognized, and the operation
* should be retried with the next possible key.
* @param caught null, or an exception returned by a preceding call if
* an operation cannot be implemented with one call of this method
* @param onUnexpected invoked, if non-null, on an {@code Exception}
* that is caught and matches nothing in the expected list, instead
* of returning it. If this parameter is null, such an exception is
Expand All @@ -165,16 +183,19 @@ private XML() { } // no instances
* immediate, without trying remaining names, if any.
* @param names one or more String keys to be tried in order until
* the action succeeds.
* @return null if any attempt succeeded, otherwise an exception,
* which may have further exceptions in its suppressed list.
* @return null if any attempt succeeded, or if the first exception
* caught was passed to the onUnexpected handler; otherwise the first
* exception caught (if the caller supplied a non-null
* <var>caught</var>, then that exception), which may have further
* exceptions in its suppressed list.
*/
public static <T, V extends T> Exception setFirstSupported(
SetMethod<? super T> setter, V value,
List<Class<? extends Exception>> expected,
Exception caught,
Consumer<? super Exception> onUnexpected, String... names)
{
requireNonNull(expected);
Exception caught = null;
for ( String name : names )
{
try
Expand Down Expand Up @@ -204,6 +225,18 @@ public static <T, V extends T> Exception setFirstSupported(
return caught;
}

/**
* Calls the six-argument overload passing null for <var>caught</var>.
*/
public static <T, V extends T> Exception setFirstSupported(
SetMethod<? super T> setter, V value,
List<Class<? extends Exception>> expected,
Consumer<? super Exception> onUnexpected, String... names)
{
return setFirstSupported(
setter, value, expected, null, onUnexpected, names);
}

/**
* A functional interface fitting various {@code setFeature} or
* {@code setProperty} methods in Java XML APIs.
Expand Down Expand Up @@ -268,6 +301,17 @@ public interface Parsing<T extends Parsing<T>>
/** Whether to allow a DTD at all. */
T allowDTD(boolean v);

/**
* Specifies that any DTD should be ignored (neither processed nor
* rejected as an error).
*<p>
* This treatment is available in Java 22 and later.
* In earlier Java versions, this will not succeed. Where it is
* supported, the most recent call of this method or of
* {@link #allowDTD allowDTD} will be honored.
*/
T ignoreDTD();

/**
* Whether to retrieve external "general" entities (those
* that can be used in the document body) declared in the DTD.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004-2023 Tada AB and other contributors, as listed below.
* Copyright (c) 2004-2024 Tada AB and other contributors, as listed below.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the The BSD 3-Clause License
Expand Down Expand Up @@ -173,7 +173,7 @@ public SourceVersion getSupportedSourceVersion()
* Update latest_tested to be the latest Java release on which this
* annotation processor has been tested without problems.
*/
int latest_tested = 21;
int latest_tested = 22;
int ordinal_9 = SourceVersion.RELEASE_9.ordinal();
int ordinal_latest = latest_tested - 9 + ordinal_9;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2023 Tada AB and other contributors, as listed below.
* Copyright (c) 2018-2024 Tada AB and other contributors, as listed below.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the The BSD 3-Clause License
Expand Down Expand Up @@ -272,6 +272,43 @@
" WHERE extname = 'pljava'"
}
)

@SQLAction(implementor="postgresql_xml",
provides="xml_java_ge_22", requires="javaSpecificationGE", install=
"SELECT CASE WHEN" +
" javatest.javaSpecificationGE('22')" +
" THEN set_config('pljava.implementors', 'xml_java_ge_22,' || " +
" current_setting('pljava.implementors'), true) " +
"END"
)

@SQLAction(implementor="xml_java_ge_22", requires="lowLevelXMLEcho", install=
"WITH" +
" s(how) AS (SELECT unnest('{5,6,7}'::int[]))," +
" r(isdoc) AS (" +
" SELECT" +
" javatest.lowlevelxmlecho(" +
/*
* A truly minimal DTD, <!DOCTYPE a>, cannot be ignored by Java 22's SAX/DOM
* parser (though it can be, when using the StAX API). NullPointerException
* calling getActiveGrammar().isImmutable() is the result. Bug: JDK-8329295
* Including either an externalID or an internal subset (like the empty []
* here) avoids the issue.
*/
" '<!DOCTYPE a []><a/>'::xml, how, params) IS DOCUMENT" +
" FROM" +
" s," +
" (SELECT null::void AS ignoreDTD) AS params" +
" )" +
"SELECT" +
" CASE WHEN every(isdoc)" +
" THEN javatest.logmessage('INFO', 'jdk.xml.dtd.support=ignore OK')" +
" ELSE javatest.logmessage('WARNING', 'jdk.xml.dtd.support=ignore NG')" +
" END " +
"FROM" +
" r"
)

@MappedUDT(schema="javatest", name="onexml", structure="c1 xml",
implementor="postgresql_xml",
comment="A composite type mapped by the PassXML example class")
Expand Down Expand Up @@ -783,8 +820,7 @@ public static SQLXML lowLevelXMLEcho(
*<p>
* Column names in the <em>adjust</em> row are case-insensitive versions of
* the method names in {@link Adjusting.XML.Parsing}, and the value of each
* column should be of the appropriate type (at present, boolean for all of
* them).
* column should be of the appropriate type (if the method has a parameter).
* @param adjust A row type as described above, possibly of no columns if no
* adjustments are wanted
* @param axp An instance of Adjusting.XML.Parsing
Expand All @@ -804,6 +840,8 @@ T applyAdjustments(ResultSet adjust, T axp)
axp.lax(adjust.getBoolean(i));
else if ( "allowDTD".equalsIgnoreCase(k) )
axp.allowDTD(adjust.getBoolean(i));
else if ( "ignoreDTD".equalsIgnoreCase(k) )
axp.ignoreDTD();
else if ( "externalGeneralEntities".equalsIgnoreCase(k) )
axp.externalGeneralEntities(adjust.getBoolean(i));
else if ( "externalParameterEntities".equalsIgnoreCase(k) )
Expand Down
4 changes: 4 additions & 0 deletions pljava-packaging/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ jos.close();
simple update is possible, just repeat the next entry, with
the from-version changed.
-->
<utf8 dir="target/classes" includes="pljava--.sql"
fullpath=
"pljava/sharedir/pljava/pljava--1.6.7--${project.version}.sql"
/>
<utf8 dir="target/classes" includes="pljava--.sql"
fullpath=
"pljava/sharedir/pljava/pljava--1.6.6--${project.version}.sql"
Expand Down
20 changes: 11 additions & 9 deletions pljava-packaging/src/main/java/Node.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2023 Tada AB and other contributors, as listed below.
* Copyright (c) 2015-2024 Tada AB and other contributors, as listed below.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the The BSD 3-Clause License
Expand Down Expand Up @@ -127,16 +127,18 @@
* to the installer jar anyway, it will also contain some methods intended to be
* useful for tasks related to installation and testing. The idea is not to go
* overboard, but supply a few methods largely modeled on the most basic ones of
* PostgreSQL's {@code PostgresNode.pm}, with the idea that they can be invoked
* from {@code jshell} if its classpath includes the installer jar (and one of
* the PostgreSQL JDBC drivers).
* PostgreSQL's {@code PostgreSQL::Test::Cluster} Perl module (formerly named
* {@code PostgresNode}, from which the name of this class was taken). The
* methods can be invoked from {@code jshell} if its classpath includes the
* installer jar (and one of the PostgreSQL JDBC drivers).
*<p>
* An
* <a href="../../../../../../develop/node.html">introduction with examples</a>
* is available.
*<p>
* Unlike the many capabilities of {@code PostgresNode.pm}, this only deals in
* TCP sockets bound to {@code localhost} ({@code StandardProtocolFamily.UNIX}
* Unlike the many capabilities of {@code PostgreSQL::Test::Cluster}, this only
* deals in TCP sockets bound to {@code localhost}
* ({@code StandardProtocolFamily.UNIX}
* finally arrived in Java 16 but this class does not support it yet) and only
* a few of the most basic operations.
*<p>
Expand Down Expand Up @@ -2623,9 +2625,9 @@ private static Object invoke(InvocationHandler h, int stateIdx, Object o)
* Waits for the {@code postmaster.pid} file to have the right contents
* (the right pid for process <em>p</em>, and ready status for PG 10+).
*<p>
* The {code PostgresNode.pm} version of this is also used when shutting
* down, and waits for the file to go away; that could be implemented here,
* but not today.
* The {@code PostgreSQL:Test:Cluster} version of this is also used when
* shutting down, and waits for the file to go away; that could be
* implemented here, but not today.
*/
private void wait_for_pid_file(Process p, ProcessHandle.Info info)
throws Exception
Expand Down
13 changes: 4 additions & 9 deletions pljava-pgxs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,15 @@

<profiles>
<profile>
<id>nashorngone</id>
<id>nashornmod</id>
<activation>
<jdk>[15,)</jdk>
</activation>
<dependencies>
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js</artifactId>
<version>20.1.0</version>
</dependency>
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js-scriptengine</artifactId>
<version>20.1.0</version>
<groupId>org.openjdk.nashorn</groupId>
<artifactId>nashorn-core</artifactId>
<version>15.4</version>
</dependency>
</dependencies>
</profile>
Expand Down
41 changes: 41 additions & 0 deletions pljava-so/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,47 @@
}
},
{
name : "FreeBSD",
object_extension : ".o",
probe: function(os_name) {
return os_name.toLowerCase().contains("freebsd");
},
compile : function(cc, files, output_dir, includes, defines, flags) {
includes.add(java_include.resolve("freebsd").toString());
defines.put("FreeBSD", null);
flags.add("-c");
if(isDebugEnabled)
flags.add("-g");
var compileProcess = utils.processBuilder(function(l) {
l.add(cc);
l.addAll(pgxs.formatDefines(defines));
l.addAll(pgxs.formatIncludes(includes));
l.addAll(flags);
l.addAll(files);
});
compileProcess.directory(output_dir.toFile());
return runCommand(compileProcess);
},
link : function(cc, flags, files, target_path) {
if(isDebugEnabled)
flags.add("-g");
flags.add("-shared-libgcc");
var linkingProcess = utils.processBuilder(function(l) {
l.add(cc);
l.addAll(flags);
l.addAll(of("-shared", "-o", "lib" + library_name + ".so"));
l.addAll(files);
});
linkingProcess.directory(target_path.toFile());
return runCommand(linkingProcess);
}
},
{
name : "Mac OS X",
Expand Down
Loading

0 comments on commit 5df3520

Please sign in to comment.