You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Kenny Wu (Jira)" <ji...@apache.org> on 2023/02/07 03:37:00 UTC
[jira] [Comment Edited] (FLINK-30929) Add helpful message when ElasticsearchSink.Builder.build() throws an IllegalArgumentException.
[ https://issues.apache.org/jira/browse/FLINK-30929?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17685029#comment-17685029 ]
Kenny Wu edited comment on FLINK-30929 at 2/7/23 3:36 AM:
----------------------------------------------------------
[~martijnvisser] I have checked the latest version. The case, as well as other property check statements, has been improved in the new implement already, thx. I will close this ticket
{code:java}
public B setHosts(HttpHost... hosts) {
Preconditions.checkNotNull(hosts);
Preconditions.checkState(hosts.length > 0, "Hosts cannot be empty.");
this.hosts = Arrays.asList(hosts);
return this.self();
}{code}
was (Author: JIRAUSER298888):
[~martijnvisser] I have checked the latest version. The case has been improved already, as well as other property check statements.
{code:java}
public B setHosts(HttpHost... hosts) {
Preconditions.checkNotNull(hosts);
Preconditions.checkState(hosts.length > 0, "Hosts cannot be empty.");
this.hosts = Arrays.asList(hosts);
return this.self();
}{code}
> Add helpful message when ElasticsearchSink.Builder.build() throws an IllegalArgumentException.
> ----------------------------------------------------------------------------------------------
>
> Key: FLINK-30929
> URL: https://issues.apache.org/jira/browse/FLINK-30929
> Project: Flink
> Issue Type: Improvement
> Components: Connectors / ElasticSearch
> Affects Versions: 1.13.6
> Reporter: Kenny Wu
> Priority: Major
> Fix For: 1.15.0
>
> Attachments: image-2023-02-06-21-28-37-835.png
>
>
> When I test flink-connector-elasticsearch on my project. And *I got an IllegalArgumentException with nothing helpful message.*
> *Here's the exception message:*
>
> {code:java}
> Exception in thread "main" java.lang.IllegalArgumentException
> at org.apache.flink.util.Preconditions.checkArgument(Preconditions.java:122)
> at org.apache.flink.streaming.connectors.elasticsearch7.Elasticsearch7ApiCallBridge.<init>(Elasticsearch7ApiCallBridge.java:61)
> at org.apache.flink.streaming.connectors.elasticsearch7.ElasticsearchSink.<init>(ElasticsearchSink.java:74)
> ... {code}
>
> *I could not see which exactly the argument was illegal.*
> After I read the code in (Elasticsearch7ApiCallBridge.java:61), I realized that proberbly the ES hosts was empty. And finally fixed it.
> !image-2023-02-06-21-28-37-835.png!
> I think helpful message should be printed when such an important argument is illegal and fails to build the connector.
> And I'd love to improve it. thanks
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)