-
Bug
-
Resolution: Done
-
Major
-
None
-
None
-
False
-
None
-
False
-
-
In RelationalBaseSourceConnector#validate (used as Connector#validate() for relational datastore connectors) we call RelationalBaseSourceConnector#validateConnection when only some connection related config options (like hostname etc) are valid. This can lead to exceptions.
For example when you provide a `schema.include.list` for a Postgres connector with an invalid regular expression like "+" as value but with working connection properties (which are checked in RelationalBaseSourceConnector#validate) the code assumes everything is fine to instantiate and validate the connection. But then, when instantiating an instance of the PostgresConnectorConfig the invalid regular expression gets compiled, leading to a PatternException.
This breaks the new PostgreSQL Connect REST Extension tests and it will also break Kafka Connect's validate connector-config endpoint (PUT /connector-plugins/($connector-plugin-name)/config/validate) which will also return the exception instead of the expected response with the config definition, errors, etc.
$ cat register-postgres-test.json { "connector.class": "io.debezium.connector.postgresql.PostgresConnector", "tasks.max": "1", "database.hostname": "postgres", "database.port": "5432", "database.user": "postgres", "database.password": "postgres", "database.dbname" : "postgres", "topic.prefix": "dbserver1", "schema.include.list": "+" } $ cat register-postgres-test.json | curl -X PUT -H "Content-Type: application/json" localhost:8083/connector-plugins/PostgresConnector/config/validate --data-binary @- | jq . { "error_code": 500, "message": "java.util.regex.PatternSyntaxException: Dangling meta character '+' near index 0\n+\n^" }