postgresql-jdbc.git / summary / log / commit / refs

commit    9a0dbf1b7cceb5e751fe83f6fec99790b13ff57c
Author:   Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
Date:     Thu Apr 16 12:02:59 2020 +0000

    Inline COPY_ERROR_MESSAGE so it can be localized properly
    
    gettext searches for GT.tr(...) uses, and it can't infer the value of
    a field or a variable. That is why GT.tr argument should always be a constant.


pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 ab06a88b..15d34074 100644 --- a/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java +++ b/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java @@ -74,7 +74,6 @@ import java.util.logging.Logger; public class QueryExecutorImpl extends QueryExecutorBase { private static final Logger LOGGER = Logger.getLogger(QueryExecutorImpl.class.getName()); - private static final String COPY_ERROR_MESSAGE = "COPY commands are only supported using the CopyManager API."; /** * TimeZone of the current connection (TimeZone backend parameter). @@ -2383,7 +2382,7 @@ public class QueryExecutorImpl extends QueryExecutorBase { // We'll send a CopyFail message for COPY FROM STDIN so that // server does not wait for the data. - byte[] buf = Utils.encodeUTF8(COPY_ERROR_MESSAGE); + byte[] buf = Utils.encodeUTF8("COPY commands are only supported using the CopyManager API."); pgStream.sendChar('f'); pgStream.sendInteger4(buf.length + 4 + 1); pgStream.send(buf); @@ -2400,7 +2399,7 @@ public class QueryExecutorImpl extends QueryExecutorBase { // In case of CopyOutResponse, we cannot abort data transfer, // so just throw an error and ignore CopyData messages handler.handleError( - new PSQLException(GT.tr(COPY_ERROR_MESSAGE), + new PSQLException(GT.tr("COPY commands are only supported using the CopyManager API."), PSQLState.NOT_IMPLEMENTED)); break; [parent: f6731dfc771b]