Skip to content
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

trim whitespace from values in schema tool property files #1899

Closed
punktilious opened this issue Feb 2, 2021 · 1 comment
Closed

trim whitespace from values in schema tool property files #1899

punktilious opened this issue Feb 2, 2021 · 1 comment
Assignees
Labels
P2 Priority 2 - Should Have persistence schema

Comments

@punktilious
Copy link
Collaborator

The schema tool uses values from properties files to configure the database connection. Trailing spaces may not be obvious and can cause issues if they are used in SQL statements (typically when used with bind variables).

The schema tool should trim values and ideally warn when the trim changes the value.

Additionally, the values must be checked with DataDefinitionUtil#assertValidName(String name).

@lmsurpre lmsurpre added the P2 Priority 2 - Should Have label Mar 11, 2021
@tbieste tbieste self-assigned this May 11, 2021
@tbieste tbieste added this to the Sprint 2021-06 milestone May 11, 2021
tbieste added a commit that referenced this issue May 11, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
tbieste added a commit that referenced this issue May 11, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
tbieste added a commit that referenced this issue May 11, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
tbieste added a commit that referenced this issue May 11, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
tbieste added a commit that referenced this issue May 11, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
tbieste added a commit that referenced this issue May 13, 2021
Issue #1899 - Trim whitespace from values in schema tool property files
@prb112
Copy link
Contributor

prb112 commented May 13, 2021

Works as expected...

cat << EOF > db.properties
db.host=localhost
db.port=50000
db.database=fhirdb
user=db2inst1
password=change-password
schemaName=test1
EOF
java -jar ~/.m2/repository/com/ibm/fhir/fhir-persistence-schema/4.8.0-SNAPSHOT/fhir-persistence-schema-4.8.0-SNAPSHOT-cli.jar
--db-type db2 --list-tenants --prop-file db.properties

2021-05-13 10:46:55.379 00000001 WARNING com.ibm.fhir.schema.app.Main Whitespace trimmed from value of property 'schemaName'
2021-05-13 10:46:55.454 00000001 INFO .common.JdbcConnectionProvider Opening connection to database: jdbc:db2://localhost:50000/fhirdb
2021-05-13 10:46:57.599 00000001 WARNING ls.pool.PoolConnectionProvider Get connection took 2.144 seconds
The FHIR_ADMIN schema appears not to be deployed with the TENANTS table
2021-05-13 10:46:57.678 00000001 INFO com.ibm.fhir.schema.app.Main Processing took: 2.253 s
2021-05-13 10:46:57.679 00000001 INFO com.ibm.fhir.schema.app.Main SCHEMA CHANGE: OK

@prb112 prb112 closed this as completed May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Priority 2 - Should Have persistence schema
Projects
None yet
Development

No branches or pull requests

4 participants