Permalink
Browse files

chore: use 5432 as default port when running code from IDE

When code is compiled from IDE, mvn.project.property.template.default.pg.port
might be unresolved, however it's better to just use 5432
  • Loading branch information...
vlsi committed Jun 30, 2018
1 parent 86c46f9 commit 5dc03f63f170ed371a4f4ba06d491be489627b11
Showing with 4 additions and 3 deletions.
  1. +4 −3 pgjdbc/src/main/java/org/postgresql/Driver.java
@@ -6,7 +6,6 @@
package org.postgresql;

import org.postgresql.jdbc.PgConnection;

import org.postgresql.util.DriverInfo;
import org.postgresql.util.ExpressionProperties;
import org.postgresql.util.GT;
@@ -64,6 +63,8 @@
private static final Logger PARENT_LOGGER = Logger.getLogger("org.postgresql");
private static final Logger LOGGER = Logger.getLogger("org.postgresql.Driver");
private static SharedTimer sharedTimer = new SharedTimer();
private static final String DEFAULT_PORT =
/*$"\""+mvn.project.property.template.default.pg.port+"\";"$*//*-*/"5431";

static {
try {
@@ -580,7 +581,7 @@ public static Properties parseURL(String url, Properties defaults) {
ports.append(portStr);
hosts.append(address.subSequence(0, portIdx));
} else {
ports.append("/*$mvn.project.property.template.default.pg.port$*/");
ports.append(DEFAULT_PORT);
hosts.append(address);
}
ports.append(',');
@@ -596,7 +597,7 @@ public static Properties parseURL(String url, Properties defaults) {
then set it to default
*/
if (defaults == null || !defaults.containsKey("PGPORT")) {
urlProps.setProperty("PGPORT", "/*$mvn.project.property.template.default.pg.port$*/");
urlProps.setProperty("PGPORT", DEFAULT_PORT);
}
if (defaults == null || !defaults.containsKey("PGHOST")) {
urlProps.setProperty("PGHOST", "localhost");

0 comments on commit 5dc03f6

Please sign in to comment.