Skip to content

Commit

Permalink
chore: use 5432 as default port when running code from IDE
Browse files Browse the repository at this point in the history
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 5dc03f6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pgjdbc/src/main/java/org/postgresql/Driver.java
Expand Up @@ -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;
Expand Down Expand Up @@ -64,6 +63,8 @@ public class Driver implements java.sql.Driver {
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 {
Expand Down Expand Up @@ -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(',');
Expand All @@ -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");
Expand Down

3 comments on commit 5dc03f6

@davecramer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vlsi this does look wrong. How did it get to 5431 ?

@vlsi
Copy link
Member Author

@vlsi vlsi commented on 5dc03f6 Nov 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea.

@davecramer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha, ok, I'll push the other commit that fixes it.

Please sign in to comment.