anshumg commented on a change in pull request #2010:
URL: https://github.com/apache/lucene-solr/pull/2010#discussion_r525809933



##########
File path: solr/core/src/test/org/apache/solr/cloud/LeaderElectionTest.java
##########
@@ -414,6 +425,11 @@ private void waitForLeader(List<ClientThread> threads, int 
seq)
 
   private int getLeaderThread() throws KeeperException, InterruptedException {
     String leaderUrl = getLeaderUrl("collection1", "shard1");
+    // strip off the scheme
+    final int at = leaderUrl.indexOf("://");
+    if (at != -1) {
+      leaderUrl = leaderUrl.substring(at+3);

Review comment:
       Can you please add a space around `+`.

##########
File path: solr/core/src/java/org/apache/solr/cloud/ZkController.java
##########
@@ -2131,12 +2128,7 @@ public LeaderElector getOverseerElector() {
   static String generateNodeName(final String hostName,
                                  final String hostPort,
                                  final String hostContext) {
-    try {
-      return hostName + ':' + hostPort + '_' +
-          URLEncoder.encode(trimLeadingAndTrailingSlashes(hostContext), 
"UTF-8");
-    } catch (UnsupportedEncodingException e) {
-      throw new Error("JVM Does not seem to support UTF-8", e);
-    }
+    return hostName + ':' + hostPort + '_' + 
URLEncoder.encode(trimLeadingAndTrailingSlashes(hostContext), 
StandardCharsets.UTF_8);

Review comment:
       Java8 doesn't have `URLEncoder.encode(String, Charset)`. Also, it'd 
through the exception on 8x.
   I like it this way, just saying that you might have to remember that when 
merging.
   




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to