diff --git a/pljava-api/src/main/java/org/postgresql/pljava/sqlgen/Lexicals.java b/pljava-api/src/main/java/org/postgresql/pljava/sqlgen/Lexicals.java index 85bdc66bc..1b6e014a0 100644 --- a/pljava-api/src/main/java/org/postgresql/pljava/sqlgen/Lexicals.java +++ b/pljava-api/src/main/java/org/postgresql/pljava/sqlgen/Lexicals.java @@ -279,7 +279,7 @@ private Lexicals() { } // do not instantiate * engine, letting it handle the details. */ public static final Pattern NEWLINE = Pattern.compile( - "(?ms:$(?:(?except newline, for any Java-recognized newline. diff --git a/pljava-api/src/test/java/LexicalsTest.java b/pljava-api/src/test/java/LexicalsTest.java index 174258115..89b94d07f 100644 --- a/pljava-api/src/test/java/LexicalsTest.java +++ b/pljava-api/src/test/java/LexicalsTest.java @@ -29,6 +29,8 @@ import static org.postgresql.pljava.sqlgen.Lexicals.ISO_AND_PG_IDENTIFIER_CAPTURING; +import static + org.postgresql.pljava.sqlgen.Lexicals.NEWLINE; import static org.postgresql.pljava.sqlgen.Lexicals.SEPARATOR; import static @@ -45,6 +47,22 @@ public class LexicalsTest extends TestCase { public LexicalsTest(String name) { super(name); } + public void testNewline() throws Exception + { + Matcher m = NEWLINE.matcher("abcd\nefgh"); + m.region(4, 9); + assertTrue("newline 0", m.lookingAt()); + assertTrue("newline 1", m.lookingAt()); + + m.reset("abcd\r\nefgh").region(4, 10); + assertTrue("newline 2", m.lookingAt()); + assertEquals("\r\n", m.group()); + + m.reset("abcd\n\refgh").region(4, 10); + assertTrue("newline 3", m.lookingAt()); + assertEquals("\n", m.group()); + } + public void testSeparator() throws Exception { Pattern allTheRest = Pattern.compile(".*", Pattern.DOTALL); diff --git a/pljava-examples/pom.xml b/pljava-examples/pom.xml index 320788c27..497d6a4d9 100644 --- a/pljava-examples/pom.xml +++ b/pljava-examples/pom.xml @@ -230,11 +230,13 @@ function executeReport(report, locale) * A special file manager that will rewrite the RELDOTS seen in * -linkoffline above. The options a file manager recognizes must be the * first ones in args; handleFirstOptions below returns at the first one - * the file manager doesn't know what to do with. + * the file manager doesn't know what to do with. Java 19 seems to have + * learned to pass the args to the file manager without the fuss here. */ var rmgr = new org.postgresql.pljava.pgxs.RelativizingFileManager( smgr, Charset.forName(report.outputEncoding)); - rmgr.handleFirstOptions(args); + if ( 0 > v.compareTo(java.lang.Runtime.Version.parse("19-ea")) ) + rmgr.handleFirstOptions(args); var task = tool.getTask(null, rmgr, diagListener, null, args, null); if (task.call()) diff --git a/pljava/pom.xml b/pljava/pom.xml index 51eb86f51..52491f1c1 100644 --- a/pljava/pom.xml +++ b/pljava/pom.xml @@ -182,11 +182,15 @@ function executeReport(report, locale) * A special file manager that will rewrite the RELDOTS seen in * -linkoffline above. The options a file manager recognizes must be the * first ones in args; handleFirstOptions below returns at the first one - * the file manager doesn't know what to do with. + * the file manager doesn't know what to do with. Java 19 seems to have + * learned to pass the args to the file manager without the fuss here. */ var rmgr = new org.postgresql.pljava.pgxs.RelativizingFileManager( smgr, Charset.forName(report.outputEncoding)); - rmgr.handleFirstOptions(args); + + var v = java.lang.Runtime.version(); + if ( 0 > v.compareTo(java.lang.Runtime.Version.parse("19-ea")) ) + rmgr.handleFirstOptions(args); var task = tool.getTask(null, rmgr, diagListener, null, args, null); if (task.call()) diff --git a/pljava/src/main/java/org/postgresql/pljava/management/Commands.java b/pljava/src/main/java/org/postgresql/pljava/management/Commands.java index 0cdafa254..df3884388 100644 --- a/pljava/src/main/java/org/postgresql/pljava/management/Commands.java +++ b/pljava/src/main/java/org/postgresql/pljava/management/Commands.java @@ -88,18 +88,18 @@ *
SELECT sqlj.install_jar(<jar_url>, <jar_name>, <deploy>); *
*

Parameters

- *
+ *
Parameters for sqlj.install_jar(url...)
* - * + * * * * - * + * * * * - * + * * @@ -109,20 +109,20 @@ *
SELECT sqlj.install_jar(<jar_image>, <jar_name>, <deploy>); *
*

Parameters

- *
Parameters for sqlj.install_jar(url...)
jar_urljar_urlThe URL that denotes the location of the jar that should be loaded
jar_namejar_nameThis is the name by which this jar can be referenced once it has been * loaded
deploydeployTrue if the jar should be deployed according to a {@link * org.postgresql.pljava.management.SQLDeploymentDescriptor deployment * descriptor}, false otherwise
Parameters for + *
* - * + * * * * - * + * * * * - * + * * @@ -136,17 +136,17 @@ *
SELECT sqlj.replace_jar(<jar_url>, <jar_name>, <redeploy>); *
*

Parameters

- *
Parameters for * sqlj.install_jar(bytea...)
jar_imagejar_imageThe byte array that constitutes the contents of the jar that should be * loaded
jar_namejar_nameThis is the name by which this jar can be referenced once it has been * loaded
deploydeployTrue if the jar should be deployed according to a {@link * org.postgresql.pljava.management.SQLDeploymentDescriptor deployment * descriptor}, false otherwise
+ *
Parameters for sqlj.replace_jar(url...)
* - * + * * * * - * + * * * * - * + * *
Parameters for sqlj.replace_jar(url...)
jar_urljar_urlThe URL that denotes the location of the jar that should be loaded
jar_namejar_nameThe name of the jar to be replaced
redeployredeployTrue if the old and new jar should be undeployed and deployed according * to their respective {@link * org.postgresql.pljava.management.SQLDeploymentDescriptor deployment @@ -157,19 +157,19 @@ *
SELECT sqlj.replace_jar(<jar_image>, <jar_name>, <redeploy>); *
*

Parameters

- *
Parameters for + *
* - * + * * * * - * + * * * * - * + * *
Parameters for * sqlj.replace_jar(bytea...)
jar_imagejar_imageThe byte array that constitutes the contents of the jar that should be * loaded
jar_namejar_nameThe name of the jar to be replaced
redeployredeployTrue if the old and new jar should be undeployed and deployed according * to their respective {@link * org.postgresql.pljava.management.SQLDeploymentDescriptor deployment @@ -184,13 +184,13 @@ *
SELECT sqlj.remove_jar(<jar_name>, <undeploy>); *
*

Parameters

- *
+ *
Parameters for sqlj.remove_jar
* - * + * * * * - * + * * @@ -204,7 +204,7 @@ *
SELECT sqlj.get_classpath(<schema>); *
*

Parameters

- *
Parameters for sqlj.remove_jar
jar_namejar_nameThe name of the jar to be removed
undeployundeployTrue if the jar should be undeployed according to its {@link * org.postgresql.pljava.management.SQLDeploymentDescriptor deployment * descriptor}, false otherwise
+ *
Parameters for sqlj.get_classpath
* * * @@ -219,7 +219,7 @@ *
SELECT sqlj.set_classpath(<schema>, <classpath>); *
*

Parameters

- *
Parameters for sqlj.get_classpath
schemaThe name of the schema
+ *
Parameters for sqlj.set_classpath
* * * @@ -236,7 +236,7 @@ *
SELECT sqlj.add_type_mapping(<sqlTypeName>, <className>); *
*

Parameters

- *
Parameters for sqlj.set_classpath
schemaThe name of the schema
+ *
Parameters for sqlj.add_type_mapping
* * *
Parameters for sqlj.add_type_mapping
sqlTypeNameThe name of the SQL type. The name can be qualified with a @@ -256,7 +256,7 @@ *
SELECT sqlj.drop_type_mapping(<sqlTypeName>); *
*

Parameters

- *
+ *
Parameters for sqlj.drop_type_mapping
* * *
Parameters for sqlj.drop_type_mapping
sqlTypeNameThe name of the SQL type. The name can be qualified with a @@ -275,7 +275,7 @@ * {@code SELECT sqlj.alias_java_language(, sandboxed => );} * *

Parameters

- *
+ *
Parameters for sqlj.alias_java_language
* * *
Parameters for sqlj.alias_java_language
aliasThe name desired for the language alias. Language names are not