Repository: pgjdbc/pgjdbc
Pull request #1427 (2019-02-27 16:50:33)

Add disallow multiple empty lines
Adds checkstyle rule for disallowing multiple empty newlines. Split into three commits:

* First one adds an unrelated newline in dist.xml
* Second one is the "big" one that is kind of funny because the diff excluding newlines is totally empty.
* Third one adds the new checkstyle rule

The majority of the deletions in the second commit are doubled newlines. There's also a handful of manual single newline cleanups for tests to align the code blocks (ex: see `pgjdbc/src/test/java/org/postgresql/test/jdbc42/PreparedStatementTest.java`).

AppVeyorBot: :white_check_mark: [Build pgjdbc 1.0.150 completed](https://ci.appveyor.com/project/davecramer/pgjdbc/builds/22695390) (commit https://github.com/pgjdbc/pgjdbc/commit/d339ca147d by @sehrope)
codecov-io: # [Codecov](https://codecov.io/gh/pgjdbc/pgjdbc/pull/1427?src=pr&el=h1) Report
> Merging [#1427](https://codecov.io/gh/pgjdbc/pgjdbc/pull/1427?src=pr&el=desc) into [master](https://codecov.io/gh/pgjdbc/pgjdbc/commit/0c5cf475d35fb73d921eac922089cf4406e48c9d?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `n/a`.



```diff
@@             Coverage Diff              @@
##             master    #1427      +/-   ##
============================================
+ Coverage     68.74%   68.75%   +<.01%     
  Complexity     3902     3902              
============================================
  Files           179      179              
  Lines         16414    16414              
  Branches       2672     2672              
============================================
+ Hits          11284    11285       +1     
  Misses         3882     3882              
+ Partials       1248     1247       -1
```

AppVeyorBot: :x: [Build pgjdbc 1.0.200 failed](https://ci.appveyor.com/project/davecramer/pgjdbc/builds/23645997) (commit https://github.com/pgjdbc/pgjdbc/commit/04711ff1d2 by @sehrope)
davecramer: @sehrope sorry, but can you fix the conflicts and I'll push this ASAP
sehrope: Amazingly even with the flurry of activity everything rebased cleanly :tada:. I also added a few more fixes for new code that has gone in since Feb.

Rrunning `git diff --ignore-blank-lines  HEAD~3` shows nothing changing outside the newlines and checkstyle config:

```
diff --git a/pgjdbc/src/assembly/dist.xml b/pgjdbc/src/assembly/dist.xml
index 6bd4f9d4..331b4aa4 100644
--- a/pgjdbc/src/assembly/dist.xml
+++ b/pgjdbc/src/assembly/dist.xml
@@ -40,4 +40,4 @@
       <scope>runtime</scope>
     </dependencySet>
   </dependencySets>
-</assembly>
\ No newline at end of file
+</assembly>
diff --git a/pgjdbc/src/main/checkstyle/checks.xml b/pgjdbc/src/main/checkstyle/checks.xml
index 6221650e..75f4095b 100644
--- a/pgjdbc/src/main/checkstyle/checks.xml
+++ b/pgjdbc/src/main/checkstyle/checks.xml
@@ -101,6 +100,7 @@
     <module name="EmptyLineSeparator">
       <property name="allowNoEmptyLineBetweenFields" value="true"/>
       <property name="allowMultipleEmptyLines" value="false"/>
+      <property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>
     </module>
     <module name="SeparatorWrap">
       <property name="tokens" value="DOT"/>
```

@davecramer Once this passes CI it should be good to merge.

Patch:
diff --git a/docs/documentation/head/binary-data.md b/docs/documentation/head/binary-data.md
index bbd36f1e..6a4fcd2b 100644
--- a/docs/documentation/head/binary-data.md
+++ b/docs/documentation/head/binary-data.md
@@ -3,7 +3,7 @@ layout: default_docs
 title: Chapter 7. Storing Binary Data
 header: Chapter 7. Storing Binary Data
 resource: media
-previoustitle: Chapter 6. Calling Stored Functions
+previoustitle: Chapter 6. Calling Stored Functions and Procedures
 previous: callproc.html
 nexttitle: Chapter 8. JDBC escapes
 next: escapes.html
diff --git a/docs/documentation/head/callproc.md b/docs/documentation/head/callproc.md
index bf5e14a5..d5eb1950 100644
--- a/docs/documentation/head/callproc.md
+++ b/docs/documentation/head/callproc.md
@@ -1,7 +1,7 @@
 ---
 layout: default_docs
-title: Chapter 6. Calling Stored Functions
-header: Chapter 6. Calling Stored Functions
+title: Chapter 6. Calling Stored Functions and Procedures
+header: Chapter 6. Calling Stored Functions and Procedures
 resource: media
 previoustitle: Creating and Modifying Database Objects
 previous: ddl.html
@@ -11,9 +11,24 @@ next: binary-data.html
 
 **Table of Contents**
 
-* [Obtaining a `ResultSet` from a stored function](callproc.html#callproc-resultset)
-	* [From a Function Returning `SETOF` type](callproc.html#callproc-resultset-setof)
-	* [From a Function Returning a refcursor](callproc.html#callproc-resultset-refcursor)
+* [Obtaining a `ResultSet` from a stored function](callproc.html#callfunc-resultset)
+	* [From a Function Returning `SETOF` type](callproc.html#callfunc-resultset-setof)
+	* [From a Function Returning a refcursor](callproc.html#callfunc-resultset-refcursor)
+* [Calling stored procedure with transaction control](callproc.html#call-procedure-example)
+
+PostgreSQL™ supports two types of stored objects, functions that can return a
+result value and - starting from v11 - procedures that can perform transaction
+control. Both types of stored objects are invoked using `CallableStatement` and
+the standard JDBC escape call syntax `{call storedobject(?)}`. The
+`escapeSyntaxCallMode` connection property controls how the driver transforms the
+call syntax to invoke functions or procedures.
+
+The default mode, `select`, supports backwards compatibility for existing
+applications and supports function invocation only. This is required to invoke
+a void returning function. For new applications, use
+`escapeSyntaxCallMode=callIfNoReturn` to map `CallableStatement`s with return
+values to stored functions and `CallableStatement`s without return values to
+stored procedures.
 
 <a name="call-function-example"></a>
 **Example 6.1. Calling a built in stored function**
@@ -22,15 +37,15 @@ This example shows how to call a PostgreSQL™ built in function, `upper`, which
 simply converts the supplied string argument to uppercase.
 
 ```java
-CallableStatement upperProc = conn.prepareCall("{? = call upper( ? ) }");
-upperProc.registerOutParameter(1, Types.VARCHAR);
-upperProc.setString(2, "lowercase to uppercase");
-upperProc.execute();
-String upperCased = upperProc.getString(1);
-upperProc.close();
+CallableStatement upperFunc = conn.prepareCall("{? = call upper( ? ) }");
+upperFunc.registerOutParameter(1, Types.VARCHAR);
+upperFunc.setString(2, "lowercase to uppercase");
+upperFunc.execute();
+String upperCased = upperFunc.getString(1);
+upperFunc.close();
 ```
 
-<a name="callproc-resultset"></a>
+<a name="callfunc-resultset"></a>
 # Obtaining a `ResultSet` from a stored function
 
 PostgreSQL's™ stored functions can return results in two different ways. The
@@ -38,7 +53,7 @@ function may return either a refcursor value or a `SETOF` some datatype.  Depend
 on which of these return methods are used determines how the function should be
 called.
 
-<a name="callproc-resultset-setof"></a>
+<a name="callfunc-resultset-setof"></a>
 ## From a Function Returning `SETOF` type
 
 Functions that return data as a set should not be called via the `CallableStatement`
@@ -61,7 +76,7 @@ rs.close();
 stmt.close();
 ```
 
-<a name="callproc-resultset-refcursor"></a>
+<a name="callfunc-resultset-refcursor"></a>
 ## From a Function Returning a refcursor
 
 When calling a function that returns a refcursor you must cast the return type of
@@ -94,17 +109,17 @@ stmt.close();
 // We must be inside a transaction for cursors to work.
 conn.setAutoCommit(false);
 
-// Procedure call.
-CallableStatement proc = conn.prepareCall("{? = call refcursorfunc() }");
-proc.registerOutParameter(1, Types.OTHER);
-proc.execute();
-ResultSet results = (ResultSet) proc.getObject(1);
+// Function call.
+CallableStatement func = conn.prepareCall("{? = call refcursorfunc() }");
+func.registerOutParameter(1, Types.OTHER);
+func.execute();
+ResultSet results = (ResultSet) func.getObject(1);
 while (results.next())
 {
     // do something with the results.
 }
 results.close();
-proc.close();
+func.close();
 ```
 
 It is also possible to treat the refcursor return value as a cursor name directly.
@@ -116,9 +131,43 @@ you are free to directly use cursor commands on it, such as `FETCH` and `MOVE`.
 
 ```java
 conn.setAutoCommit(false);
-CallableStatement proc = conn.prepareCall("{? = call refcursorfunc() }");
-proc.registerOutParameter(1, Types.OTHER);
+CallableStatement func = conn.prepareCall("{? = call refcursorfunc() }");
+func.registerOutParameter(1, Types.OTHER);
+func.execute();
+String cursorName = func.getString(1);
+func.close();
+```
+
+<a name="call-procedure-example"></a>
+**Example 6.5. Calling a stored procedure
+
+This example shows how to call a PostgreSQL™ procedure that uses transaction control.
+
+```java
+// set up a connection
+String url = "jdbc:postgresql://localhost/test";
+Properties props = new Properties();
+... other properties ...
+// Ensure EscapeSyntaxCallmode property set to support procedures if no return value
+props.setProperty("escapeSyntaxCallMode", "callIfNoReturn");
+Connection con = DriverManager.getConnection(url, props);
+
+// Setup procedure to call.
+Statement stmt = con.createStatement();
+stmt.execute("CREATE TEMP TABLE temp_val ( some_val bigint )");
+stmt.execute("CREATE OR REPLACE PROCEDURE commitproc(a INOUT bigint) AS '"
+    + " BEGIN "
+    + "    INSERT INTO temp_val values(a); "
+    + "    COMMIT; "
+    + " END;' LANGUAGE plpgsql");
+stmt.close();
+
+// As of v11, we must be outside a transaction for procedures with transactions to work.
+con.setAutoCommit(true);
+
+// Procedure call with transaction
+CallableStatement proc = con.prepareCall("{call commitproc( ? )}");
+proc.setInt(1, 100);
 proc.execute();
-String cursorName = proc.getString(1);
 proc.close();
 ```
diff --git a/docs/documentation/head/index.html b/docs/documentation/head/index.html
index 70ef62fd..dce2deae 100644
--- a/docs/documentation/head/index.html
+++ b/docs/documentation/head/index.html
@@ -86,16 +86,17 @@
 								</dl>
 							</dd>
 
-							<dt>6. <a href="callproc.html">Calling Stored Functions</a></dt>
+							<dt>6. <a href="callproc.html">Calling Stored Functions and Procedures</a></dt>
 							<dd>
 								<dl>
-									<dt><a href="callproc.html#callproc-resultset">Obtaining a ResultSet from a stored function</a></dt>
+									<dt><a href="callproc.html#callfunc-resultset">Obtaining a ResultSet from a stored function</a></dt>
 										<dd>
 											<dl>
-												<dt><a href="callproc.html#callproc-resultset-setof">From a Function Returning SETOF type</a></dt>
-												<dt><a href="callproc.html#callproc-resultset-refcursor">From a Function Returning a <span class="type">refcursor</span></a></dt>
+												<dt><a href="callproc.html#callfunc-resultset-setof">From a Function Returning SETOF type</a></dt>
+												<dt><a href="callproc.html#callfunc-resultset-refcursor">From a Function Returning a <span class="type">refcursor</span></a></dt>
 											</dl>
 										</dd>
+									<dt><a href="callproc.html#call-procedure-example">Calling stored procedure with transaction control</a></dt>
 								</dl>
 							</dd>
 
diff --git a/pgjdbc/src/assembly/dist.xml b/pgjdbc/src/assembly/dist.xml
index 6bd4f9d4..331b4aa4 100644
--- a/pgjdbc/src/assembly/dist.xml
+++ b/pgjdbc/src/assembly/dist.xml
@@ -40,4 +40,4 @@
       <scope>runtime</scope>
     </dependencySet>
   </dependencySets>
-</assembly>
\ No newline at end of file
+</assembly>
diff --git a/pgjdbc/src/main/checkstyle/checks.xml b/pgjdbc/src/main/checkstyle/checks.xml
index 6221650e..75f4095b 100644
--- a/pgjdbc/src/main/checkstyle/checks.xml
+++ b/pgjdbc/src/main/checkstyle/checks.xml
@@ -22,7 +22,6 @@
 
   <property name="fileExtensions" value="java, properties, xml"/>
 
-
   <!-- Checks for whitespace                               -->
   <!-- See http://checkstyle.sf.net/config_whitespace.html -->
   <module name="FileTabCharacter">
@@ -101,6 +100,7 @@
     <module name="EmptyLineSeparator">
       <property name="allowNoEmptyLineBetweenFields" value="true"/>
       <property name="allowMultipleEmptyLines" value="false"/>
+      <property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/>
     </module>
     <module name="SeparatorWrap">
       <property name="tokens" value="DOT"/>
diff --git a/pgjdbc/src/main/java/org/postgresql/PGConnection.java b/pgjdbc/src/main/java/org/postgresql/PGConnection.java
index b220f56a..1da637e3 100644
--- a/pgjdbc/src/main/java/org/postgresql/PGConnection.java
+++ b/pgjdbc/src/main/java/org/postgresql/PGConnection.java
@@ -167,7 +167,6 @@ public interface PGConnection {
    */
   void setDefaultFetchSize(int fetchSize) throws SQLException;
 
-
   /**
    * Get the default fetch size for statements created from this connection.
    *
@@ -224,7 +223,6 @@ public interface PGConnection {
    */
   PreferQueryMode getPreferQueryMode();
 
-
   /**
    * Connection configuration regarding automatic per-query savepoints.
    *
diff --git a/pgjdbc/src/main/java/org/postgresql/PGStatement.java b/pgjdbc/src/main/java/org/postgresql/PGStatement.java
index 17d2ffde..cbe3b2e8 100644
--- a/pgjdbc/src/main/java/org/postgresql/PGStatement.java
+++ b/pgjdbc/src/main/java/org/postgresql/PGStatement.java
@@ -23,7 +23,6 @@ public interface PGStatement {
   long DATE_POSITIVE_SMALLER_INFINITY = 185543533774800000L;
   long DATE_NEGATIVE_SMALLER_INFINITY = -185543533774800000L;
 
-
   /**
    * Returns the Last inserted/updated oid.
    *
diff --git a/pgjdbc/src/main/java/org/postgresql/core/PGStream.java b/pgjdbc/src/main/java/org/postgresql/core/PGStream.java
index d8bcb3a6..7bba846e 100644
--- a/pgjdbc/src/main/java/org/postgresql/core/PGStream.java
+++ b/pgjdbc/src/main/java/org/postgresql/core/PGStream.java
@@ -540,7 +540,6 @@ public class PGStream implements Closeable, Flushable {
     }
   }
 
-
   /**
    * Flush any pending output to the backend.
    *
diff --git a/pgjdbc/src/main/java/org/postgresql/core/ParameterList.java b/pgjdbc/src/main/java/org/postgresql/core/ParameterList.java
index f62993d8..de73c512 100644
--- a/pgjdbc/src/main/java/org/postgresql/core/ParameterList.java
+++ b/pgjdbc/src/main/java/org/postgresql/core/ParameterList.java
@@ -23,7 +23,6 @@ import java.sql.SQLException;
  * @author Oliver Jowett (oliver@opencloud.com)
  */
 public interface ParameterList {
-
   void registerOutParameter(int index, int sqlType) throws SQLException;
 
   /**
diff --git a/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java b/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java
index 20ce1762..63cbc074 100644
--- a/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java
+++ b/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java
@@ -674,7 +674,6 @@ public class QueryExecutorImpl extends QueryExecutorBase {
       }
     }
 
-
     pgStream.sendChar('F');
     pgStream.sendInteger4(4 + 4 + 2 + 2 * paramCount + 2 + encodedSize + 2);
     pgStream.sendInteger4(fnid);
@@ -2026,7 +2025,6 @@ public class QueryExecutorImpl extends QueryExecutorBase {
 
           LOGGER.log(Level.FINEST, " <=BE ParameterDescription");
 
-
           DescribeRequest describeData = pendingDescribeStatementQueue.getFirst();
           SimpleQuery query = describeData.query;
           SimpleParameterList params = describeData.parameterList;
@@ -2101,7 +2099,6 @@ public class QueryExecutorImpl extends QueryExecutorBase {
           pgStream.receiveInteger4(); // len, discarded
           LOGGER.log(Level.FINEST, " <=BE PortalSuspended");
 
-
           ExecuteRequest executeData = pendingExecuteQueue.removeFirst();
           SimpleQuery currentQuery = executeData.query;
           Portal currentPortal = executeData.portal;
@@ -2128,7 +2125,6 @@ public class QueryExecutorImpl extends QueryExecutorBase {
 
           doneAfterRowDescNoData = false;
 
-
           ExecuteRequest executeData = pendingExecuteQueue.peekFirst();
           SimpleQuery currentQuery = executeData.query;
           Portal currentPortal = executeData.portal;
@@ -2210,7 +2206,6 @@ public class QueryExecutorImpl extends QueryExecutorBase {
             }
           }
 
-
           if (!noResults) {
             if (tuples == null) {
               tuples = new ArrayList<byte[][]>();
diff --git a/pgjdbc/src/main/java/org/postgresql/core/v3/SimpleParameterList.java b/pgjdbc/src/main/java/org/postgresql/core/v3/SimpleParameterList.java
index 18a3e7a2..8d53eafa 100644
--- a/pgjdbc/src/main/java/org/postgresql/core/v3/SimpleParameterList.java
+++ b/pgjdbc/src/main/java/org/postgresql/core/v3/SimpleParameterList.java
@@ -477,4 +477,3 @@ class SimpleParameterList implements V3ParameterList {
 
   private int pos = 0;
 }
-
diff --git a/pgjdbc/src/main/java/org/postgresql/core/v3/replication/V3ReplicationProtocol.java b/pgjdbc/src/main/java/org/postgresql/core/v3/replication/V3ReplicationProtocol.java
index cd362306..ac229f5d 100644
--- a/pgjdbc/src/main/java/org/postgresql/core/v3/replication/V3ReplicationProtocol.java
+++ b/pgjdbc/src/main/java/org/postgresql/core/v3/replication/V3ReplicationProtocol.java
@@ -136,5 +136,4 @@ public class V3ReplicationProtocol implements ReplicationProtocol {
           PSQLState.CONNECTION_UNABLE_TO_CONNECT, ioe);
     }
   }
-
 }
diff --git a/pgjdbc/src/main/java/org/postgresql/gss/GssAction.java b/pgjdbc/src/main/java/org/postgresql/gss/GssAction.java
index f747fd4a..298a80f4 100644
--- a/pgjdbc/src/main/java/org/postgresql/gss/GssAction.java
+++ b/pgjdbc/src/main/java/org/postgresql/gss/GssAction.java
@@ -92,7 +92,6 @@ class GssAction implements PrivilegedAction<Exception> {
       while (!established) {
         outToken = secContext.initSecContext(inToken, 0, inToken.length);
 
-
         if (outToken != null) {
           LOGGER.log(Level.FINEST, " FE=> Password(GSS Authentication Token)");
 
diff --git a/pgjdbc/src/main/java/org/postgresql/gss/MakeGSS.java b/pgjdbc/src/main/java/org/postgresql/gss/MakeGSS.java
index b3b856b4..0c5d27db 100644
--- a/pgjdbc/src/main/java/org/postgresql/gss/MakeGSS.java
+++ b/pgjdbc/src/main/java/org/postgresql/gss/MakeGSS.java
@@ -24,7 +24,6 @@ import javax.security.auth.Subject;
 import javax.security.auth.login.LoginContext;
 
 public class MakeGSS {
-
   private static final Logger LOGGER = Logger.getLogger(MakeGSS.class.getName());
 
   public static void authenticate(PGStream pgStream, String host, String user, String password,
diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java b/pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java
index 1522ade9..89f71485 100644
--- a/pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java
+++ b/pgjdbc/src/main/java/org/postgresql/jdbc/AbstractBlobClob.java
@@ -246,8 +246,6 @@ public abstract class AbstractBlobClob {
   }
 
   protected synchronized LargeObject getLo(boolean forWrite) throws SQLException {
-
-
     if (this.currentLo != null) {
       if (forWrite && !currentLoIsWriteable) {
         // Reopen the stream in read-write, at the same pos.
diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java b/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java
index 80201a89..fda19477 100644
--- a/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java
+++ b/pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java
@@ -1582,7 +1582,6 @@ public class PgDatabaseMetaData implements DatabaseMetaData {
       tuple[5] = connection.encodeString(pgType); // Type name
       tuple[7] = null; // Buffer length
 
-
       String defval = rs.getString("adsrc");
 
       if (defval != null) {
@@ -2552,7 +2551,6 @@ public class PgDatabaseMetaData implements DatabaseMetaData {
         + "else null end as base_type "
         + "from pg_catalog.pg_type t, pg_catalog.pg_namespace n where t.typnamespace = n.oid and n.nspname != 'pg_catalog' and n.nspname != 'pg_toast'";
 
-
     StringBuilder toAdd = new StringBuilder();
     if (types != null) {
       toAdd.append(" and (false ");
diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java b/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
index 4ef826fa..f1b9fbf5 100644
--- a/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
+++ b/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
@@ -943,11 +943,8 @@ public class PgResultSet implements ResultSet, org.postgresql.PGRefCursorResultS
           PSQLState.INVALID_CURSOR_STATE);
     }
 
-
     int numKeys = primaryKeys.size();
     if (deleteStatement == null) {
-
-
       StringBuilder deleteSQL =
           new StringBuilder("DELETE FROM ").append(onlyTable).append(tableName).append(" where ");
 
@@ -967,7 +964,6 @@ public class PgResultSet implements ResultSet, org.postgresql.PGRefCursorResultS
       deleteStatement.setObject(i + 1, primaryKeys.get(i).getValue());
     }
 
-
     deleteStatement.executeUpdate();
 
     rows.remove(currentRow);
@@ -1040,8 +1036,6 @@ public class PgResultSet implements ResultSet, org.postgresql.PGRefCursorResultS
 
       // need to clear this in case of another insert
       clearRowBuffer(false);
-
-
     }
   }
 
@@ -1068,13 +1062,11 @@ public class PgResultSet implements ResultSet, org.postgresql.PGRefCursorResultS
       insertStatement = null;
     }
 
-
     // make sure the underlying data is null
     clearRowBuffer(false);
 
     onInsertRow = true;
     doingUpdates = false;
-
   }
 
   private synchronized void clearRowBuffer(boolean copyCurrentRow) throws SQLException {
@@ -1088,7 +1080,6 @@ public class PgResultSet implements ResultSet, org.postgresql.PGRefCursorResultS
 
     // clear the updateValues hash map for the next set of updates
     updateValues.clear();
-
   }
 
   public boolean rowDeleted() throws SQLException {
@@ -1252,7 +1243,6 @@ public class PgResultSet implements ResultSet, org.postgresql.PGRefCursorResultS
 
   public synchronized void updateObject(int columnIndex, Object x, int scale) throws SQLException {
     this.updateObject(columnIndex, x);
-
   }
 
   @Override
@@ -1299,7 +1289,6 @@ public class PgResultSet implements ResultSet, org.postgresql.PGRefCursorResultS
     selectStatement = connection.prepareStatement(sqlText,
         ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
 
-
     for (int j = 0, i = 1; j < numKeys; j++, i++) {
       selectStatement.setObject(i, primaryKeys.get(j).getValue());
     }
@@ -1318,7 +1307,6 @@ public class PgResultSet implements ResultSet, org.postgresql.PGRefCursorResultS
     rs.close();
     selectStatement.close();
     selectStatement = null;
-
   }
 
   @Override
@@ -1500,7 +1488,6 @@ public class PgResultSet implements ResultSet, org.postgresql.PGRefCursorResultS
     updateObject(findColumn(columnName), x);
   }
 
-
   /**
    * Is this ResultSet updateable?
    */
@@ -1540,7 +1527,6 @@ public class PgResultSet implements ResultSet, org.postgresql.PGRefCursorResultS
     // with oids has been removed in version 12
     // FIXME: with oids does not automatically create an index, should check for primary keys first
 
-
     usingOID = false;
     int oidIndex = findColumnIndex("oid"); // 0 if not present
 
@@ -1578,7 +1564,6 @@ public class PgResultSet implements ResultSet, org.postgresql.PGRefCursorResultS
 
     connection.getLogger().log(Level.FINE, "no of keys={0}", i);
 
-
     if (i < 1) {
       throw new PSQLException(GT.tr("No primary key found for table {0}.", tableName),
           PSQLState.DATA_ERROR);
@@ -1679,7 +1664,6 @@ public class PgResultSet implements ResultSet, org.postgresql.PGRefCursorResultS
   }
 
   private void updateRowBuffer() throws SQLException {
-
     for (Map.Entry<String, Object> entry : updateValues.entrySet()) {
       int columnIndex = findColumn(entry.getKey()) - 1;
 
diff --git a/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java b/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java
index 59341329..d0effef6 100644
--- a/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java
+++ b/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java
@@ -1107,7 +1107,6 @@ public class TimestampUtils {
       micros = ByteConverter.int8(bytes, 0);
     }
 
-
     return LocalTime.ofNanoOfDay(micros * 1000);
   }
   //#endif
diff --git a/pgjdbc/src/main/java/org/postgresql/ssl/LibPQFactory.java b/pgjdbc/src/main/java/org/postgresql/ssl/LibPQFactory.java
index 2f259af8..4b9c69e7 100644
--- a/pgjdbc/src/main/java/org/postgresql/ssl/LibPQFactory.java
+++ b/pgjdbc/src/main/java/org/postgresql/ssl/LibPQFactory.java
@@ -70,7 +70,6 @@ public class LibPQFactory extends WrappedFactory {
       sslcertfile = defaultdir + "postgresql.crt";
     }
 
-
     // If the properties are empty, give null to prevent client key selection
     km = new LazyKeyManager(("".equals(sslcertfile) ? null : sslcertfile),
       ("".equals(sslkeyfile) ? null : sslkeyfile), getCallbackHandler(info), defaultfile);
diff --git a/pgjdbc/src/main/java/org/postgresql/sspi/SSPIClient.java b/pgjdbc/src/main/java/org/postgresql/sspi/SSPIClient.java
index 7ef573be..8a612b68 100644
--- a/pgjdbc/src/main/java/org/postgresql/sspi/SSPIClient.java
+++ b/pgjdbc/src/main/java/org/postgresql/sspi/SSPIClient.java
@@ -111,7 +111,6 @@ public class SSPIClient implements ISSPIClient {
     }
   }
 
-
   /**
    * Respond to an authentication request from the back-end for SSPI authentication (AUTH_REQ_SSPI).
    *
diff --git a/pgjdbc/src/main/java/org/postgresql/util/Base64.java b/pgjdbc/src/main/java/org/postgresql/util/Base64.java
index 46446b05..79f2ac2e 100644
--- a/pgjdbc/src/main/java/org/postgresql/util/Base64.java
+++ b/pgjdbc/src/main/java/org/postgresql/util/Base64.java
@@ -55,9 +55,7 @@ package org.postgresql.util;
  * @version 2.1
  */
 public class Base64 {
-
   /* ******** P U B L I C F I E L D S ******** */
-
   /**
    * No options specified. Value is zero.
    */
@@ -79,7 +77,6 @@ public class Base64 {
   public static final int DONT_BREAK_LINES = 8;
 
   /* ******** P R I V A T E F I E L D S ******** */
-
   /**
    * Maximum line length (76) of Base64 output.
    */
@@ -180,7 +177,6 @@ public class Base64 {
   }
 
   /* ******** E N C O D I N G M E T H O D S ******** */
-
   /**
    * Encodes up to three bytes of the array <var>source</var> and writes the resulting four Base64
    * bytes to <var>destination</var>. The source and destination arrays can be manipulated anywhere
@@ -348,20 +344,16 @@ public class Base64 {
         e += 4;
       } // end if: some padding needed
 
-
       // Return value according to relevant encoding.
       try {
         return new String(outBuff, 0, e, PREFERRED_ENCODING);
       } catch (java.io.UnsupportedEncodingException uue) {
         return new String(outBuff, 0, e);
       }
-
     }
-
   }
 
   /* ******** D E C O D I N G M E T H O D S ******** */
-
   /**
    * Decodes four bytes from array <var>source</var> and writes the resulting bytes (up to three of
    * them) to <var>destination</var>. The source and destination arrays can be manipulated anywhere
@@ -415,7 +407,6 @@ public class Base64 {
             | ((DECODABET[source[srcOffset + 2]] & 0xFF) << 6)
             | ((DECODABET[source[srcOffset + 3]] & 0xFF));
 
-
         destination[destOffset] = (byte) (outBuff >> 16);
         destination[destOffset + 1] = (byte) (outBuff >> 8);
         destination[destOffset + 2] = (byte) (outBuff);
diff --git a/pgjdbc/src/main/java/org/postgresql/util/PGtokenizer.java b/pgjdbc/src/main/java/org/postgresql/util/PGtokenizer.java
index 19bd3053..d2c92670 100644
--- a/pgjdbc/src/main/java/org/postgresql/util/PGtokenizer.java
+++ b/pgjdbc/src/main/java/org/postgresql/util/PGtokenizer.java
@@ -89,8 +89,6 @@ public class PGtokenizer {
     }
 
     // Don't forget the last token ;-)
-
-
     if (s < string.length()) {
       tokens.add(string.substring(s));
     }
diff --git a/pgjdbc/src/main/java/org/postgresql/util/PSQLState.java b/pgjdbc/src/main/java/org/postgresql/util/PSQLState.java
index ca4de8ba..21ff5c85 100644
--- a/pgjdbc/src/main/java/org/postgresql/util/PSQLState.java
+++ b/pgjdbc/src/main/java/org/postgresql/util/PSQLState.java
@@ -68,6 +68,8 @@ public enum PSQLState {
   INVALID_SQL_STATEMENT_NAME("26000"),
   INVALID_AUTHORIZATION_SPECIFICATION("28000"),
 
+  INVALID_TRANSACTION_TERMINATION("2D000"),
+
   STATEMENT_NOT_ALLOWED_IN_FUNCTION_CALL("2F003"),
 
   INVALID_SAVEPOINT_SPECIFICATION("3B000"),
diff --git a/pgjdbc/src/main/java/org/postgresql/util/ServerErrorMessage.java b/pgjdbc/src/main/java/org/postgresql/util/ServerErrorMessage.java
index 7b3f62c2..5921b88f 100644
--- a/pgjdbc/src/main/java/org/postgresql/util/ServerErrorMessage.java
+++ b/pgjdbc/src/main/java/org/postgresql/util/ServerErrorMessage.java
@@ -14,7 +14,6 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 public class ServerErrorMessage implements Serializable {
-
   private static final Logger LOGGER = Logger.getLogger(ServerErrorMessage.class.getName());
 
   private static final Character SEVERITY = 'S';


Test patch:
diff --git a/pgjdbc/src/test/java/org/postgresql/core/ParserTest.java b/pgjdbc/src/test/java/org/postgresql/core/ParserTest.java
index 34c8ca3a..955955b2 100644
--- a/pgjdbc/src/test/java/org/postgresql/core/ParserTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/core/ParserTest.java
@@ -243,8 +243,5 @@ public class ParserTest {
     command = qry.get(0).getCommand();
     Assert.assertEquals(43,command.getBatchRewriteValuesBraceOpenPosition());
     Assert.assertEquals(49,command.getBatchRewriteValuesBraceClosePosition());
-
-
-
   }
 }
diff --git a/pgjdbc/src/test/java/org/postgresql/replication/LogicalReplicationStatusTest.java b/pgjdbc/src/test/java/org/postgresql/replication/LogicalReplicationStatusTest.java
index 0f483c7b..ee81bd20 100644
--- a/pgjdbc/src/test/java/org/postgresql/replication/LogicalReplicationStatusTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/replication/LogicalReplicationStatusTest.java
@@ -336,7 +336,6 @@ public class LogicalReplicationStatusTest {
     receiveMessageWithoutBlock(stream, 1);
     stream.forceUpdateStatus();
 
-
     LogSequenceNumber flushed = getFlushLocationOnView();
     LogSequenceNumber applied = getReplayLocationOnView();
 
diff --git a/pgjdbc/src/test/java/org/postgresql/replication/LogicalReplicationTest.java b/pgjdbc/src/test/java/org/postgresql/replication/LogicalReplicationTest.java
index 759d1c32..dd35a544 100644
--- a/pgjdbc/src/test/java/org/postgresql/replication/LogicalReplicationTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/replication/LogicalReplicationTest.java
@@ -166,7 +166,6 @@ public class LogicalReplicationTest {
             .withSlotOption("skip-empty-xacts", true)
             .start();
 
-
     List<String> result = new ArrayList<String>();
 
     Statement st = sqlConnection.createStatement();
@@ -731,7 +730,6 @@ public class LogicalReplicationTest {
     consumedData.addAll(receiveMessageWithoutBlock(stream, 3));
     String result = group(consumedData);
 
-
     String wait = group(Arrays.asList(
         "BEGIN",
         "table public.test_logic_table: INSERT: pk[integer]:1 name[character varying]:'first tx changes'",
diff --git a/pgjdbc/src/test/java/org/postgresql/test/TestUtil.java b/pgjdbc/src/test/java/org/postgresql/test/TestUtil.java
index b66c0fae..0ce472c7 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/TestUtil.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/TestUtil.java
@@ -473,7 +473,6 @@ public class TestUtil {
     try {
       dropType(con, name);
 
-
       // Now create the table
       st.executeUpdate("create type " + name + " as enum (" + values + ")");
     } finally {
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/ArrayTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/ArrayTest.java
index 8e1874c9..60ec800f 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/ArrayTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/ArrayTest.java
@@ -332,7 +332,6 @@ public class ArrayTest extends BaseTest4 {
     Assert.assertEquals(3, resultCount);
   }
 
-
   /**
    * Starting with 8.0 non-standard (beginning index isn't 1) bounds the dimensions are returned in
    * the data. The following should return "[0:3]={0,1,2,3,4}" when queried. Older versions simply
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/AutoRollbackTestSuite.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/AutoRollbackTestSuite.java
index 08c590be..212d4e96 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/AutoRollbackTestSuite.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/AutoRollbackTestSuite.java
@@ -356,7 +356,6 @@ public class AutoRollbackTestSuite extends BaseTest4 {
       }
     }
 
-
     try {
       assertRows("rollbacktest", rowsExpected);
       executeSqlSuccess();
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/BlobTransactionTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/BlobTransactionTest.java
index be1e9346..3d8621cd 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/BlobTransactionTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/BlobTransactionTest.java
@@ -142,7 +142,6 @@ public class BlobTransactionTest {
     ResultSet rs2 = pstmt2.executeQuery();
     assertTrue(rs2.next());
 
-
     // con replace the blob
     byte[] newData = randomData();
     pstmt = con.prepareStatement("UPDATE testblob SET lo=? where id=?");
@@ -158,7 +157,6 @@ public class BlobTransactionTest {
       assertEquals(initialContentReRead[i], initialData[i]);
     }
 
-
     con2.rollback();
     pstmt2 = con2.prepareStatement("SELECT lo FROM testblob WHERE id=?");
     pstmt2.setString(1, "testConcurrentReplace");
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/CopyTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/CopyTest.java
index 278e8102..fde54ab8 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/CopyTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/CopyTest.java
@@ -358,7 +358,6 @@ public class CopyTest {
 
       stmt.execute("SET DateStyle = 'ISO, DMY'");
 
-
       // I expect an SQLException
       String sql = "COPY copytest FROM STDIN with xxx " + copyParams;
       CopyIn cp = manager.copyIn(sql);
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/CursorFetchTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/CursorFetchTest.java
index 6f66898e..c4b6d943 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/CursorFetchTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/CursorFetchTest.java
@@ -90,7 +90,6 @@ public class CursorFetchTest extends BaseTest4 {
     }
   }
 
-
   // Similar, but for scrollable resultsets.
   @Test
   public void testScrollableFetch() throws Exception {
@@ -480,7 +479,6 @@ public class CursorFetchTest extends BaseTest4 {
     }
   }
 
-
   // Empty resultsets require all row positioning methods to return false
   @Test
   public void testNoRowResultPositioning() throws Exception {
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DatabaseEncodingTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DatabaseEncodingTest.java
index a2b430ec..711fc506 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DatabaseEncodingTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DatabaseEncodingTest.java
@@ -313,7 +313,6 @@ public class DatabaseEncodingTest {
         // Expected exception.
       }
 
-
       // Try it with padding and a truncated length.
       Arrays.fill(paddedSequence, (byte) 0);
       System.arraycopy(sequence, 0, paddedSequence, 0, sequence.length);
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
index 9d244726..53bc9c55 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java
@@ -57,7 +57,6 @@ public class DatabaseMetaDataTest {
     TestUtil.createCompositeType(con, "custom", "i int", false);
     TestUtil.createCompositeType(con, "_custom", "f float", false);
 
-
     // 8.2 does not support arrays of composite types
     TestUtil.createTable(con, "customtable", "c1 custom, c2 _custom"
         + (TestUtil.haveMinimumServerVersion(con, ServerVersion.v8_3) ? ", c3 custom[], c4 _custom[]" : ""));
@@ -117,7 +116,6 @@ public class DatabaseMetaDataTest {
     TestUtil.dropDomain(con, "varbit2");
     TestUtil.dropDomain(con, "float83");
 
-
     TestUtil.closeDB(con);
   }
 
@@ -224,7 +222,6 @@ public class DatabaseMetaDataTest {
     TestUtil.createTable(con1, "ww",
         "m int not null, n int not null, constraint m_pkey primary key ( m, n ), constraint ww_m_fkey foreign key ( m, n ) references vv ( a, b )");
 
-
     DatabaseMetaData dbmd = con.getMetaData();
     assertNotNull(dbmd);
 
@@ -259,7 +256,6 @@ public class DatabaseMetaDataTest {
     }
     assertEquals(2, numRows);
 
-
     TestUtil.dropTable(con1, "vv");
     TestUtil.dropTable(con1, "ww");
     TestUtil.closeDB(con1);
@@ -365,7 +361,6 @@ public class DatabaseMetaDataTest {
             + "REFERENCES PERSON (FIRST_NAME, LAST_NAME) MATCH SIMPLE "
             + "ON UPDATE CASCADE ON DELETE CASCADE");
 
-
     DatabaseMetaData dbmd = con.getMetaData();
     assertNotNull(dbmd);
     ResultSet rs = dbmd.getImportedKeys(null, "", "person");
@@ -409,8 +404,6 @@ public class DatabaseMetaDataTest {
 
     TestUtil.dropTable(con1, "person");
     TestUtil.closeDB(con1);
-
-
   }
 
   @Test
@@ -424,7 +417,6 @@ public class DatabaseMetaDataTest {
             + "CONSTRAINT people FOREIGN KEY (people_id) references people(id),"
             + "constraint policy FOREIGN KEY (policy_id) references policy(id)");
 
-
     DatabaseMetaData dbmd = con.getMetaData();
     assertNotNull(dbmd);
 
@@ -467,7 +459,6 @@ public class DatabaseMetaDataTest {
 
     assertTrue(rs.getString("FK_NAME").startsWith("people"));
 
-
     TestUtil.dropTable(con1, "users");
     TestUtil.dropTable(con1, "people");
     TestUtil.dropTable(con1, "policy");
@@ -542,9 +533,7 @@ public class DatabaseMetaDataTest {
     assertTrue(rs.next());
     assertEquals("updated", rs.getString(4));
 
-
     rs.close();
-
   }
 
   @Test
@@ -716,7 +705,6 @@ public class DatabaseMetaDataTest {
     assertEquals("id", rs.getString("COLUMN_NAME"));
     assertEquals("A", rs.getString("ASC_OR_DESC"));
 
-
     assertTrue(rs.next());
     assertEquals("idx_a_d", rs.getString("INDEX_NAME"));
     assertEquals("quest", rs.getString("COLUMN_NAME"));
@@ -1042,7 +1030,6 @@ public class DatabaseMetaDataTest {
       assertEquals("data type", Types.DISTINCT, dataType);
       assertEquals("type name ", "testint8", typeName);
       assertEquals("remarks", "jdbc123", remarks);
-
     } finally {
       try {
         Statement stmt = con.createStatement();
@@ -1075,7 +1062,6 @@ public class DatabaseMetaDataTest {
       assertEquals("data type", Types.DISTINCT, dataType);
       assertEquals("type name ", "testint8", typeName);
       assertEquals("remarks", "jdbc123", remarks);
-
     } finally {
       try {
         Statement stmt = con.createStatement();
@@ -1107,7 +1093,6 @@ public class DatabaseMetaDataTest {
       assertEquals("data type", Types.DISTINCT, dataType);
       assertEquals("type name ", "testint8", typeName);
       assertEquals("remarks", "jdbc123", remarks);
-
     } finally {
       try {
         Statement stmt = con.createStatement();
@@ -1137,7 +1122,6 @@ public class DatabaseMetaDataTest {
       assertTrue("base type", rs.wasNull());
       assertEquals("data type", Types.STRUCT, dataType);
       assertEquals("type name ", "testint8", typeName);
-
     } finally {
       try {
         Statement stmt = con.createStatement();
@@ -1206,7 +1190,6 @@ public class DatabaseMetaDataTest {
     for (String typeName : stringTypeList) {
       assertTrue(types.contains(typeName));
     }
-
   }
 
   @Test
@@ -1296,7 +1279,6 @@ public class DatabaseMetaDataTest {
         }
       }
     }
-
   }
 
   @Test
@@ -1432,5 +1414,4 @@ public class DatabaseMetaDataTest {
 
     rs.close();
   }
-
 }
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DateTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DateTest.java
index c7da9294..83fb195f 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DateTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DateTest.java
@@ -67,7 +67,6 @@ public class DateTest {
     assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'3456-01-01'")));
     assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testdate", "'0101-01-01 BC'")));
 
-
     /* dateTest() contains all of the tests */
     dateTest();
 
@@ -162,7 +161,6 @@ public class DateTest {
     assertNotNull(d);
     assertEquals(makeDate(1950, 2, 7), d);
 
-
     assertTrue(rs.next());
     d = rs.getDate(1);
     assertNotNull(d);
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DriverTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DriverTest.java
index 19f788db..33943639 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DriverTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/DriverTest.java
@@ -223,7 +223,6 @@ public class DriverTest {
     String loggerFile = System.getProperty("loggerFile");
 
     try {
-
       PrintWriter printWriter = new PrintWriter(new NullOutputStream(System.err));
       DriverManager.setLogWriter(printWriter);
       assertEquals(DriverManager.getLogWriter(), printWriter);
@@ -243,14 +242,11 @@ public class DriverTest {
       DriverManager.setLogWriter(null);
       System.setProperty("loggerLevel", loggerLevel);
       System.setProperty("loggerFile", loggerFile);
-
     }
-
   }
 
   @Test
   public void testSetLogStream() throws Exception {
-
     // this is a dummy to make sure TestUtil is initialized
     Connection con = DriverManager.getConnection(TestUtil.getURL(), TestUtil.getUser(), TestUtil.getPassword());
     con.close();
@@ -258,7 +254,6 @@ public class DriverTest {
     String loggerFile = System.getProperty("loggerFile");
 
     try {
-
       DriverManager.setLogStream(new NullOutputStream(System.err));
       System.clearProperty("loggerFile");
       System.clearProperty("loggerLevel");
@@ -276,10 +271,6 @@ public class DriverTest {
       DriverManager.setLogStream(null);
       System.setProperty("loggerLevel", loggerLevel);
       System.setProperty("loggerFile", loggerFile);
-
-
     }
-
   }
-
 }
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/IntervalTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/IntervalTest.java
index 56b58784..ce3f4138 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/IntervalTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/IntervalTest.java
@@ -299,5 +299,4 @@ public class IntervalTest {
   private java.sql.Date makeDate(int y, int m, int d) {
     return new java.sql.Date(y - 1900, m - 1, d);
   }
-
 }
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/RefCursorTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/RefCursorTest.java
index 5ed35682..b2ab199e 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/RefCursorTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/RefCursorTest.java
@@ -66,7 +66,6 @@ public class RefCursorTest extends BaseTest4 {
     stmt.executeUpdate("INSERT INTO testrs VALUES (6)");
     stmt.executeUpdate("INSERT INTO testrs VALUES (9)");
 
-
     // Create the functions.
     stmt.execute("CREATE OR REPLACE FUNCTION testspg__getRefcursor () RETURNS refcursor AS '"
         + "declare v_resset refcursor; begin open v_resset for select id from testrs order by id; "
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/ServerPreparedStmtTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/ServerPreparedStmtTest.java
index 5cc26e65..127ee158 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/ServerPreparedStmtTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/ServerPreparedStmtTest.java
@@ -94,8 +94,6 @@ public class ServerPreparedStmtTest extends BaseTest4 {
     rs.close();
 
     // Verify that using the statement still works after turning off prepares
-
-
     if (Boolean.getBoolean("org.postgresql.forceBinary")) {
       return;
     }
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/StatementTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/StatementTest.java
index 7c3cf6e5..3bb4c0d9 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/StatementTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/StatementTest.java
@@ -516,7 +516,6 @@ public class StatementTest {
     }
   }
 
-
   /**
    * <p>Demonstrates a safe approach to concurrently reading the latest
    * warnings while periodically clearing them.</p>
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/TimeTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/TimeTest.java
index 6441214a..c46f1fe3 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/TimeTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/TimeTest.java
@@ -74,7 +74,6 @@ public class TimeTest {
     assertNotNull(rs);
     assertTrue(rs.next());
 
-
     Time time = rs.getTime(1);
     Timestamp timestamp = rs.getTimestamp(1);
     assertNotNull(timestamp);
@@ -137,7 +136,6 @@ public class TimeTest {
     assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testtime", "'22:12:01'")));
     assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL("testtime", "'08:46:44'")));
 
-
     // Fall through helper
     timeTest();
 
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/TimestampTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/TimestampTest.java
index 284de4a6..25dae656 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/TimestampTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/TimestampTest.java
@@ -213,7 +213,6 @@ public class TimestampTest extends BaseTest4 {
     assertEquals(1, stmt.executeUpdate(TestUtil.insertSQL(TSWTZ_TABLE,
         "'" + tsu.toString(null, new Timestamp(tmpTime4.getTime())) + "'")));
 
-
     // Fall through helper
     timestampTestWTZ();
 
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/UpdateableResultTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/UpdateableResultTest.java
index 677f41e0..ac2ad1fb 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/UpdateableResultTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/UpdateableResultTest.java
@@ -114,7 +114,6 @@ public class UpdateableResultTest extends BaseTest4 {
     assertEquals(999, rs.getInt(1));
     assertEquals("anyvalue", rs.getString(2));
 
-
     // make sure the update got to the db and the driver isn't lying to us.
     rs.close();
     rs = st.executeQuery("select * from second");
@@ -322,8 +321,6 @@ public class UpdateableResultTest extends BaseTest4 {
         rs.updateString("name", "dave");
         rs.updateRow();
       }
-
-
       fail("should not get here, update should fail");
     } catch (SQLException ex) {
     }
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/UpsertTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/UpsertTest.java
index 05934f44..f257dfeb 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc2/UpsertTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc2/UpsertTest.java
@@ -22,7 +22,6 @@ import java.sql.Statement;
 import java.util.ArrayList;
 import java.util.Collection;
 
-
 /**
  * Tests {@code INSERT .. ON CONFLICT} introduced in PostgreSQL 9.5.
  */
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3BlobTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3BlobTest.java
index f759a3e7..66f3f3c7 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3BlobTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3BlobTest.java
@@ -186,7 +186,6 @@ public class Jdbc3BlobTest {
     ps.close();
   }
 
-
   /**
    * Test the writing and reading of a single byte.
    */
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java
index f54e1a58..9dfa192f 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3CallableStatementTest.java
@@ -534,8 +534,6 @@ public class Jdbc3CallableStatementTest extends BaseTest4 {
 
       stmt.execute(insertRealTab);
       stmt.close();
-
-
     } catch (Exception ex) {
       fail(ex.getMessage());
       throw ex;
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3TestSuite.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3TestSuite.java
index 2693cf7f..a059d5fa 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3TestSuite.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3TestSuite.java
@@ -24,6 +24,7 @@ import org.junit.runners.Suite;
     Jdbc3CallableStatementTest.class,
     Jdbc3SavepointTest.class,
     ParameterMetaDataTest.class,
+    ProcedureTransactionTest.class,
     ResultSetTest.class,
     SendRecvBufferSizeTest.class,
     SqlCommandParseTest.class,
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc3/ProcedureTransactionTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc3/ProcedureTransactionTest.java
new file mode 100644
index 00000000..e1262df9
--- /dev/null
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc3/ProcedureTransactionTest.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2019, PostgreSQL Global Development Group
+ * See the LICENSE file in the project root for more information.
+ */
+
+package org.postgresql.test.jdbc3;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.postgresql.PGProperty;
+import org.postgresql.core.ServerVersion;
+import org.postgresql.jdbc.EscapeSyntaxCallMode;
+import org.postgresql.test.TestUtil;
+import org.postgresql.test.jdbc2.BaseTest4;
+import org.postgresql.util.PSQLState;
+
+import org.junit.Test;
+
+import java.sql.CallableStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Properties;
+
+public class ProcedureTransactionTest extends BaseTest4 {
+
+  @Override
+  protected void updateProperties(Properties props) {
+    super.updateProperties(props);
+    PGProperty.ESCAPE_SYNTAX_CALL_MODE.set(props, EscapeSyntaxCallMode.CALL_IF_NO_RETURN.value());
+  }
+
+  @Override
+  public void setUp() throws Exception {
+    super.setUp();
+    Statement stmt = con.createStatement();
+    if (TestUtil.haveMinimumServerVersion(con, ServerVersion.v11)) {
+      stmt.execute("create temp table proc_test ( some_val bigint )");
+      stmt.execute(
+          "CREATE OR REPLACE PROCEDURE mycommitproc(a INOUT bigint) AS 'BEGIN INSERT INTO proc_test values(a); commit; END;' LANGUAGE plpgsql");
+      stmt.execute(
+          "CREATE OR REPLACE PROCEDURE myrollbackproc(a INOUT bigint) AS 'BEGIN INSERT INTO proc_test values(a); rollback; END;' LANGUAGE plpgsql");
+      stmt.execute(
+          "CREATE OR REPLACE PROCEDURE mynotxnproc(a INOUT bigint) AS 'BEGIN INSERT INTO proc_test values(a); END;' LANGUAGE plpgsql");
+    }
+  }
+
+  @Override
+  public void tearDown() throws SQLException {
+    Statement stmt = con.createStatement();
+    if (TestUtil.haveMinimumServerVersion(con, ServerVersion.v11)) {
+      stmt.execute("drop procedure mycommitproc(a INOUT bigint) ");
+      stmt.execute("drop procedure myrollbackproc(a INOUT bigint) ");
+      stmt.execute("drop procedure mynotxnproc(a INOUT bigint) ");
+      stmt.execute("drop table proc_test ");
+    }
+    stmt.close();
+    super.tearDown();
+  }
+
+  @Test
+  public void testProcWithNoTxnControl() throws SQLException {
+    assumeMinimumServerVersion(ServerVersion.v11);
+    assumeCallableStatementsSupported();
+    CallableStatement cs = con.prepareCall("call mynotxnproc(?)");
+    int val = 1;
+    cs.setInt(1, val);
+    cs.execute();
+    TestUtil.closeQuietly(cs);
+
+    cs = con.prepareCall("select some_val from proc_test where some_val = ?");
+    cs.setInt(1, val);
+    ResultSet rs = cs.executeQuery();
+
+    assertTrue(rs.next());
+    assertTrue(rs.getInt(1) == val);
+
+    TestUtil.closeQuietly(rs);
+    TestUtil.closeQuietly(cs);
+  }
+
+  @Test
+  public void testProcWithCommitInside() throws SQLException {
+    assumeMinimumServerVersion(ServerVersion.v11);
+    assumeCallableStatementsSupported();
+    CallableStatement cs = con.prepareCall("call mycommitproc(?)");
+    int val = 2;
+    cs.setInt(1, val);
+    cs.execute();
+    TestUtil.closeQuietly(cs);
+
+    cs = con.prepareCall("select some_val from proc_test where some_val = ?");
+    cs.setInt(1, val);
+    ResultSet rs = cs.executeQuery();
+
+    assertTrue(rs.next());
+    assertTrue(rs.getInt(1) == val);
+
+    TestUtil.closeQuietly(rs);
+    TestUtil.closeQuietly(cs);
+  }
+
+  @Test
+  public void testProcWithRollbackInside() throws SQLException {
+    assumeMinimumServerVersion(ServerVersion.v11);
+    assumeCallableStatementsSupported();
+    CallableStatement cs = con.prepareCall("call myrollbackproc(?)");
+    int val = 3;
+    cs.setInt(1, val);
+    cs.execute();
+    TestUtil.closeQuietly(cs);
+
+    cs = con.prepareCall("select some_val from proc_test where some_val = ?");
+    cs.setInt(1, val);
+    ResultSet rs = cs.executeQuery();
+
+    assertFalse(rs.next());
+
+    TestUtil.closeQuietly(rs);
+    TestUtil.closeQuietly(cs);
+  }
+
+  @Test
+  public void testProcAutoCommitTrue() throws SQLException {
+    con.setAutoCommit(true);
+    testProcAutoCommit();
+  }
+
+  @Test
+  public void testProcAutoCommitFalse() throws SQLException {
+    // setting autocommit false enables application transaction control, meaning JDBC driver issues a BEGIN
+    // as of PostgreSQL 11, Stored Procedures with transaction control inside the procedure cannot be
+    // invoked inside a transaction, the procedure must start the top level transaction
+    // see: https://www.postgresql.org/docs/current/plpgsql-transactions.html
+    con.setAutoCommit(false);
+    try {
+      testProcAutoCommit();
+      fail("Should throw an exception");
+    } catch (SQLException ex) {
+      //2D000 invalid_transaction_termination
+      assertTrue(ex.getSQLState().equalsIgnoreCase(PSQLState.INVALID_TRANSACTION_TERMINATION.getState()));
+      con.rollback();
+    }
+
+  }
+
+  private void testProcAutoCommit() throws SQLException {
+    assumeMinimumServerVersion(ServerVersion.v11);
+    assumeCallableStatementsSupported();
+    CallableStatement cs = con.prepareCall("call mycommitproc(?)");
+    int val = 4;
+    cs.setInt(1, val);
+    cs.execute();
+    TestUtil.closeQuietly(cs);
+
+    cs = con.prepareCall("select some_val from proc_test where some_val = ?");
+    cs.setInt(1, val);
+    ResultSet rs = cs.executeQuery();
+
+    assertTrue(rs.next());
+    assertTrue(rs.getInt(1) == val);
+
+    TestUtil.closeQuietly(rs);
+    TestUtil.closeQuietly(cs);
+  }
+
+}
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc3/SendRecvBufferSizeTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc3/SendRecvBufferSizeTest.java
index 9d63f144..2d309b63 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc3/SendRecvBufferSizeTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc3/SendRecvBufferSizeTest.java
@@ -40,7 +40,6 @@ public class SendRecvBufferSizeTest {
     TestUtil.closeDB(conn);
   }
 
-
   // dummy test
   @Test
   public void testSelect() throws SQLException {
@@ -48,5 +47,4 @@ public class SendRecvBufferSizeTest {
     stmt.execute("select * from hold");
     stmt.close();
   }
-
 }
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc4/DatabaseMetaDataTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc4/DatabaseMetaDataTest.java
index 7d209f15..e41ee12f 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc4/DatabaseMetaDataTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc4/DatabaseMetaDataTest.java
@@ -42,8 +42,6 @@ public class DatabaseMetaDataTest {
     TestUtil.createSchema(conn, "nofunctions");
     TestUtil.execute("create function hasfunctions.addfunction (integer, integer) "
         + "RETURNS integer AS 'select $1 + $2;' LANGUAGE SQL IMMUTABLE", conn);
-
-
   }
 
   @After
@@ -129,7 +127,6 @@ public class DatabaseMetaDataTest {
     ResultSet rs = dbmd.getProcedures("", "hasfunctions",null);
     assertTrue(rs.next());
 
-
     Statement statement = conn.createStatement();
     statement.execute("set search_path=hasfunctions");
 
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc42/Jdbc42CallableStatementTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc42/Jdbc42CallableStatementTest.java
index fa2ae9fd..531a8499 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc42/Jdbc42CallableStatementTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc42/Jdbc42CallableStatementTest.java
@@ -88,5 +88,4 @@ public class Jdbc42CallableStatementTest extends BaseTest4 {
       con.setAutoCommit(true);
     }
   }
-
 }
diff --git a/pgjdbc/src/test/java/org/postgresql/test/jdbc42/PreparedStatementTest.java b/pgjdbc/src/test/java/org/postgresql/test/jdbc42/PreparedStatementTest.java
index 96c5e8d0..00ada27d 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/jdbc42/PreparedStatementTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/jdbc42/PreparedStatementTest.java
@@ -96,17 +96,11 @@ public class PreparedStatementTest extends BaseTest4 {
 
     ResultSet rs = con.createStatement().executeQuery("select tt from timetable order by id asc");
     Assert.assertTrue(rs.next());
-
     LocalTime localTime = (LocalTime)rs.getObject(1,LocalTime.class);
-
-
     Assert.assertEquals( LocalTime.MAX, localTime);
 
     Assert.assertTrue(rs.next());
-
     localTime = (LocalTime)rs.getObject(1, LocalTime.class);
-
     Assert.assertEquals( LocalTime.MIN, localTime);
-
   }
 }
diff --git a/pgjdbc/src/test/java/org/postgresql/test/ssl/SslTest.java b/pgjdbc/src/test/java/org/postgresql/test/ssl/SslTest.java
index 2a2e750f..8c96c8b4 100644
--- a/pgjdbc/src/test/java/org/postgresql/test/ssl/SslTest.java
+++ b/pgjdbc/src/test/java/org/postgresql/test/ssl/SslTest.java
@@ -123,7 +123,6 @@ public class SslTest extends BaseTest4 {
 
     Collection<Object[]> tests = new ArrayList<Object[]>();
 
-
     File certDirFile = TestUtil.getFile(prop.getProperty("certdir"));
     String certdir = certDirFile.getAbsolutePath();
 
@@ -272,7 +271,6 @@ public class SslTest extends BaseTest4 {
       errors = addError(errors, ae);
     }
 
-
     try {
       if (assertClientCertificate(e)) {
         return;