-
Notifications
You must be signed in to change notification settings - Fork 367
Switch Nominatim connection handling to PGSimpleDataSource #1117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package de.komoot.photon.config; | ||
|
|
||
| import com.beust.jcommander.IParameterValidator; | ||
| import com.beust.jcommander.ParameterException; | ||
|
|
||
| public class HostNameValidator implements IParameterValidator { | ||
|
|
||
| @Override | ||
| public void validate(String name, String value) throws ParameterException { | ||
| if (value.matches(".*[,&/\\\\].*")) { | ||
| throw new ParameterException("Parameter " + name + " must not contain &, /, \\ or commas."); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,6 @@ | |
| import de.komoot.photon.nominatim.model.AddressRow; | ||
| import de.komoot.photon.nominatim.model.AddressType; | ||
| import de.komoot.photon.nominatim.model.NameMap; | ||
| import org.apache.commons.dbcp2.BasicDataSource; | ||
| import org.jspecify.annotations.NullMarked; | ||
| import org.jspecify.annotations.Nullable; | ||
| import org.springframework.jdbc.core.JdbcTemplate; | ||
|
|
@@ -27,17 +26,7 @@ public class NominatimConnector { | |
| @Nullable private Boolean hasNewPostcodeLocationsTable; | ||
|
|
||
| protected NominatimConnector(PostgresqlConfig cfg, DBDataAdapter dataAdapter, DatabaseProperties dbProperties) { | ||
| BasicDataSource dataSource = new BasicDataSource(); | ||
|
|
||
| dataSource.setUrl(String.format("jdbc:postgresql://%s:%d/%s", | ||
| cfg.getHost(), cfg.getPort(), cfg.getDatabase())); | ||
| dataSource.setUsername(cfg.getUser()); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed autocommit breaks cursorsHigh Severity Replacing Reviewed by Cursor Bugbot for commit 709a827. Configure here.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| if (cfg.getPassword() != null) { | ||
| dataSource.setPassword(cfg.getPassword()); | ||
| } | ||
|
|
||
| // Keep disabled or server-side cursors won't work. | ||
| dataSource.setDefaultAutoCommit(false); | ||
| var dataSource = cfg.getDataSource(); | ||
|
|
||
| txTemplate = new TransactionTemplate(new DataSourceTransactionManager(dataSource)); | ||
|
|
||
|
|
@@ -46,7 +35,6 @@ protected NominatimConnector(PostgresqlConfig cfg, DBDataAdapter dataAdapter, Da | |
|
|
||
| dbutils = dataAdapter; | ||
| this.dbProperties = dbProperties; | ||
|
|
||
| } | ||
|
|
||
| @Nullable | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.