Skip to content

Commit

Permalink
Merge into REL1_6_STABLE these pull requests:
Browse files Browse the repository at this point in the history
PR #456, #462, #463.

Addresses issue #455, and new javadoc requirements in Java 17 and 19.
  • Loading branch information
jcflack committed Sep 7, 2023
4 parents 7de3b99 + c9b3473 + bff1d88 + 6a64e91 commit f2d3d29
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ private Lexicals() { } // do not instantiate
* engine, letting it handle the details.
*/
public static final Pattern NEWLINE = Pattern.compile(
"(?ms:$(?:(?<!^).|(?<=\\G).){1,2}+)"
"(?ms:$.{1,2}?(?:^|\\z))" // fewest of 1,2 chars between $ and ^ (or \z)
);

/** White space <em>except</em> newline, for any Java-recognized newline.
Expand Down
18 changes: 18 additions & 0 deletions pljava-api/src/test/java/LexicalsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions pljava-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
8 changes: 6 additions & 2 deletions pljava/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
48 changes: 24 additions & 24 deletions pljava/src/main/java/org/postgresql/pljava/management/Commands.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,18 @@
* <blockquote><code>SELECT sqlj.install_jar(&lt;jar_url&gt;, &lt;jar_name&gt;, &lt;deploy&gt;);</code>
* </blockquote>
* <h4>Parameters</h4>
* <blockquote><table><caption>Parameters for sqlj.install_jar(url...)</caption>
* <blockquote><table class="striped"><caption>Parameters for sqlj.install_jar(url...)</caption>
* <tr>
* <td valign="top"><b>jar_url</b></td>
* <td><b>jar_url</b></td>
* <td>The URL that denotes the location of the jar that should be loaded </td>
* </tr>
* <tr>
* <td valign="top"><b>jar_name</b></td>
* <td><b>jar_name</b></td>
* <td>This is the name by which this jar can be referenced once it has been
* loaded</td>
* </tr>
* <tr>
* <td valign="top"><b>deploy</b></td>
* <td><b>deploy</b></td>
* <td>True if the jar should be deployed according to a {@link
* org.postgresql.pljava.management.SQLDeploymentDescriptor deployment
* descriptor}, false otherwise</td>
Expand All @@ -109,20 +109,20 @@
* <blockquote><code>SELECT sqlj.install_jar(&lt;jar_image&gt;, &lt;jar_name&gt;, &lt;deploy&gt;);</code>
* </blockquote>
* <h4>Parameters</h4>
* <blockquote><table><caption>Parameters for
* <blockquote><table class="striped"><caption>Parameters for
* sqlj.install_jar(bytea...)</caption>
* <tr>
* <td valign="top"><b>jar_image</b></td>
* <td><b>jar_image</b></td>
* <td>The byte array that constitutes the contents of the jar that should be
* loaded </td>
* </tr>
* <tr>
* <td valign="top"><b>jar_name</b></td>
* <td><b>jar_name</b></td>
* <td>This is the name by which this jar can be referenced once it has been
* loaded</td>
* </tr>
* <tr>
* <td valign="top"><b>deploy</b></td>
* <td><b>deploy</b></td>
* <td>True if the jar should be deployed according to a {@link
* org.postgresql.pljava.management.SQLDeploymentDescriptor deployment
* descriptor}, false otherwise</td>
Expand All @@ -136,17 +136,17 @@
* <blockquote><code>SELECT sqlj.replace_jar(&lt;jar_url&gt;, &lt;jar_name&gt;, &lt;redeploy&gt;);</code>
* </blockquote>
* <h4>Parameters</h4>
* <blockquote><table><caption>Parameters for sqlj.replace_jar(url...)</caption>
* <blockquote><table class="striped"><caption>Parameters for sqlj.replace_jar(url...)</caption>
* <tr>
* <td valign="top"><b>jar_url</b></td>
* <td><b>jar_url</b></td>
* <td>The URL that denotes the location of the jar that should be loaded </td>
* </tr>
* <tr>
* <td valign="top"><b>jar_name</b></td>
* <td><b>jar_name</b></td>
* <td>The name of the jar to be replaced</td>
* </tr>
* <tr>
* <td valign="top"><b>redeploy</b></td>
* <td><b>redeploy</b></td>
* <td>True if the old and new jar should be undeployed and deployed according
* to their respective {@link
* org.postgresql.pljava.management.SQLDeploymentDescriptor deployment
Expand All @@ -157,19 +157,19 @@
* <blockquote><code>SELECT sqlj.replace_jar(&lt;jar_image&gt;, &lt;jar_name&gt;, &lt;redeploy&gt;);</code>
* </blockquote>
* <h4>Parameters</h4>
* <blockquote><table><caption>Parameters for
* <blockquote><table class="striped"><caption>Parameters for
* sqlj.replace_jar(bytea...)</caption>
* <tr>
* <td valign="top"><b>jar_image</b></td>
* <td><b>jar_image</b></td>
* <td>The byte array that constitutes the contents of the jar that should be
* loaded </td>
* </tr>
* <tr>
* <td valign="top"><b>jar_name</b></td>
* <td><b>jar_name</b></td>
* <td>The name of the jar to be replaced</td>
* </tr>
* <tr>
* <td valign="top"><b>redeploy</b></td>
* <td><b>redeploy</b></td>
* <td>True if the old and new jar should be undeployed and deployed according
* to their respective {@link
* org.postgresql.pljava.management.SQLDeploymentDescriptor deployment
Expand All @@ -184,13 +184,13 @@
* <blockquote><code>SELECT sqlj.remove_jar(&lt;jar_name&gt;, &lt;undeploy&gt;);</code>
* </blockquote>
* <h4>Parameters</h4>
* <blockquote><table><caption>Parameters for sqlj.remove_jar</caption>
* <blockquote><table class="striped"><caption>Parameters for sqlj.remove_jar</caption>
* <tr>
* <td valign="top"><b>jar_name</b></td>
* <td><b>jar_name</b></td>
* <td>The name of the jar to be removed</td>
* </tr>
* <tr>
* <td valign="top"><b>undeploy</b></td>
* <td><b>undeploy</b></td>
* <td>True if the jar should be undeployed according to its {@link
* org.postgresql.pljava.management.SQLDeploymentDescriptor deployment
* descriptor}, false otherwise</td>
Expand All @@ -204,7 +204,7 @@
* <blockquote><code>SELECT sqlj.get_classpath(&lt;schema&gt;);</code>
* </blockquote>
* <h4>Parameters</h4>
* <blockquote><table><caption>Parameters for sqlj.get_classpath</caption>
* <blockquote><table class="striped"><caption>Parameters for sqlj.get_classpath</caption>
* <tr>
* <td><b>schema</b></td>
* <td>The name of the schema</td>
Expand All @@ -219,7 +219,7 @@
* <blockquote><code>SELECT sqlj.set_classpath(&lt;schema&gt;, &lt;classpath&gt;);</code>
* </blockquote>
* <h4>Parameters</h4>
* <blockquote><table><caption>Parameters for sqlj.set_classpath</caption>
* <blockquote><table class="striped"><caption>Parameters for sqlj.set_classpath</caption>
* <tr>
* <td><b>schema</b></td>
* <td>The name of the schema</td>
Expand All @@ -236,7 +236,7 @@
* <blockquote><code>SELECT sqlj.add_type_mapping(&lt;sqlTypeName&gt;, &lt;className&gt;);</code>
* </blockquote>
* <h4>Parameters</h4>
* <blockquote><table><caption>Parameters for sqlj.add_type_mapping</caption>
* <blockquote><table class="striped"><caption>Parameters for sqlj.add_type_mapping</caption>
* <tr>
* <td><b>sqlTypeName</b></td>
* <td>The name of the SQL type. The name can be qualified with a
Expand All @@ -256,7 +256,7 @@
* <blockquote><code>SELECT sqlj.drop_type_mapping(&lt;sqlTypeName&gt;);</code>
* </blockquote>
* <h4>Parameters</h4>
* <blockquote><table><caption>Parameters for sqlj.drop_type_mapping</caption>
* <blockquote><table class="striped"><caption>Parameters for sqlj.drop_type_mapping</caption>
* <tr>
* <td><b>sqlTypeName</b></td>
* <td>The name of the SQL type. The name can be qualified with a
Expand All @@ -275,7 +275,7 @@
* {@code SELECT sqlj.alias_java_language(<alias>, sandboxed => <boolean>);}
* </blockquote>
* <h4>Parameters</h4>
* <blockquote><table><caption>Parameters for sqlj.alias_java_language</caption>
* <blockquote><table class="striped"><caption>Parameters for sqlj.alias_java_language</caption>
* <tr>
* <td><b>alias</b></td>
* <td>The name desired for the language alias. Language names are not
Expand Down

0 comments on commit f2d3d29

Please sign in to comment.