diff --git a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/source/SourceValidateHandler.java b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/source/SourceValidateHandler.java index d6afb17fb0ccf..e76a8b59facc0 100644 --- a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/source/SourceValidateHandler.java +++ b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/source/SourceValidateHandler.java @@ -63,9 +63,17 @@ public static ConnectorServiceProto.ValidateSourceResponse validateResponse(Stri } private static void ensurePropNotBlank(Map props, String name) { + ensurePropsExists(props, name); if (StringUtils.isBlank(props.get(name))) { throw ValidatorUtils.invalidArgument( - String.format("'%s' not found, please check the WITH properties", name)); + String.format("'%s' cannot be empty. Please check the WITH properties", name)); + } + } + + private static void ensurePropsExists(Map props, String name) { + if (!props.containsKey(name)) { + throw ValidatorUtils.invalidArgument( + String.format("'%s' is not found. Please check the WITH properties", name)); } } @@ -74,7 +82,7 @@ static void ensureRequiredProps(Map props, boolean isMultiTableS ensurePropNotBlank(props, DbzConnectorConfig.PORT); ensurePropNotBlank(props, DbzConnectorConfig.DB_NAME); ensurePropNotBlank(props, DbzConnectorConfig.USER); - ensurePropNotBlank(props, DbzConnectorConfig.PASSWORD); + ensurePropsExists(props, DbzConnectorConfig.PASSWORD); // ensure table name is passed by user in non-sharing mode if (!isMultiTableShared) { ensurePropNotBlank(props, DbzConnectorConfig.TABLE_NAME);