wuchong commented on a change in pull request #10563: [FLINK-15232][table]
Message of NoMatchingTableFactoryException should tell users what's wrong
URL: https://github.com/apache/flink/pull/10563#discussion_r357515041
##########
File path:
flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/NoMatchingTableFactoryException.java
##########
@@ -58,24 +62,32 @@ public NoMatchingTableFactoryException(
Class<?> factoryClass,
List<TableFactory> factories,
Map<String, String> properties) {
+ this(message, null, factoryClass, factories, properties, null);
+ }
- this(message, factoryClass, factories, properties, null);
+ public NoMatchingTableFactoryException(
+ String message,
+ String matchCandidatesMessage,
+ Class<?> factoryClass,
+ List<TableFactory> factories,
+ Map<String, String> properties) {
+ this(message, matchCandidatesMessage, factoryClass, factories,
properties, null);
}
@Override
public String getMessage() {
+ String matchCandidatesString = matchCandidatesMessage == null ?
+ "" :
+ "The match candidates: \n" +
matchCandidatesMessage + "\n\n";
return String.format(
"Could not find a suitable table factory for '%s'
in\nthe classpath.\n\n" +
- "Reason: %s\n\n" +
+ "Reason: %s\n\n" + matchCandidatesString +
"The following properties are
requested:\n%s\n\n" +
"The following factories have been
considered:\n%s",
factoryClass.getName(),
message,
DescriptorProperties.toString(properties),
- String.join(
- "\n",
- factories.stream().map(p ->
p.getClass().getName()).collect(Collectors.toList())
- )
+ factories.stream().map(p ->
p.getClass().getName()).collect(Collectors.joining("\n"))
Review comment:
Indent.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services