kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject [kafka] branch trunk updated: * MINOR: Catching null pointer exception for empty leader URL when assignment is null (#4798)
Date Fri, 16 Nov 2018 23:28:58 GMT
This is an automated email from the ASF dual-hosted git repository.

guozhang pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new b21e933  * MINOR: Catching null pointer exception for empty leader URL when assignment
is null (#4798)
b21e933 is described below

commit b21e933592a4893d1341a251a96b546e1b0ce3a1
Author: Benedict Jin <asdf2014@apache.org>
AuthorDate: Sat Nov 17 07:28:47 2018 +0800

    * MINOR: Catching null pointer exception for empty leader URL when assignment is null
(#4798)
    
    Catch null pointer exception for empty leader URL when assignment is null.
    
    Reviewers: Randall Hauch <rhauch@gmail.com>, Konstantine Karantasis <konstantine@confluent.io>,
Guozhang Wang <wangguoz@gmail.com>
---
 .../kafka/connect/runtime/distributed/DistributedHerder.java     | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/distributed/DistributedHerder.java
b/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/distributed/DistributedHerder.java
index f2009db..0213730 100644
--- a/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/distributed/DistributedHerder.java
+++ b/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/distributed/DistributedHerder.java
@@ -1031,7 +1031,14 @@ public class DistributedHerder extends AbstractHerder implements Runnable
{
                         @Override
                         public void run() {
                             try {
-                                String reconfigUrl = RestServer.urlJoin(leaderUrl(), "/connectors/"
+ connName + "/tasks");
+                                String leaderUrl = leaderUrl();
+                                if (leaderUrl == null || leaderUrl.trim().isEmpty()) {
+                                    cb.onCompletion(new ConnectException("Request to leader
to " +
+                                            "reconfigure connector tasks failed " +
+                                            "because the URL of the leader's REST interface
is empty!"), null);
+                                    return;
+                                }
+                                String reconfigUrl = RestServer.urlJoin(leaderUrl, "/connectors/"
+ connName + "/tasks");
                                 RestClient.httpRequest(reconfigUrl, "POST", rawTaskProps,
null, config);
                                 cb.onCompletion(null, null);
                             } catch (ConnectException e) {


Mime
View raw message