Skip to content

Commit 6ea732c

Browse files
authored
fix small issues in ConnectionFactoryImpl (#3929)
* fix small issues in ConnectionFactoryImpl * parse in same order
1 parent 95cecdb commit 6ea732c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pgjdbc/src/main/java/org/postgresql/core/v3/ConnectionFactoryImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,11 @@ private PGStream tryConnect(Properties info, SocketFactory socketFactory, HostSp
220220
if (protocolVersion != null) {
221221
int decimal = protocolVersion.indexOf('.');
222222
if (decimal == -1) {
223-
protocolMinor = Integer.parseInt(protocolVersion);
223+
protocolMajor = Integer.parseInt(protocolVersion);
224224
protocolMinor = 0;
225225
} else {
226-
protocolMinor = Integer.parseInt(protocolVersion.substring(decimal + 1));
227226
protocolMajor = Integer.parseInt(protocolVersion.substring(0,decimal));
227+
protocolMinor = Integer.parseInt(protocolVersion.substring(decimal + 1));
228228
}
229229
}
230230

@@ -754,7 +754,7 @@ private static void doAuthentication(PGStream pgStream, String host, String user
754754
// do not connect and throw an error
755755
String errorMessage = "Protocol error, received invalid options: ";
756756
for (int i = 0; i < numOptionsNotRecognized; i++) {
757-
errorMessage += i > 0 ? "" : "," + pgStream.receiveString();
757+
errorMessage += (i > 0 ? "," : "") + pgStream.receiveString();
758758
}
759759
LOGGER.log(Level.FINEST, errorMessage);
760760
throw new PSQLException(errorMessage, PSQLState.PROTOCOL_VIOLATION);

0 commit comments

Comments
 (0)