Skip to content
Permalink
Browse files
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.
  • Loading branch information
vlsi committed Apr 16, 2020
1 parent f6731df commit 9a0dbf1b7cceb5e751fe83f6fec99790b13ff57c
Showing 1 changed file with 2 additions and 3 deletions.
@@ -74,7 +74,6 @@
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 @@ protected void processResults(ResultHandler handler, int flags) throws IOExcepti
// 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 @@ protected void processResults(ResultHandler handler, int flags) throws IOExcepti
// 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;

0 comments on commit 9a0dbf1

Please sign in to comment.