You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@streampark.apache.org by "Xuxiaotuan (via GitHub)" <gi...@apache.org> on 2024/03/31 15:22:14 UTC
[PR] [ISSUE-3091][Improve] Improve streampark-flink module based on [3.10 Pre-Conditions Checking] [incubator-streampark]
Xuxiaotuan opened a new pull request, #3647:
URL: https://github.com/apache/incubator-streampark/pull/3647
## What changes were proposed in this pull request
Issue Number: close #3091
Use a unified AssertUtils.require() to complete the validation of the prerequisite
## Verifying this change
<!--*(Please pick either of the following options)*-->
This change is a trivial rework / code cleanup without any test coverage.
<!--*(example:)*
- *Added integration tests for end-to-end.*
- *Added *Test to verify the change.*
- *Manually verified the change by testing locally.* -->
## Does this pull request potentially affect one of the following parts
- Dependencies (does it add or upgrade a dependency): no
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE-3091][Improve] Improve streampark-flink module based on [3.10 Pre-Conditions Checking] [incubator-streampark]
Posted by "RocMarshal (via GitHub)" <gi...@apache.org>.
RocMarshal commented on code in PR #3647:
URL: https://github.com/apache/incubator-streampark/pull/3647#discussion_r1545916604
##########
streampark-flink/streampark-flink-sql-gateway/streampark-flink-sql-gateway-base/src/main/java/org/apache/streampark/gateway/factories/FactoryUtil.java:
##########
@@ -48,47 +48,44 @@ public static <T extends Factory> T discoverFactory(
.filter(f -> factoryClass.isAssignableFrom(f.getClass()))
.collect(Collectors.toList());
- if (foundFactories.isEmpty()) {
- throw new ValidationException(
- String.format(
- "Could not find any factories that implement '%s' in the classpath.",
- factoryClass.getName()));
- }
+ AssertUtils.required(
+ !foundFactories.isEmpty(),
+ String.format(
+ "Could not find any factories that implement '%s' in the classpath.",
+ factoryClass.getName()));
final List<Factory> matchingFactories =
foundFactories.stream()
.filter(f -> f.factoryIdentifier().equals(factoryIdentifier))
.collect(Collectors.toList());
- if (matchingFactories.isEmpty()) {
- throw new ValidationException(
- String.format(
- "Could not find any factory for identifier '%s' that implements '%s' in the classpath.%n%n"
- + "Available factory identifiers are:%n%n"
- + "%s",
- factoryIdentifier,
- factoryClass.getName(),
- foundFactories.stream()
- .map(Factory::factoryIdentifier)
- .filter(identifier -> !DEFAULT_IDENTIFIER.equals(identifier))
- .distinct()
- .sorted()
- .collect(Collectors.joining("\n"))));
- }
- if (matchingFactories.size() > 1) {
- throw new ValidationException(
- String.format(
- "Multiple factories for identifier '%s' that implement '%s' found in the classpath.\n\n"
- + "Ambiguous factory classes are:\n\n"
- + "%s",
- factoryIdentifier,
- factoryClass.getName(),
- matchingFactories.stream()
- .map(f -> f.getClass().getName())
- .sorted()
- .collect(Collectors.joining("\n"))));
- }
+ AssertUtils.required(
+ !matchingFactories.isEmpty(),
Review Comment:
There's a un-matched semantic replacement.
The original potential Exception is `ValidationException` but the it's `IllegalArgumentxx` exception.
In other words, the line is not suitable for the change.
Would you mind checking the whole corresponding changed lines about exception-matched ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE-3091][Improve] Improve streampark-flink module based on [3.10 Pre-Conditions Checking] [incubator-streampark]
Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai merged PR #3647:
URL: https://github.com/apache/incubator-streampark/pull/3647
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE-3091][Improve] Improve streampark-flink module based on [3.10 Pre-Conditions Checking] [incubator-streampark]
Posted by "RocMarshal (via GitHub)" <gi...@apache.org>.
RocMarshal commented on code in PR #3647:
URL: https://github.com/apache/incubator-streampark/pull/3647#discussion_r1545916604
##########
streampark-flink/streampark-flink-sql-gateway/streampark-flink-sql-gateway-base/src/main/java/org/apache/streampark/gateway/factories/FactoryUtil.java:
##########
@@ -48,47 +48,44 @@ public static <T extends Factory> T discoverFactory(
.filter(f -> factoryClass.isAssignableFrom(f.getClass()))
.collect(Collectors.toList());
- if (foundFactories.isEmpty()) {
- throw new ValidationException(
- String.format(
- "Could not find any factories that implement '%s' in the classpath.",
- factoryClass.getName()));
- }
+ AssertUtils.required(
+ !foundFactories.isEmpty(),
+ String.format(
+ "Could not find any factories that implement '%s' in the classpath.",
+ factoryClass.getName()));
final List<Factory> matchingFactories =
foundFactories.stream()
.filter(f -> f.factoryIdentifier().equals(factoryIdentifier))
.collect(Collectors.toList());
- if (matchingFactories.isEmpty()) {
- throw new ValidationException(
- String.format(
- "Could not find any factory for identifier '%s' that implements '%s' in the classpath.%n%n"
- + "Available factory identifiers are:%n%n"
- + "%s",
- factoryIdentifier,
- factoryClass.getName(),
- foundFactories.stream()
- .map(Factory::factoryIdentifier)
- .filter(identifier -> !DEFAULT_IDENTIFIER.equals(identifier))
- .distinct()
- .sorted()
- .collect(Collectors.joining("\n"))));
- }
- if (matchingFactories.size() > 1) {
- throw new ValidationException(
- String.format(
- "Multiple factories for identifier '%s' that implement '%s' found in the classpath.\n\n"
- + "Ambiguous factory classes are:\n\n"
- + "%s",
- factoryIdentifier,
- factoryClass.getName(),
- matchingFactories.stream()
- .map(f -> f.getClass().getName())
- .sorted()
- .collect(Collectors.joining("\n"))));
- }
+ AssertUtils.required(
+ !matchingFactories.isEmpty(),
Review Comment:
There's a un-matched semantic replacement.
The original potential Exception is `ValidationException` but the it's `IllegalArgumentxx` exception.
Would you mind checking the whole corresponding changed lines about exception-matched ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUE-3091][Improve] Improve streampark-flink module based on [3.10 Pre-Conditions Checking] [incubator-streampark]
Posted by "Xuxiaotuan (via GitHub)" <gi...@apache.org>.
Xuxiaotuan commented on PR #3647:
URL: https://github.com/apache/incubator-streampark/pull/3647#issuecomment-2029183066
@RocMarshal I restored the changes to the ValidationException
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org